diff --git a/resources/assets/enderio/config/AlloySmelterRecipes_Core.xml b/resources/assets/enderio/config/AlloySmelterRecipes_Core.xml index 7c4c7b9d..08d6164f 100644 --- a/resources/assets/enderio/config/AlloySmelterRecipes_Core.xml +++ b/resources/assets/enderio/config/AlloySmelterRecipes_Core.xml @@ -301,6 +301,58 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/assets/enderio/lang/en_US.lang b/resources/assets/enderio/lang/en_US.lang index fe0df9be..23394a97 100644 --- a/resources/assets/enderio/lang/en_US.lang +++ b/resources/assets/enderio/lang/en_US.lang @@ -129,6 +129,7 @@ tile.blockEndermanSkull.reanimated.name=Reanimated Enderman Head tile.blockEndermanSkull.tormented.name=Tormented Enderman Head enderio.blastResistant=Blast Resistant enderio.lightEmitter=Emits Light +enderio.lightBlocker=Blocks Light enderio.tooltip.isBeaconBase=Can be used as beacon base enderio.dustWheat.name=Flour @@ -183,6 +184,8 @@ enderio.blockFusedQuartz.fusedQuartz.name=Fused Quartz enderio.blockFusedQuartz.fusedGlass.name=Quite Clear Glass enderio.blockFusedQuartz.enlightenedFusedQuartz.name=Enlightened Fused Quartz enderio.blockFusedQuartz.enlightenedFusedGlass.name=Enlightened Clear Glass +enderio.blockFusedQuartz.darkFusedQuartz.name=Dark Fused Quartz +enderio.blockFusedQuartz.darkFusedGlass.name=Dark Clear Glass item.enderio.itemFusedQuartzFrame.name=Fused Quartz Frame enderio.itemPowderIngot=Powders & Ingots diff --git a/src/main/java/crazypants/enderio/material/BlockFusedQuartz.java b/src/main/java/crazypants/enderio/material/BlockFusedQuartz.java index 309e7933..f8b3f757 100644 --- a/src/main/java/crazypants/enderio/material/BlockFusedQuartz.java +++ b/src/main/java/crazypants/enderio/material/BlockFusedQuartz.java @@ -19,10 +19,8 @@ import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import crazypants.enderio.BlockEio; -import crazypants.enderio.EnderIO; import crazypants.enderio.ModObject; import crazypants.enderio.config.Config; -import crazypants.enderio.machine.painter.PainterUtil; import crazypants.enderio.machine.painter.TileEntityPaintedBlock; import crazypants.util.BlockCoord; @@ -33,42 +31,41 @@ public class BlockFusedQuartz extends BlockEio { private final static Type[] metaMapping = new Type[16]; public enum Type { - FUSED_QUARTZ("fusedQuartz", "enderio:fusedQuartz", "enderio:fusedQuartzFrame", "enderio:fusedQuartzItem"), - GLASS("fusedGlass", "enderio:fusedGlass", Config.clearGlassSameTexture ? "enderio:fusedQuartzFrame" : "enderio:fusedGlassFrame", "enderio:fusedGlassItem"), - ENLIGHTENED_FUSED_QUARTZ("enlightenedFusedQuartz", "enderio:fusedQuartz", "enderio:fusedQuartzFrame", "enderio:fusedQuartzItem"), + FUSED_QUARTZ("fusedQuartz", "enderio:fusedQuartz", "enderio:fusedQuartzFrame", "enderio:fusedQuartzItem", false, true, 0), + GLASS("fusedGlass", "enderio:fusedGlass", Config.clearGlassSameTexture ? "enderio:fusedQuartzFrame" : "enderio:fusedGlassFrame", "enderio:fusedGlassItem", false, false, 0), + ENLIGHTENED_FUSED_QUARTZ("enlightenedFusedQuartz", "enderio:fusedQuartz", "enderio:fusedQuartzFrame", "enderio:fusedQuartzItem", true, true, 0), ENLIGHTENED_GLASS("enlightenedFusedGlass", "enderio:fusedGlass", Config.clearGlassSameTexture ? "enderio:fusedQuartzFrame" : "enderio:fusedGlassFrame", - "enderio:fusedGlassItem"); + "enderio:fusedGlassItem", true, false, 0), + DARK_FUSED_QUARTZ("darkFusedQuartz", "enderio:fusedQuartz", "enderio:fusedQuartzFrame", "enderio:fusedQuartzItem", false, true, 255), + DARK_GLASS("darkFusedGlass", "enderio:fusedGlass", Config.clearGlassSameTexture ? "enderio:fusedQuartzFrame" : "enderio:fusedGlassFrame", "enderio:fusedGlassItem", false, false, 255); final String unlocalisedName; final String blockIcon; final String frameIcon; final String itemIcon; + final boolean enlightened; + final boolean blastResistance; + final int lightOpacity; + int connectedTextureMask; - private Type(String unlocalisedName, String blockIcon, String frameIcon, String itemIcon) { + private Type(String unlocalisedName, String blockIcon, String frameIcon, String itemIcon, boolean enlightened, boolean blastResistance, int lightOpacity) { this.unlocalisedName = unlocalisedName; this.frameIcon = frameIcon; this.blockIcon = blockIcon; this.itemIcon = itemIcon; + this.enlightened = enlightened; + this.blastResistance = blastResistance; + this.lightOpacity = lightOpacity; + connectedTextureMask = Config.clearGlassConnectToFusedQuartz ? ~0 : (1 << ordinal()); metaMapping[this.ordinal()] = this; } public boolean connectTo(int otherMeta) { - if(otherMeta == ordinal() || Config.clearGlassConnectToFusedQuartz) { - return true; - } + return (connectedTextureMask & (1 << otherMeta)) != 0; + } - switch (this) { - case FUSED_QUARTZ: - return otherMeta == ENLIGHTENED_FUSED_QUARTZ.ordinal(); - case ENLIGHTENED_FUSED_QUARTZ: - return otherMeta == FUSED_QUARTZ.ordinal(); - case GLASS: - return otherMeta == ENLIGHTENED_GLASS.ordinal(); - case ENLIGHTENED_GLASS: - return otherMeta == GLASS.ordinal(); - } - - return false; + void setConnectedTexture(Type other) { + connectedTextureMask |= 1 << other.ordinal(); } public static Type byMeta(int meta) { @@ -76,6 +73,21 @@ public class BlockFusedQuartz extends BlockEio { } } + static { + Type.GLASS.setConnectedTexture(Type.ENLIGHTENED_GLASS); + Type.GLASS.setConnectedTexture(Type.DARK_GLASS); + Type.ENLIGHTENED_GLASS.setConnectedTexture(Type.GLASS); + Type.ENLIGHTENED_GLASS.setConnectedTexture(Type.DARK_GLASS); + Type.DARK_GLASS.setConnectedTexture(Type.GLASS); + Type.DARK_GLASS.setConnectedTexture(Type.ENLIGHTENED_GLASS); + Type.FUSED_QUARTZ.setConnectedTexture(Type.ENLIGHTENED_FUSED_QUARTZ); + Type.FUSED_QUARTZ.setConnectedTexture(Type.DARK_FUSED_QUARTZ); + Type.ENLIGHTENED_FUSED_QUARTZ.setConnectedTexture(Type.FUSED_QUARTZ); + Type.ENLIGHTENED_FUSED_QUARTZ.setConnectedTexture(Type.DARK_FUSED_QUARTZ); + Type.DARK_FUSED_QUARTZ.setConnectedTexture(Type.FUSED_QUARTZ); + Type.DARK_FUSED_QUARTZ.setConnectedTexture(Type.ENLIGHTENED_FUSED_QUARTZ); + } + public static BlockFusedQuartz create() { BlockFusedQuartz result = new BlockFusedQuartz(); result.init(); @@ -103,7 +115,7 @@ public class BlockFusedQuartz extends BlockEio { public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) { int meta = world.getBlockMetadata(x, y, z); Type type = Type.byMeta(meta); - if (type == Type.FUSED_QUARTZ || type == Type.ENLIGHTENED_FUSED_QUARTZ) { + if (type.blastResistance) { return 2000; } else { return super.getExplosionResistance(par1Entity); @@ -140,7 +152,9 @@ public class BlockFusedQuartz extends BlockEio { @Override public int getLightOpacity(IBlockAccess world, int x, int y, int z) { - return 0; + int meta = world.getBlockMetadata(x, y, z); + Type type = Type.byMeta(meta); + return type.lightOpacity; } @Override @@ -150,10 +164,8 @@ public class BlockFusedQuartz extends BlockEio { return super.getLightValue(world, x, y, z); } int meta = world.getBlockMetadata(x, y, z); - if(meta > 1) { - return 15; - } - return super.getLightValue(world, x, y, z); + Type type = Type.byMeta(meta); + return type.enlightened ? 15 : super.getLightValue(world, x, y, z); } @Override @@ -239,13 +251,4 @@ public class BlockFusedQuartz extends BlockEio { return false; } - private ItemStack createItemStackForSourceBlock(int quartzBlockMeta, Block sourceBlock, int sourceBlockMetadata) { - if(sourceBlock == null) { - return null; - } - ItemStack result = new ItemStack(EnderIO.instance.itemFusedQuartzFrame, 1, quartzBlockMeta); - PainterUtil.setSourceBlock(result, sourceBlock, sourceBlockMetadata); - return result; - } - } diff --git a/src/main/java/crazypants/enderio/material/ItemFusedQuartz.java b/src/main/java/crazypants/enderio/material/ItemFusedQuartz.java index 79ccb4b5..cac2dd51 100644 --- a/src/main/java/crazypants/enderio/material/ItemFusedQuartz.java +++ b/src/main/java/crazypants/enderio/material/ItemFusedQuartz.java @@ -8,10 +8,10 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemBlockWithMetadata; import net.minecraft.item.ItemStack; -import net.minecraft.util.MathHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import crazypants.enderio.EnderIOTab; +import crazypants.enderio.material.BlockFusedQuartz.Type; import crazypants.util.Lang; public class ItemFusedQuartz extends ItemBlockWithMetadata { @@ -24,8 +24,8 @@ public class ItemFusedQuartz extends ItemBlockWithMetadata { @Override public String getUnlocalizedName(ItemStack par1ItemStack) { int meta = par1ItemStack.getItemDamage(); - meta = MathHelper.clamp_int(meta, 0, BlockFusedQuartz.Type.values().length - 1); - return "enderio.blockFusedQuartz." + BlockFusedQuartz.Type.values()[meta].unlocalisedName; + Type type = Type.byMeta(meta); + return "enderio.blockFusedQuartz." + type.unlocalisedName; } @Override @@ -41,13 +41,16 @@ public class ItemFusedQuartz extends ItemBlockWithMetadata { @SideOnly(Side.CLIENT) public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { int meta = par1ItemStack.getItemDamage(); - meta = MathHelper.clamp_int(meta, 0, BlockFusedQuartz.Type.values().length - 1); - if(meta == 0 || meta == 2) { + Type type = Type.byMeta(meta); + if (type.blastResistance) { par3List.add(Lang.localize("blastResistant")); } - if(meta > 1) { + if (type.enlightened) { par3List.add(Lang.localize("lightEmitter")); } + if (type.lightOpacity > 0) { + par3List.add(Lang.localize("lightBlocker")); + } }