diff --git a/codechicken/microblock/TMicroOcclusion.scala b/codechicken/microblock/TMicroOcclusion.scala index 986bb17..3b05ea6 100644 --- a/codechicken/microblock/TMicroOcclusion.scala +++ b/codechicken/microblock/TMicroOcclusion.scala @@ -106,8 +106,8 @@ trait TMicroOcclusionClient extends TMicroOcclusion { val e1 = s1-15 val c2 = s2-7 - val ebits = unpackEdgeBits(s1) - if((c2&edgeAxisMask(s1)) != ebits) + val ebits = unpackEdgeBits(e1) + if((c2&edgeAxisMask(e1)) != ebits) return -1 return (e1&0xC)>>1|(c2&(~ebits))>>(e1>>2) diff --git a/codechicken/multipart/MultipartGenerator.scala b/codechicken/multipart/MultipartGenerator.scala index db748dd..21f39b9 100644 --- a/codechicken/multipart/MultipartGenerator.scala +++ b/codechicken/multipart/MultipartGenerator.scala @@ -148,21 +148,35 @@ object MultipartGenerator } private var generatorMap:Map[SuperSet, Generator] = Map() - private var interfaceTraitMap:Map[Type, Seq[Type]] = Map() private var tileTraitMap:Map[Class[_], Set[Type]] = Map() - private var partTraitMap:Map[Class[_], Seq[Type]] = Map() + private var interfaceTraitMap_c:Map[Type, Seq[Type]] = Map() + private var interfaceTraitMap_s:Map[Type, Seq[Type]] = Map() + private var partTraitMap_c:Map[Class[_], Seq[Type]] = Map() + private var partTraitMap_s:Map[Class[_], Seq[Type]] = Map() SuperSet(Seq(), false).generate//default impl, boots generator if(FMLCommonHandler.instance.getEffectiveSide == Side.CLIENT) SuperSet(Seq(), true).generate - private def traitsForPart(part:TMultiPart):Seq[Type] = + private def partTraitMap(client:Boolean) = if(client) partTraitMap_c else partTraitMap_s + + private def interfaceTraitMap(client:Boolean) = if(client) partTraitMap_c else interfaceTraitMap_s + + private def traitsForPart(part:TMultiPart, client:Boolean):Seq[Type] = { - var ret = partTraitMap.getOrElse(part.getClass, null) + var ret = partTraitMap(client).getOrElse(part.getClass, null) if(ret == null) { - ret = getType(part).baseClasses.flatMap(s => interfaceTraitMap.getOrElse(s.asClass.toType, List())).distinct - partTraitMap = partTraitMap+(part.getClass -> ret) + if(client) + { + ret = getType(part).baseClasses.flatMap(s => interfaceTraitMap_c.getOrElse(s.asClass.toType, List())).distinct + partTraitMap_c = partTraitMap_c+(part.getClass -> ret) + } + else + { + ret = getType(part).baseClasses.flatMap(s => interfaceTraitMap_s.getOrElse(s.asClass.toType, List())).distinct + partTraitMap_s = partTraitMap_s+(part.getClass -> ret) + } } return ret } @@ -175,12 +189,17 @@ object MultipartGenerator { var tile = TileMultipartObj.getOrConvertTile(world, pos) - var partTraits = traitsForPart(part) + var partTraits = traitsForPart(part, world.isRemote) var ntile = tile if(tile != null) { if(!tile.loaded) - world.setBlock(pos.x, pos.y, pos.z, MultipartProxy.block.blockID) + { + if(world.isRemote) + world.setBlock(pos.x, pos.y, pos.z, MultipartProxy.block.blockID, 0, 3) + else + world.setBlock(pos.x, pos.y, pos.z, MultipartProxy.block.blockID, 0, 1)//the add part packet will do the conversion on the client + } val tileTraits = tileTraitMap(tile.getClass) partTraits = partTraits.filter(!tileTraits(_)) @@ -211,7 +230,7 @@ object MultipartGenerator */ def generateCompositeTile(tile:TileEntity, parts:Seq[TMultiPart], client:Boolean):TileMultipart = { - var partTraits = parts.flatMap(traitsForPart(_)).distinct + var partTraits = parts.flatMap(traitsForPart(_, client)).distinct if(tile != null && tile.isInstanceOf[TileMultipart]) { var tileTraits = tileTraitMap(tile.getClass) @@ -227,11 +246,12 @@ object MultipartGenerator */ def partRemoved(tile:TileMultipart, part:TMultiPart):TileMultipart = { - var partTraits = tile.partList.flatMap(traitsForPart(_)) + val client = tile.worldObj.isRemote + var partTraits = tile.partList.flatMap(traitsForPart(_, client)) var testSet = partTraits.toSet - if(!traitsForPart(part).forall(testSet(_))) + if(!traitsForPart(part, client).forall(testSet(_))) { - val ntile = SuperSet(testSet.toSeq, tile.worldObj.isRemote).generate + val ntile = SuperSet(testSet.toSeq, client).generate tile.worldObj.setBlockTileEntity(tile.xCoord, tile.yCoord, tile.zCoord, ntile) ntile.loadFrom(tile) return ntile @@ -242,14 +262,33 @@ object MultipartGenerator /** * register s_trait to be applied to tiles containing parts implementing s_interface */ - def registerTrait(s_interface:String, s_trait:String) + def registerTrait(s_interface:String, s_trait:String):Unit = registerTrait(s_interface, s_trait, s_trait) + + /** + * register traits to be applied to tiles containing parts implementing s_interface + * s_trait for server worlds (may be null) + * c_trait for client worlds (may be null) + */ + def registerTrait(s_interface:String, c_trait:String, s_trait:String) { - val iSymbol = mirror.staticClass(s_interface).asClass - val tSymbol = mirror.staticClass(s_trait).asClass - //TODO some checking - var reg = interfaceTraitMap.getOrElse(iSymbol.toType, Seq()) - if(!reg.contains(tSymbol.toType)) - reg = reg:+tSymbol.toType - interfaceTraitMap = interfaceTraitMap+(iSymbol.toType->reg) + val iSymbol = mirror.staticClass(s_interface).asClass + if(c_trait != null) + { + val tSymbol = mirror.staticClass(c_trait).asClass + //TODO some checking + var reg = interfaceTraitMap_c.getOrElse(iSymbol.toType, Seq()) + if(!reg.contains(tSymbol.toType)) + reg = reg:+tSymbol.toType + interfaceTraitMap_c = interfaceTraitMap_c+(iSymbol.toType->reg) + } + if(s_trait != null) + { + val tSymbol = mirror.staticClass(s_trait).asClass + //TODO some checking + var reg = interfaceTraitMap_s.getOrElse(iSymbol.toType, Seq()) + if(!reg.contains(tSymbol.toType)) + reg = reg:+tSymbol.toType + interfaceTraitMap_s = interfaceTraitMap_s+(iSymbol.toType->reg) + } } } \ No newline at end of file diff --git a/codechicken/multipart/TNormalOcclusion.scala b/codechicken/multipart/TNormalOcclusion.scala index f923b03..84d665b 100644 --- a/codechicken/multipart/TNormalOcclusion.scala +++ b/codechicken/multipart/TNormalOcclusion.scala @@ -12,7 +12,7 @@ object NormalOcclusionTest def apply(part1:JNormalOcclusion, part2:TMultiPart):Boolean = { var boxes = Seq[Cuboid6]() - if(part2.isInstanceOf[TNormalOcclusion]) + if(part2.isInstanceOf[JNormalOcclusion]) boxes = boxes++part2.asInstanceOf[JNormalOcclusion].getOcclusionBoxes if(part2.isInstanceOf[JPartialOcclusion]) diff --git a/codechicken/multipart/handler/Proxies.scala b/codechicken/multipart/handler/Proxies.scala index 8fd19e4..584ce50 100644 --- a/codechicken/multipart/handler/Proxies.scala +++ b/codechicken/multipart/handler/Proxies.scala @@ -33,7 +33,7 @@ class MultipartProxy_serverImpl MultipartGenerator.registerTrait("net.minecraftforge.liquids.ITankContainer", "codechicken.multipart.TLiquidTank") MultipartGenerator.registerTrait("codechicken.multipart.JPartialOcclusion", "codechicken.multipart.TPartialOcclusionTile") - MultipartGenerator.registerTrait("codechicken.multipart.IRandomDisplayTick", "codechicken.multipart.TRandomDisplayTickTile") + MultipartGenerator.registerTrait("codechicken.multipart.IRandomDisplayTick", "codechicken.multipart.TRandomDisplayTickTile", null) } def postInit() diff --git a/codechicken/multipart/minecraft/Content.java b/codechicken/multipart/minecraft/Content.java index 43a2bc6..72e14c7 100644 --- a/codechicken/multipart/minecraft/Content.java +++ b/codechicken/multipart/minecraft/Content.java @@ -13,7 +13,7 @@ public class Content implements IPartFactory, IPartConverter @Override public TMultiPart createPart(String name, boolean client) { - if(name.equals("mc_torch")) return client ? new TorchPartClient() : new TorchPart(); + if(name.equals("mc_torch")) return new TorchPart(); return null; } @@ -38,7 +38,7 @@ public class Content implements IPartFactory, IPartConverter int id = world.getBlockId(pos.x, pos.y, pos.z); int meta = world.getBlockMetadata(pos.x, pos.y, pos.z); if(id == Block.torchWood.blockID) - return world.isRemote ? new TorchPartClient(meta) : new TorchPart(meta); + return new TorchPart(meta); return null; } diff --git a/codechicken/multipart/minecraft/EventHandler.java b/codechicken/multipart/minecraft/EventHandler.java index c421176..efc867f 100644 --- a/codechicken/multipart/minecraft/EventHandler.java +++ b/codechicken/multipart/minecraft/EventHandler.java @@ -24,51 +24,63 @@ public class EventHandler @ForgeSubscribe public void playerInteract(PlayerInteractEvent event) { - MovingObjectPosition hit = RayTracer.reTrace(event.entityPlayer.worldObj, event.entityPlayer); - if(event.action == Action.RIGHT_CLICK_BLOCK && place(event.entityPlayer, event.entityPlayer.worldObj, hit)) + if(event.action == Action.RIGHT_CLICK_BLOCK && event.entityPlayer.worldObj.isRemote && place(event.entityPlayer, event.entityPlayer.worldObj)) event.setCanceled(true); } - public boolean place(EntityPlayer player, World world, MovingObjectPosition hit) + public static boolean place(EntityPlayer player, World world) { + MovingObjectPosition hit = RayTracer.reTrace(world, player); BlockCoord pos = new BlockCoord(hit.blockX, hit.blockY, hit.blockZ).offset(hit.sideHit); ItemStack held = player.getHeldItem(); - TileMultipart tile = TileMultipartObj.getOrConvertTile(world, pos); - if(tile == null) - return false; - - TMultiPart part = null; + McBlockPart part = null; if(held.itemID == Block.torchWood.blockID) part = TorchPart.placement(world, pos, hit.sideHit); if(part == null) return false; - if(tile.canAddPart(part)) + + if(world.isRemote && !player.isSneaking())//attempt to use block activated like normal and tell the server the right stuff { - if(!world.isRemote) - { - TileMultipartObj.addPart(world, pos, part); - if(!player.capabilities.isCreativeMode) - { - held.stackSize--; - if (held.stackSize == 0) - { - player.inventory.mainInventory[player.inventory.currentItem] = null; - MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, held)); - } - } - } - else + Vector3 f = new Vector3(hit.hitVec).add(-hit.blockX, -hit.blockY, -hit.blockZ); + Block block = Block.blocksList[world.getBlockId(hit.blockX, hit.blockY, hit.blockZ)]; + if(block != null && block.onBlockActivated(world, hit.blockX, hit.blockY, hit.blockZ, player, hit.sideHit, (float)f.x, (float)f.y, (float)f.z)) { player.swingItem(); - Vector3 f = new Vector3(hit.hitVec).add(-hit.blockX, -hit.blockY, -hit.blockZ); PacketCustom.sendToServer(new Packet15Place( hit.blockX, hit.blockY, hit.blockZ, hit.sideHit, player.inventory.getCurrentItem(), (float)f.x, (float)f.y, (float)f.z)); + return false; } - return true; } - return false; + + TileMultipart tile = TileMultipartObj.getOrConvertTile(world, pos); + if(tile == null || !tile.canAddPart(part)) + return false; + + if(!world.isRemote) + { + TileMultipartObj.addPart(world, pos, part); + world.playSoundEffect(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5, + part.getBlock().stepSound.getPlaceSound(), + (part.getBlock().stepSound.getVolume() + 1.0F) / 2.0F, + part.getBlock().stepSound.getPitch() * 0.8F); + if(!player.capabilities.isCreativeMode) + { + held.stackSize--; + if (held.stackSize == 0) + { + player.inventory.mainInventory[player.inventory.currentItem] = null; + MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, held)); + } + } + } + else + { + player.swingItem(); + new PacketCustom(McMultipartSPH.channel, 1).sendToServer(); + } + return true; } } diff --git a/codechicken/multipart/minecraft/McBlockPart.java b/codechicken/multipart/minecraft/McBlockPart.java new file mode 100644 index 0000000..9d44c92 --- /dev/null +++ b/codechicken/multipart/minecraft/McBlockPart.java @@ -0,0 +1,91 @@ +package codechicken.multipart.minecraft; + +import net.minecraft.block.Block; +import net.minecraft.client.particle.EffectRenderer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Icon; +import net.minecraft.util.MovingObjectPosition; +import codechicken.core.vec.Cuboid6; +import codechicken.multipart.IconHitEffects; +import codechicken.multipart.JCuboidPart; +import codechicken.multipart.JIconHitEffects; +import codechicken.multipart.JNormalOcclusion; +import codechicken.multipart.NormalOcclusionTest; +import codechicken.multipart.TMultiPart; +import codechicken.scala.JSeq; +import codechicken.scala.ScalaBridge; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public abstract class McBlockPart extends JCuboidPart implements JNormalOcclusion, JIconHitEffects +{ + public abstract Block getBlock(); + + @Override + public boolean occlusionTest(TMultiPart npart) + { + return NormalOcclusionTest.apply(this, npart); + } + + @Override + public JSeq getOcclusionBoxes() + { + return ScalaBridge.seq(getBounds()); + } + + @Override + public JSeq getCollisionBoxes() + { + return ScalaBridge.seq(); + } + + @Override + public JSeq getDrops() + { + return ScalaBridge.seq(new ItemStack(getBlock())); + } + + @Override + public ItemStack pickItem(MovingObjectPosition hit) + { + return new ItemStack(getBlock()); + } + + @Override + public float getStrength(MovingObjectPosition hit, EntityPlayer player) + { + return getBlock().getPlayerRelativeBlockHardness(player, player.worldObj, hit.blockX, hit.blockY, hit.blockZ)*30; + } + + @Override + public Icon getBreakingIcon(Object subPart, int side) + { + return getBlock().getIcon(0, 0); + } + + @Override + @SideOnly(Side.CLIENT) + public Icon getBrokenIcon(int side) + { + return getBlock().getIcon(0, 0); + } + + @Override + public void addHitEffects(MovingObjectPosition hit, EffectRenderer effectRenderer) + { + IconHitEffects.addHitEffects(this, hit, effectRenderer); + } + + @Override + public void addDestroyEffects(EffectRenderer effectRenderer) + { + IconHitEffects.addDestroyEffects(this, effectRenderer, false); + } + + @Override + public int getLightValue() + { + return Block.lightValue[getBlock().blockID]; + } +} diff --git a/codechicken/multipart/minecraft/McMultipartSPH.java b/codechicken/multipart/minecraft/McMultipartSPH.java new file mode 100644 index 0000000..2a17ed2 --- /dev/null +++ b/codechicken/multipart/minecraft/McMultipartSPH.java @@ -0,0 +1,22 @@ +package codechicken.multipart.minecraft; + +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.NetServerHandler; +import codechicken.core.packet.PacketCustom; +import codechicken.core.packet.PacketCustom.IServerPacketHandler; + +public class McMultipartSPH implements IServerPacketHandler +{ + public static Object channel = MinecraftMultipartMod.instance; + + @Override + public void handlePacket(PacketCustom packet, NetServerHandler nethandler, EntityPlayerMP sender) + { + switch(packet.getType()) + { + case 1: + EventHandler.place(sender, sender.worldObj); + break; + } + } +} diff --git a/codechicken/multipart/minecraft/MinecraftMultipartMod.java b/codechicken/multipart/minecraft/MinecraftMultipartMod.java index fd72c24..54224d2 100644 --- a/codechicken/multipart/minecraft/MinecraftMultipartMod.java +++ b/codechicken/multipart/minecraft/MinecraftMultipartMod.java @@ -2,17 +2,26 @@ package codechicken.multipart.minecraft; import net.minecraftforge.common.MinecraftForge; import codechicken.core.asm.CodeChickenCorePlugin; +import codechicken.core.packet.PacketCustom; +import codechicken.core.packet.PacketCustom.CustomTinyPacketHandler; import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.network.NetworkMod; @Mod(name="Minecraft Multipart", version="1.0.0.0", useMetadata = false, modid = "McMultipart", acceptedMinecraftVersions=CodeChickenCorePlugin.mcVersion) +@NetworkMod(clientSideRequired = true, serverSideRequired = true, tinyPacketHandler=CustomTinyPacketHandler.class) public class MinecraftMultipartMod { + @Instance("McMultipart") + public static MinecraftMultipartMod instance; + @PreInit public void preInit(FMLPreInitializationEvent event) { new Content().init(); MinecraftForge.EVENT_BUS.register(new EventHandler()); + PacketCustom.assignHandler(this, new McMultipartSPH()); } } diff --git a/codechicken/multipart/minecraft/TorchPart.java b/codechicken/multipart/minecraft/TorchPart.java index 76c7d9d..9b5ba05 100644 --- a/codechicken/multipart/minecraft/TorchPart.java +++ b/codechicken/multipart/minecraft/TorchPart.java @@ -1,28 +1,25 @@ package codechicken.multipart.minecraft; +import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.block.BlockTorch; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; -import codechicken.scala.JSeq; -import codechicken.scala.ScalaBridge; -import codechicken.multipart.JCuboidPart; -import codechicken.multipart.JNormalOcclusion; -import codechicken.multipart.NormalOcclusionTest; -import codechicken.multipart.TMultiPart; +import codechicken.multipart.IRandomDisplayTick; import codechicken.core.data.MCDataInput; import codechicken.core.data.MCDataOutput; import codechicken.core.inventory.InventoryUtils; +import codechicken.core.lighting.LazyLightMatrix; import codechicken.core.vec.BlockCoord; import codechicken.core.vec.Cuboid6; import codechicken.core.vec.Vector3; -public class TorchPart extends JCuboidPart implements JNormalOcclusion, IPartMeta +public class TorchPart extends McBlockPart implements IPartMeta, IRandomDisplayTick { public static BlockTorch torch = (BlockTorch) Block.torchWood; public static int[] metaSideMap = new int[]{-1, 4, 5, 2, 3, 0}; @@ -38,6 +35,12 @@ public class TorchPart extends JCuboidPart implements JNormalOcclusion, IPartMet this.meta = (byte)meta; } + @Override + public Block getBlock() + { + return torch; + } + @Override public String getType() { @@ -68,17 +71,6 @@ public class TorchPart extends JCuboidPart implements JNormalOcclusion, IPartMet meta = packet.readByte(); } - @Override - public boolean occlusionTest(TMultiPart npart) - { - return NormalOcclusionTest.apply(this, npart); - } - - public JSeq getOcclusionBoxes() - { - return ScalaBridge.seq(getBounds()); - } - @Override public Cuboid6 getBounds() { @@ -98,12 +90,6 @@ public class TorchPart extends JCuboidPart implements JNormalOcclusion, IPartMet } } - @Override - public JSeq getCollisionBoxes() - { - return ScalaBridge.seq(); - } - public void onNeighbourChanged() { TileEntity tile = getTile(); @@ -139,13 +125,7 @@ public class TorchPart extends JCuboidPart implements JNormalOcclusion, IPartMet return torch.blockID; } - @Override - public int getLightValue() - { - return Block.lightValue[getBlockId()]; - } - - public static TMultiPart placement(World world, BlockCoord pos, int side) + public static McBlockPart placement(World world, BlockCoord pos, int side) { if(side == 0) return null; @@ -155,22 +135,47 @@ public class TorchPart extends JCuboidPart implements JNormalOcclusion, IPartMet return new TorchPart(sideMetaMap[side^1]); } - + @Override - public JSeq getDrops() + public void randomDisplayTick(Random random) { - return ScalaBridge.seq(new ItemStack(torch)); + double d0 = getTile().xCoord + 0.5; + double d1 = getTile().yCoord + 0.7; + double d2 = getTile().zCoord + 0.5; + double d3 = 0.22D; + double d4 = 0.27D; + + World world = getTile().worldObj; + if (meta == 1) + { + world.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0, 0, 0); + world.spawnParticle("flame", d0 - d4, d1 + d3, d2, 0, 0, 0); + } + else if (meta == 2) + { + world.spawnParticle("smoke", d0 + d4, d1 + d3, d2, 0, 0, 0); + world.spawnParticle("flame", d0 + d4, d1 + d3, d2, 0, 0, 0); + } + else if (meta == 3) + { + world.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0, 0, 0); + world.spawnParticle("flame", d0, d1 + d3, d2 - d4, 0, 0, 0); + } + else if (meta == 4) + { + world.spawnParticle("smoke", d0, d1 + d3, d2 + d4, 0, 0, 0); + world.spawnParticle("flame", d0, d1 + d3, d2 + d4, 0, 0, 0); + } + else + { + world.spawnParticle("smoke", d0, d1, d2, 0, 0, 0); + world.spawnParticle("flame", d0, d1, d2, 0, 0, 0); + } } @Override - public ItemStack pickItem(MovingObjectPosition hit) + public void renderStatic(Vector3 pos, LazyLightMatrix olm, int pass) { - return new ItemStack(torch); - } - - @Override - public float getStrength(MovingObjectPosition hit, EntityPlayer player) - { - return torch.getPlayerRelativeBlockHardness(player, player.worldObj, hit.blockX, hit.blockY, hit.blockZ)*30; + new RenderBlocks(new PartMetaAccess(this)).renderBlockTorch(torch, getTile().xCoord, getTile().yCoord, getTile().zCoord); } } diff --git a/codechicken/multipart/minecraft/TorchPartClient.java b/codechicken/multipart/minecraft/TorchPartClient.java deleted file mode 100644 index 0ca82db..0000000 --- a/codechicken/multipart/minecraft/TorchPartClient.java +++ /dev/null @@ -1,96 +0,0 @@ -package codechicken.multipart.minecraft; - -import java.util.Random; - -import net.minecraft.client.particle.EffectRenderer; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.util.Icon; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; -import codechicken.core.vec.Vector3; -import codechicken.multipart.IRandomDisplayTick; -import codechicken.multipart.IconHitEffects; -import codechicken.multipart.JIconHitEffects; -import codechicken.core.lighting.LazyLightMatrix; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class TorchPartClient extends TorchPart implements IRandomDisplayTick, JIconHitEffects -{ - public TorchPartClient() - { - } - - public TorchPartClient(int meta) - { - super(meta); - } - - @Override - public void randomDisplayTick(Random random) - { - double d0 = getTile().xCoord + 0.5; - double d1 = getTile().yCoord + 0.7; - double d2 = getTile().zCoord + 0.5; - double d3 = 0.22D; - double d4 = 0.27D; - - World world = getTile().worldObj; - if (meta == 1) - { - world.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0, 0, 0); - world.spawnParticle("flame", d0 - d4, d1 + d3, d2, 0, 0, 0); - } - else if (meta == 2) - { - world.spawnParticle("smoke", d0 + d4, d1 + d3, d2, 0, 0, 0); - world.spawnParticle("flame", d0 + d4, d1 + d3, d2, 0, 0, 0); - } - else if (meta == 3) - { - world.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0, 0, 0); - world.spawnParticle("flame", d0, d1 + d3, d2 - d4, 0, 0, 0); - } - else if (meta == 4) - { - world.spawnParticle("smoke", d0, d1 + d3, d2 + d4, 0, 0, 0); - world.spawnParticle("flame", d0, d1 + d3, d2 + d4, 0, 0, 0); - } - else - { - world.spawnParticle("smoke", d0, d1, d2, 0, 0, 0); - world.spawnParticle("flame", d0, d1, d2, 0, 0, 0); - } - } - - @Override - public void renderStatic(Vector3 pos, LazyLightMatrix olm, int pass) - { - new RenderBlocks(new PartMetaAccess(this)).renderBlockTorch(torch, getTile().xCoord, getTile().yCoord, getTile().zCoord); - } - - @Override - public Icon getBreakingIcon(Object subPart, int side) - { - return torch.getIcon(0, 0); - } - - @Override - @SideOnly(Side.CLIENT) - public Icon getBrokenIcon(int side) - { - return torch.getIcon(0, 0); - } - - @Override - public void addHitEffects(MovingObjectPosition hit, EffectRenderer effectRenderer) - { - IconHitEffects.addHitEffects(this, hit, effectRenderer); - } - - @Override - public void addDestroyEffects(EffectRenderer effectRenderer) - { - IconHitEffects.addDestroyEffects(this, effectRenderer, false); - } -}