From ee0ab2c486cc63ec0417fa64e6898b95edb55fae Mon Sep 17 00:00:00 2001 From: HellFirePvP <01ecs01m> Date: Thu, 22 Oct 2015 20:25:46 +0200 Subject: [PATCH] Added Extended Aura Node and linked renderers to Thaumcraft --- .../makeo/gadomancy/client/ClientProxy.java | 8 ++++ .../renderers/item/ItemExNodeRenderer.java | 31 ++++++++++++++ .../tile/RenderTileExtendedNode.java | 20 +++++++++ .../gadomancy/common/blocks/BlockNode.java | 29 +++++++++++++ .../common/blocks/tiles/TileExtendedNode.java | 42 +++++++++++++++++++ .../common/registration/RegisteredBlocks.java | 6 ++- .../assets/gadomancy/lang/en_US.lang | 1 + 7 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 src/main/java/makeo/gadomancy/client/renderers/item/ItemExNodeRenderer.java create mode 100644 src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileExtendedNode.java create mode 100644 src/main/java/makeo/gadomancy/common/blocks/BlockNode.java create mode 100644 src/main/java/makeo/gadomancy/common/blocks/tiles/TileExtendedNode.java diff --git a/src/main/java/makeo/gadomancy/client/ClientProxy.java b/src/main/java/makeo/gadomancy/client/ClientProxy.java index 5640b2f..6ec3042 100644 --- a/src/main/java/makeo/gadomancy/client/ClientProxy.java +++ b/src/main/java/makeo/gadomancy/client/ClientProxy.java @@ -9,14 +9,17 @@ import makeo.gadomancy.client.events.ResourceReloadListener; import makeo.gadomancy.client.gui.InfusionClawGui; import makeo.gadomancy.client.renderers.block.RenderBlockTransparent; import makeo.gadomancy.client.renderers.entity.RenderAdditionalGolemBase; +import makeo.gadomancy.client.renderers.item.ItemExNodeRenderer; import makeo.gadomancy.client.renderers.item.ItemRenderRemoteJar; import makeo.gadomancy.client.renderers.item.ItemRenderTileEntity; import makeo.gadomancy.client.renderers.tile.RenderTileArcaneDropper; +import makeo.gadomancy.client.renderers.tile.RenderTileExtendedNode; import makeo.gadomancy.client.renderers.tile.RenderTileInfusionClaw; import makeo.gadomancy.client.renderers.tile.RenderTileRemoteJar; import makeo.gadomancy.client.renderers.tile.RenderTileStickyJar; import makeo.gadomancy.common.CommonProxy; import makeo.gadomancy.common.blocks.tiles.TileArcaneDropper; +import makeo.gadomancy.common.blocks.tiles.TileExtendedNode; import makeo.gadomancy.common.blocks.tiles.TileInfusionClaw; import makeo.gadomancy.common.blocks.tiles.TileRemoteJar; import makeo.gadomancy.common.blocks.tiles.TileStickyJar; @@ -70,6 +73,9 @@ public class ClientProxy extends CommonProxy { RenderTileInfusionClaw renderTileInfusionClaw = new RenderTileInfusionClaw(); ClientRegistry.bindTileEntitySpecialRenderer(TileInfusionClaw.class, renderTileInfusionClaw); + RenderTileExtendedNode nodeRenderer = new RenderTileExtendedNode(); + ClientRegistry.bindTileEntitySpecialRenderer(TileExtendedNode.class, nodeRenderer); + //Items TileArcaneDropper fakeTile = new TileArcaneDropper(); fakeTile.blockMetadata = 8 | ForgeDirection.SOUTH.ordinal(); @@ -77,6 +83,8 @@ public class ClientProxy extends CommonProxy { MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockInfusionClaw), new ItemRenderTileEntity(renderTileInfusionClaw, new TileInfusionClaw())); + MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockNode), new ItemExNodeRenderer()); + MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockRemoteJar), new ItemRenderRemoteJar(renderTileRemoteJar)); //Blocks diff --git a/src/main/java/makeo/gadomancy/client/renderers/item/ItemExNodeRenderer.java b/src/main/java/makeo/gadomancy/client/renderers/item/ItemExNodeRenderer.java new file mode 100644 index 0000000..6b4ebed --- /dev/null +++ b/src/main/java/makeo/gadomancy/client/renderers/item/ItemExNodeRenderer.java @@ -0,0 +1,31 @@ +package makeo.gadomancy.client.renderers.item; + +import makeo.gadomancy.common.registration.RegisteredBlocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import thaumcraft.client.renderers.tile.ItemNodeRenderer; +/** + * This class is part of the Gadomancy Mod + * Gadomancy is Open Source and distributed under the + * GNU LESSER GENERAL PUBLIC LICENSE + * for more read the LICENSE file + *

+ * Created by HellFirePvP @ 22.10.2015 20:11 + */ +public class ItemExNodeRenderer extends ItemNodeRenderer { + + public ItemExNodeRenderer() { + //AspectList list = new AspectList().add(Aspect.FIRE, 100).add(Aspect.ENTROPY, 100).add(Aspect.WATER, 50); + //new Injector(this).setField("aspects", list); + } + + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return (item != null) && (item.getItem() == Item.getItemFromBlock(RegisteredBlocks.blockNode)) && (item.getItemDamage() == 0); + } + + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return helper != ItemRendererHelper.EQUIPPED_BLOCK; + } +} diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileExtendedNode.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileExtendedNode.java new file mode 100644 index 0000000..c8293aa --- /dev/null +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileExtendedNode.java @@ -0,0 +1,20 @@ +package makeo.gadomancy.client.renderers.tile; + +import net.minecraft.tileentity.TileEntity; +import thaumcraft.client.renderers.tile.TileNodeRenderer; + +/** + * This class is part of the Gadomancy Mod + * Gadomancy is Open Source and distributed under the + * GNU LESSER GENERAL PUBLIC LICENSE + * for more read the LICENSE file + *

+ * Created by HellFirePvP @ 22.10.2015 19:44 + */ +public class RenderTileExtendedNode extends TileNodeRenderer { + + @Override + public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) { + super.renderTileEntityAt(tile, x, y, z, partialTicks); + } +} diff --git a/src/main/java/makeo/gadomancy/common/blocks/BlockNode.java b/src/main/java/makeo/gadomancy/common/blocks/BlockNode.java new file mode 100644 index 0000000..22784d1 --- /dev/null +++ b/src/main/java/makeo/gadomancy/common/blocks/BlockNode.java @@ -0,0 +1,29 @@ +package makeo.gadomancy.common.blocks; + +import makeo.gadomancy.common.blocks.tiles.TileExtendedNode; +import makeo.gadomancy.common.registration.RegisteredItems; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +/** + * This class is part of the Gadomancy Mod + * Gadomancy is Open Source and distributed under the + * GNU LESSER GENERAL PUBLIC LICENSE + * for more read the LICENSE file + * + * Created by HellFirePvP @ 22.10.2015 19:47 + */ +public class BlockNode extends thaumcraft.common.blocks.BlockAiry { + //We overwrite and use the TC class for visual effects and world interact handling. + //This way our node behaves like TC ones. + + public BlockNode() { + super(); + setCreativeTab(RegisteredItems.creativeTab); + } + + @Override + public TileEntity createTileEntity(World world, int metadata) { + return new TileExtendedNode(); + } +} diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileExtendedNode.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileExtendedNode.java new file mode 100644 index 0000000..4ca3ef5 --- /dev/null +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileExtendedNode.java @@ -0,0 +1,42 @@ +package makeo.gadomancy.common.blocks.tiles; + +import net.minecraft.nbt.NBTTagCompound; +import thaumcraft.common.tiles.TileNode; + +/** + * This class is part of the Gadomancy Mod + * Gadomancy is Open Source and distributed under the + * GNU LESSER GENERAL PUBLIC LICENSE + * for more read the LICENSE file + * + * Created by HellFirePvP @ 21.10.2015 23:39 + */ +public class TileExtendedNode extends TileNode { + + private boolean growing = false; + + @Override + public void updateEntity() { + super.updateEntity(); + } + + @Override + public void readCustomNBT(NBTTagCompound nbttagcompound) { + super.readCustomNBT(nbttagcompound); + + NBTTagCompound compound = nbttagcompound.getCompoundTag("Gadomancy"); + this.growing = compound.getBoolean("growing"); + + } + + @Override + public void writeCustomNBT(NBTTagCompound nbttagcompound) { + super.writeCustomNBT(nbttagcompound); + + NBTTagCompound compound = new NBTTagCompound(); + compound.setBoolean("growing", growing); + + nbttagcompound.setTag("Gadomancy", compound); + } + +} diff --git a/src/main/java/makeo/gadomancy/common/registration/RegisteredBlocks.java b/src/main/java/makeo/gadomancy/common/registration/RegisteredBlocks.java index 8272df6..c221616 100644 --- a/src/main/java/makeo/gadomancy/common/registration/RegisteredBlocks.java +++ b/src/main/java/makeo/gadomancy/common/registration/RegisteredBlocks.java @@ -2,12 +2,13 @@ package makeo.gadomancy.common.registration; import cpw.mods.fml.common.registry.GameRegistry; import makeo.gadomancy.api.ClickBehavior; -import makeo.gadomancy.api.GadomancyApi; import makeo.gadomancy.common.blocks.BlockArcaneDropper; import makeo.gadomancy.common.blocks.BlockInfusionClaw; +import makeo.gadomancy.common.blocks.BlockNode; import makeo.gadomancy.common.blocks.BlockRemoteJar; import makeo.gadomancy.common.blocks.BlockStickyJar; import makeo.gadomancy.common.blocks.tiles.TileArcaneDropper; +import makeo.gadomancy.common.blocks.tiles.TileExtendedNode; import makeo.gadomancy.common.blocks.tiles.TileInfusionClaw; import makeo.gadomancy.common.blocks.tiles.TileRemoteJar; import makeo.gadomancy.common.blocks.tiles.TileStickyJar; @@ -40,6 +41,7 @@ public class RegisteredBlocks { public static BlockArcaneDropper blockArcaneDropper; public static BlockInfusionClaw blockInfusionClaw; public static BlockRemoteJar blockRemoteJar; + public static BlockNode blockNode; public static void init() { registerBlocks(); @@ -56,6 +58,7 @@ public class RegisteredBlocks { blockArcaneDropper = registerBlock(new BlockArcaneDropper()); blockInfusionClaw = registerBlock(new BlockInfusionClaw()); blockRemoteJar = registerBlock(new BlockRemoteJar(), ItemBlockRemoteJar.class); + blockNode = registerBlock(new BlockNode()); } private static T registerBlock(String name, T block) { @@ -86,6 +89,7 @@ public class RegisteredBlocks { registerTile(TileArcaneDropper.class); registerTile(TileInfusionClaw.class); registerTile(TileRemoteJar.class); + registerTile(TileExtendedNode.class); } private static void registerTile(Class tile, String name) { diff --git a/src/main/resources/assets/gadomancy/lang/en_US.lang b/src/main/resources/assets/gadomancy/lang/en_US.lang index a9f2d6b..646a128 100644 --- a/src/main/resources/assets/gadomancy/lang/en_US.lang +++ b/src/main/resources/assets/gadomancy/lang/en_US.lang @@ -41,6 +41,7 @@ tile.BlockStickyJar.name=Sticky Jar tile.BlockArcaneDropper.name=Arcane Dropper tile.BlockInfusionClaw.name=Infusion Claw tile.BlockRemoteJar.name=[WIP] Mirrored Jar +tile.BlockNode.name=Aura Node gadomancy.info.InfusionClaw.owner=You are now the owner. gadomancy.info.InfusionClaw.waila=ยง7Owner: