diff --git a/src/main/java/com/cricketcraft/chisel/Chisel.java b/src/main/java/com/cricketcraft/chisel/Chisel.java index 46f6ea07..67c4f7c0 100644 --- a/src/main/java/com/cricketcraft/chisel/Chisel.java +++ b/src/main/java/com/cricketcraft/chisel/Chisel.java @@ -1,6 +1,20 @@ package com.cricketcraft.chisel; -import com.cricketcraft.chisel.api.IChiselItem; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.config.Configuration; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + import com.cricketcraft.chisel.block.BlockCarvable; import com.cricketcraft.chisel.block.tileentity.TileEntityAutoChisel; import com.cricketcraft.chisel.block.tileentity.TileEntityPresent; @@ -30,8 +44,12 @@ import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; -import cpw.mods.fml.common.event.*; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLInterModComms; +import cpw.mods.fml.common.event.FMLMissingMappingsEvent; import cpw.mods.fml.common.event.FMLMissingMappingsEvent.MissingMapping; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; @@ -39,20 +57,6 @@ import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry.Type; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.config.Configuration; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; @Mod(modid = Chisel.MOD_ID, name = Chisel.MOD_NAME, version = Chisel.VERSION, guiFactory = "com.cricketcraft.chisel.client.gui.GuiFactory", dependencies = "after:ForgeMultipart;after:Thaumcraft;after:appliedenergistics2;after:Railcraft") public class Chisel { @@ -70,7 +74,8 @@ public class Chisel { public static int renderCarpetId; public static int renderAutoChiselId; public static int renderGlowId; - + public static int renderLayeredId; + public static final Logger logger = LogManager.getLogger(MOD_ID); @Instance(MOD_ID) diff --git a/src/main/java/com/cricketcraft/chisel/block/BlockCarvableLayered.java b/src/main/java/com/cricketcraft/chisel/block/BlockCarvableLayered.java new file mode 100644 index 00000000..92f0a117 --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/block/BlockCarvableLayered.java @@ -0,0 +1,38 @@ +package com.cricketcraft.chisel.block; + +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.util.IIcon; + +import com.cricketcraft.chisel.Chisel; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockCarvableLayered extends BlockCarvable { + @SideOnly(Side.CLIENT) + private IIcon baseTexture; + private String baseTexLocation; + + public BlockCarvableLayered(Material mat, String baseTexLocation) { + super(mat); + this.baseTexLocation = baseTexLocation; + } + @Override + public void registerBlockIcons(IIconRegister register) { + super.registerBlockIcons(register); + baseTexture = register.registerIcon(Chisel.MOD_ID + ":" + baseTexLocation); + } + public IIcon getBaseTex() { + return baseTexture; + } + @Override + public int getRenderType() { + return Chisel.renderLayeredId; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } +} diff --git a/src/main/java/com/cricketcraft/chisel/block/BlockCarvableTorch.java b/src/main/java/com/cricketcraft/chisel/block/BlockCarvableTorch.java index bae70cd8..01d32a44 100644 --- a/src/main/java/com/cricketcraft/chisel/block/BlockCarvableTorch.java +++ b/src/main/java/com/cricketcraft/chisel/block/BlockCarvableTorch.java @@ -1,33 +1,87 @@ package com.cricketcraft.chisel.block; +import java.util.Random; + import net.minecraft.block.BlockTorch; import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.world.World; import com.cricketcraft.chisel.Chisel; import com.cricketcraft.chisel.api.ICarvable; import com.cricketcraft.chisel.carving.CarvableHelper; import com.cricketcraft.chisel.carving.CarvableVariation; +import com.cricketcraft.chisel.init.ChiselTabs; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class BlockCarvableTorch extends BlockTorch implements ICarvable { - public CarvableHelper carverHelper; - private String texLocation; + public CarvableHelper carverHelper; + private String texLocation; + protected boolean emitsParticles = true; - public BlockCarvableTorch() - { - super(); - - carverHelper = new CarvableHelper(); - } + public BlockCarvableTorch() + { + super(); + carverHelper = new CarvableHelper(); + setCreativeTab(ChiselTabs.tabOtherChiselBlocks); + setLightLevel(0.9375F); + setBlockName("torch"); + } @Override public CarvableVariation getVariation(int metadata) { return carverHelper.getVariation(metadata); } @Override - public void registerBlockIcons(IIconRegister icon){ - this.blockIcon = icon.registerIcon(Chisel.MOD_ID + ":torch/"+ texLocation); - } + public void registerBlockIcons(IIconRegister icon){ + this.blockIcon = icon.registerIcon(Chisel.MOD_ID + ":torch/"+ texLocation); + } public void setInformation(String textureLocation){ - this.texLocation = textureLocation; - } + this.texLocation = textureLocation; + } + public BlockCarvableTorch disableParticles() + { + this.emitsParticles = false; + return this; + } + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_) + { + if(emitsParticles) + { + int l = p_149734_1_.getBlockMetadata(p_149734_2_, p_149734_3_, p_149734_4_); + double d0 = (double)((float)p_149734_2_ + 0.5F); + double d1 = (double)((float)p_149734_3_ + 0.7F); + double d2 = (double)((float)p_149734_4_ + 0.5F); + double d3 = 0.2199999988079071D; + double d4 = 0.27000001072883606D; + + if (l == 1) + { + p_149734_1_.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D); + p_149734_1_.spawnParticle("flame", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D); + } + else if (l == 2) + { + p_149734_1_.spawnParticle("smoke", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D); + p_149734_1_.spawnParticle("flame", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D); + } + else if (l == 3) + { + p_149734_1_.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D); + p_149734_1_.spawnParticle("flame", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D); + } + else if (l == 4) + { + p_149734_1_.spawnParticle("smoke", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D); + p_149734_1_.spawnParticle("flame", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D); + } + else + { + p_149734_1_.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D); + p_149734_1_.spawnParticle("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D); + } + } + } } \ No newline at end of file diff --git a/src/main/java/com/cricketcraft/chisel/client/render/BlockLayeredRenderer.java b/src/main/java/com/cricketcraft/chisel/client/render/BlockLayeredRenderer.java new file mode 100644 index 00000000..1dd4a016 --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/client/render/BlockLayeredRenderer.java @@ -0,0 +1,49 @@ +package com.cricketcraft.chisel.client.render; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.world.IBlockAccess; + +import org.lwjgl.opengl.GL11; + +import com.cricketcraft.chisel.Chisel; +import com.cricketcraft.chisel.block.BlockCarvableLayered; +import com.cricketcraft.chisel.utils.Drawing; + +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class BlockLayeredRenderer implements ISimpleBlockRenderingHandler { + + public BlockLayeredRenderer() { + Chisel.renderLayeredId = RenderingRegistry.getNextAvailableRenderId(); + } + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + //GL11.glDisable(GL11.GL_LIGHTING); + Drawing.drawBlock(block, ((BlockCarvableLayered)block).getBaseTex(), renderer); + //GL11.glEnable(GL11.GL_LIGHTING); + Drawing.drawBlock(block, metadata, renderer); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + Drawing.renderAllFaces(renderer, block, x, y, z, ((BlockCarvableLayered) block).getBaseTex()); + renderer.renderStandardBlock(block, x, y, z); + return true; + } + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } + + @Override + public int getRenderId() { + return Chisel.renderLayeredId; + } +} diff --git a/src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java b/src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java index 8a9ca03f..26998a0f 100644 --- a/src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java +++ b/src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java @@ -5,6 +5,7 @@ import net.minecraft.block.Block; import com.cricketcraft.chisel.Chisel; import com.cricketcraft.chisel.block.BlockCarvable; import com.cricketcraft.chisel.block.BlockCarvableGlass; +import com.cricketcraft.chisel.block.BlockCarvableLayered; import com.cricketcraft.chisel.block.BlockCarvablePane; import com.cricketcraft.chisel.block.BlockCarvablePowered; import com.cricketcraft.chisel.block.BlockCarvablePumpkin; @@ -105,10 +106,8 @@ public final class ChiselBlocks { public static final BlockCarvable technical = null; public static final BlockCarvableGlass technical2 = null; public static final BlockCarvable futura = null; - public static final BlockCarvable bone = null; - public static final BlockCarvable scorching = null; public static final BlockCarvable brickCustom = null; - public static final BlockCarvable sign = null; + public static final BlockCarvableLayered sign = null; public static final BlockCarvable arcane = null; public static final BlockCarvable bloodRune = null; public static final BlockCarvableSand colored_sand = null; diff --git a/src/main/java/com/cricketcraft/chisel/init/Features.java b/src/main/java/com/cricketcraft/chisel/init/Features.java index b2bb96ba..5479bd19 100644 --- a/src/main/java/com/cricketcraft/chisel/init/Features.java +++ b/src/main/java/com/cricketcraft/chisel/init/Features.java @@ -28,6 +28,7 @@ import com.cricketcraft.chisel.block.BlockBeaconBase; import com.cricketcraft.chisel.block.BlockCarvable; import com.cricketcraft.chisel.block.BlockCarvableGlass; import com.cricketcraft.chisel.block.BlockCarvableGlow; +import com.cricketcraft.chisel.block.BlockCarvableLayered; import com.cricketcraft.chisel.block.BlockCarvablePane; import com.cricketcraft.chisel.block.BlockCarvablePowered; import com.cricketcraft.chisel.block.BlockCarvablePumpkin; @@ -2343,7 +2344,7 @@ public enum Features { WARNING_SIGN { @Override void addBlocks() { - BlockCarvable sign = (BlockCarvable) new BlockCarvable(Material.iron).setCreativeTab(ChiselTabs.tabMetalChiselBlocks).setHardness(2.0F).setResistance(10.0F); + BlockCarvableLayered sign = (BlockCarvableLayered) new BlockCarvableLayered(Material.iron, "warning/base").setCreativeTab(ChiselTabs.tabMetalChiselBlocks).setHardness(2.0F).setResistance(10.0F); sign.carverHelper.addVariation(StatCollector.translateToLocal("tile.warningSign.0.desc"), 0, "warning/rad"); sign.carverHelper.addVariation(StatCollector.translateToLocal("tile.warningSign.1.desc"), 1, "warning/bio"); sign.carverHelper.addVariation(StatCollector.translateToLocal("tile.warningSign.2.desc"), 2, "warning/fire"); @@ -2371,11 +2372,15 @@ public enum Features { @Override void addBlocks() { Carving.chisel.addVariation("torch", Blocks.torch, 0, 0); - for(int metadata = 0; metadata < 10; metadata++){ - torch[metadata] = (BlockCarvableTorch) new BlockCarvableTorch().setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setLightLevel(0.9375F).setBlockName("torch"); - torch[metadata].setInformation("torch" + (metadata + 1)); - GameRegistry.registerBlock(torch[metadata], "torch" + (metadata + 1)); - Carving.chisel.addVariation("torch", torch[metadata], 0, (metadata + 1)); + for(int type = 0; type < 10; type++){ + if(type == 8 || type == 9) + torch[type] = (BlockCarvableTorch) new BlockCarvableTorch().disableParticles(); + else + torch[type] = (BlockCarvableTorch) new BlockCarvableTorch(); + + torch[type].setInformation("torch" + (type + 1)); + GameRegistry.registerBlock(torch[type], "torch" + (type + 1)); + Carving.chisel.addVariation("torch", torch[type], 0, (type + 1)); } Carving.chisel.registerOre("torch", "torch"); } diff --git a/src/main/java/com/cricketcraft/chisel/proxy/ClientProxy.java b/src/main/java/com/cricketcraft/chisel/proxy/ClientProxy.java index 4a119d61..f2a36042 100644 --- a/src/main/java/com/cricketcraft/chisel/proxy/ClientProxy.java +++ b/src/main/java/com/cricketcraft/chisel/proxy/ClientProxy.java @@ -13,6 +13,7 @@ import com.cricketcraft.chisel.client.render.BlockAdvancedMarbleRenderer; import com.cricketcraft.chisel.client.render.BlockCarpetRenderer; import com.cricketcraft.chisel.client.render.BlockEldritchRenderer; import com.cricketcraft.chisel.client.render.BlockGlowRenderer; +import com.cricketcraft.chisel.client.render.BlockLayeredRenderer; import com.cricketcraft.chisel.client.render.BlockMarblePaneRenderer; import com.cricketcraft.chisel.client.render.BlockMarblePillarRenderer; import com.cricketcraft.chisel.client.render.BlockMarbleStairsRenderer; @@ -53,6 +54,7 @@ public class ClientProxy extends CommonProxy { RenderingRegistry.registerBlockHandler(new BlockAdvancedMarbleRenderer()); RenderingRegistry.registerBlockHandler(new BlockCarpetRenderer()); RenderingRegistry.registerBlockHandler(new BlockGlowRenderer()); + RenderingRegistry.registerBlockHandler(new BlockLayeredRenderer()); RenderingRegistry.registerBlockHandler(new BlockTexturedOreRenderer()); diff --git a/src/main/resources/assets/chisel/textures/blocks/warning/acid.png b/src/main/resources/assets/chisel/textures/blocks/warning/acid.png index 0ae7c68d..3874bf8b 100755 Binary files a/src/main/resources/assets/chisel/textures/blocks/warning/acid.png and b/src/main/resources/assets/chisel/textures/blocks/warning/acid.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/warning/base.png b/src/main/resources/assets/chisel/textures/blocks/warning/base.png index 42e63ba4..4fd87254 100755 Binary files a/src/main/resources/assets/chisel/textures/blocks/warning/base.png and b/src/main/resources/assets/chisel/textures/blocks/warning/base.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/warning/bio.png b/src/main/resources/assets/chisel/textures/blocks/warning/bio.png index 1cccf346..380449c2 100755 Binary files a/src/main/resources/assets/chisel/textures/blocks/warning/bio.png and b/src/main/resources/assets/chisel/textures/blocks/warning/bio.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/warning/cryogenic.png b/src/main/resources/assets/chisel/textures/blocks/warning/cryogenic.png index 09a55caf..392e8284 100755 Binary files a/src/main/resources/assets/chisel/textures/blocks/warning/cryogenic.png and b/src/main/resources/assets/chisel/textures/blocks/warning/cryogenic.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/warning/death.png b/src/main/resources/assets/chisel/textures/blocks/warning/death.png index d0ba85ed..2cc5b94a 100755 Binary files a/src/main/resources/assets/chisel/textures/blocks/warning/death.png and b/src/main/resources/assets/chisel/textures/blocks/warning/death.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/warning/explosion.png b/src/main/resources/assets/chisel/textures/blocks/warning/explosion.png index cf9ce3a4..fa8b774f 100755 Binary files a/src/main/resources/assets/chisel/textures/blocks/warning/explosion.png and b/src/main/resources/assets/chisel/textures/blocks/warning/explosion.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/warning/fall.png b/src/main/resources/assets/chisel/textures/blocks/warning/fall.png index f2f74f36..90997a8b 100755 Binary files a/src/main/resources/assets/chisel/textures/blocks/warning/fall.png and b/src/main/resources/assets/chisel/textures/blocks/warning/fall.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/warning/falling.png b/src/main/resources/assets/chisel/textures/blocks/warning/falling.png index 1d573998..c45b44ab 100755 Binary files a/src/main/resources/assets/chisel/textures/blocks/warning/falling.png and b/src/main/resources/assets/chisel/textures/blocks/warning/falling.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/warning/fire.png b/src/main/resources/assets/chisel/textures/blocks/warning/fire.png index a6bac062..d81f8d13 100755 Binary files a/src/main/resources/assets/chisel/textures/blocks/warning/fire.png and b/src/main/resources/assets/chisel/textures/blocks/warning/fire.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/warning/generic.png b/src/main/resources/assets/chisel/textures/blocks/warning/generic.png index 109700b7..26dd4108 100755 Binary files a/src/main/resources/assets/chisel/textures/blocks/warning/generic.png and b/src/main/resources/assets/chisel/textures/blocks/warning/generic.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/warning/illuminati.png b/src/main/resources/assets/chisel/textures/blocks/warning/illuminati.png index cba0ba59..9a5f8540 100755 Binary files a/src/main/resources/assets/chisel/textures/blocks/warning/illuminati.png and b/src/main/resources/assets/chisel/textures/blocks/warning/illuminati.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/warning/noentry.png b/src/main/resources/assets/chisel/textures/blocks/warning/noentry.png index 51191f48..5cea8961 100755 Binary files a/src/main/resources/assets/chisel/textures/blocks/warning/noentry.png and b/src/main/resources/assets/chisel/textures/blocks/warning/noentry.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/warning/rad.png b/src/main/resources/assets/chisel/textures/blocks/warning/rad.png index 13f23208..53ccbab0 100755 Binary files a/src/main/resources/assets/chisel/textures/blocks/warning/rad.png and b/src/main/resources/assets/chisel/textures/blocks/warning/rad.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/warning/sound.png b/src/main/resources/assets/chisel/textures/blocks/warning/sound.png index 46185fae..64cb240f 100755 Binary files a/src/main/resources/assets/chisel/textures/blocks/warning/sound.png and b/src/main/resources/assets/chisel/textures/blocks/warning/sound.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/warning/underconstruction.png b/src/main/resources/assets/chisel/textures/blocks/warning/underconstruction.png index 4d542daf..811eebad 100755 Binary files a/src/main/resources/assets/chisel/textures/blocks/warning/underconstruction.png and b/src/main/resources/assets/chisel/textures/blocks/warning/underconstruction.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/warning/voltage.png b/src/main/resources/assets/chisel/textures/blocks/warning/voltage.png index 2e7d60fa..14d95896 100755 Binary files a/src/main/resources/assets/chisel/textures/blocks/warning/voltage.png and b/src/main/resources/assets/chisel/textures/blocks/warning/voltage.png differ