Dinos destroy food blocks even when blockbreaking is set to false
AechtRob opened this issue ยท 0 comments
Dinos which eat plants continue to destroy plant and leaf blocks (and melons etc,) in the world, even when the config is set not to break blocks.
I think this is handled by the class DinoAIEatFeedersAndBlocks, and I think that my suggestion is that in that class, this code:
}else if(FoodMappings.INSTANCE.getBlockFoodAmount(this.entity.world.getBlockState(destinationBlock).getBlock(), this.entity.type.diet) > 0){
this.entity.setHunger(Math.min(this.entity.getMaxHunger(), this.entity.getHunger() + FoodMappings.INSTANCE.getBlockFoodAmount(block, this.entity.type.diet)));
this.entity.setHealth(Math.min(this.entity.getMaxHealth(), (int) (this.entity.getHealth() + FoodMappings.INSTANCE.getBlockFoodAmount(block, this.entity.type.diet) / 10)));
this.entity.playSound(SoundEvents.ENTITY_GENERIC_EAT, 1, 1);
this.entity.world.destroyBlock(up, false);
this.resetTask();
would need to change to either this (= dinos can't interact with leaf/plant/melon blocks in the world at all and will starve unless there is a feeder):
}else if(**Revival.CONFIG_OPTIONS.dinoBlockBreaking &&** FoodMappings.INSTANCE.getBlockFoodAmount(this.entity.world.getBlockState(destinationBlock).getBlock(), this.entity.type.diet) > 0){
this.entity.setHunger(Math.min(this.entity.getMaxHunger(), this.entity.getHunger() + FoodMappings.INSTANCE.getBlockFoodAmount(block, this.entity.type.diet)));
this.entity.setHealth(Math.min(this.entity.getMaxHealth(), (int) (this.entity.getHealth() + FoodMappings.INSTANCE.getBlockFoodAmount(block, this.entity.type.diet) / 10)));
this.entity.playSound(SoundEvents.ENTITY_GENERIC_EAT, 1, 1);
this.entity.world.destroyBlock(up, false);
this.resetTask();
or to this (= dinos can "graze" on the blocks and satisfy their hunger from them, but the blocks themselves won't be broken by the action):
}else if(FoodMappings.INSTANCE.getBlockFoodAmount(this.entity.world.getBlockState(destinationBlock).getBlock(), this.entity.type.diet) > 0){
this.entity.setHunger(Math.min(this.entity.getMaxHunger(), this.entity.getHunger() + FoodMappings.INSTANCE.getBlockFoodAmount(block, this.entity.type.diet)));
this.entity.setHealth(Math.min(this.entity.getMaxHealth(), (int) (this.entity.getHealth() + FoodMappings.INSTANCE.getBlockFoodAmount(block, this.entity.type.diet) / 10)));
this.entity.playSound(SoundEvents.ENTITY_GENERIC_EAT, 1, 1);
**if (Revival.CONFIG_OPTIONS.dinoBlockBreaking) {this.entity.world.destroyBlock(up, false);}**
this.resetTask();