use of forestry.core.network.packets.PacketFXSignal in project ForestryMC by ForestryMC.
the class FarmableSapling method plantSaplingAt.
@Override
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) {
ItemStack copy = germling.copy();
player.setHeldItem(EnumHand.MAIN_HAND, copy);
EnumActionResult actionResult = copy.onItemUse(player, world, pos.down(), EnumHand.MAIN_HAND, EnumFacing.UP, 0, 0, 0);
player.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
if (actionResult == EnumActionResult.SUCCESS) {
PacketFXSignal packet = new PacketFXSignal(PacketFXSignal.SoundFXType.BLOCK_PLACE, pos, Blocks.SAPLING.getDefaultState());
NetworkUtil.sendNetworkPacket(packet, pos, world);
return true;
}
return false;
}
use of forestry.core.network.packets.PacketFXSignal in project ForestryMC by ForestryMC.
the class CropRubber method harvestBlock.
@Override
protected NonNullList<ItemStack> harvestBlock(World world, BlockPos pos) {
NonNullList<ItemStack> harvested = NonNullList.create();
harvested.add(PluginIC2.resin.copy());
PacketFXSignal packet = new PacketFXSignal(PacketFXSignal.VisualFXType.BLOCK_BREAK, PacketFXSignal.SoundFXType.BLOCK_BREAK, pos, blockState);
NetworkUtil.sendNetworkPacket(packet, pos, world);
world.setBlockState(pos, replantState, Constants.FLAG_BLOCK_SYNC);
return harvested;
}
use of forestry.core.network.packets.PacketFXSignal in project ForestryMC by ForestryMC.
the class BlockUtil method setBlockWithPlaceSound.
public static boolean setBlockWithPlaceSound(World world, BlockPos pos, IBlockState blockState) {
if (world.setBlockState(pos, blockState)) {
PacketFXSignal packet = new PacketFXSignal(PacketFXSignal.SoundFXType.BLOCK_PLACE, pos, blockState);
NetworkUtil.sendNetworkPacket(packet, pos, world);
return true;
}
return false;
}
use of forestry.core.network.packets.PacketFXSignal in project ForestryMC by ForestryMC.
the class BlockUtil method setBlockWithBreakSound.
public static boolean setBlockWithBreakSound(World world, BlockPos pos, IBlockState blockState, IBlockState oldState) {
if (world.setBlockState(pos, blockState)) {
PacketFXSignal packet = new PacketFXSignal(PacketFXSignal.VisualFXType.BLOCK_BREAK, PacketFXSignal.SoundFXType.BLOCK_BREAK, pos, oldState);
NetworkUtil.sendNetworkPacket(packet, pos, world);
return true;
}
return false;
}
use of forestry.core.network.packets.PacketFXSignal in project ForestryMC by ForestryMC.
the class ItemGermlingGE method onItemRightClickPollen.
private static ActionResult<ItemStack> onItemRightClickPollen(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, BlockPos pos, ITree tree) {
ICheckPollinatable checkPollinatable = GeneticsUtil.getCheckPollinatable(worldIn, pos);
if (checkPollinatable == null || !checkPollinatable.canMateWith(tree)) {
return new ActionResult<>(EnumActionResult.FAIL, itemStackIn);
}
IPollinatable pollinatable = GeneticsUtil.getOrCreatePollinatable(playerIn.getGameProfile(), worldIn, pos, true);
if (pollinatable == null || !pollinatable.canMateWith(tree)) {
return new ActionResult<>(EnumActionResult.FAIL, itemStackIn);
}
if (worldIn.isRemote) {
return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn);
} else {
pollinatable.mateWith(tree);
IBlockState blockState = worldIn.getBlockState(pos);
PacketFXSignal packet = new PacketFXSignal(PacketFXSignal.VisualFXType.BLOCK_BREAK, PacketFXSignal.SoundFXType.BLOCK_BREAK, pos, blockState);
NetworkUtil.sendNetworkPacket(packet, pos, worldIn);
if (!playerIn.capabilities.isCreativeMode) {
itemStackIn.shrink(1);
}
return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn);
}
}
Aggregations