First draft. Still lots to do.

This commit is contained in:
Christian 2013-03-06 18:22:17 -05:00
parent 55660989e4
commit e06e30dc87
43 changed files with 168 additions and 501 deletions

View file

@ -2,6 +2,6 @@
<classpath>
<classpathentry kind="src" path="common"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry combineaccessrules="false" kind="src" path="/Forge-Client"/>
<classpathentry combineaccessrules="false" kind="src" path="/Forge"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -231,35 +231,35 @@ public class BuildCraftBuilders {
fillerDestroy = fillerDestroyProp.getBoolean(DefaultProps.FILLER_DESTROY);
templateItem = new ItemBptTemplate(Integer.parseInt(templateItemId.value));
templateItem.setItemName("templateItem");
templateItem.setUnlocalizedName("templateItem");
LanguageRegistry.addName(templateItem, "Template");
blueprintItem = new ItemBptBluePrint(Integer.parseInt(blueprintItemId.value));
blueprintItem.setItemName("blueprintItem");
blueprintItem.setUnlocalizedName("blueprintItem");
LanguageRegistry.addName(blueprintItem, "Blueprint");
markerBlock = new BlockMarker(Integer.parseInt(markerId.value));
CoreProxy.proxy.registerBlock(markerBlock.setBlockName("markerBlock"));
CoreProxy.proxy.registerBlock(markerBlock.setUnlocalizedName("markerBlock"));
CoreProxy.proxy.addName(markerBlock, "Land Mark");
pathMarkerBlock = new BlockPathMarker(Integer.parseInt(pathMarkerId.value));
CoreProxy.proxy.registerBlock(pathMarkerBlock.setBlockName("pathMarkerBlock"));
CoreProxy.proxy.registerBlock(pathMarkerBlock.setUnlocalizedName("pathMarkerBlock"));
CoreProxy.proxy.addName(pathMarkerBlock, "Path Mark");
fillerBlock = new BlockFiller(Integer.parseInt(fillerId.value));
CoreProxy.proxy.registerBlock(fillerBlock.setBlockName("fillerBlock"));
CoreProxy.proxy.registerBlock(fillerBlock.setUnlocalizedName("fillerBlock"));
CoreProxy.proxy.addName(fillerBlock, "Filler");
builderBlock = new BlockBuilder(Integer.parseInt(builderId.value));
CoreProxy.proxy.registerBlock(builderBlock.setBlockName("builderBlock"));
CoreProxy.proxy.registerBlock(builderBlock.setUnlocalizedName("builderBlock"));
CoreProxy.proxy.addName(builderBlock, "Builder");
architectBlock = new BlockArchitect(Integer.parseInt(architectId.value));
CoreProxy.proxy.registerBlock(architectBlock.setBlockName("architectBlock"));
CoreProxy.proxy.registerBlock(architectBlock.setUnlocalizedName("architectBlock"));
CoreProxy.proxy.addName(architectBlock, "Architect Table");
libraryBlock = new BlockBlueprintLibrary(Integer.parseInt(libraryId.value));
CoreProxy.proxy.registerBlock(libraryBlock.setBlockName("libraryBlock"));
CoreProxy.proxy.registerBlock(libraryBlock.setUnlocalizedName("libraryBlock"));
CoreProxy.proxy.addName(libraryBlock, "Blueprint Library");
GameRegistry.registerTileEntity(TileMarker.class, "Marker");

View file

@ -213,7 +213,7 @@ public class BuildCraftCore {
Property wrenchId = BuildCraftCore.mainConfiguration.getItem("wrench.id", DefaultProps.WRENCH_ID);
wrenchItem = (new ItemWrench(wrenchId.getInt(DefaultProps.WRENCH_ID))).setIconIndex(0 * 16 + 2).setItemName("wrenchItem");
wrenchItem = (new ItemWrench(wrenchId.getInt(DefaultProps.WRENCH_ID))).setIconIndex(0 * 16 + 2).setUnlocalizedName("wrenchItem");
LanguageRegistry.addName(wrenchItem, "Wrench");
Property springId = BuildCraftCore.mainConfiguration.getBlock("springBlock.id", DefaultProps.SPRING_ID);
@ -229,23 +229,23 @@ public class BuildCraftCore {
BuildCraftCore.modifyWorld = modifyWorld.getBoolean(true);
if(BuildCraftCore.modifyWorld) {
springBlock = new BlockSpring(Integer.parseInt(springId.value)).setBlockName("eternalSpring");
springBlock = new BlockSpring(Integer.parseInt(springId.value)).setUnlocalizedName("eternalSpring");
GameRegistry.registerBlock(springBlock, "eternalSpring");
}
woodenGearItem = (new ItemBuildCraft(Integer.parseInt(woodenGearId.value))).setIconIndex(1 * 16 + 0).setItemName("woodenGearItem");
woodenGearItem = (new ItemBuildCraft(Integer.parseInt(woodenGearId.value))).setIconIndex(1 * 16 + 0).setUnlocalizedName("woodenGearItem");
LanguageRegistry.addName(woodenGearItem, "Wooden Gear");
stoneGearItem = (new ItemBuildCraft(Integer.parseInt(stoneGearId.value))).setIconIndex(1 * 16 + 1).setItemName("stoneGearItem");
stoneGearItem = (new ItemBuildCraft(Integer.parseInt(stoneGearId.value))).setIconIndex(1 * 16 + 1).setUnlocalizedName("stoneGearItem");
LanguageRegistry.addName(stoneGearItem, "Stone Gear");
ironGearItem = (new ItemBuildCraft(Integer.parseInt(ironGearId.value))).setIconIndex(1 * 16 + 2).setItemName("ironGearItem");
ironGearItem = (new ItemBuildCraft(Integer.parseInt(ironGearId.value))).setIconIndex(1 * 16 + 2).setUnlocalizedName("ironGearItem");
LanguageRegistry.addName(ironGearItem, "Iron Gear");
goldGearItem = (new ItemBuildCraft(Integer.parseInt(goldenGearId.value))).setIconIndex(1 * 16 + 3).setItemName("goldGearItem");
goldGearItem = (new ItemBuildCraft(Integer.parseInt(goldenGearId.value))).setIconIndex(1 * 16 + 3).setUnlocalizedName("goldGearItem");
LanguageRegistry.addName(goldGearItem, "Gold Gear");
diamondGearItem = (new ItemBuildCraft(Integer.parseInt(diamondGearId.value))).setIconIndex(1 * 16 + 4).setItemName("diamondGearItem");
diamondGearItem = (new ItemBuildCraft(Integer.parseInt(diamondGearId.value))).setIconIndex(1 * 16 + 4).setUnlocalizedName("diamondGearItem");
LanguageRegistry.addName(diamondGearItem, "Diamond Gear");
} finally {
mainConfiguration.save();

View file

@ -120,27 +120,27 @@ public class BuildCraftEnergy {
LanguageRegistry.addName(new ItemStack(engineBlock, 1, 1), "Steam Engine");
LanguageRegistry.addName(new ItemStack(engineBlock, 1, 2), "Combustion Engine");
oilStill = (new BlockOilStill(oilStillId.getInt(DefaultProps.OIL_STILL_ID), Material.water)).setBlockName("oil");
CoreProxy.proxy.addName(oilStill.setBlockName("oilStill"), "Oil");
oilStill = (new BlockOilStill(oilStillId.getInt(DefaultProps.OIL_STILL_ID), Material.water)).setUnlocalizedName("oil");
CoreProxy.proxy.addName(oilStill.setUnlocalizedName("oilStill"), "Oil");
CoreProxy.proxy.registerBlock(oilStill);
oilMoving = (new BlockOilFlowing(oilMovingId.getInt(DefaultProps.OIL_MOVING_ID), Material.water)).setBlockName("oil");
CoreProxy.proxy.addName(oilMoving.setBlockName("oilMoving"), "Oil");
oilMoving = (new BlockOilFlowing(oilMovingId.getInt(DefaultProps.OIL_MOVING_ID), Material.water)).setUnlocalizedName("oil");
CoreProxy.proxy.addName(oilMoving.setUnlocalizedName("oilMoving"), "Oil");
CoreProxy.proxy.registerBlock(oilMoving);
// Oil and fuel
if (oilMoving.blockID + 1 != oilStill.blockID)
throw new RuntimeException("Oil Still id must be Oil Moving id + 1");
fuel = new ItemBuildCraft(itemFuelId.getInt(DefaultProps.FUEL_ID)).setItemName("fuel");
fuel = new ItemBuildCraft(itemFuelId.getInt(DefaultProps.FUEL_ID)).setUnlocalizedName("fuel");
LanguageRegistry.addName(fuel, "Fuel");
MinecraftForge.EVENT_BUS.register(new OilBucketHandler());
bucketOil = (new ItemBucketOil(bucketOilId.getInt(DefaultProps.BUCKET_OIL_ID))).setItemName("bucketOil").setContainerItem(Item.bucketEmpty);
bucketOil = (new ItemBucketOil(bucketOilId.getInt(DefaultProps.BUCKET_OIL_ID))).setUnlocalizedName("bucketOil").setContainerItem(Item.bucketEmpty);
LanguageRegistry.addName(bucketOil, "Oil Bucket");
bucketFuel = new ItemBuildCraft(Integer.parseInt(bucketFuelId.value)).setItemName("bucketFuel").setContainerItem(Item.bucketEmpty);
bucketFuel = new ItemBuildCraft(Integer.parseInt(bucketFuelId.value)).setUnlocalizedName("bucketFuel").setContainerItem(Item.bucketEmpty);
bucketFuel.setIconIndex(0 * 16 + 3).setMaxStackSize(1);
LanguageRegistry.addName(bucketFuel, "Fuel Bucket");

View file

@ -166,41 +166,41 @@ public class BuildCraftFactory {
BuildCraftCore.mainConfiguration.save();
miningWellBlock = new BlockMiningWell(Integer.parseInt(minigWellId.value));
CoreProxy.proxy.registerBlock(miningWellBlock.setBlockName("miningWellBlock"));
CoreProxy.proxy.registerBlock(miningWellBlock.setUnlocalizedName("miningWellBlock"));
CoreProxy.proxy.addName(miningWellBlock, "Mining Well");
plainPipeBlock = new BlockPlainPipe(Integer.parseInt(plainPipeId.value));
CoreProxy.proxy.registerBlock(plainPipeBlock.setBlockName("plainPipeBlock"));
CoreProxy.proxy.registerBlock(plainPipeBlock.setUnlocalizedName("plainPipeBlock"));
CoreProxy.proxy.addName(plainPipeBlock, "Mining Pipe");
autoWorkbenchBlock = new BlockAutoWorkbench(Integer.parseInt(autoWorkbenchId.value));
CoreProxy.proxy.registerBlock(autoWorkbenchBlock.setBlockName("autoWorkbenchBlock"));
CoreProxy.proxy.registerBlock(autoWorkbenchBlock.setUnlocalizedName("autoWorkbenchBlock"));
CoreProxy.proxy.addName(autoWorkbenchBlock, "Automatic Crafting Table");
frameBlock = new BlockFrame(Integer.parseInt(frameId.value));
CoreProxy.proxy.registerBlock(frameBlock.setBlockName("frameBlock"));
CoreProxy.proxy.registerBlock(frameBlock.setUnlocalizedName("frameBlock"));
CoreProxy.proxy.addName(frameBlock, "Frame");
quarryBlock = new BlockQuarry(Integer.parseInt(quarryId.value));
CoreProxy.proxy.registerBlock(quarryBlock.setBlockName("machineBlock"));
CoreProxy.proxy.registerBlock(quarryBlock.setUnlocalizedName("machineBlock"));
CoreProxy.proxy.addName(quarryBlock, "Quarry");
tankBlock = new BlockTank(Integer.parseInt(tankId.value));
CoreProxy.proxy.registerBlock(tankBlock.setBlockName("tankBlock"));
CoreProxy.proxy.registerBlock(tankBlock.setUnlocalizedName("tankBlock"));
CoreProxy.proxy.addName(tankBlock, "Tank");
pumpBlock = new BlockPump(Integer.parseInt(pumpId.value));
CoreProxy.proxy.registerBlock(pumpBlock.setBlockName("pumpBlock"));
CoreProxy.proxy.registerBlock(pumpBlock.setUnlocalizedName("pumpBlock"));
CoreProxy.proxy.addName(pumpBlock, "Pump");
refineryBlock = new BlockRefinery(Integer.parseInt(refineryId.value));
CoreProxy.proxy.registerBlock(refineryBlock.setBlockName("refineryBlock"));
CoreProxy.proxy.registerBlock(refineryBlock.setUnlocalizedName("refineryBlock"));
CoreProxy.proxy.addName(refineryBlock, "Refinery");
hopperDisabled = Boolean.parseBoolean(hopperDisable.value);
if (!hopperDisabled) {
hopperBlock = new BlockHopper(Integer.parseInt(hopperId.value));
CoreProxy.proxy.registerBlock(hopperBlock.setBlockName("blockHopper"));
CoreProxy.proxy.registerBlock(hopperBlock.setUnlocalizedName("blockHopper"));
CoreProxy.proxy.addName(hopperBlock, "Hopper");
}

View file

@ -77,7 +77,7 @@ public class BuildCraftSilicon {
BuildCraftCore.mainConfiguration.save();
laserBlock = new BlockLaser(Integer.parseInt(laserId.value));
CoreProxy.proxy.addName(laserBlock.setBlockName("laserBlock"), "Laser");
CoreProxy.proxy.addName(laserBlock.setUnlocalizedName("laserBlock"), "Laser");
CoreProxy.proxy.registerBlock(laserBlock);
assemblyTableBlock = new BlockAssemblyTable(Integer.parseInt(assemblyTableId.value));
@ -87,7 +87,7 @@ public class BuildCraftSilicon {
LanguageRegistry.addName(new ItemStack(assemblyTableBlock, 0, 1), "Advanced Crafting Table");
redstoneChipset = new ItemRedstoneChipset(Integer.parseInt(redstoneChipsetId.value));
redstoneChipset.setItemName("redstoneChipset");
redstoneChipset.setUnlocalizedName("redstoneChipset");
}

View file

@ -198,7 +198,7 @@ public class BuildCraftTransport {
int meta = world.getBlockMetadata(i, j, k);
for (String excluded : excludedBlocks) {
if (excluded.equals(block.getBlockName()))
if (excluded.equals(block.getUnlocalizedName()))
return false;
String[] tokens = excluded.split(":");
@ -258,7 +258,7 @@ public class BuildCraftTransport {
Property pipeWaterproofId = BuildCraftCore.mainConfiguration.getItem("pipeWaterproof.id", DefaultProps.PIPE_WATERPROOF_ID);
pipeWaterproof = new ItemBuildCraft(Integer.parseInt(pipeWaterproofId.value)).setIconIndex(2 * 16 + 1);
pipeWaterproof.setItemName("pipeWaterproof");
pipeWaterproof.setUnlocalizedName("pipeWaterproof");
pipeWaterproof.setCreativeTab(CreativeTabs.tabMaterials);
LanguageRegistry.addName(pipeWaterproof, "Pipe Waterproof");
genericPipeBlock = new BlockGenericPipe(Integer.parseInt(genericPipeId.value));
@ -304,44 +304,44 @@ public class BuildCraftTransport {
Property redPipeWireId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "redPipeWire.id", DefaultProps.RED_PIPE_WIRE);
redPipeWire = new ItemBuildCraft(Integer.parseInt(redPipeWireId.value)).setIconIndex(4 * 16 + 0);
redPipeWire.setItemName("redPipeWire");
redPipeWire.setUnlocalizedName("redPipeWire");
LanguageRegistry.addName(redPipeWire, "Red Pipe Wire");
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 1), new ItemStack(Item.redstone, 1),
new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(redPipeWire, 8)));
Property bluePipeWireId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "bluePipeWire.id", DefaultProps.BLUE_PIPE_WIRE);
bluePipeWire = new ItemBuildCraft(Integer.parseInt(bluePipeWireId.value)).setIconIndex(4 * 16 + 1);
bluePipeWire.setItemName("bluePipeWire");
bluePipeWire.setUnlocalizedName("bluePipeWire");
LanguageRegistry.addName(bluePipeWire, "Blue Pipe Wire");
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 4), new ItemStack(Item.redstone, 1),
new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(bluePipeWire, 8)));
Property greenPipeWireId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "greenPipeWire.id", DefaultProps.GREEN_PIPE_WIRE);
greenPipeWire = new ItemBuildCraft(Integer.parseInt(greenPipeWireId.value)).setIconIndex(4 * 16 + 2);
greenPipeWire.setItemName("greenPipeWire");
greenPipeWire.setUnlocalizedName("greenPipeWire");
LanguageRegistry.addName(greenPipeWire, "Green Pipe Wire");
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 2), new ItemStack(Item.redstone, 1),
new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(greenPipeWire, 8)));
Property yellowPipeWireId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "yellowPipeWire.id", DefaultProps.YELLOW_PIPE_WIRE);
yellowPipeWire = new ItemBuildCraft(Integer.parseInt(yellowPipeWireId.value)).setIconIndex(4 * 16 + 3);
yellowPipeWire.setItemName("yellowPipeWire");
yellowPipeWire.setUnlocalizedName("yellowPipeWire");
LanguageRegistry.addName(yellowPipeWire, "Yellow Pipe Wire");
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 11), new ItemStack(Item.redstone, 1),
new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(yellowPipeWire, 8)));
Property pipeGateId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipeGate.id", DefaultProps.GATE_ID);
pipeGate = new ItemGate(Integer.parseInt(pipeGateId.value), 0).setIconIndex(2 * 16 + 3);
pipeGate.setItemName("pipeGate");
pipeGate.setUnlocalizedName("pipeGate");
Property pipeGateAutarchicId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipeGateAutarchic.id",
DefaultProps.GATE_AUTARCHIC_ID);
pipeGateAutarchic = new ItemGate(Integer.parseInt(pipeGateAutarchicId.value), 1).setIconIndex(2 * 16 + 3);
pipeGateAutarchic.setItemName("pipeGateAutarchic");
pipeGateAutarchic.setUnlocalizedName("pipeGateAutarchic");
Property pipeFacadeId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipeFacade.id", DefaultProps.PIPE_FACADE_ID);
facadeItem = new ItemFacade(Integer.parseInt(pipeFacadeId.value));
facadeItem.setItemName("pipeFacade");
facadeItem.setUnlocalizedName("pipeFacade");
} finally {
BuildCraftCore.mainConfiguration.save();
@ -440,7 +440,7 @@ public class BuildCraftTransport {
int id = prop.getInt(defaultID);
ItemPipe res = BlockGenericPipe.registerPipe(id, clas);
res.setItemName(clas.getSimpleName());
res.setUnlocalizedName(clas.getSimpleName());
LanguageRegistry.addName(res, descr);
// Add appropriate recipe to temporary list

View file

@ -16,7 +16,7 @@ public class BlueprintManager {
sig.itemClassName = item.getClass().getSimpleName();
}
sig.itemName = item.getItemNameIS(new ItemStack(item));
sig.itemName = item.getUnlocalizedName(new ItemStack(item));
return sig;
}

View file

@ -206,7 +206,7 @@ public class BptBlock {
}
}
sig.blockName = block.getBlockName();
sig.blockName = block.getUnlocalizedName();
sig.replaceNullWithStar();
return sig;

View file

@ -108,8 +108,8 @@ public class BlockArchitect extends BlockContainer {
}
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving) {
super.onBlockPlacedBy(world, i, j, k, entityliving);
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving, ItemStack stack) {
super.onBlockPlacedBy(world, i, j, k, entityliving, stack);
ForgeDirection orientation = Utils.get2dOrientation(new Position(entityliving.posX, entityliving.posY, entityliving.posZ), new Position(i, j, k));

View file

@ -72,7 +72,7 @@ public class BlockBlueprintLibrary extends BlockContainer {
}
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving) {
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving, ItemStack stack) {
if (CoreProxy.proxy.isSimulating(world) && entityliving instanceof EntityPlayer) {
TileBlueprintLibrary tile = (TileBlueprintLibrary) world.getBlockTileEntity(i, j, k);
tile.owner = ((EntityPlayer) entityliving).username;

View file

@ -112,8 +112,8 @@ public class BlockBuilder extends BlockContainer {
}
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving) {
super.onBlockPlacedBy(world, i, j, k, entityliving);
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving, ItemStack stack) {
super.onBlockPlacedBy(world, i, j, k, entityliving, stack);
ForgeDirection orientation = Utils.get2dOrientation(new Position(entityliving.posX, entityliving.posY, entityliving.posZ), new Position(i, j, k));
world.setBlockMetadataWithNotify(i, j, k, orientation.getOpposite().ordinal());

View file

@ -110,16 +110,9 @@ public class GuiBlueprintLibrary extends GuiBuildCraft {
@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
int i = 0;
// if (library.owner.equals(player.username)) {
i = mc.renderEngine.getTexture(DefaultProps.TEXTURE_PATH_GUI + "/library_rw.png");
// } else {
// i = mc.renderEngine
// .getTexture("/net/minecraft/src/buildcraft/builders/gui/library_r.png");
// }
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.func_98187_b(DefaultProps.TEXTURE_PATH_GUI + "/library_rw.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(i);
int j = (width - xSize) / 2;
int k = (height - ySize) / 2;
drawTexturedModalRect(j, k, 0, 0, xSize, ySize);

View file

@ -20,7 +20,7 @@ public class ItemBlockBuildCraft extends ItemBlock {
@Override
public String getItemDisplayName(ItemStack itemstack) {
return StringUtil.localize(getItemNameIS(itemstack));
return StringUtil.localize(getUnlocalizedName(itemstack));
}
}

View file

@ -17,12 +17,11 @@ public class ItemBuildCraft extends Item {
public ItemBuildCraft(int i) {
super(i);
setTextureFile(DefaultProps.TEXTURE_ITEMS);
setCreativeTab(CreativeTabBuildCraft.tabBuildCraft);
}
@Override
public String getItemDisplayName(ItemStack itemstack) {
return StringUtil.localize(getItemNameIS(itemstack));
return StringUtil.localize(getUnlocalizedName(itemstack));
}
}

View file

@ -35,8 +35,8 @@ public class ItemRedstoneChipset extends ItemBuildCraft {
}
@Override
public String getItemNameIS(ItemStack itemstack) {
return (new StringBuilder()).append(super.getItemName()).append(".").append(itemstack.getItemDamage()).toString();
public String getUnlocalizedName(ItemStack itemstack) {
return (new StringBuilder()).append(super.getUnlocalizedName()).append(".").append(itemstack.getItemDamage()).toString();
}
@Override

View file

@ -22,7 +22,7 @@ public class SpringPopulate {
@ForgeSubscribe
public void populate(PopulateChunkEvent.Post event) {
boolean doGen = TerrainGen.populate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkX, event.hasVillageGenerated, PopulateChunkEvent.Populate.EventType.CUSTOM);
if (!doGen) {
@ -35,13 +35,13 @@ public class SpringPopulate {
doPopulate(event.world, event.rand, worldX, worldZ);
}
private void doPopulate(World world, Random random, int x, int z) {
// A spring will be generated every 40th chunk.
if(random.nextFloat() > 0.025f)
return;
// Do not generate water in the End or the Nether
BiomeGenBase biomegenbase = world.getWorldChunkManager().getBiomeGenAt(x, z);
if (biomegenbase.biomeID == BiomeGenBase.sky.biomeID || biomegenbase.biomeID == BiomeGenBase.hell.biomeID)
@ -49,17 +49,17 @@ public class SpringPopulate {
int posX = x + random.nextInt(16);
int posZ = z + random.nextInt(16);
for(int i = 0; i < 5; i++) {
int candidate = world.getBlockId(posX, i, posZ);
if(candidate != Block.bedrock.blockID)
continue;
world.setBlock(posX, i + 1, posZ, BuildCraftCore.springBlock.blockID);
world.func_94575_c(posX, i + 1, posZ, BuildCraftCore.springBlock.blockID);
for(int j = i + 2; j < world.getActualHeight() - 10; j++) {
if(!boreToSurface(world, posX, j, posZ)) {
if(world.isAirBlock(posX, j, posZ))
world.setBlockWithNotify(posX, j, posZ, Block.waterStill.blockID);
world.func_94575_c(posX, j, posZ, Block.waterStill.blockID);
break;
}
}
@ -70,15 +70,15 @@ public class SpringPopulate {
private boolean boreToSurface(World world, int x, int y, int z) {
if(world.isAirBlock(x, y, z))
return false;
int existing = world.getBlockId(x, y, z);
if(existing != Block.stone.blockID
&& existing != Block.dirt.blockID
&& existing != Block.gravel.blockID
&& existing != Block.grass.blockID)
return false;
world.setBlockWithNotify(x, y, z, Block.waterStill.blockID);
world.func_94575_c(x, y, z, Block.waterStill.blockID);
return true;
}
}

View file

@ -358,7 +358,7 @@ public class BptBlueprint extends BptBase {
if (!"*".equals(sig.itemClassName) && !item.getClass().getSimpleName().equals(sig.itemClassName))
return false;
if (!"*".equals(sig.itemName) && !item.getItemNameIS(new ItemStack(item)).equals(sig.itemName))
if (!"*".equals(sig.itemName) && !item.getUnlocalizedName(new ItemStack(item)).equals(sig.itemName))
return false;
return true;

View file

@ -98,7 +98,7 @@ public class CoreProxy {
/* REGISTRATION */
public void registerBlock(Block block) {
Item.itemsList[block.blockID] = null;
Item.itemsList[block.blockID] = new ItemBlockBuildCraft(block.blockID - 256, block.getBlockName());
Item.itemsList[block.blockID] = new ItemBlockBuildCraft(block.blockID - 256, block.getUnlocalizedName());
}
public void registerTileEntity(Class clas, String ident) {

View file

@ -1,118 +0,0 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.render;
import net.minecraft.client.renderer.RenderEngine;
import net.minecraftforge.client.ForgeHooksClient;
import cpw.mods.fml.client.FMLTextureFX;
public class TextureLiquidsFX extends FMLTextureFX {
private final int redMin, redMax, greenMin, greenMax, blueMin, blueMax;
private final String texture;
public TextureLiquidsFX(int redMin, int redMax, int greenMin, int greenMax, int blueMin, int blueMax, int spriteIndex, String texture) {
super(spriteIndex);
this.redMin = redMin;
this.redMax = redMax;
this.greenMin = greenMin;
this.greenMax = greenMax;
this.blueMin = blueMin;
this.blueMax = blueMax;
this.texture = texture;
setup();
}
@Override
public void setup() {
super.setup();
red = new float[tileSizeSquare];
green = new float[tileSizeSquare];
blue = new float[tileSizeSquare];
alpha = new float[tileSizeSquare];
}
@Override
public void bindImage(RenderEngine renderengine) {
ForgeHooksClient.bindTexture(texture, 0);
}
@Override
public void onTick() {
for (int i = 0; i < tileSizeBase; ++i) {
for (int j = 0; j < tileSizeBase; ++j) {
float var3 = 0.0F;
for (int k = i - 1; k <= i + 1; ++k) {
int r = k & tileSizeMask;
int g = j & tileSizeMask;
var3 += this.red[r + g * tileSizeBase];
}
this.green[i + j * tileSizeBase] = var3 / 3.3F + this.blue[i + j * tileSizeBase] * 0.8F;
}
}
for (int i = 0; i < tileSizeBase; ++i) {
for (int j = 0; j < tileSizeBase; ++j) {
this.blue[i + j * tileSizeBase] += this.alpha[i + j * tileSizeBase] * 0.05F;
if (this.blue[i + j * tileSizeBase] < 0.0F) {
this.blue[i + j * tileSizeBase] = 0.0F;
}
this.alpha[i + j * tileSizeBase] -= 0.1F;
if (Math.random() < 0.05D) {
this.alpha[i + j * tileSizeBase] = 0.5F;
}
}
}
float af[] = green;
green = red;
red = af;
for (int i1 = 0; i1 < tileSizeSquare; i1++) {
float f1 = red[i1];
if (f1 > 1.0F) {
f1 = 1.0F;
}
if (f1 < 0.0F) {
f1 = 0.0F;
}
float f2 = f1 * f1;
int r = (int) (redMin + f2 * (redMax - redMin));
int g = (int) (greenMin + f2 * (greenMax - greenMin));
int b = (int) (blueMin + f2 * (blueMax - blueMin));
if (anaglyphEnabled) {
int i3 = (r * 30 + g * 59 + b * 11) / 100;
int j3 = (r * 30 + g * 70) / 100;
int k3 = (r * 30 + b * 70) / 100;
r = i3;
g = j3;
b = k3;
}
imageData[i1 * 4 + 0] = (byte) r;
imageData[i1 * 4 + 1] = (byte) g;
imageData[i1 * 4 + 2] = (byte) b;
imageData[i1 * 4 + 3] = (byte) 255;
}
}
protected float red[];
protected float green[];
protected float blue[];
protected float alpha[];
}

View file

@ -36,7 +36,7 @@ public class BlockEngine extends BlockContainer {
setHardness(0.5F);
setCreativeTab(CreativeTabBuildCraft.tabBuildCraft);
setBlockName("engineBlock");
setUnlocalizedName("engineBlock");
}
@Override

View file

@ -80,7 +80,7 @@ public class BlockOilFlowing extends BlockFluid implements ILiquid {
world.setBlockWithNotify(i, j, k, 0);
} else {
world.setBlockMetadataWithNotify(i, j, k, l);
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
world.scheduleBlockUpdate(i, j, k, blockID, tickRate(world));
world.notifyBlocksOfNeighborChange(i, j, k, blockID);
}
} else if (flag) {
@ -240,7 +240,7 @@ public class BlockOilFlowing extends BlockFluid implements ILiquid {
public void onBlockAdded(World world, int i, int j, int k) {
super.onBlockAdded(world, i, j, k);
if (world.getBlockId(i, j, k) == blockID) {
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
world.scheduleBlockUpdate(i, j, k, blockID, tickRate(world));
}
}

View file

@ -5,9 +5,6 @@ import buildcraft.core.DefaultProps;
import buildcraft.core.render.RenderingEntityBlocks;
import buildcraft.core.render.RenderingEntityBlocks.EntityRenderIndex;
import buildcraft.energy.render.RenderEngine;
import buildcraft.energy.render.TextureFuelFX;
import buildcraft.energy.render.TextureOilFX;
import buildcraft.energy.render.TextureOilFlowFX;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
@ -21,10 +18,6 @@ public class EnergyProxyClient extends EnergyProxy {
@Override
public void registerTextureFX() {
net.minecraft.client.renderer.RenderEngine renderEngine = FMLClientHandler.instance().getClient().renderEngine;
renderEngine.registerTextureFX(new TextureOilFX());
renderEngine.registerTextureFX(new TextureFuelFX());
renderEngine.registerTextureFX(new TextureOilFlowFX());
}
@Override

View file

@ -107,7 +107,7 @@ public class EngineIron extends Engine {
if (burnTime > 0 || fuel.amount > 0) {
if (burnTime > 0) {
burnTime--;
}
}
if (burnTime <= 0) {
if(fuel != null) {
if (--fuel.amount <= 0) {
@ -125,7 +125,7 @@ public class EngineIron extends Engine {
}
} else if (penaltyCooling <= 0) {
if (lastPowered) {
lastPowered = false;
lastPowered = false;
penaltyCooling = 30 * 20;
// 30 sec of penalty on top of the cooling
}
@ -431,19 +431,11 @@ public class EngineIron extends Engine {
}
}
public int getFuelId() {
return fuelTank.getLiquid() != null ? fuelTank.getLiquid().itemID : 0;
public LiquidStack getFuel() {
return fuelTank.getLiquid();
}
public int getFuelMeta() {
return fuelTank.getLiquid() != null ? fuelTank.getLiquid().itemMeta : 0;
}
public int getCoolantId() {
return coolantTank.getLiquid() != null ? coolantTank.getLiquid().itemID : 0;
}
public int getCoolantMeta() {
return coolantTank.getLiquid() != null ? coolantTank.getLiquid().itemMeta : 0;
public LiquidStack getCoolant() {
return coolantTank.getLiquid();
}
}

View file

@ -1,8 +1,8 @@
/**
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
@ -26,12 +26,7 @@ public class ItemBucketOil extends ItemBucket {
@Override
public String getItemDisplayName(ItemStack itemstack) {
return StringUtil.localize(getItemNameIS(itemstack));
}
@Override
public String getTextureFile() {
return DefaultProps.TEXTURE_ITEMS;
return StringUtil.localize(getUnlocalizedName(itemstack));
}
}

View file

@ -13,6 +13,7 @@ import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.Item;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.liquids.LiquidStack;
import org.lwjgl.opengl.GL11;
@ -37,9 +38,8 @@ public class GuiCombustionEngine extends GuiEngine {
@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
int i = mc.renderEngine.getTexture(DefaultProps.TEXTURE_PATH_GUI + "/combustion_engine_gui.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(i);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.func_98187_b(DefaultProps.TEXTURE_PATH_GUI + "/combustion_engine_gui.png");
int j = (width - xSize) / 2;
int k = (height - ySize) / 2;
drawTexturedModalRect(j, k, 0, 0, xSize, ySize);
@ -48,31 +48,19 @@ public class GuiCombustionEngine extends GuiEngine {
EngineIron engineIron = ((EngineIron) engine.engine);
if (engine.getScaledBurnTime(58) > 0) {
displayGauge(j, k, 19, 104, engine.getScaledBurnTime(58), engineIron.getFuelId(), engineIron.getFuelMeta());
displayGauge(j, k, 19, 104, engine.getScaledBurnTime(58), engineIron.getFuel());
}
if (engineIron.getScaledCoolant(58) > 0) {
displayGauge(j, k, 19, 122, engineIron.getScaledCoolant(58), engineIron.getCoolantId(), engineIron.getCoolantMeta());
displayGauge(j, k, 19, 122, engineIron.getScaledCoolant(58), engineIron.getCoolant());
}
}
private void displayGauge(int j, int k, int line, int col, int squaled, int liquidId, int liquidMeta) {
int liquidImgIndex = 0;
if (liquidId <= 0)
return;
if (liquidId < Block.blocksList.length && Block.blocksList[liquidId] != null) {
ForgeHooksClient.bindTexture(Block.blocksList[liquidId].getTextureFile(), 0);
liquidImgIndex = Block.blocksList[liquidId].blockIndexInTexture;
} else if (Item.itemsList[liquidId] != null) {
ForgeHooksClient.bindTexture(Item.itemsList[liquidId].getTextureFile(), 0);
liquidImgIndex = Item.itemsList[liquidId].getIconFromDamage(liquidMeta);
} else
return;
int imgLine = liquidImgIndex / 16;
int imgColumn = liquidImgIndex - imgLine * 16;
private void displayGauge(int j, int k, int line, int col, int squaled, LiquidStack liquid) {
if (liquid == null)
{
return;
}
int start = 0;
while (true) {
@ -86,7 +74,7 @@ public class GuiCombustionEngine extends GuiEngine {
squaled = 0;
}
drawTexturedModalRect(j + col, k + line + 58 - x - start, imgColumn * 16, imgLine * 16 + (16 - x), 16, 16 - (16 - x));
func_94065_a(j + col, k + line + 58 - x - start, liquid.getRenderingIcon(), 16, 16 - (16 - x));
start = start + 16;
if (x == 0 || squaled == 0) {
@ -94,9 +82,7 @@ public class GuiCombustionEngine extends GuiEngine {
}
}
int i = mc.renderEngine.getTexture(DefaultProps.TEXTURE_PATH_GUI + "/combustion_engine_gui.png");
mc.renderEngine.bindTexture(i);
mc.renderEngine.func_98187_b(DefaultProps.TEXTURE_PATH_GUI + "/combustion_engine_gui.png");
drawTexturedModalRect(j + col, k + line, 176, 0, 16, 60);
}
}

View file

@ -33,9 +33,8 @@ public class GuiSteamEngine extends GuiEngine {
@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
int i = mc.renderEngine.getTexture(DefaultProps.TEXTURE_PATH_GUI + "/steam_engine_gui.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(i);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.func_98187_b(DefaultProps.TEXTURE_PATH_GUI + "/steam_engine_gui.png");
int j = (width - xSize) / 2;
int k = (height - ySize) / 2;
drawTexturedModalRect(j, k, 0, 0, xSize, ySize);

View file

@ -1,20 +0,0 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.energy.render;
import buildcraft.BuildCraftEnergy;
import buildcraft.core.render.TextureLiquidsFX;
public class TextureFuelFX extends TextureLiquidsFX {
public TextureFuelFX() {
super(150, 250, 150, 250, 0, 10, BuildCraftEnergy.fuel.getIconFromDamage(0), BuildCraftEnergy.fuel.getTextureFile());
}
}

View file

@ -1,20 +0,0 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.energy.render;
import buildcraft.BuildCraftEnergy;
import buildcraft.core.render.TextureLiquidsFX;
public class TextureOilFX extends TextureLiquidsFX {
public TextureOilFX() {
super(10, 31, 10, 31, 10, 31, BuildCraftEnergy.oilStill.blockIndexInTexture, BuildCraftEnergy.oilStill.getTextureFile());
}
}

View file

@ -1,114 +0,0 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.energy.render;
import net.minecraft.client.renderer.RenderEngine;
import org.lwjgl.opengl.GL11;
import buildcraft.BuildCraftEnergy;
import buildcraft.core.DefaultProps;
import cpw.mods.fml.client.FMLTextureFX;
public class TextureOilFlowFX extends FMLTextureFX {
public TextureOilFlowFX() {
super(BuildCraftEnergy.oilMoving.blockIndexInTexture + 1);
tileSize = 2;
}
@Override
protected void setup() {
super.setup();
field_1138_g = new float[tileSizeSquare];
field_1137_h = new float[tileSizeSquare];
field_1136_i = new float[tileSizeSquare];
field_1135_j = new float[tileSizeSquare];
field_1134_k = 0;
}
@Override
public void bindImage(RenderEngine renderengine) {
GL11.glBindTexture(3553, renderengine.getTexture(DefaultProps.TEXTURE_BLOCKS));
}
@Override
public void onTick() {
field_1134_k++;
for (int i = 0; i < tileSizeBase; i++) {
for (int k = 0; k < tileSizeBase; k++) {
float f = 0.0F;
for (int j1 = k - 2; j1 <= k; j1++) {
int k1 = i & tileSizeMask;
int i2 = j1 & tileSizeMask;
f += field_1138_g[k1 + i2 * tileSizeBase];
}
field_1137_h[i + k * tileSizeBase] = f / 3.2F + field_1136_i[i + k * tileSizeBase] * 0.8F;
}
}
for (int j = 0; j < tileSizeBase; j++) {
for (int l = 0; l < tileSizeBase; l++) {
field_1136_i[j + l * tileSizeBase] += field_1135_j[j + l * tileSizeBase] * 0.05F;
if (field_1136_i[j + l * tileSizeBase] < 0.0F) {
field_1136_i[j + l * tileSizeBase] = 0.0F;
}
field_1135_j[j + l * tileSizeBase] -= 0.3F;
if (Math.random() < 0.20000000000000001D) {
field_1135_j[j + l * tileSizeBase] = 0.5F;
}
}
}
float af[] = field_1137_h;
field_1137_h = field_1138_g;
field_1138_g = af;
for (int i1 = 0; i1 < tileSizeSquare; i1++) {
float f1 = field_1138_g[i1 - field_1134_k * tileSizeBase & tileSizeSquareMask];
if (f1 > 1.0F) {
f1 = 1.0F;
}
if (f1 < 0.0F) {
f1 = 0.0F;
}
float f2 = f1 * f1;
int l1 = (int) (10F + f2 * 22F);
int j2 = (int) (50F + f2 * 64F);
int k2 = 255;
if (anaglyphEnabled) {
int i3 = (l1 * 30 + j2 * 59 + k2 * 11) / 100;
int j3 = (l1 * 30 + j2 * 70) / 100;
int k3 = (l1 * 30 + k2 * 70) / 100;
l1 = i3;
j2 = j3;
k2 = k3;
}
// imageData[i1 * 4 + 0] = (byte)l1;
// imageData[i1 * 4 + 1] = (byte)j2;
// imageData[i1 * 4 + 2] = (byte) k2;
// imageData[i1 * 4 + 3] = /*(byte)l2*/(byte)255;
imageData[i1 * 4 + 0] = (byte) l1;
imageData[i1 * 4 + 1] = (byte) l1;
imageData[i1 * 4 + 2] = (byte) l1;
imageData[i1 * 4 + 3] = /* (byte)l2 */(byte) 255;
}
}
protected float field_1138_g[];
protected float field_1137_h[];
protected float field_1136_i[];
protected float field_1135_j[];
private int field_1134_k;
}

View file

@ -57,7 +57,7 @@ public class BlockMiningWell extends BlockMachineRoot {
}
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving) {
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving, ItemStack stack) {
ForgeDirection orientation = Utils.get2dOrientation(new Position(entityliving.posX, entityliving.posY, entityliving.posZ), new Position(i, j, k));
world.setBlockMetadataWithNotify(i, j, k, orientation.getOpposite().ordinal());

View file

@ -47,8 +47,8 @@ public class BlockQuarry extends BlockMachineRoot {
}
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving) {
super.onBlockPlacedBy(world, i, j, k, entityliving);
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving, ItemStack stack) {
super.onBlockPlacedBy(world, i, j, k, entityliving, stack);
ForgeDirection orientation = Utils.get2dOrientation(new Position(entityliving.posX, entityliving.posY, entityliving.posZ), new Position(i, j, k));

View file

@ -65,8 +65,8 @@ public class BlockRefinery extends BlockContainer {
}
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving) {
super.onBlockPlacedBy(world, i, j, k, entityliving);
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving, ItemStack stack) {
super.onBlockPlacedBy(world, i, j, k, entityliving, stack);
ForgeDirection orientation = Utils.get2dOrientation(new Position(entityliving.posX, entityliving.posY, entityliving.posZ), new Position(i, j, k));

View file

@ -11,7 +11,7 @@ public class ItemAssemblyTable extends ItemBlock {
}
@Override
public String getItemNameIS(ItemStack par1ItemStack) {
public String getUnlocalizedName(ItemStack par1ItemStack) {
return par1ItemStack.getItemDamage() == 0 ? "block.assemblyTableBlock" : "block.assemblyWorkbenchBlock";
}

View file

@ -47,13 +47,13 @@ public class BlockGenericPipe extends BlockContainer {
Pipe,
Gate
}
static class RaytraceResult {
RaytraceResult(Part hitPart, MovingObjectPosition movingObjectPosition) {
this.hitPart = hitPart;
this.movingObjectPosition = movingObjectPosition;
}
public Part hitPart;
public MovingObjectPosition movingObjectPosition;
}
@ -230,14 +230,14 @@ public class BlockGenericPipe extends BlockContainer {
@Override
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 origin, Vec3 direction) {
RaytraceResult raytraceResult = doRayTrace(world, x, y, z, origin, direction);
if (raytraceResult == null) {
return null;
} else {
return raytraceResult.movingObjectPosition;
}
}
public RaytraceResult doRayTrace(World world, int x, int y, int z, EntityPlayer entityPlayer) {
double pitch = Math.toRadians(entityPlayer.rotationPitch);
double yaw = Math.toRadians(entityPlayer.rotationYaw);
@ -245,39 +245,39 @@ public class BlockGenericPipe extends BlockContainer {
double dirX = -Math.sin(yaw) * Math.cos(pitch);
double dirY = -Math.sin(pitch);
double dirZ = Math.cos(yaw) * Math.cos(pitch);
double reachDistance = 5;
if (entityPlayer instanceof EntityPlayerMP) {
reachDistance = ((EntityPlayerMP) entityPlayer).theItemInWorldManager.getBlockReachDistance();
}
Vec3 origin = Vec3.vec3dPool.getVecFromPool(entityPlayer.posX, entityPlayer.posY + 1.62 - entityPlayer.yOffset, entityPlayer.posZ);
Vec3 origin = Vec3.fakePool.getVecFromPool(entityPlayer.posX, entityPlayer.posY + 1.62 - entityPlayer.yOffset, entityPlayer.posZ);
Vec3 direction = origin.addVector(dirX * reachDistance, dirY * reachDistance, dirZ * reachDistance);
return doRayTrace(world, x, y, z, origin, direction);
}
public RaytraceResult doRayTrace(World world, int x, int y, int z, Vec3 origin, Vec3 direction) {
float xMin = Utils.pipeMinPos, xMax = Utils.pipeMaxPos, yMin = Utils.pipeMinPos, yMax = Utils.pipeMaxPos, zMin = Utils.pipeMinPos, zMax = Utils.pipeMaxPos;
TileEntity pipeTileEntity = world.getBlockTileEntity(x, y, z);
Pipe pipe = getPipe(world, x, y, z);
if (pipeTileEntity == null || !isValid(pipe)) {
return null;
}
/**
* pipe hits along x, y, and z axis, gate (all 6 sides) [and wires+facades]
* pipe hits along x, y, and z axis, gate (all 6 sides) [and wires+facades]
*/
MovingObjectPosition[] hits = new MovingObjectPosition[] { null, null, null, null, null, null, null, null, null };
boolean needAxisCheck = false;
boolean needCenterCheck = true;
// check along the x axis
if (Utils.checkPipesConnections(world, pipeTileEntity, x - 1, y, z)) {
xMin = 0.0F;
needAxisCheck = true;
@ -287,7 +287,7 @@ public class BlockGenericPipe extends BlockContainer {
xMax = 1.0F;
needAxisCheck = true;
}
if (needAxisCheck) {
setBlockBounds(xMin, yMin, zMin, xMax, yMax, zMax);
@ -297,7 +297,7 @@ public class BlockGenericPipe extends BlockContainer {
needAxisCheck = false;
needCenterCheck = false; // center already checked through this axis
}
// check along the y axis
if (Utils.checkPipesConnections(world, pipeTileEntity, x, y - 1, z)) {
@ -309,7 +309,7 @@ public class BlockGenericPipe extends BlockContainer {
yMax = 1.0F;
needAxisCheck = true;
}
if (needAxisCheck) {
setBlockBounds(xMin, yMin, zMin, xMax, yMax, zMax);
@ -319,7 +319,7 @@ public class BlockGenericPipe extends BlockContainer {
needAxisCheck = false;
needCenterCheck = false; // center already checked through this axis
}
// check along the z axis
if (Utils.checkPipesConnections(world, pipeTileEntity, x, y, z - 1)) {
@ -331,7 +331,7 @@ public class BlockGenericPipe extends BlockContainer {
zMax = 1.0F;
needAxisCheck = true;
}
if (needAxisCheck) {
setBlockBounds(xMin, yMin, zMin, xMax, yMax, zMax);
@ -341,7 +341,7 @@ public class BlockGenericPipe extends BlockContainer {
needAxisCheck = false;
needCenterCheck = false; // center already checked through this axis
}
// check center (only if no axis were checked/the pipe has no connections)
if (needCenterCheck) {
@ -349,59 +349,59 @@ public class BlockGenericPipe extends BlockContainer {
hits[0] = super.collisionRayTrace(world, x, y, z, origin, direction);
}
// gates
if (pipe.hasGate()) {
for (int side = 0; side < 6; side++) {
setBlockBoundsToGate(ForgeDirection.VALID_DIRECTIONS[side]);
hits[3 + side] = super.collisionRayTrace(world, x, y, z, origin, direction);
}
}
// TODO: check wires, facades
// get closest hit
double minLengthSquared = Double.POSITIVE_INFINITY;
int minIndex = -1;
for (int i = 0; i < hits.length; i++) {
MovingObjectPosition hit = hits[i];
if (hit == null) continue;
double lengthSquared = hit.hitVec.squareDistanceTo(origin);
if (lengthSquared < minLengthSquared) {
minLengthSquared = lengthSquared;
minIndex = i;
}
}
// reset bounds
setBlockBounds(0, 0, 0, 1, 1, 1);
if (minIndex == -1) {
return null;
} else {
Part hitPart;
if (minIndex < 3) {
hitPart = Part.Pipe;
} else {
hitPart = Part.Gate;
}
return new RaytraceResult(hitPart, hits[minIndex]);
}
}
private void setBlockBoundsToGate(ForgeDirection dir) {
float min = Utils.pipeMinPos + 0.05F;
float max = Utils.pipeMaxPos - 0.05F;
switch (dir) {
case DOWN:
setBlockBounds(min, Utils.pipeMinPos - 0.10F, min, max, Utils.pipeMinPos, max);
@ -537,17 +537,17 @@ public class BlockGenericPipe extends BlockContainer {
return meta;
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving placer) {
super.onBlockPlacedBy(world, x, y, z, placer);
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving placer, ItemStack stack) {
super.onBlockPlacedBy(world, x, y, z, placer, stack);
Pipe pipe = getPipe(world, x, y, z);
if (isValid(pipe)) {
pipe.onBlockPlacedBy(placer);
}
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int par6, float xOffset, float yOffset, float zOffset) {
super.onBlockActivated(world, x, y, z, entityplayer, par6, xOffset, yOffset, zOffset);
@ -629,17 +629,17 @@ public class BlockGenericPipe extends BlockContainer {
pipe.container.scheduleRenderUpdate();
return true;
}
boolean openGateGui = false;
if (pipe.hasGate()) {
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, entityplayer);
if (rayTraceResult != null && rayTraceResult.hitPart == Part.Gate) {
openGateGui = true;
}
}
if (openGateGui) {
pipe.gate.openGui(entityplayer);
@ -679,7 +679,7 @@ public class BlockGenericPipe extends BlockContainer {
/**
* Drops a pipe wire item of the passed color.
*
*
* @param color
*/
private void dropWire(IPipe.WireColor color, World world, int i, int j, int k) {
@ -789,14 +789,13 @@ public class BlockGenericPipe extends BlockContainer {
public static ItemPipe registerPipe(int key, Class<? extends Pipe> clas) {
ItemPipe item = new ItemPipe(key);
item.setItemName("buildcraftPipe." + clas.getSimpleName().toLowerCase());
GameRegistry.registerItem(item, item.getItemName());
item.setUnlocalizedName("buildcraftPipe." + clas.getSimpleName().toLowerCase());
GameRegistry.registerItem(item, item.getUnlocalizedName());
pipes.put(item.itemID, clas);
Pipe dummyPipe = createPipe(item.itemID);
if (dummyPipe != null) {
item.setTextureFile(dummyPipe.getTextureFile());
item.setTextureIndex(dummyPipe.getTextureIndexForItem());
}

View file

@ -53,7 +53,7 @@ public class ItemFacade extends ItemBuildCraft {
}
@Override
public String getItemNameIS(ItemStack itemstack) {
public String getUnlocalizedName(ItemStack itemstack) {
return "item.Facade";
}
@ -102,7 +102,7 @@ public class ItemFacade extends ItemBuildCraft {
} catch (Exception e) {
continue;
}
if (!(b.blockID == 20)){
if (b.blockID == 7 || b.blockID == 18 || b.blockID == 19 || b.blockID == 95) {
continue;

View file

@ -53,8 +53,8 @@ public class ItemGate extends ItemBuildCraft {
}
@Override
public String getItemNameIS(ItemStack itemstack) {
return (new StringBuilder()).append(super.getItemName()).append(".").append(itemstack.getItemDamage()).toString();
public String getUnlocalizedName(ItemStack itemstack) {
return (new StringBuilder()).append(super.getUnlocalizedName()).append(".").append(itemstack.getItemDamage()).toString();
}
@SuppressWarnings("unchecked")

View file

@ -74,7 +74,7 @@ public class ItemPipe extends ItemBuildCraft implements IItemPipe {
}
if (BlockGenericPipe.placePipe(pipe, world, i, j, k, blockID, 0)) {
Block.blocksList[blockID].onBlockPlacedBy(world, i, j, k, entityplayer);
Block.blocksList[blockID].onBlockPlacedBy(world, i, j, k, entityplayer, itemstack);
world.playSoundEffect(i + 0.5F, j + 0.5F, k + 0.5F,
block.stepSound.getPlaceSound(),
(block.stepSound.getVolume() + 1.0F) / 2.0F,

View file

@ -252,9 +252,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
renderState.facadeMatrix.setConnected(direction, blockId != 0 && Block.blocksList[blockId] != null);
if (Block.blocksList[blockId] != null) {
Block block = Block.blocksList[blockId];
renderState.facadeMatrix.setTextureFile(direction, block.getTextureFile());
renderState.facadeMatrix.setTextureIndex(direction,
block.getBlockTextureFromSideAndMetadata(direction.ordinal(), this.facadeMeta[direction.ordinal()]));
// TODO
}
}

View file

@ -29,7 +29,6 @@ public class FacadeItemRenderer implements IItemRenderer {
// Render Facade
GL11.glPushMatrix();
ForgeHooksClient.bindTexture(block.getTextureFile(), 0);
block.setBlockBounds(0F, 0F, 1F - 1F / 16F, 1F, 1F, 1F);
render.setRenderBoundsFromBlock(block);
GL11.glTranslatef(translateX, translateY, translateZ);
@ -62,7 +61,6 @@ public class FacadeItemRenderer implements IItemRenderer {
GL11.glPopMatrix();
// Render StructurePipe
ForgeHooksClient.bindTexture(DefaultProps.TEXTURE_BLOCKS, 0);
block = BuildCraftTransport.genericPipeBlock;
int textureID = 7 * 16 + 13; // Structure pipe
block.setBlockBounds(Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMaxPos, Utils.pipeMaxPos, Utils.pipeMaxPos - 1F / 16F);

View file

@ -180,7 +180,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
if (state.facadeMatrix.isConnected(direction)) {
ForgeHooksClient.bindTexture(state.facadeMatrix.getTextureFile(direction), 0);
state.currentTextureIndex = state.facadeMatrix.getTextureIndex(direction);
state.currentTextureIndex = state.facadeMatrix.getTextureIcon(direction);
// Hollow facade
if (state.pipeConnectionMatrix.isConnected(direction)) {

View file

@ -437,7 +437,7 @@ public class RenderPipe extends TileEntitySpecialRenderer {
GL11.glTranslatef((float) d, (float) d1, (float) d2);
GL11.glTranslatef(0, 0.25F, 0);
GL11.glScalef(renderScale, renderScale, renderScale);
dummyEntityItem.func_92058_a(itemstack);
dummyEntityItem.setEntityItemStack(itemstack);
customRenderItem.doRenderItem(dummyEntityItem, 0, 0, 0, 0, 0);
GL11.glPopMatrix();
}

View file

@ -4,38 +4,25 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.util.Icon;
import net.minecraftforge.common.ForgeDirection;
public class FacadeMatrix extends ConnectionMatrix {
private String[] _textureFiles = new String[ForgeDirection.VALID_DIRECTIONS.length];
private int[] _textureIndex = new int[ForgeDirection.VALID_DIRECTIONS.length];
private Icon[] _textureIcons = new Icon[ForgeDirection.VALID_DIRECTIONS.length];
private boolean dirty = false;
public FacadeMatrix() {
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
_textureFiles[direction.ordinal()] = "";
}
}
public String getTextureFile(ForgeDirection direction) {
return _textureFiles[direction.ordinal()];
public Icon getTextureIcon(ForgeDirection direction) {
return _textureIcons[direction.ordinal()];
}
public void setTextureFile(ForgeDirection direction, String filePath) {
if (!_textureFiles[direction.ordinal()].equals(filePath)) {
_textureFiles[direction.ordinal()] = filePath;
dirty = true;
}
}
public int getTextureIndex(ForgeDirection direction) {
return _textureIndex[direction.ordinal()];
}
public void setTextureIndex(ForgeDirection direction, int value) {
if (_textureIndex[direction.ordinal()] != value) {
_textureIndex[direction.ordinal()] = value;
public void setTextureIcon(ForgeDirection direction, Icon value) {
if (_textureIcons[direction.ordinal()] != value) {
_textureIcons[direction.ordinal()] = value;
dirty = true;
}
}
@ -55,8 +42,7 @@ public class FacadeMatrix extends ConnectionMatrix {
public void readData(DataInputStream data) throws IOException {
super.readData(data);
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
_textureFiles[i] = data.readUTF();
_textureIndex[i] = data.readInt();
_textureIcons[i] = data.readInt();
}
}
@ -65,7 +51,7 @@ public class FacadeMatrix extends ConnectionMatrix {
super.writeData(data);
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
data.writeUTF(_textureFiles[i]);
data.writeInt(_textureIndex[i]);
data.writeInt(_textureIcons[i]);
}
}
}