Merge branch 'BuildCraft-5.0.x' into builder

This commit is contained in:
SpaceToad 2014-02-23 23:25:30 +01:00
commit 681b3372f7
10 changed files with 375 additions and 198 deletions

View file

@ -29,7 +29,7 @@ if (System.getenv().BUILD_NUMBER)
else else
logger.lifecycle "SETTING BUILDNUMBER TO 0" logger.lifecycle "SETTING BUILDNUMBER TO 0"
version = "5.0.1" version = "5.0.2"
group= "com.mod-buildcraft" group= "com.mod-buildcraft"
archivesBaseName = "buildcraft" // the name that all artifacts will use as a base. artifacts names follow this pattern: [baseName]-[appendix]-[version]-[classifier].[extension] archivesBaseName = "buildcraft" // the name that all artifacts will use as a base. artifacts names follow this pattern: [baseName]-[appendix]-[version]-[classifier].[extension]
@ -48,7 +48,7 @@ minecraft {
sourceSets { sourceSets {
main { main {
java { java {
srcDir 'common/buildcraft' srcDir 'common'
// exclude 'some exclusion' // exclude 'some exclusion'
// include 'some inclusion' // include 'some inclusion'
} }

View file

@ -71,6 +71,7 @@ public class BuildCraftSilicon extends BuildCraftMod {
BuildCraftCore.mainConfiguration.save(); BuildCraftCore.mainConfiguration.save();
laserBlock = new BlockLaser(); laserBlock = new BlockLaser();
laserBlock.setBlockName("laserBlock");
CoreProxy.proxy.registerBlock(laserBlock); CoreProxy.proxy.registerBlock(laserBlock);
assemblyTableBlock = new BlockLaserTable(); assemblyTableBlock = new BlockLaserTable();

View file

@ -14,10 +14,10 @@ import buildcraft.api.recipes.BuildcraftRecipes;
import buildcraft.api.transport.IExtractionHandler; import buildcraft.api.transport.IExtractionHandler;
import buildcraft.api.transport.PipeManager; import buildcraft.api.transport.PipeManager;
import buildcraft.core.DefaultProps; import buildcraft.core.DefaultProps;
import buildcraft.core.BuildCraftConfiguration;
import buildcraft.core.InterModComms; import buildcraft.core.InterModComms;
import buildcraft.core.ItemBuildCraft; import buildcraft.core.ItemBuildCraft;
import buildcraft.core.Version; import buildcraft.core.Version;
import buildcraft.core.network.PacketHandler;
import buildcraft.core.proxy.CoreProxy; import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.triggers.BCAction; import buildcraft.core.triggers.BCAction;
import buildcraft.core.triggers.BCTrigger; import buildcraft.core.triggers.BCTrigger;
@ -34,11 +34,6 @@ import buildcraft.transport.PipeIconProvider;
import buildcraft.transport.PipeTriggerProvider; import buildcraft.transport.PipeTriggerProvider;
import buildcraft.transport.TransportProxy; import buildcraft.transport.TransportProxy;
import buildcraft.transport.WireIconProvider; import buildcraft.transport.WireIconProvider;
import buildcraft.transport.blueprints.BptBlockPipe;
import buildcraft.transport.blueprints.BptItemPipeDiamond;
import buildcraft.transport.blueprints.BptItemPipeEmerald;
import buildcraft.transport.blueprints.BptItemPipeIron;
import buildcraft.transport.blueprints.BptItemPipeWooden;
import buildcraft.transport.gates.GateExpansionPulsar; import buildcraft.transport.gates.GateExpansionPulsar;
import buildcraft.api.gates.GateExpansions; import buildcraft.api.gates.GateExpansions;
import buildcraft.api.transport.PipeWire; import buildcraft.api.transport.PipeWire;
@ -46,7 +41,6 @@ import buildcraft.transport.ItemPipeWire;
import buildcraft.transport.gates.GateExpansionRedstoneFader; import buildcraft.transport.gates.GateExpansionRedstoneFader;
import buildcraft.transport.gates.GateExpansionTimer; import buildcraft.transport.gates.GateExpansionTimer;
import buildcraft.transport.network.PacketHandlerTransport; import buildcraft.transport.network.PacketHandlerTransport;
import buildcraft.transport.network.PacketPipeTransportTraveler;
import buildcraft.transport.pipes.PipeFluidsCobblestone; import buildcraft.transport.pipes.PipeFluidsCobblestone;
import buildcraft.transport.pipes.PipeFluidsEmerald; import buildcraft.transport.pipes.PipeFluidsEmerald;
import buildcraft.transport.pipes.PipeFluidsGold; import buildcraft.transport.pipes.PipeFluidsGold;
@ -115,6 +109,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.common.config.Property; import net.minecraftforge.common.config.Property;
import net.minecraftforge.oredict.RecipeSorter;
@Mod(version = Version.VERSION, modid = "BuildCraft|Transport", name = "Buildcraft Transport", dependencies = DefaultProps.DEPENDENCY_CORE) @Mod(version = Version.VERSION, modid = "BuildCraft|Transport", name = "Buildcraft Transport", dependencies = DefaultProps.DEPENDENCY_CORE)
public class BuildCraftTransport extends BuildCraftMod { public class BuildCraftTransport extends BuildCraftMod {
@ -159,6 +154,8 @@ public class BuildCraftTransport extends BuildCraftMod {
// public static Item pipeItemsStipes; // public static Item pipeItemsStipes;
public static Item pipeStructureCobblestone; public static Item pipeStructureCobblestone;
public static int groupItemsTrigger; public static int groupItemsTrigger;
public static String[] facadeBlacklist;
public static BCTrigger[] triggerPipe = new BCTrigger[PipeContents.values().length]; public static BCTrigger[] triggerPipe = new BCTrigger[PipeContents.values().length];
public static BCTrigger[] triggerPipeWireActive = new BCTrigger[PipeWire.values().length]; public static BCTrigger[] triggerPipeWireActive = new BCTrigger[PipeWire.values().length];
public static BCTrigger[] triggerPipeWireInactive = new BCTrigger[PipeWire.values().length]; public static BCTrigger[] triggerPipeWireInactive = new BCTrigger[PipeWire.values().length];
@ -177,6 +174,7 @@ public class BuildCraftTransport extends BuildCraftMod {
public static BCAction actionExtractionPresetYellow = new ActionExtractionPreset(EnumColor.YELLOW); public static BCAction actionExtractionPresetYellow = new ActionExtractionPreset(EnumColor.YELLOW);
public IIconProvider pipeIconProvider = new PipeIconProvider(); public IIconProvider pipeIconProvider = new PipeIconProvider();
public IIconProvider wireIconProvider = new WireIconProvider(); public IIconProvider wireIconProvider = new WireIconProvider();
@Instance("BuildCraft|Transport") @Instance("BuildCraft|Transport")
public static BuildCraftTransport instance; public static BuildCraftTransport instance;
@ -257,6 +255,9 @@ public class BuildCraftTransport extends BuildCraftMod {
} else } else
excludedFluidBlocks = new String[0]; excludedFluidBlocks = new String[0];
filteredBufferBlock = new BlockFilteredBuffer();
CoreProxy.proxy.registerBlock(filteredBufferBlock.setBlockName("filteredBufferBlock"));
PipeManager.registerExtractionHandler(new ExtractionHandler(excludedItemBlocks, excludedFluidBlocks)); PipeManager.registerExtractionHandler(new ExtractionHandler(excludedItemBlocks, excludedFluidBlocks));
GateExpansions.registerExpansion(GateExpansionPulsar.INSTANCE); GateExpansions.registerExpansion(GateExpansionPulsar.INSTANCE);
@ -267,6 +268,36 @@ public class BuildCraftTransport extends BuildCraftMod {
groupItemsTriggerProp.comment = "when reaching this amount of objects in a pipes, items will be automatically grouped"; groupItemsTriggerProp.comment = "when reaching this amount of objects in a pipes, items will be automatically grouped";
groupItemsTrigger = groupItemsTriggerProp.getInt(); groupItemsTrigger = groupItemsTriggerProp.getInt();
Property facadeBlacklistProp = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "facade.blacklist", new String[] {
Block.blockRegistry.getNameForObject(Blocks.bedrock),
Block.blockRegistry.getNameForObject(Blocks.command_block),
Block.blockRegistry.getNameForObject(Blocks.end_portal_frame),
Block.blockRegistry.getNameForObject(Blocks.grass),
Block.blockRegistry.getNameForObject(Blocks.leaves),
Block.blockRegistry.getNameForObject(Blocks.leaves2),
Block.blockRegistry.getNameForObject(Blocks.lit_pumpkin),
Block.blockRegistry.getNameForObject(Blocks.lit_redstone_lamp),
Block.blockRegistry.getNameForObject(Blocks.mob_spawner),
Block.blockRegistry.getNameForObject(Blocks.monster_egg),
Block.blockRegistry.getNameForObject(Blocks.redstone_lamp),
Block.blockRegistry.getNameForObject(Blocks.double_stone_slab),
Block.blockRegistry.getNameForObject(Blocks.double_wooden_slab),
Block.blockRegistry.getNameForObject(Blocks.sponge),
BuildCraftConfiguration.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftBuilders.architectBlock)),
BuildCraftConfiguration.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftBuilders.builderBlock)),
BuildCraftConfiguration.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftBuilders.fillerBlock)),
BuildCraftConfiguration.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftBuilders.libraryBlock)),
BuildCraftConfiguration.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftFactory.autoWorkbenchBlock)),
BuildCraftConfiguration.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftFactory.floodGateBlock)),
BuildCraftConfiguration.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftFactory.miningWellBlock)),
BuildCraftConfiguration.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftFactory.pumpBlock)),
BuildCraftConfiguration.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftFactory.quarryBlock)),
BuildCraftConfiguration.surroundWithQuotes(Block.blockRegistry.getNameForObject(BuildCraftTransport.filteredBufferBlock)),
});
facadeBlacklistProp.comment = "Blocks listed here will not have facades created. The format is modid:blockname.\nFor mods with a | character, the value needs to be surrounded with quotes.";
facadeBlacklist = facadeBlacklistProp.getStringList();
pipeWaterproof = new ItemBuildCraft(); pipeWaterproof = new ItemBuildCraft();
pipeWaterproof.setUnlocalizedName("pipeWaterproof"); pipeWaterproof.setUnlocalizedName("pipeWaterproof");
LanguageRegistry.addName(pipeWaterproof, "Pipe Sealant"); LanguageRegistry.addName(pipeWaterproof, "Pipe Sealant");
@ -330,9 +361,6 @@ public class BuildCraftTransport extends BuildCraftMod {
plugItem.setUnlocalizedName("pipePlug"); plugItem.setUnlocalizedName("pipePlug");
CoreProxy.proxy.registerItem(plugItem); CoreProxy.proxy.registerItem(plugItem);
filteredBufferBlock = new BlockFilteredBuffer();
CoreProxy.proxy.registerBlock(filteredBufferBlock.setBlockName("filteredBufferBlock"));
for (PipeContents kind : PipeContents.values()) { for (PipeContents kind : PipeContents.values()) {
triggerPipe[kind.ordinal()] = new TriggerPipeContents(kind); triggerPipe[kind.ordinal()] = new TriggerPipeContents(kind);
} }
@ -435,6 +463,7 @@ public class BuildCraftTransport extends BuildCraftMod {
//Facade turning helper //Facade turning helper
GameRegistry.addRecipe(facadeItem.new FacadeRecipe()); GameRegistry.addRecipe(facadeItem.new FacadeRecipe());
RecipeSorter.register("facadeTurningHelper", ItemFacade.FacadeRecipe.class, RecipeSorter.Category.SHAPELESS, "");
BuildcraftRecipes.assemblyTable.addRecipe(1000, new ItemStack(plugItem, 8), new ItemStack(pipeStructureCobblestone)); BuildcraftRecipes.assemblyTable.addRecipe(1000, new ItemStack(plugItem, 8), new ItemStack(pipeStructureCobblestone));
} }

