-
-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'version/main' into Moobien
- Loading branch information
Showing
87 changed files
with
593 additions
and
439 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...avigation/IDynamicHeuristicNavigator.java → ...thfinding/IDynamicHeuristicNavigator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
src/main/java/com/minecolonies/api/entity/pathfinding/IMinecoloniesNavigator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package com.minecolonies.api.entity.pathfinding; | ||
|
||
import com.minecolonies.core.entity.pathfinding.navigation.MinecoloniesAdvancedPathNavigate; | ||
import com.minecolonies.core.entity.pathfinding.pathjobs.AbstractPathJob; | ||
import com.minecolonies.core.entity.pathfinding.pathresults.PathResult; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.entity.Mob; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
/** | ||
* Describes the Navigator used by minecolonies entities | ||
*/ | ||
public interface IMinecoloniesNavigator | ||
{ | ||
/** | ||
* Sets a new pathjob to execute | ||
* | ||
* @param job to run | ||
* @param dest | ||
* @param speedFactor | ||
* @param safeDestination | ||
* @param <T> | ||
* @return null or new pathresult | ||
*/ | ||
@Nullable | ||
<T extends AbstractPathJob> PathResult<T> setPathJob( | ||
@NotNull AbstractPathJob job, | ||
BlockPos dest, | ||
double speedFactor, boolean safeDestination); | ||
|
||
/** | ||
* Indirectly triggers a recalulation, by marking the navigator as done | ||
*/ | ||
void recalc(); | ||
|
||
/** | ||
* Returns the pathresult holding the current pathing task and result | ||
* | ||
* @return | ||
*/ | ||
PathResult getPathResult(); | ||
|
||
/** | ||
* Gets the safe destination the entity wants to travel to | ||
* | ||
* @return | ||
*/ | ||
BlockPos getSafeDestination(); | ||
|
||
/** | ||
* Gets the entity of the navigator | ||
* | ||
* @return | ||
*/ | ||
Mob getOurEntity(); | ||
|
||
/** | ||
* Pauses the navigator for X ticks from starting any new pathing tasks | ||
* | ||
* @param pauseTicks | ||
*/ | ||
void setPauseTicks(int pauseTicks); | ||
|
||
/** | ||
* Returns the stuck handler used by the navigator | ||
* | ||
* @return | ||
*/ | ||
IStuckHandler<MinecoloniesAdvancedPathNavigate> getStuckHandler(); | ||
} |
15 changes: 12 additions & 3 deletions
15
src/main/java/com/minecolonies/api/entity/pathfinding/IStuckHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
package com.minecolonies.api.entity.pathfinding; | ||
|
||
import com.minecolonies.core.entity.pathfinding.navigation.AbstractAdvancedPathNavigate; | ||
import net.minecraft.world.entity.ai.navigation.PathNavigation; | ||
|
||
/** | ||
* Stuck handler for pathing, gets called to check/deal with stuck status | ||
*/ | ||
public interface IStuckHandler | ||
public interface IStuckHandler<NAV extends PathNavigation & IMinecoloniesNavigator> | ||
{ | ||
/** | ||
* Checks if the navigator is stuck | ||
* | ||
* @param navigator navigator to check | ||
*/ | ||
void checkStuck(final AbstractAdvancedPathNavigate navigator); | ||
void checkStuck(final NAV navigator); | ||
|
||
void resetGlobalStuckTimers(); | ||
|
||
/** | ||
* Returns the stuck level (0-9) indicating how long the entity is stuck and which stuck actions got used | ||
* | ||
* @return | ||
*/ | ||
public int getStuckLevel(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 26 additions & 7 deletions
33
...ain/java/com/minecolonies/api/eventbus/events/colony/citizens/CitizenRemovedModEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 61 additions & 57 deletions
118
src/main/java/com/minecolonies/api/loot/ModLootConditions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,61 @@ | ||
package com.minecolonies.api.loot; | ||
|
||
import com.minecolonies.api.util.constant.Constants; | ||
import net.minecraft.advancements.critereon.EnchantmentPredicate; | ||
import net.minecraft.advancements.critereon.ItemPredicate; | ||
import net.minecraft.advancements.critereon.MinMaxBounds; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.tags.ItemTags; | ||
import net.minecraft.world.item.Items; | ||
import net.minecraft.world.item.enchantment.Enchantments; | ||
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; | ||
import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType; | ||
import net.minecraft.world.level.storage.loot.predicates.MatchTool; | ||
import net.minecraftforge.registries.DeferredRegister; | ||
import net.minecraftforge.registries.RegistryObject; | ||
|
||
import static com.minecolonies.api.util.constant.Constants.MOD_ID; | ||
|
||
/** Container class for registering custom loot conditions */ | ||
public final class ModLootConditions | ||
{ | ||
public final static DeferredRegister<LootItemConditionType> DEFERRED_REGISTER = DeferredRegister.create(Registries.LOOT_CONDITION_TYPE, Constants.MOD_ID); | ||
|
||
public static final ResourceLocation ENTITY_IN_BIOME_TAG_ID = new ResourceLocation(MOD_ID, "entity_in_biome_tag"); | ||
public static final ResourceLocation RESEARCH_UNLOCKED_ID = new ResourceLocation(MOD_ID, "research_unlocked"); | ||
|
||
public static final RegistryObject<LootItemConditionType> entityInBiomeTag; | ||
public static final RegistryObject<LootItemConditionType> researchUnlocked; | ||
|
||
// also some convenience definitions for existing conditions; some stolen from BlockLootSubProvider | ||
public static final LootItemCondition.Builder HAS_SILK_TOUCH = MatchTool.toolMatches(ItemPredicate.Builder.item().hasEnchantment(new EnchantmentPredicate(Enchantments.SILK_TOUCH, MinMaxBounds.Ints.atLeast(1)))); | ||
public static final LootItemCondition.Builder HAS_SHEARS = MatchTool.toolMatches(ItemPredicate.Builder.item().of(Items.SHEARS)); | ||
public static final LootItemCondition.Builder HAS_SHEARS_OR_SILK_TOUCH = HAS_SHEARS.or(HAS_SILK_TOUCH); | ||
public static final LootItemCondition.Builder HAS_NO_SHEARS_OR_SILK_TOUCH = HAS_SHEARS_OR_SILK_TOUCH.invert(); | ||
public static final LootItemCondition.Builder HAS_HOE = MatchTool.toolMatches(ItemPredicate.Builder.item().of(ItemTags.HOES)); | ||
|
||
public static void init() | ||
{ | ||
// just for classloading | ||
} | ||
|
||
static | ||
{ | ||
entityInBiomeTag = DEFERRED_REGISTER.register(ModLootConditions.ENTITY_IN_BIOME_TAG_ID.getPath(), | ||
() -> new LootItemConditionType(new EntityInBiomeTag.Serializer())); | ||
|
||
researchUnlocked = DEFERRED_REGISTER.register(ModLootConditions.RESEARCH_UNLOCKED_ID.getPath(), | ||
() -> new LootItemConditionType(new ResearchUnlocked.Serializer())); | ||
} | ||
|
||
|
||
private ModLootConditions() | ||
{ | ||
throw new IllegalStateException("Tried to initialize: ModLootConditions but this is a Utility class."); | ||
} | ||
} | ||
package com.minecolonies.api.loot; | ||
|
||
import com.minecolonies.api.util.constant.Constants; | ||
import net.minecraft.advancements.critereon.EnchantmentPredicate; | ||
import net.minecraft.advancements.critereon.ItemPredicate; | ||
import net.minecraft.advancements.critereon.MinMaxBounds; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.tags.ItemTags; | ||
import net.minecraft.world.item.Items; | ||
import net.minecraft.world.item.enchantment.Enchantments; | ||
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; | ||
import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType; | ||
import net.minecraft.world.level.storage.loot.predicates.MatchTool; | ||
import net.minecraftforge.registries.DeferredRegister; | ||
import net.minecraftforge.registries.RegistryObject; | ||
|
||
import static com.minecolonies.api.util.constant.Constants.MOD_ID; | ||
|
||
/** Container class for registering custom loot conditions */ | ||
public final class ModLootConditions | ||
{ | ||
public final static DeferredRegister<LootItemConditionType> DEFERRED_REGISTER = DeferredRegister.create(Registries.LOOT_CONDITION_TYPE, Constants.MOD_ID); | ||
|
||
public static final ResourceLocation ENTITY_IN_BIOME_TAG_ID = new ResourceLocation(MOD_ID, "entity_in_biome_tag"); | ||
public static final ResourceLocation RESEARCH_UNLOCKED_ID = new ResourceLocation(MOD_ID, "research_unlocked"); | ||
|
||
public static final RegistryObject<LootItemConditionType> entityInBiomeTag; | ||
public static final RegistryObject<LootItemConditionType> researchUnlocked; | ||
|
||
// also some convenience definitions for existing conditions; some stolen from BlockLootSubProvider | ||
public static final LootItemCondition.Builder HAS_SILK_TOUCH = MatchTool.toolMatches(ItemPredicate.Builder.item().hasEnchantment(new EnchantmentPredicate(Enchantments.SILK_TOUCH, MinMaxBounds.Ints.atLeast(1)))); | ||
public static final LootItemCondition.Builder HAS_SHEARS = MatchTool.toolMatches(ItemPredicate.Builder.item().of(Items.SHEARS)); | ||
public static final LootItemCondition.Builder HAS_SHEARS_OR_SILK_TOUCH = HAS_SHEARS.or(HAS_SILK_TOUCH); | ||
public static final LootItemCondition.Builder HAS_NO_SHEARS_OR_SILK_TOUCH = HAS_SHEARS_OR_SILK_TOUCH.invert(); | ||
public static final LootItemCondition.Builder HAS_NETHERITE_HOE = MatchTool.toolMatches(ItemPredicate.Builder.item().of(Items.NETHERITE_HOE)); | ||
public static final LootItemCondition.Builder HAS_DIAMOND_HOE = MatchTool.toolMatches(ItemPredicate.Builder.item().of(Items.DIAMOND_HOE)); | ||
public static final LootItemCondition.Builder HAS_IRON_HOE = MatchTool.toolMatches(ItemPredicate.Builder.item().of(Items.IRON_HOE)); | ||
public static final LootItemCondition.Builder HAS_GOLDEN_HOE = MatchTool.toolMatches(ItemPredicate.Builder.item().of(Items.GOLDEN_HOE)); | ||
public static final LootItemCondition.Builder HAS_HOE = MatchTool.toolMatches(ItemPredicate.Builder.item().of(ItemTags.HOES)); | ||
|
||
public static void init() | ||
{ | ||
// just for classloading | ||
} | ||
|
||
static | ||
{ | ||
entityInBiomeTag = DEFERRED_REGISTER.register(ModLootConditions.ENTITY_IN_BIOME_TAG_ID.getPath(), | ||
() -> new LootItemConditionType(new EntityInBiomeTag.Serializer())); | ||
|
||
researchUnlocked = DEFERRED_REGISTER.register(ModLootConditions.RESEARCH_UNLOCKED_ID.getPath(), | ||
() -> new LootItemConditionType(new ResearchUnlocked.Serializer())); | ||
} | ||
|
||
|
||
private ModLootConditions() | ||
{ | ||
throw new IllegalStateException("Tried to initialize: ModLootConditions but this is a Utility class."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.