mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
add option to let copper golems open barrels
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/TransportItemsBetweenContainers.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/TransportItemsBetweenContainers.java
|
||||
@@ -287,7 +_,7 @@
|
||||
LevelChunk chunkNow = level.getChunkSource().getChunkNow(chunkPos.x, chunkPos.z);
|
||||
if (chunkNow != null) {
|
||||
for (BlockEntity blockEntity : chunkNow.getBlockEntities().values()) {
|
||||
- if (blockEntity instanceof ChestBlockEntity chestBlockEntity) {
|
||||
+ if (blockEntity instanceof net.minecraft.world.level.block.entity.BaseContainerBlockEntity chestBlockEntity) { // Purpur - copper golem can place items in barrels option
|
||||
double d1 = chestBlockEntity.getBlockPos().distToCenterSqr(mob.position());
|
||||
if (d1 < d) {
|
||||
TransportItemsBetweenContainers.TransportItemTarget transportItemTarget1 = this.isTargetValidToPick(
|
||||
@@ -446,7 +_,7 @@
|
||||
}
|
||||
|
||||
private boolean isWantedBlock(PathfinderMob mob, BlockState state) {
|
||||
- return isPickingUpItems(mob) ? this.sourceBlockType.test(state) : this.destinationBlockType.test(state);
|
||||
+ return isPickingUpItems(mob) ? this.sourceBlockType.test(state) : (mob.level().purpurConfig.copperGolemCanOpenBarrel && state.is(net.minecraft.world.level.block.Blocks.BARREL)) || this.destinationBlockType.test(state); // Purpur - copper golem can place items in barrels option
|
||||
}
|
||||
|
||||
private static double getInteractionRange(PathfinderMob mob) {
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/animal/coppergolem/CopperGolemAi.java
|
||||
+++ b/net/minecraft/world/entity/animal/coppergolem/CopperGolemAi.java
|
||||
@@ -43,7 +_,7 @@
|
||||
private static final int TICK_TO_START_ON_REACHED_INTERACTION = 1;
|
||||
private static final int TICK_TO_PLAY_ON_REACHED_SOUND = 9;
|
||||
private static final Predicate<BlockState> TRANSPORT_ITEM_SOURCE_BLOCK = blockState -> blockState.is(BlockTags.COPPER_CHESTS);
|
||||
- private static final Predicate<BlockState> TRANSPORT_ITEM_DESTINATION_BLOCK = blockState -> blockState.is(Blocks.CHEST)
|
||||
+ private static final Predicate<BlockState> TRANSPORT_ITEM_DESTINATION_BLOCK = blockState -> blockState.is(Blocks.CHEST) // Purpur - copper golem can place items in barrels option - diff on change
|
||||
|| blockState.is(Blocks.TRAPPED_CHEST);
|
||||
private static final ImmutableList<SensorType<? extends Sensor<? super CopperGolem>>> SENSOR_TYPES = ImmutableList.of(
|
||||
SensorType.NEAREST_LIVING_ENTITIES, SensorType.HURT_BY
|
||||
@@ -1514,6 +1514,7 @@ public class PurpurWorldConfig {
|
||||
public double copperGolemScale = 1.0D;
|
||||
public boolean copperGolemTakeDamageFromWater = false;
|
||||
public boolean copperGolemAlwaysDropExp = false;
|
||||
public boolean copperGolemCanOpenBarrel = false;
|
||||
private void copperGolemSettings() {
|
||||
copperGolemRidable = getBoolean("mobs.copper_golem.ridable", copperGolemRidable);
|
||||
copperGolemRidableInWater = getBoolean("mobs.copper_golem.ridable-in-water", copperGolemRidableInWater);
|
||||
@@ -1525,6 +1526,7 @@ public class PurpurWorldConfig {
|
||||
copperGolemScale = Mth.clamp(getDouble("mobs.copper_golem.attributes.scale", copperGolemScale), 0.0625D, 16.0D);
|
||||
copperGolemTakeDamageFromWater = getBoolean("mobs.copper_golem.takes-damage-from-water", copperGolemTakeDamageFromWater);
|
||||
copperGolemAlwaysDropExp = getBoolean("mobs.copper_golem.always-drop-exp", copperGolemAlwaysDropExp);
|
||||
copperGolemCanOpenBarrel = getBoolean("mobs.copper_golem.can-open-barrel", copperGolemCanOpenBarrel);
|
||||
}
|
||||
|
||||
public boolean cowRidable = false;
|
||||
|
||||
Reference in New Issue
Block a user