View file

@ -25,4 +25,11 @@ public class BuildCraftConfiguration extends Configuration {
super.save(); super.save();
} }
public static String surroundWithQuotes(String stringToSurroundWithQuotes){
return String.format("\"%s\"", stringToSurroundWithQuotes);
}
public static String stripSurroundingQuotes(String stringToStripQuotes) {
return stringToStripQuotes.replaceAll("^\"|\"$", "");
}
} }

View file

@ -11,6 +11,7 @@ package buildcraft.core;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.google.common.base.Strings;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
@ -26,70 +27,104 @@ import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
public class InterModComms { public class InterModComms {
public static void processIMC(IMCEvent event) { public static void processIMC(IMCEvent event) {
for (IMCMessage m : event.getMessages()) { for (IMCMessage m : event.getMessages()) {
if ("add-facade".equals(m.key)) { if (m.key.equals("add-facade")) {
processFacadeIMC(event, m); processAddFacadeIMC(event, m);
} else if (m.key.equals("oil-lake-biome")) { } else if (m.key.equals("blacklist-facade")) {
processOilLakeBiomeIMC(event, m); processBlacklistFacadeIMC(event, m);
} else if (m.key.equals("oil-gen-exclude")) { } else if (m.key.equals("oil-lake-biome")) {
processOilGenExcludeIMC(event, m); processOilLakeBiomeIMC(event, m);
} } else if (m.key.equals("oil-gen-exclude")) {
} processOilGenExcludeIMC(event, m);
} }
}
}
public static void processFacadeIMC(IMCEvent event, IMCMessage m) { public static void processAddFacadeIMC(IMCEvent event, IMCMessage m) {
try { try {
if (m.isStringMessage()) { if (m.isStringMessage()) {
Splitter splitter = Splitter.on("@").trimResults(); Splitter splitter = Splitter.on("@").trimResults();
String[] array = Iterables.toArray(splitter.split(m.getStringValue()), String.class); String[] array = Iterables.toArray(splitter.split(m.getStringValue()), String.class);
if (array.length != 2) { if (array.length != 2) {
Logger.getLogger("Buildcraft").log(Level.INFO, String.format("Received an invalid add-facade request %s from mod %s", m.getStringValue(), m.getSender())); Logger.getLogger("Buildcraft").log(Level.INFO, String.format("Received an invalid add-facade request %s from mod %s", m.getStringValue(), m.getSender()));
} else { } else {
Integer blId = Ints.tryParse(array[0]); String blockName = array[0];
Integer metaId = Ints.tryParse(array[1]); Integer metaId = Ints.tryParse(array[1]);
if (blId == null || metaId == null) {
Logger.getLogger("Buildcraft").log(Level.INFO, String.format("Received an invalid add-facade request %s from mod %s", m.getStringValue(), m.getSender()));
} else {
Block block = (Block) Block.blockRegistry.getObjectById(blId);
ItemFacade.addFacade(new ItemStack(block, 1, metaId));
}
}
} else if (m.isItemStackMessage()) {
ItemFacade.addFacade(m.getItemStackValue());
}
} catch (Exception ex) {
} if (Strings.isNullOrEmpty(blockName)|| metaId == null) {
} Logger.getLogger("Buildcraft").log(Level.INFO, String.format("Received an invalid add-facade request %s from mod %s", m.getStringValue(), m.getSender()));
} else {
Block block = (Block) Block.blockRegistry.getObject(blockName);
if(block.getRenderType() != 0 && block.getRenderType() != 31) {
ItemFacade.addFacade(new ItemStack(block, 1, metaId));
} else {
logRedundantAddFacadeMessage(m, block.toString());
}
}
}
} else if (m.isItemStackMessage()) {
ItemStack modItemStack = m.getItemStackValue();
public static void processOilLakeBiomeIMC(IMCEvent event, IMCMessage m) { Block block = Block.getBlockFromItem(modItemStack.getItem());
try { if(block != null && block.getRenderType() != 0 && block.getRenderType() != 31) {
String biomeID = m.getStringValue().trim(); ItemFacade.addFacade(modItemStack);
int id = Integer.valueOf(biomeID); } else {
if (id >= BiomeGenBase.getBiomeGenArray().length) { logRedundantAddFacadeMessage(m, block.toString());
throw new IllegalArgumentException("Biome ID must be less than " + BiomeGenBase.getBiomeGenArray().length); }
} }
OilPopulate.INSTANCE.surfaceDepositBiomes.add(id); } catch (Exception ex) {
} catch (Exception ex) { }
Logger.getLogger("Buildcraft").log(Level.WARNING, String.format("Received an invalid oil-lake-biome request %s from mod %s", m.getStringValue(), m.getSender())); }
}
Logger.getLogger("Buildcraft").log(Level.INFO, String.format("Received an successfull oil-lake-biome request %s from mod %s", m.getStringValue(), m.getSender()));
}
public static void processOilGenExcludeIMC(IMCEvent event, IMCMessage m) { public static void processBlacklistFacadeIMC(IMCEvent event, IMCMessage message){
try { try {
String biomeID = m.getStringValue().trim(); if(message.isItemStackMessage()) {
int id = Integer.valueOf(biomeID); ItemStack modItemStack = message.getItemStackValue();
if (id >= BiomeGenBase.getBiomeGenArray().length) {
throw new IllegalArgumentException("Biome ID must be less than " + BiomeGenBase.getBiomeGenArray().length); Block block = Block.getBlockFromItem(modItemStack.getItem());
} if(block != null) {
OilPopulate.INSTANCE.excludedBiomes.add(id); String blockName = Block.blockRegistry.getNameForObject(block);
} catch (Exception ex) { ItemFacade.blacklistFacade(blockName);
Logger.getLogger("Buildcraft").log(Level.WARNING, String.format("Received an invalid oil-gen-exclude request %s from mod %s", m.getStringValue(), m.getSender())); }
} } else {
Logger.getLogger("Buildcraft").log(Level.INFO, String.format("Received an successfull oil-gen-exclude request %s from mod %s", m.getStringValue(), m.getSender())); Logger.getLogger("Buildcraft").log(Level.INFO, String.format("Invalid blacklist-facade message from mod %s. Send an ItemStackMessage instead.", message.getSender()));
} }
} catch (Throwable _) {
}
}
private static void logRedundantAddFacadeMessage(IMCMessage m, String blockName)
{
Logger.getLogger("Buildcraft").log(Level.WARNING, String.format("%s is trying to add %s a facade that Buildcraft will add later. Facade not added.", m.getSender(), blockName));
}
public static void processOilLakeBiomeIMC(IMCEvent event, IMCMessage m) {
try {
String biomeID = m.getStringValue().trim();
int id = Integer.valueOf(biomeID);
if (id >= BiomeGenBase.getBiomeGenArray().length) {
throw new IllegalArgumentException("Biome ID must be less than " + BiomeGenBase.getBiomeGenArray().length);
}
OilPopulate.INSTANCE.surfaceDepositBiomes.add(id);
} catch (Exception ex) {
Logger.getLogger("Buildcraft").log(Level.WARNING, String.format("Received an invalid oil-lake-biome request %s from mod %s", m.getStringValue(), m.getSender()));
}
Logger.getLogger("Buildcraft").log(Level.INFO, String.format("Received an successfull oil-lake-biome request %s from mod %s", m.getStringValue(), m.getSender()));
}
public static void processOilGenExcludeIMC(IMCEvent event, IMCMessage m) {
try {
String biomeID = m.getStringValue().trim();
int id = Integer.valueOf(biomeID);
if (id >= BiomeGenBase.getBiomeGenArray().length) {
throw new IllegalArgumentException("Biome ID must be less than " + BiomeGenBase.getBiomeGenArray().length);
}
OilPopulate.INSTANCE.excludedBiomes.add(id);
} catch (Exception ex) {
Logger.getLogger("Buildcraft").log(Level.WARNING, String.format("Received an invalid oil-gen-exclude request %s from mod %s", m.getStringValue(), m.getSender()));
}
Logger.getLogger("Buildcraft").log(Level.INFO, String.format("Received an successfull oil-gen-exclude request %s from mod %s", m.getStringValue(), m.getSender()));
}
} }

View file

@ -8,17 +8,17 @@
*/ */
package buildcraft.core; package buildcraft.core;
import buildcraft.BuildCraftCore;
import java.util.Random; import java.util.Random;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.event.terraingen.PopulateChunkEvent; import net.minecraftforge.event.terraingen.PopulateChunkEvent;
import net.minecraftforge.event.terraingen.TerrainGen; import net.minecraftforge.event.terraingen.TerrainGen;
import buildcraft.BuildCraftCore;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class SpringPopulate { public class SpringPopulate {
@ -28,6 +28,7 @@ public class SpringPopulate {
boolean doGen = TerrainGen.populate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkX, event.hasVillageGenerated, PopulateChunkEvent.Populate.EventType.CUSTOM); boolean doGen = TerrainGen.populate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkX, event.hasVillageGenerated, PopulateChunkEvent.Populate.EventType.CUSTOM);
if (!doGen) { if (!doGen) {
event.setResult(Result.ALLOW);
return; return;
} }

View file

@ -8,14 +8,15 @@
*/ */
package buildcraft.energy.worldgen; package buildcraft.energy.worldgen;
import buildcraft.BuildCraftCore; import static net.minecraftforge.common.BiomeDictionary.Type.DESERT;
import buildcraft.BuildCraftEnergy; import static net.minecraftforge.common.BiomeDictionary.Type.FOREST;
import static net.minecraftforge.common.BiomeDictionary.Type.FROZEN;
import static net.minecraftforge.common.BiomeDictionary.Type.WASTELAND;
import java.util.HashSet; import java.util.HashSet;
import java.util.Random; import java.util.Random;
import java.util.Set; import java.util.Set;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockFlower; import net.minecraft.block.BlockFlower;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -24,17 +25,17 @@ import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.common.BiomeDictionary; import net.minecraftforge.common.BiomeDictionary;
import static net.minecraftforge.common.BiomeDictionary.Type.DESERT; import net.minecraftforge.common.util.EnumHelper;
import static net.minecraftforge.common.BiomeDictionary.Type.FOREST;
import static net.minecraftforge.common.BiomeDictionary.Type.FROZEN;
import static net.minecraftforge.common.BiomeDictionary.Type.WASTELAND;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.terraingen.PopulateChunkEvent; import net.minecraftforge.event.terraingen.PopulateChunkEvent;
import net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType; import net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType;
import net.minecraftforge.event.terraingen.TerrainGen; import net.minecraftforge.event.terraingen.TerrainGen;
import net.minecraftforge.fluids.BlockFluidBase; import net.minecraftforge.fluids.BlockFluidBase;
import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.common.util.EnumHelper; import buildcraft.BuildCraftCore;
import buildcraft.BuildCraftEnergy;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class OilPopulate { public class OilPopulate {
@ -65,6 +66,7 @@ public class OilPopulate {
boolean doGen = TerrainGen.populate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkX, event.hasVillageGenerated, EVENT_TYPE); boolean doGen = TerrainGen.populate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkX, event.hasVillageGenerated, EVENT_TYPE);
if (!doGen) { if (!doGen) {
event.setResult(Result.ALLOW);
return; return;
} }
@ -256,7 +258,7 @@ public class OilPopulate {
} }
} }
private boolean isReplaceableFluid(World world, int x, int y, int z) { private boolean isReplaceableFluid(World world, int x, int y, int z) {
Block block = world.getBlock(x, y, z); Block block = world.getBlock(x, y, z);
return (block instanceof BlockFluidBase || block instanceof IFluidBlock) && block.getMaterial() != Material.lava; return (block instanceof BlockFluidBase || block instanceof IFluidBlock) && block.getMaterial() != Material.lava;
} }
@ -268,33 +270,33 @@ public class OilPopulate {
private boolean isReplaceableForLake(World world, BiomeGenBase biome, int x, int y, int z) { private boolean isReplaceableForLake(World world, BiomeGenBase biome, int x, int y, int z) {
Block block = world.getBlock(x, y, z); Block block = world.getBlock(x, y, z);
if (block == null) { if (block == null) {
return true; return true;
} }
if (block == biome.fillerBlock || block == biome.topBlock) { if (block == biome.fillerBlock || block == biome.topBlock) {
return true; return true;
} }
if (!block.getMaterial().blocksMovement()) { if (!block.getMaterial().blocksMovement()) {
return true; return true;
} }
// TODO: The code below doesn't seem to have been replaced by something // TODO: The code below doesn't seem to have been replaced by something
// in 1.7.2 - to update or remove. // in 1.7.2 - to update or remove.
//if (block.isGenMineableReplaceable(world, x, y, z, Blocks.stone)) { //if (block.isGenMineableReplaceable(world, x, y, z, Blocks.stone)) {
// return true; // return true;
//} //}
if (block instanceof BlockFlower) { if (block instanceof BlockFlower) {
return true; return true;
} }
if (!block.isOpaqueCube()) { if (!block.isOpaqueCube()) {
return true; return true;
} }
return false; return false;
} }
@ -352,27 +354,27 @@ public class OilPopulate {
for (; y > 0; --y) { for (; y > 0; --y) {
Block block = chunk.getBlock(trimmedX, y, trimmedZ); Block block = chunk.getBlock(trimmedX, y, trimmedZ);
if (block == null) { if (block == null) {
continue; continue;
} }
if (block instanceof BlockFluidBase) { if (block instanceof BlockFluidBase) {
return y; return y;
} }
if (block instanceof IFluidBlock) { if (block instanceof IFluidBlock) {
return y; return y;
} }
if (!block.getMaterial().blocksMovement()) { if (!block.getMaterial().blocksMovement()) {
continue; continue;
} }
if (block instanceof BlockFlower) { if (block instanceof BlockFlower) {
continue; continue;
} }
return y - 1; return y - 1;
} }

View file

@ -12,6 +12,8 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import buildcraft.core.BlockSpring;
import buildcraft.core.BuildCraftConfiguration;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
@ -41,6 +43,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemFacade extends ItemBuildCraft { public class ItemFacade extends ItemBuildCraft {
public final static LinkedList<ItemStack> allFacades = new LinkedList<ItemStack>(); public final static LinkedList<ItemStack> allFacades = new LinkedList<ItemStack>();
public final static LinkedList<String> blacklistedFacades = new LinkedList<String>();
public ItemFacade() { public ItemFacade() {
super(); super();
@ -62,7 +65,13 @@ public class ItemFacade extends ItemBuildCraft {
if (Item.getItemFromBlock(decodedBlock) != null) { if (Item.getItemFromBlock(decodedBlock) != null) {
name += ": " + CoreProxy.proxy.getItemDisplayName(newStack); name += ": " + CoreProxy.proxy.getItemDisplayName(newStack);
} else { } else {
name += " < BROKEN (" + decodedBlock.getLocalizedName() + ":" + decodedMeta + " )>"; String localizedName;
try {
localizedName = decodedBlock.getLocalizedName();
} catch(NullPointerException npe) {
localizedName = "Null";
}
name += " < BROKEN (" + localizedName + ":" + decodedMeta + " )>";
} }
return name; return name;
} }
@ -95,11 +104,11 @@ public class ItemFacade extends ItemBuildCraft {
TileGenericPipe pipeTile = (TileGenericPipe) tile; TileGenericPipe pipeTile = (TileGenericPipe) tile;
if (pipeTile.addFacade(ForgeDirection.getOrientation(side).getOpposite(), ItemFacade.getBlock(stack), ItemFacade.getMetaData(stack))) { if (pipeTile.addFacade(ForgeDirection.getOrientation(side).getOpposite(), ItemFacade.getBlock(stack), ItemFacade.getMetaData(stack))) {
if (!player.capabilities.isCreativeMode) { stack.stackSize--;
stack.stackSize--;
}
return true; return true;
} }
return false; return false;
} }
@ -107,58 +116,88 @@ public class ItemFacade extends ItemBuildCraft {
for (Object o : Block.blockRegistry) { for (Object o : Block.blockRegistry) {
Block b = (Block) o; Block b = (Block) o;
if (!(b == Blocks.glass)) { if (!isBlockValidForFacade(b))
if (b == Blocks.bedrock {
|| b == Blocks.grass continue;
|| b == Blocks.leaves
|| b == Blocks.sponge
|| b == Blocks.chest
|| b == Blocks.redstone_lamp
|| b == Blocks.lit_redstone_lamp
|| b == Blocks.lit_pumpkin) {
continue;
}
if (!b.isOpaqueCube()
|| b.hasTileEntity(0)
|| !b.renderAsNormalBlock()
|| b.getRenderType() != 0) {
continue;
}
} }
Item item = Item.getItemFromBlock(b); Item item = Item.getItemFromBlock(b);
if (item != null) { if (item == null) {
ItemStack base = new ItemStack(item, 1); continue;
}
if (base.getHasSubtypes()) { if (isBlockBlacklisted(b))
Set<String> names = Sets.newHashSet(); {
continue;
}
for (int meta = 0; meta <= 15; meta++) { registerValidFacades(b, item);
ItemStack is = new ItemStack(item, 1, meta); }
}
if (!Strings.isNullOrEmpty(is.getUnlocalizedName()) private static void registerValidFacades(Block block, Item item)
&& names.add(is.getUnlocalizedName())) { {
Set<String> names = Sets.newHashSet();
try { for(int i=0; i <= 15; i++) {
ItemFacade.addFacade(is); try {
} catch (Throwable t) { ItemStack stack = new ItemStack(item, 1, i);
t.printStackTrace();
} if(!Strings.isNullOrEmpty(stack.getUnlocalizedName())
&& names.add(stack.getUnlocalizedName())) {
ItemFacade.addFacade(stack);
// prevent adding multiple facades if it's a rotatable block
if(block.getRenderType() == 31) {
break;
} }
} }
} else { } catch(Throwable t) {
try { t.printStackTrace();
ItemFacade.addFacade(base);
} catch (Throwable t) {
t.printStackTrace();
}
}
} }
} }
} }
private static boolean isBlockBlacklisted(Block block)
{
String blockName = Block.blockRegistry.getNameForObject(block);
for (String blacklistedBlock : BuildCraftTransport.facadeBlacklist) {
if(blockName.equals(BuildCraftConfiguration.stripSurroundingQuotes(blacklistedBlock))) {
return true;
}
}
for(String blacklistedBlock : blacklistedFacades){
if(blockName.equals(blacklistedBlock)){
return true;
}
}
return false;
}
private static boolean isBlockValidForFacade(Block block)
{
if(block.getRenderType() != 0 && block.getRenderType() != 31)
{
return false;
}
if(!block.renderAsNormalBlock()) {
if((block != Blocks.glass && block != Blocks.stained_glass)) {
return false;
}
}
if(block instanceof BlockSpring || block instanceof BlockGenericPipe)
{
return false;
}
return true;
}
public static int getMetaData(ItemStack stack) { public static int getMetaData(ItemStack stack) {
if (stack.hasTagCompound() && stack.getTagCompound().hasKey("meta")) { if (stack.hasTagCompound() && stack.getTagCompound().hasKey("meta")) {
return stack.getTagCompound().getInteger("meta"); return stack.getTagCompound().getInteger("meta");
@ -168,11 +207,23 @@ public class ItemFacade extends ItemBuildCraft {
} }
public static Block getBlock(ItemStack stack) { public static Block getBlock(ItemStack stack) {
if (stack.hasTagCompound() && stack.getTagCompound().hasKey("id")) { if(!stack.hasTagCompound()) {
return (Block) Block.blockRegistry.getObjectById(stack.getTagCompound().getInteger("id")); return null;
} else {
return (Block) Block.blockRegistry.getObjectById((stack.getItemDamage() & 0xFFF0) >>> 4);
} }
Block facadeBlock = null;
NBTTagCompound stackTagCompound = stack.getTagCompound();
// reading the 'id' tag is kept to maintain back-compat.
// The stack gets upgraded the first time this code is run.
if(stackTagCompound.hasKey("id")) {
facadeBlock = (Block)Block.blockRegistry.getObjectById(stackTagCompound.getInteger("id"));
stackTagCompound.removeTag("id");
stackTagCompound.setString("name", Block.blockRegistry.getNameForObject(facadeBlock));
} else if (stackTagCompound.hasKey("name")) {
facadeBlock = (Block) Block.blockRegistry.getObject(stackTagCompound.getString("name"));
}
return facadeBlock;
} }
@Override @Override
@ -183,26 +234,20 @@ public class ItemFacade extends ItemBuildCraft {
public static void addFacade(ItemStack itemStack) { public static void addFacade(ItemStack itemStack) {
ItemStack facade = getStack(Block.getBlockFromItem(itemStack.getItem()), itemStack.getItemDamage()); ItemStack facade = getStack(Block.getBlockFromItem(itemStack.getItem()), itemStack.getItemDamage());
allFacades.add(facade); if(!allFacades.contains(facade)) {
allFacades.add(facade);
ItemStack facade6 = facade.copy(); ItemStack facade6 = facade.copy();
facade6.stackSize = 6; facade6.stackSize = 6;
// 3 Structurepipes + this block makes 6 facades // 3 Structurepipes + this block makes 6 facades
BuildcraftRecipes.assemblyTable.addRecipe(8000, facade6, new ItemStack(BuildCraftTransport.pipeStructureCobblestone, 3), itemStack); BuildcraftRecipes.assemblyTable.addRecipe(8000, facade6, new ItemStack(BuildCraftTransport.pipeStructureCobblestone, 3), itemStack);
}
}
Block bl = Block.getBlockFromItem(itemStack.getItem()); public static void blacklistFacade(String blockName) {
if(!blacklistedFacades.contains(blockName)) {
// Special handling for logs blacklistedFacades.add(blockName);
if (bl != null && bl.getRenderType() == 31) {
ItemStack rotLog1 = getStack(
Block.getBlockFromItem(itemStack.getItem()),
itemStack.getItemDamage() | 4);
ItemStack rotLog2 = getStack(
Block.getBlockFromItem(itemStack.getItem()),
itemStack.getItemDamage() | 8);
allFacades.add(rotLog1);
allFacades.add(rotLog2);
} }
} }
@ -213,51 +258,85 @@ public class ItemFacade extends ItemBuildCraft {
@Override @Override
public boolean matches(InventoryCrafting inventorycrafting, World world) { public boolean matches(InventoryCrafting inventorycrafting, World world) {
ItemStack slotmatch = null; Object[] facade = getFacadeBlockFromCraftingGrid(inventorycrafting);
for (int i = 0; i < inventorycrafting.getSizeInventory(); i++) {
ItemStack slot = inventorycrafting.getStackInSlot(i);
if (slot != null && slot.getItem() == ItemFacade.this && slotmatch == null) {
slotmatch = slot;
} else if (slot != null) {
slotmatch = NO_MATCH;
}
}
if (slotmatch != null && slotmatch != NO_MATCH) {
Block block = ItemFacade.getBlock(slotmatch);
return block != null && block.getRenderType() == 31;
}
return false; return facade != null && facade[0] != null;
} }
@Override @Override
public ItemStack getCraftingResult(InventoryCrafting inventorycrafting) { public ItemStack getCraftingResult(InventoryCrafting inventorycrafting) {
Object[] facade = getFacadeBlockFromCraftingGrid(inventorycrafting);
if(facade == null) {
return null;
}
Block block = (Block)facade[0];
ItemStack originalFacade = (ItemStack)facade[1];
if(block == null) {
return null;
}
return getNextFacadeItemStack(block, originalFacade);
}
private Object[] getFacadeBlockFromCraftingGrid(InventoryCrafting inventorycrafting) {
ItemStack slotmatch = null; ItemStack slotmatch = null;
int countOfItems = 0;
for (int i = 0; i < inventorycrafting.getSizeInventory(); i++) { for (int i = 0; i < inventorycrafting.getSizeInventory(); i++) {
ItemStack slot = inventorycrafting.getStackInSlot(i); ItemStack slot = inventorycrafting.getStackInSlot(i);
if (slot != null && slot.getItem() == ItemFacade.this && slotmatch == null) { if (slot != null && slot.getItem() == ItemFacade.this && slotmatch == null) {
slotmatch = slot; slotmatch = slot;
countOfItems++;
} else if (slot != null) { } else if (slot != null) {
slotmatch = NO_MATCH; slotmatch = NO_MATCH;
} }
if(countOfItems > 1) {
return null;
}
} }
if (slotmatch != null && slotmatch != NO_MATCH) { if (slotmatch != null && slotmatch != NO_MATCH) {
Block block = ItemFacade.getBlock(slotmatch); return new Object[] { ItemFacade.getBlock(slotmatch), slotmatch };
int blockMeta = ItemFacade.getMetaData(slotmatch);
if (block != null && block.getRenderType() == 31 && (blockMeta & 0xC) == 0)
return getStack(block, (blockMeta & 0x3) | 4);
// Meta | 4 = true
if (block != null && block.getRenderType() == 31 && (blockMeta & 0x8) == 0)
return getStack(block, (blockMeta & 0x3) | 8);
// Meta | 8 = true
if (block != null && block.getRenderType() == 31 && (blockMeta & 0x4) == 0)
return getStack(block, (blockMeta & 0x3));
} }
return null; return null;
} }
private ItemStack getNextFacadeItemStack(Block block, ItemStack originalFacade)
{
int blockMeta = ItemFacade.getMetaData(originalFacade);
int stackMeta = 0;
switch(block.getRenderType()) {
case 1:
//supports cycling through variants (wool, planks, etc)
if(blockMeta >= 15) {
stackMeta = 0;
} else {
stackMeta = blockMeta + 1;
}
break;
case 31:
if ((blockMeta & 0xC) == 0) {
// Meta | 4 = true
stackMeta = (blockMeta & 0x3) | 4;
} else if ((blockMeta & 0x8) == 0) {
// Meta | 8 = true
stackMeta = (blockMeta & 0x3) | 8;
} else if ((blockMeta & 0x4) == 0) {
stackMeta = (blockMeta & 0x3);
}
break;
default:
stackMeta = blockMeta;
}
return getStack(block, stackMeta);
}
@Override @Override
public int getRecipeSize() { public int getRecipeSize() {
return 1; return 1;
@ -285,7 +364,7 @@ public class ItemFacade extends ItemBuildCraft {
ItemStack stack = new ItemStack(BuildCraftTransport.facadeItem, 1, 0); ItemStack stack = new ItemStack(BuildCraftTransport.facadeItem, 1, 0);
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("meta", metadata); nbt.setInteger("meta", metadata);
nbt.setInteger("id", Block.blockRegistry.getIDForObject(block)); nbt.setString("name", Block.blockRegistry.getNameForObject(block));
stack.setTagCompound(nbt); stack.setTagCompound(nbt);
return stack; return stack;
} }

View file

@ -87,18 +87,27 @@ public final class GateDefinition {
AND, OR; AND, OR;
public static final GateLogic[] VALUES = values(); public static final GateLogic[] VALUES = values();
@SideOnly(Side.CLIENT)
private IIcon iconLit; private IIcon iconLit;
@SideOnly(Side.CLIENT)
private IIcon iconDark; private IIcon iconDark;
@SideOnly(Side.CLIENT)
private IIcon iconItem; private IIcon iconItem;
@SideOnly(Side.CLIENT)
public IIcon getIconLit() { public IIcon getIconLit() {
return iconLit; return iconLit;
} }
@SideOnly(Side.CLIENT)
public IIcon getIconDark() { public IIcon getIconDark() {
return iconDark; return iconDark;
} }
@SideOnly(Side.CLIENT)
public IIcon getIconItem() { public IIcon getIconItem() {
return iconItem; return iconItem;
} }
@ -107,11 +116,13 @@ public final class GateDefinition {
return name().toLowerCase(Locale.ENGLISH); return name().toLowerCase(Locale.ENGLISH);
} }
@SideOnly(Side.CLIENT)
public void registerBlockIcon(IIconRegister iconRegister) { public void registerBlockIcon(IIconRegister iconRegister) {
iconLit = iconRegister.registerIcon("buildcraft:gates/gate_lit_" + getTag()); iconLit = iconRegister.registerIcon("buildcraft:gates/gate_lit_" + getTag());
iconDark = iconRegister.registerIcon("buildcraft:gates/gate_dark_" + getTag()); iconDark = iconRegister.registerIcon("buildcraft:gates/gate_dark_" + getTag());
} }
@SideOnly(Side.CLIENT)
public void registerItemIcon(IIconRegister iconRegister) { public void registerItemIcon(IIconRegister iconRegister) {
iconItem = iconRegister.registerIcon("buildcraft:gates/gate_logic_" + getTag()); iconItem = iconRegister.registerIcon("buildcraft:gates/gate_logic_" + getTag());
} }

View file

@ -16,11 +16,10 @@ import buildcraft.transport.PipeIconProvider;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.Item; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.IItemRenderer;
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
public class FacadeItemRenderer implements IItemRenderer { public class FacadeItemRenderer implements IItemRenderer {
@ -38,38 +37,42 @@ public class FacadeItemRenderer implements IItemRenderer {
Tessellator tessellator = Tessellator.instance; Tessellator tessellator = Tessellator.instance;
if (block == null) if (block == null) {
return; return;
}
if(block.getIcon(0, decodedMeta) == null) {
return;
}
// Render Facade // Render Facade
GL11.glPushMatrix(); GL11.glPushMatrix();
block.setBlockBounds(0F, 0F, 1F - 1F / 16F, 1F, 1F, 1F); block.setBlockBounds(0F, 0F, 1F - 1F / 16F, 1F, 1F, 1F);
render.setRenderBoundsFromBlock(block); render.setRenderBoundsFromBlock(block);
GL11.glTranslatef(translateX, translateY, translateZ); GL11.glTranslatef(translateX, translateY, translateZ);
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F); tessellator.setNormal(0.0F, -1F, 0.0F);
render.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, decodedMeta)); render.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, tryGetBlockIcon(block, 0, decodedMeta));
tessellator.draw(); tessellator.draw();
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.setNormal(0.0F, 1.0F, 0.0F);
render.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, decodedMeta)); render.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, tryGetBlockIcon(block, 1, decodedMeta));
tessellator.draw(); tessellator.draw();
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F); tessellator.setNormal(0.0F, 0.0F, -1F);
render.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, decodedMeta)); render.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, tryGetBlockIcon(block, 2, decodedMeta));
tessellator.draw(); tessellator.draw();
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F); tessellator.setNormal(0.0F, 0.0F, 1.0F);
render.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, decodedMeta)); render.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, tryGetBlockIcon(block, 3, decodedMeta));
tessellator.draw(); tessellator.draw();
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0.0F, 0.0F); tessellator.setNormal(-1F, 0.0F, 0.0F);
render.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, decodedMeta)); render.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, tryGetBlockIcon(block, 4, decodedMeta));
tessellator.draw(); tessellator.draw();
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F); tessellator.setNormal(1.0F, 0.0F, 0.0F);
render.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, decodedMeta)); render.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, tryGetBlockIcon(block, 5, decodedMeta));
tessellator.draw(); tessellator.draw();
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
GL11.glPopMatrix(); GL11.glPopMatrix();
@ -111,6 +114,15 @@ public class FacadeItemRenderer implements IItemRenderer {
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
} }
private IIcon tryGetBlockIcon( Block block, int side, int decodedMeta)
{
try {
return block.getIcon(side, decodedMeta);
} catch (Throwable t) {
return Blocks.cobblestone.getIcon(0, 0);
}
}
@Override @Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) { public boolean handleRenderType(ItemStack item, ItemRenderType type) {
switch (type) { switch (type) {