diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index 1ad42e13..0d8c0c61 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -786,16 +786,14 @@ public enum Features { FUTURA { - // TODO Overlay is WIP @Override void addBlocks() { - BlockCarvable futura = (BlockCarvable) new BlockCarvable(Material.rock/* - * , "futura/screenOverlay-ctm" - */).setCreativeTab(ChiselTabs.tabMetalChiselBlocks).setHardness(2.0F).setResistance(10F); + BlockCarvable futura = (BlockCarvable) new BlockCarvable(Material.rock).setCreativeTab(ChiselTabs.tabMetalChiselBlocks).setHardness(2.0F).setResistance(10F); futura.carverHelper.addVariation("tile.futura.0.desc", 0, "futura/WIP/screenMetallicWIP"); futura.carverHelper.addVariation("tile.futura.1.desc", 1, "futura/WIP/screenCyanWIP"); - futura.carverHelper.addVariation("tile.futura.2.desc", 2, "futura/WIP/controllerWIP", new SubmapManagerFakeController()); + futura.carverHelper.addVariation("tile.futura.2.desc", 2, "futura/WIP/controllerWIP-Overlay", new SubmapManagerFakeController(2)); futura.carverHelper.addVariation("tile.futura.3.desc", 3, "futura/WIP/wavyWIP"); + futura.carverHelper.addVariation("tile.futura.4.desc", 4, "futura/WIP/controllerWIP-Overlay", new SubmapManagerFakeController(4)); futura.carverHelper.registerAll(futura, "futura"); BlockCarvable circuits = (BlockCarvable) new BlockCarvableGlow("animations/strobe").setCreativeTab(ChiselTabs.tabMetalChiselBlocks).setHardness(2.0F).setResistance(10.0F); diff --git a/src/main/java/com/cricketcraft/chisel/block/BlockCarvableGlow.java b/src/main/java/com/cricketcraft/chisel/block/BlockCarvableGlow.java index ebc7c772..af963c6c 100644 --- a/src/main/java/com/cricketcraft/chisel/block/BlockCarvableGlow.java +++ b/src/main/java/com/cricketcraft/chisel/block/BlockCarvableGlow.java @@ -1,5 +1,6 @@ package com.cricketcraft.chisel.block; +import com.cricketcraft.chisel.client.render.SubmapManagerBase; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; @@ -14,6 +15,7 @@ public class BlockCarvableGlow extends BlockCarvableColor { @SideOnly(Side.CLIENT) private IIcon glowTexture; + private SubmapManagerBase submapManagerBase; private String glowTexturePath; public BlockCarvableGlow(String glowTexture) { @@ -27,12 +29,26 @@ public class BlockCarvableGlow extends BlockCarvableColor { this.glowTexturePath = glowTexture; } + public BlockCarvableGlow(Material material, String glowTexture, SubmapManagerBase submapManagerBase){ + super(material); + this.glowTexturePath = glowTexture; + this.submapManagerBase = submapManagerBase; + } + @Override public void registerBlockIcons(IIconRegister register) { super.registerBlockIcons(register); glowTexture = register.registerIcon(Chisel.MOD_ID + ":" + glowTexturePath); } + public boolean hasSubmapManager(){ + return submapManagerBase == null; + } + + public SubmapManagerBase getSubmapManager(){ + return hasSubmapManager() ? submapManagerBase : null; + } + public IIcon getGlowTexture() { return glowTexture; } diff --git a/src/main/java/com/cricketcraft/chisel/client/render/RendererLayeredGlow.java b/src/main/java/com/cricketcraft/chisel/client/render/RendererLayeredGlow.java index fa24b0ec..0025b551 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/RendererLayeredGlow.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/RendererLayeredGlow.java @@ -1,5 +1,7 @@ package com.cricketcraft.chisel.client.render; +import com.cricketcraft.chisel.api.carving.IVariationInfo; +import com.cricketcraft.chisel.api.rendering.RenderBlocksCTM; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; @@ -37,11 +39,33 @@ public class RendererLayeredGlow implements ISimpleBlockRenderingHandler { @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { Tessellator.instance.setColorOpaque_I(Configurations.configColors[world.getBlockMetadata(x, y, z)]); - Tessellator.instance.setBrightness(0xF000F0); - Drawing.renderAllFaces(renderer, block, x, y, z, ((BlockCarvableGlow) block).getGlowTexture()); + Tessellator.instance.setBrightness(0xF000F0); + BlockCarvableGlow glow = (BlockCarvableGlow) block; + if(glow.hasSubmapManager()){ + renderer.overrideBlockTexture = glow.getGlowTexture(); + getContext(renderer, glow, world).renderBlockAllFaces(glow, x, y, z); + } else { + Drawing.renderAllFaces(renderer, block, x, y, z, ((BlockCarvableGlow) block).getGlowTexture()); + } renderer.renderStandardBlock(block, x, y, z); return true; } + + private RenderBlocks getContext(RenderBlocks rendererOld, BlockCarvableGlow block, IBlockAccess world) { + if (!rendererOld.hasOverrideBlockTexture() && block != null) { + RenderBlocks rb = block.getSubmapManager().createRenderContext(rendererOld, block, world); + if (rb != null && rb != rendererOld) { + rb.blockAccess = world; + if (rb instanceof RenderBlocksCTM) { + RenderBlocksCTM rbctm = (RenderBlocksCTM) rb; + rbctm.manager = rbctm.manager == null ? block.getSubmapManager() : rbctm.manager; + rbctm.rendererOld = rbctm.rendererOld == null ? rendererOld : rbctm.rendererOld; + } + return rb; + } + } + return rendererOld; + } @Override public boolean shouldRender3DInInventory(int modelId) { diff --git a/src/main/java/com/cricketcraft/chisel/client/render/SubmapManagerFakeController.java b/src/main/java/com/cricketcraft/chisel/client/render/SubmapManagerFakeController.java index 26a6223c..f7aed032 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/SubmapManagerFakeController.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/SubmapManagerFakeController.java @@ -18,9 +18,11 @@ public class SubmapManagerFakeController extends SubmapManagerBase { private TextureSubmap map; private CTM ctm = CTM.getInstance(); + private int meta; - public SubmapManagerFakeController() { + public SubmapManagerFakeController(int meta) { ctm.disableObscuredFaceCheck = true; + this.meta = meta; } @Override @@ -30,7 +32,7 @@ public class SubmapManagerFakeController extends SubmapManagerBase { @Override public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - ctm.buildConnectionMap(world, x, y, z, side, ChiselBlocks.futura, 2); + ctm.buildConnectionMap(world, x, y, z, side, ChiselBlocks.futura, meta); if (ctm.connectedAnd(TOP, BOTTOM, LEFT, RIGHT)) { return map.getSubIcon(1, 1); } else if (ctm.connectedAnd(TOP, BOTTOM)) { @@ -45,6 +47,10 @@ public class SubmapManagerFakeController extends SubmapManagerBase { @Override @SideOnly(Side.CLIENT) public void registerIcons(String modName, Block block, IIconRegister register) { - map = new TextureSubmap(register.registerIcon(modName + ":futura/WIP/controllerWIP-ctm"), 2, 2); + if(meta == 2){ + map = new TextureSubmap(register.registerIcon(modName + ":futura/WIP/controller"), 2, 2); + } else { + map = new TextureSubmap(register.registerIcon(modName + ":futura/WIP/controllerPurple"), 2, 2); + } } } diff --git a/src/main/java/com/cricketcraft/chisel/inventory/InventoryChiselSelection.java b/src/main/java/com/cricketcraft/chisel/inventory/InventoryChiselSelection.java index 688ced75..bb42c15f 100644 --- a/src/main/java/com/cricketcraft/chisel/inventory/InventoryChiselSelection.java +++ b/src/main/java/com/cricketcraft/chisel/inventory/InventoryChiselSelection.java @@ -128,7 +128,7 @@ public class InventoryChiselSelection implements IInventory { activeVariations = 0; while (activeVariations < normalSlots && activeVariations < list.size()) { - if(Block.blockRegistry.getNameForObject(list.get(activeVariations)) != null) { + if(Block.blockRegistry.getNameForObject(Block.getBlockFromItem(list.get(activeVariations).getItem())) != null) { inventory[activeVariations] = list.get(activeVariations); activeVariations++; } diff --git a/src/main/resources/assets/chisel/lang/en_US.lang b/src/main/resources/assets/chisel/lang/en_US.lang index 9890a007..7da9b867 100644 --- a/src/main/resources/assets/chisel/lang/en_US.lang +++ b/src/main/resources/assets/chisel/lang/en_US.lang @@ -239,6 +239,7 @@ tile.futura.0.desc=Glowing Screen with Metallic Borders tile.futura.1.desc=Glowing Screen with Cyan Borders tile.futura.2.desc=Applied Labyrinthic Neon Lines tile.futura.3.desc=Poptart Rainbow +tile.futura.4.desc=Purple Applie Labyrinthic Neon Lines tile.futuraCircuit.black.desc=Black tile.futuraCircuit.blue.desc=Blue tile.futuraCircuit.brown.desc=Brown diff --git a/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controller.png b/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controller.png index d8eeda88..5192e16c 100644 Binary files a/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controller.png and b/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controller.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerAnim.png.mcmeta b/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controller.png.mcmeta similarity index 100% rename from src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerAnim.png.mcmeta rename to src/main/resources/assets/chisel/textures/blocks/futura/WIP/controller.png.mcmeta diff --git a/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerAnim.png b/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerAnim.png deleted file mode 100644 index 0a64976d..00000000 Binary files a/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerAnim.png and /dev/null differ diff --git a/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerPurple.png b/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerPurple.png new file mode 100644 index 00000000..03b77ded Binary files /dev/null and b/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerPurple.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerPurple.png.mcmeta b/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerPurple.png.mcmeta new file mode 100644 index 00000000..fd1abe54 --- /dev/null +++ b/src/main/resources/assets/chisel/textures/blocks/futura/WIP/controllerPurple.png.mcmeta @@ -0,0 +1,19 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 0 + ] + } +}