Fixed up buckets... lot of oversights D:
This commit is contained in:
parent
ac219bec91
commit
b3bf9c64eb
1 changed files with 37 additions and 2 deletions
|
|
@ -14,6 +14,7 @@ import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
|
@ -68,7 +69,8 @@ public class ItemModBuckets extends Item
|
||||||
int meta = state.getBlock().getMetaFromState(state);
|
int meta = state.getBlock().getMetaFromState(state);
|
||||||
|
|
||||||
if (material.isLiquid() && meta == 0)
|
if (material.isLiquid() && meta == 0)
|
||||||
world.setBlockToAir(blockpos);
|
if(world.setBlockToAir(blockpos))
|
||||||
|
player.swingItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
@ -103,13 +105,46 @@ public class ItemModBuckets extends Item
|
||||||
return itemstack;
|
return itemstack;
|
||||||
|
|
||||||
if (itemstack.getItemDamage() == 0)
|
if (itemstack.getItemDamage() == 0)
|
||||||
world.setBlockState(blockpos, Blocks.flowing_water.getDefaultState(), 3);
|
if(tryPlaceWater(world, blockpos))
|
||||||
|
player.swingItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return itemstack;
|
return itemstack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean tryPlaceWater(World worldIn, BlockPos pos)
|
||||||
|
{
|
||||||
|
Material material = worldIn.getBlockState(pos).getBlock().getMaterial();
|
||||||
|
boolean flag = !material.isSolid();
|
||||||
|
|
||||||
|
if (!worldIn.isAirBlock(pos) && !flag)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (worldIn.provider.doesWaterVaporize())
|
||||||
|
{
|
||||||
|
int i = pos.getX();
|
||||||
|
int j = pos.getY();
|
||||||
|
int k = pos.getZ();
|
||||||
|
worldIn.playSoundEffect((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);
|
||||||
|
|
||||||
|
for (int l = 0; l < 8; ++l)
|
||||||
|
worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D, new int[0]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!worldIn.isRemote && flag && !material.isLiquid())
|
||||||
|
worldIn.destroyBlock(pos, true);
|
||||||
|
|
||||||
|
worldIn.setBlockState(pos, Blocks.flowing_water.getDefaultState(), 3);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName(ItemStack itemStack)
|
public String getUnlocalizedName(ItemStack itemStack)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue