mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-23 03:49:22 +01:00
check for deny
This commit is contained in:
parent
287e43c6ad
commit
9670fc7669
2 changed files with 13 additions and 8 deletions
|
@ -12,10 +12,14 @@ package de.ellpeck.actuallyadditions.mod.entity;
|
|||
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.DefaultFarmerBehavior;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockBush;
|
||||
import net.minecraft.block.BlockDirt;
|
||||
import net.minecraft.block.BlockFarmland;
|
||||
import net.minecraft.block.BlockGrass;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -85,11 +89,10 @@ public class EntityWorm extends Entity{
|
|||
|
||||
DefaultFarmerBehavior.useHoeAt(world, pos);
|
||||
state = this.world.getBlockState(pos);
|
||||
block = state.getBlock();
|
||||
isFarmland = block instanceof BlockFarmland;
|
||||
isFarmland = state.getBlock() instanceof BlockFarmland;
|
||||
|
||||
IBlockState stateToModify = isFarmland ? state : Blocks.FARMLAND.getDefaultState();
|
||||
this.world.setBlockState(pos, stateToModify.withProperty(BlockFarmland.MOISTURE, 7), 2);
|
||||
if(isFarmland)
|
||||
this.world.setBlockState(pos, state.withProperty(BlockFarmland.MOISTURE, 7), 2);
|
||||
|
||||
if(!isFarmland){
|
||||
this.world.setBlockToAir(pos.up());
|
||||
|
|
|
@ -32,6 +32,8 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.UseHoeEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -77,9 +79,9 @@ public class ItemWorm extends ItemBase{
|
|||
return super.onItemUse(player, world, pos, hand, side, par8, par9, par10);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SubscribeEvent(priority = EventPriority.LOW)
|
||||
public void onHoe(UseHoeEvent event){
|
||||
if(ConfigBoolValues.WORMS.isEnabled()){
|
||||
if(ConfigBoolValues.WORMS.isEnabled() && event.getResult() != Result.DENY){
|
||||
World world = event.getWorld();
|
||||
if(!world.isRemote){
|
||||
BlockPos pos = event.getPos();
|
||||
|
|
Loading…
Reference in a new issue