merged with latest changes and fix compilation errors

This commit is contained in:
SpaceToad 2014-02-16 12:14:30 +01:00
commit 1677fa3785
36 changed files with 280 additions and 478 deletions

View file

@ -1,13 +1,21 @@
## Welcome to Buildcraft on GitHub
### Rule on opening issues
**Please only open an issue if you are planning to either fix the bug or implement the feature.**
If you're part of the BuildCraft team, this means that you will set yourself as the assignee. If you're an external contributor, that means that your issue must be a pull request. We are trying to keep the issues list to things that are scheduled for implementation / correction. If you would like to report a bug but do not plan to fix it, please report on the bug reporting board (http://mod-buildcraft.com/forums/index.php?board=2.0). If you would like to suggest a feature, you can start a thread on the feature ideas board (http://mod-buildcraft.com/forums/index.php?board=4.0). New issues that do not follow this rule will get closed, existing ones will be closed progressively.
Assigned features and issues that are not scheduled for any particular release and is left open for several months will get closed eventually. BuildCraft being an open-source project, if this particular fix or feature is important to you, feel free to go ahead and submit a pull request for it.
### Contributing
If you wish to submit a pull request to fix bugs or broken behaviour feel free to do so. If you would like to add
features or change existing behaviour or balance, please discuss it with Sengir or Krapht before submiting the pull request.
features or change existing behaviour or balance, please discuss it on the feature ideas board before (http://mod-buildcraft.com/forums/index.php?board=4.0 before).
Do not submit pull requests which solely "fix" formatting. As these kinds of changes are usually very intrusive in commit history and everyone has their own idea what "proper formatting" is, they should be done by one of the main contributors.
Please only submit "code cleanup", if the changes actually have a substantial impact on readability.
### Reporting issues
* Do not open an issue if you're not planning to fix it, intead open a thread on http://mod-buildcraft.com/forums/index.php?board=2.0
* Before reporting an issue, please check that it has not been reported before.
* Issues are for bugs/crashes, please do not use them to ask general questions.
* Always include the version you are having trouble with. Or if you're building from source, which source you're building.

51
bc-build.sh Executable file
View file

@ -0,0 +1,51 @@
VERSION=5.0.0
MC_VERSION=1.7.2
FORGE_VERSION=10.12.0.1024
BUILD_NUMBER=58
build_dir=`pwd`/build-$VERSION
forge_archive=forge-$MC_VERSION-$FORGE_VERSION-src.zip
rm -rf $build_dir
mkdir $build_dir
mkdir $build_dir/forge
cd $build_dir/forge
wget http://files.minecraftforge.net/maven/net/minecraftforge/forge/$MC_VERSION-$FORGE_VERSION/$forge_archive
unzip $forge_archive
./gradlew setupDecompWorkspace
rm -rf src/*
mkdir src/main
cp -r ../../common src/main/java
cp -r ../../buildcraft_resources src/main/resources
(
cd src/main
for j in `find .` ; do
if [ ! -d $j ]; then
case $j in
*Version.java)
sed "s/@VERSION@/$VERSION/g" $j > $j.tmp && mv $j.tmp $j
sed "s/@MC_VERSION@/$MC_VERSION/g" $j > $j.tmp && mv $j.tmp $j
sed "s/@BUILD_NUMBER@/$BUILD_NUMBER/g" $j > $j.tmp && mv $j.tmp $j
;;
*.info)
sed "s/@VERSION@/$VERSION/g" $j > $j.tmp && mv $j.tmp $j
sed "s/@MC_VERSION@/$MC_VERSION/g" $j > $j.tmp && mv $j.tmp $j
sed "s/@BUILD_NUMBER@/$BUILD_NUMBER/g" $j > $j.tmp && mv $j.tmp $j
;;
esac
fi
done
)
./gradlew reobf
(
cd build/libs
mv *.jar $build_dir/buildcraft-$MC_VERSION-$VERSION.jar
)

View file

@ -104,100 +104,100 @@ gui.pipes.emzuli.title=Extraction Presets
gui.pipes.emzuli.paint=Paint Items %s
gui.pipes.emzuli.nopaint=Don't Paint Items
item.bucketFuel=Fuel Bucket
item.bucketOil=Oil Bucket
item.woodenGearItem=Wood Gear
item.stoneGearItem=Stone Gear
item.ironGearItem=Iron Gear
item.goldGearItem=Gold Gear
item.diamondGearItem=Diamond Gear
item.templateItem=Template
item.wrenchItem=Wrench
item.pipeWaterproof=Pipe Sealant
item.redPipeWire=Red Pipe Wire
item.bluePipeWire=Blue Pipe Wire
item.greenPipeWire=Green Pipe Wire
item.yellowPipeWire=Yellow Pipe Wire
item.redstone_red_chipset=Redstone Chipset
item.redstone_iron_chipset=Iron Chipset
item.redstone_gold_chipset=Golden Chipset
item.redstone_diamond_chipset=Diamond Chipset
item.redstone_pulsating_chipset=Pulsating Chipset
item.redstone_quartz_chipset=Quartz Chipset
item.redstone_comp_chipset=Redstone Comp Chipset
item.blueprintItem=Blueprint
item.PipeItemsWood=Wooden Transport Pipe
item.PipeItemsCobblestone=Cobblestone Transport Pipe
item.PipeItemsStone=Stone Transport Pipe
item.PipeItemsQuartz=Quartz Transport Pipe
item.PipeItemsIron=Iron Transport Pipe
item.PipeItemsGold=Golden Transport Pipe
item.PipeItemsDiamond=Diamond Transport Pipe
item.PipeItemsObsidian=Obsidian Transport Pipe
item.PipeItemsEmerald=Emerald Transport Pipe
item.PipeItemsLapis=Lazuli Transport Pipe
item.PipeItemsDaizuli=Daizuli Transport Pipe
item.PipeItemsEmzuli=Emzuli Transport Pipe
item.PipeFluidsWood=Wooden Fluid Pipe
item.PipeFluidsCobblestone=Cobblestone Fluid Pipe
item.PipeFluidsStone=Stone Fluid Pipe
item.PipeFluidsIron=Iron Fluid Pipe
item.PipeFluidsGold=Golden Fluid Pipe
item.PipeFluidsEmerald=Emerald Fluid Pipe
item.PipePowerWood=Wooden Kinesis Pipe
item.PipePowerCobblestone=Cobblestone Kinesis Pipe
item.PipePowerStone=Stone Kinesis Pipe
item.PipePowerQuartz=Quartz Kinesis Pipe
item.PipePowerIron=Iron Kinesis Pipe
item.PipePowerGold=Golden Kinesis Pipe
item.PipePowerDiamond=Diamond Kinesis Pipe
item.PipeItemsStripes=Stripes Transport Pipe
item.PipeStructureCobblestone=Cobblestone Structure Pipe
item.PipeItemsVoid=Void Transport Pipe
item.PipeFluidsVoid=Void Fluid Pipe
item.PipeItemsSandstone=Sandstone Transport Pipe
item.PipeFluidsSandstone=Sandstone Fluid Pipe
item.Facade=Facade
item.PipePlug=Pipe Plug
item.bucketFuel.name=Fuel Bucket
item.bucketOil.name=Oil Bucket
item.woodenGearItem.name=Wood Gear
item.stoneGearItem.name=Stone Gear
item.ironGearItem.name=Iron Gear
item.goldGearItem.name=Gold Gear
item.diamondGearItem.name=Diamond Gear
item.templateItem.name=Template
item.wrenchItem.name=Wrench
item.pipeWaterproof.name=Pipe Sealant
item.redPipeWire.name=Red Pipe Wire
item.bluePipeWire.name=Blue Pipe Wire
item.greenPipeWire.name=Green Pipe Wire
item.yellowPipeWire.name=Yellow Pipe Wire
item.redstone_red_chipset.name=Redstone Chipset
item.redstone_iron_chipset.name=Iron Chipset
item.redstone_gold_chipset.name=Golden Chipset
item.redstone_diamond_chipset.name=Diamond Chipset
item.redstone_pulsating_chipset.name=Pulsating Chipset
item.redstone_quartz_chipset.name=Quartz Chipset
item.redstone_comp_chipset.name=Redstone Comp Chipset
item.blueprintItem.name=Blueprint
item.PipeItemsWood.name=Wooden Transport Pipe
item.PipeItemsCobblestone.name=Cobblestone Transport Pipe
item.PipeItemsStone.name=Stone Transport Pipe
item.PipeItemsQuartz.name=Quartz Transport Pipe
item.PipeItemsIron.name=Iron Transport Pipe
item.PipeItemsGold.name=Golden Transport Pipe
item.PipeItemsDiamond.name=Diamond Transport Pipe
item.PipeItemsObsidian.name=Obsidian Transport Pipe
item.PipeItemsEmerald.name=Emerald Transport Pipe
item.PipeItemsLapis.name=Lazuli Transport Pipe
item.PipeItemsDaizuli.name=Daizuli Transport Pipe
item.PipeItemsEmzuli.name=Emzuli Transport Pipe
item.PipeFluidsWood.name=Wooden Fluid Pipe
item.PipeFluidsCobblestone.name=Cobblestone Fluid Pipe
item.PipeFluidsStone.name=Stone Fluid Pipe
item.PipeFluidsIron.name=Iron Fluid Pipe
item.PipeFluidsGold.name=Golden Fluid Pipe
item.PipeFluidsEmerald.name=Emerald Fluid Pipe
item.PipePowerWood.name=Wooden Kinesis Pipe
item.PipePowerCobblestone.name=Cobblestone Kinesis Pipe
item.PipePowerStone.name=Stone Kinesis Pipe
item.PipePowerQuartz.name=Quartz Kinesis Pipe
item.PipePowerIron.name=Iron Kinesis Pipe
item.PipePowerGold.name=Golden Kinesis Pipe
item.PipePowerDiamond.name=Diamond Kinesis Pipe
item.PipeItemsStripes.name=Stripes Transport Pipe
item.PipeStructureCobblestone.name=Cobblestone Structure Pipe
item.PipeItemsVoid.name=Void Transport Pipe
item.PipeFluidsVoid.name=Void Fluid Pipe
item.PipeItemsSandstone.name=Sandstone Transport Pipe
item.PipeFluidsSandstone.name=Sandstone Fluid Pipe
item.Facade.name=Facade
item.PipePlug.name=Pipe Plug
tab.machines=Buildcraft Machines
tab.facades=Buildcraft Facades
itemGroup.buildcraft.machines=Buildcraft Machines
itemGroup.buildcraft.facades=Buildcraft Facades
tile.architectBlock=Architect Table
tile.assemblyTableBlock=Assembly Table
tile.assemblyWorkbenchBlock=Advanced Crafting Table
tile.autoWorkbenchBlock=Auto Workbench
tile.blockFuel=Fuel
tile.blockHopper=Chute
tile.blockOil=Oil
tile.builderBlock=Builder
tile.engineIron=Combustion Engine
tile.engineStone=Stirling Engine
tile.engineWood=Redstone Engine
tile.fillerBlock=Filler
tile.filteredBufferBlock=Filtered Buffer
tile.floodGateBlock=Flood Gate
tile.frameBlock=Frame
tile.integrationTableBlock=Integration Table
tile.laserBlock=Laser
tile.libraryBlock=Blueprint Library
tile.machineBlock=Quarry
tile.markerBlock=Land Mark
tile.miningWellBlock=Mining Well
tile.pathMarkerBlock=Path Marker
tile.plainPipeBlock=Mining Pipe
tile.pumpBlock=Pump
tile.refineryBlock=Refinery
tile.spring.oil=Oil Spring
tile.spring.water=Water Spring
tile.tankBlock=Tank
tile.architectBlock.name=Architect Table
tile.assemblyTableBlock.name=Assembly Table
tile.assemblyWorkbenchBlock.name=Advanced Crafting Table
tile.autoWorkbenchBlock.name=Auto Workbench
tile.blockFuel.name=Fuel
tile.blockHopper.name=Chute
tile.blockOil.name=Oil
tile.builderBlock.name=Builder
tile.engineIron.name=Combustion Engine
tile.engineStone.name=Stirling Engine
tile.engineWood.name=Redstone Engine
tile.fillerBlock.name=Filler
tile.filteredBufferBlock.name=Filtered Buffer
tile.floodGateBlock.name=Flood Gate
tile.frameBlock.name=Frame
tile.integrationTableBlock.name=Integration Table
tile.laserBlock.name=Laser
tile.libraryBlock.name=Blueprint Library
tile.machineBlock.name=Quarry
tile.markerBlock.name=Land Mark
tile.miningWellBlock.name=Mining Well
tile.pathMarkerBlock.name=Path Marker
tile.plainPipeBlock.name=Mining Pipe
tile.pumpBlock.name=Pump
tile.refineryBlock.name=Refinery
tile.spring.oil.name=Oil Spring
tile.spring.water.name=Water Spring
tile.tankBlock.name=Tank
tip.gate.wires=Compatible Wires:
tip.gate.wires=§9§oCompatible Wires:
tip.gate.wires.redstone=Red
tip.gate.wires.iron=Red, Blue
tip.gate.wires.gold=Red, Blue, Yellow
tip.gate.wires.diamond=Red, Blue, Yellow, Green
tip.gate.expansions=Installed Expansions:
tip.gate.expansions=§9§oInstalled Expansions:
tip.PipeFluidsCobblestone=Basic pipe, 10 mB/t\nWon't connect to Stone
tip.PipeFluidsEmerald=Extraction pipe, 40 mB/t

View file

@ -8,25 +8,20 @@
*/
package buildcraft;
import buildcraft.api.blueprints.BptBlock;
import buildcraft.api.bptblocks.BptBlockBed;
import buildcraft.api.bptblocks.BptBlockCustomStack;
import buildcraft.api.bptblocks.BptBlockDelegate;
import buildcraft.api.bptblocks.BptBlockDirt;
import buildcraft.api.bptblocks.BptBlockDoor;
import buildcraft.api.bptblocks.BptBlockFluid;
import buildcraft.api.bptblocks.BptBlockIgnore;
import buildcraft.api.bptblocks.BptBlockIgnoreMeta;
import buildcraft.api.bptblocks.BptBlockInventory;
import buildcraft.api.bptblocks.BptBlockLever;
import buildcraft.api.bptblocks.BptBlockPiston;
import buildcraft.api.bptblocks.BptBlockPumpkin;
import buildcraft.api.bptblocks.BptBlockRedstoneRepeater;
import buildcraft.api.bptblocks.BptBlockRotateInventory;
import buildcraft.api.bptblocks.BptBlockRotateMeta;
import buildcraft.api.bptblocks.BptBlockSign;
import buildcraft.api.bptblocks.BptBlockStairs;
import buildcraft.api.bptblocks.BptBlockWallSide;
import java.io.File;
import java.io.IOException;
import java.util.LinkedList;
import java.util.TreeMap;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import buildcraft.api.filler.FillerManager;
import buildcraft.api.filler.IFillerPattern;
import buildcraft.api.gates.ActionManager;
@ -37,16 +32,6 @@ import buildcraft.builders.BlockFiller;
import buildcraft.builders.BlockMarker;
import buildcraft.builders.BlockPathMarker;
import buildcraft.builders.EventHandlerBuilders;
import buildcraft.builders.blueprints.BlueprintDatabase;
import buildcraft.builders.filler.pattern.PatternFill;
import buildcraft.builders.filler.pattern.PatternPyramid;
import buildcraft.builders.filler.pattern.PatternStairs;
import buildcraft.builders.filler.pattern.PatternBox;
import buildcraft.builders.filler.pattern.PatternFlatten;
import buildcraft.builders.filler.pattern.PatternHorizon;
import buildcraft.builders.filler.pattern.PatternCylinder;
import buildcraft.builders.filler.FillerRegistry;
import buildcraft.builders.filler.pattern.PatternClear;
import buildcraft.builders.GuiHandler;
import buildcraft.builders.IBuilderHook;
import buildcraft.builders.ItemBlueprintStandard;
@ -57,7 +42,17 @@ import buildcraft.builders.TileBuilder;
import buildcraft.builders.TileFiller;
import buildcraft.builders.TileMarker;
import buildcraft.builders.TilePathMarker;
import buildcraft.builders.blueprints.BlueprintDatabase;
import buildcraft.builders.filler.FillerRegistry;
import buildcraft.builders.filler.pattern.FillerPattern;
import buildcraft.builders.filler.pattern.PatternBox;
import buildcraft.builders.filler.pattern.PatternClear;
import buildcraft.builders.filler.pattern.PatternCylinder;
import buildcraft.builders.filler.pattern.PatternFill;
import buildcraft.builders.filler.pattern.PatternFlatten;
import buildcraft.builders.filler.pattern.PatternHorizon;
import buildcraft.builders.filler.pattern.PatternPyramid;
import buildcraft.builders.filler.pattern.PatternStairs;
import buildcraft.builders.network.PacketHandlerBuilders;
import buildcraft.builders.triggers.ActionFiller;
import buildcraft.builders.triggers.BuildersActionProvider;
@ -69,7 +64,6 @@ import buildcraft.core.InterModComms;
import buildcraft.core.Version;
import buildcraft.core.blueprints.BptPlayerIndex;
import buildcraft.core.blueprints.BptRootIndex;
import buildcraft.core.network.PacketHandler;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.BCLog;
import cpw.mods.fml.common.Mod;
@ -86,22 +80,6 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.File;
import java.io.IOException;
import java.util.LinkedList;
import java.util.TreeMap;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Property;
@Mod(name = "BuildCraft Builders", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Builders", dependencies = DefaultProps.DEPENDENCY_CORE)
public class BuildCraftBuilders extends BuildCraftMod {
@ -148,7 +126,7 @@ public class BuildCraftBuilders extends BuildCraftMod {
public void init(FMLInitializationEvent evt) {
channels = NetworkRegistry.INSTANCE.newChannel
(DefaultProps.NET_CHANNEL_NAME + "-BUILDERS", new PacketHandlerBuilders());
// Register gui handler
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
@ -276,31 +254,24 @@ public class BuildCraftBuilders extends BuildCraftMod {
markerBlock = new BlockMarker();
CoreProxy.proxy.registerBlock(markerBlock.setBlockName("markerBlock"));
CoreProxy.proxy.addName(markerBlock, "Land Mark");
pathMarkerBlock = new BlockPathMarker();
CoreProxy.proxy.registerBlock(pathMarkerBlock.setBlockName("pathMarkerBlock"));
CoreProxy.proxy.addName(pathMarkerBlock, "Path Mark");
fillerBlock = new BlockFiller();
CoreProxy.proxy.registerBlock(fillerBlock.setBlockName("fillerBlock"));
CoreProxy.proxy.addName(fillerBlock, "Filler");
builderBlock = new BlockBuilder();
CoreProxy.proxy.registerBlock(builderBlock.setBlockName("builderBlock"));
CoreProxy.proxy.addName(builderBlock, "Builder");
architectBlock = new BlockArchitect();
CoreProxy.proxy.registerBlock(architectBlock.setBlockName("architectBlock"));
CoreProxy.proxy.addName(architectBlock, "Architect Table");
libraryBlock = new BlockBlueprintLibrary();
CoreProxy.proxy.registerBlock(libraryBlock.setBlockName("libraryBlock"));
CoreProxy.proxy.addName(libraryBlock, "Blueprint Library");
urbanistBlock = new BlockUrbanist ();
CoreProxy.proxy.registerBlock(urbanistBlock.setBlockName("urbanistBlock"));
CoreProxy.proxy.addName(urbanistBlock, "Urbanist");
CoreProxy.proxy.registerTileEntity(TileUrbanist.class, "net.minecraft.src.builders.TileUrbanist");
GameRegistry.registerTileEntity(TileMarker.class, "Marker");

View file

@ -75,7 +75,6 @@ import buildcraft.core.triggers.TriggerInventory;
import buildcraft.core.triggers.TriggerInventoryLevel;
import buildcraft.core.triggers.TriggerMachine;
import buildcraft.core.utils.BCLog;
import buildcraft.core.utils.Localization;
import buildcraft.core.recipes.AssemblyRecipeManager;
import buildcraft.core.recipes.IntegrationRecipeManager;
import buildcraft.core.recipes.RefineryRecipeManager;
@ -304,9 +303,6 @@ public class BuildCraftCore extends BuildCraftMod {
CoreProxy.proxy.initializeRendering();
CoreProxy.proxy.initializeEntityRendering();
Localization.addLocalization("/lang/buildcraft/", DefaultProps.DEFAULT_LANGUAGE);
}
@EventHandler

View file

@ -8,6 +8,22 @@
*/
package buildcraft;
import java.util.TreeMap;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import buildcraft.api.fuels.IronEngineCoolant;
import buildcraft.api.fuels.IronEngineFuel;
import buildcraft.api.recipes.BuildcraftRecipes;
@ -16,19 +32,16 @@ import buildcraft.core.BlockSpring;
import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms;
import buildcraft.core.Version;
import buildcraft.core.fluids.BCFluid;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.triggers.BCTrigger;
import buildcraft.energy.BlockBuildcraftFluid;
import buildcraft.energy.BlockEnergyEmitter;
import buildcraft.energy.BlockEnergyReceiver;
import buildcraft.energy.BlockEngine;
import buildcraft.energy.BptBlockEngine;
import buildcraft.energy.EnergyProxy;
import buildcraft.energy.GuiHandler;
import buildcraft.energy.ItemBucketBuildcraft;
import buildcraft.energy.ItemEngine;
import buildcraft.energy.BucketHandler;
import buildcraft.energy.TileEnergyEmitter;
import buildcraft.energy.TileEnergyReceiver;
import buildcraft.energy.TileEngine.EnergyStage;
@ -51,24 +64,6 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.TreeMap;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
@Mod(name = "BuildCraft Energy", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Energy", dependencies = DefaultProps.DEPENDENCY_CORE)
public class BuildCraftEnergy extends BuildCraftMod {
@ -104,9 +99,9 @@ public class BuildCraftEnergy extends BuildCraftMod {
public static BuildCraftEnergy instance;
@EventHandler
public void preInit(FMLPreInitializationEvent evt) {
int oilDesertBiomeId = BuildCraftCore.mainConfiguration.get("biomes", "oilDesert", DefaultProps.BIOME_OIL_DESERT).getInt(DefaultProps.BIOME_OIL_DESERT);
int oilOceanBiomeId = BuildCraftCore.mainConfiguration.get("biomes", "oilOcean", DefaultProps.BIOME_OIL_OCEAN).getInt(DefaultProps.BIOME_OIL_OCEAN);
public void preInit(FMLPreInitializationEvent evt) {
int oilDesertBiomeId = BuildCraftCore.mainConfiguration.get("biomes", "biomeOilDesert", DefaultProps.BIOME_OIL_DESERT).getInt(DefaultProps.BIOME_OIL_DESERT);
int oilOceanBiomeId = BuildCraftCore.mainConfiguration.get("biomes", "biomeOilOcean", DefaultProps.BIOME_OIL_OCEAN).getInt(DefaultProps.BIOME_OIL_OCEAN);
canOilBurn = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "burnOil", true, "Can oil burn?").getBoolean(true);
oilWellScalar = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "oilWellGenerationRate", 1.0, "Probability of oil well generation").getDouble(1.0);
@ -145,24 +140,23 @@ public class BuildCraftEnergy extends BuildCraftMod {
// Oil and fuel
buildcraftFluidOil = new BCFluid("oil").setDensity(800).setViscosity(1500);
buildcraftFluidOil = new Fluid("oil").setDensity(800).setViscosity(1500);
FluidRegistry.registerFluid(buildcraftFluidOil);
fluidOil = FluidRegistry.getFluid("oil");
buildcraftFluidFuel = new BCFluid("fuel");
buildcraftFluidFuel = new Fluid("fuel");
FluidRegistry.registerFluid(buildcraftFluidFuel);
fluidFuel = FluidRegistry.getFluid("fuel");
buildcraftFluidRedPlasma = new BCFluid("redplasma").setDensity(10000).setViscosity(10000).setLuminosity(30);
buildcraftFluidRedPlasma = new Fluid("redplasma").setDensity(10000).setViscosity(10000).setLuminosity(30);
FluidRegistry.registerFluid(buildcraftFluidRedPlasma);
fluidRedPlasma = FluidRegistry.getFluid("redplasma");
if (fluidOil.getBlock() == null) {
blockOil = new BlockBuildcraftFluid(fluidOil, Material.water).setFlammable(canOilBurn).setFlammability(0);
blockOil.setBlockName("blockOil");
CoreProxy.proxy.addName(blockOil, "Oil");
CoreProxy.proxy.registerBlock(blockOil);
fluidOil.setBlock(blockOil);
fluidOil.setBlock(blockOil);
} else {
blockOil = fluidOil.getBlock();
}
@ -176,17 +170,15 @@ public class BuildCraftEnergy extends BuildCraftMod {
if (fluidFuel.getBlock() == null) {
blockFuel = new BlockBuildcraftFluid(fluidFuel, Material.water).setFlammable(true).setFlammability(5).setParticleColor(0.7F, 0.7F, 0.0F);
blockFuel.setBlockName("blockFuel");
CoreProxy.proxy.addName(blockFuel, "Fuel");
CoreProxy.proxy.registerBlock(blockFuel);
fluidFuel.setBlock(blockFuel);
fluidFuel.setBlock(blockFuel);
} else {
blockFuel = fluidFuel.getBlock();
}
if (fluidRedPlasma.getBlock() == null) {
if (fluidRedPlasma.getBlock() == null) {
blockRedPlasma = new BlockBuildcraftFluid(fluidRedPlasma, Material.water).setFlammable(false).setParticleColor(0.9F, 0, 0);
blockRedPlasma.setBlockName("blockRedPlasma");
CoreProxy.proxy.addName(blockRedPlasma, "Red Plasma");
CoreProxy.proxy.registerBlock(blockRedPlasma);
fluidRedPlasma.setBlock(blockRedPlasma);
} else {
@ -219,7 +211,7 @@ public class BuildCraftEnergy extends BuildCraftMod {
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("redplasma", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(bucketRedPlasma), new ItemStack(Items.bucket));
}
// TODO: Are these still really necessary? If not, remove the
// TODO: Are these still really necessary? If not, remove the
// BucketHandler class as well.
//BucketHandler.INSTANCE.buckets.put(blockOil, bucketOil);
//BucketHandler.INSTANCE.buckets.put(blockFuel, bucketFuel);
@ -240,12 +232,10 @@ public class BuildCraftEnergy extends BuildCraftMod {
emitterBlock = new BlockEnergyEmitter ();
CoreProxy.proxy.registerBlock(emitterBlock.setBlockName("energyEmitterBlock"));
CoreProxy.proxy.addName(emitterBlock, "Energy Emitter");
CoreProxy.proxy.registerTileEntity(TileEnergyEmitter.class, "net.minecraft.src.builders.TileEnergyEmitter");
receiverBlock = new BlockEnergyReceiver ();
CoreProxy.proxy.registerBlock(receiverBlock.setBlockName("energyReceiverBlock"));
CoreProxy.proxy.addName(receiverBlock, "Energy Receiver");
CoreProxy.proxy.registerTileEntity(TileEnergyReceiver.class, "net.minecraft.src.builders.TileEnergyReceiver");
MinecraftForge.EVENT_BUS.register(this);
@ -255,8 +245,8 @@ public class BuildCraftEnergy extends BuildCraftMod {
public void init(FMLInitializationEvent evt) {
channels = NetworkRegistry.INSTANCE.newChannel
(DefaultProps.NET_CHANNEL_NAME + "-ENERGY", new PacketHandlerTransport());
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
//new BptBlockEngine(engineBlock.blockID);

View file

@ -184,43 +184,33 @@ public class BuildCraftFactory extends BuildCraftMod {
miningWellBlock = new BlockMiningWell();
CoreProxy.proxy.registerBlock(miningWellBlock.setBlockName("miningWellBlock"));
CoreProxy.proxy.addName(miningWellBlock, "Mining Well");
plainPipeBlock = new BlockPlainPipe();
CoreProxy.proxy.registerBlock(plainPipeBlock.setBlockName("plainPipeBlock"));
CoreProxy.proxy.addName(plainPipeBlock, "Mining Pipe");
autoWorkbenchBlock = new BlockAutoWorkbench();
CoreProxy.proxy.registerBlock(autoWorkbenchBlock.setBlockName("autoWorkbenchBlock"));
CoreProxy.proxy.addName(autoWorkbenchBlock, "Automatic Crafting Table");
frameBlock = new BlockFrame();
CoreProxy.proxy.registerBlock(frameBlock.setBlockName("frameBlock"));
CoreProxy.proxy.addName(frameBlock, "Frame");
quarryBlock = new BlockQuarry();
CoreProxy.proxy.registerBlock(quarryBlock.setBlockName("machineBlock"));
CoreProxy.proxy.addName(quarryBlock, "Quarry");
tankBlock = new BlockTank();
CoreProxy.proxy.registerBlock(tankBlock.setBlockName("tankBlock"));
CoreProxy.proxy.addName(tankBlock, "Tank");
pumpBlock = new BlockPump();
CoreProxy.proxy.registerBlock(pumpBlock.setBlockName("pumpBlock"));
CoreProxy.proxy.addName(pumpBlock, "Pump");
floodGateBlock = new BlockFloodGate();
CoreProxy.proxy.registerBlock(floodGateBlock.setBlockName("floodGateBlock"));
CoreProxy.proxy.addName(floodGateBlock, "Flood Gate");
refineryBlock = new BlockRefinery();
CoreProxy.proxy.registerBlock(refineryBlock.setBlockName("refineryBlock"));
CoreProxy.proxy.addName(refineryBlock, "Refinery");
hopperBlock = new BlockHopper();
CoreProxy.proxy.registerBlock(hopperBlock.setBlockName("blockHopper"));
CoreProxy.proxy.addName(hopperBlock, "Hopper");
FactoryProxy.proxy.initializeEntityRenders();

View file

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

View file

@ -8,16 +8,29 @@
*/
package buildcraft;
import java.util.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.IIconProvider;
import buildcraft.api.gates.ActionManager;
import buildcraft.api.gates.GateExpansions;
import buildcraft.api.recipes.BuildcraftRecipes;
import buildcraft.api.transport.IExtractionHandler;
import buildcraft.api.transport.PipeManager;
import buildcraft.api.transport.PipeWire;
import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms;
import buildcraft.core.ItemBuildCraft;
import buildcraft.core.Version;
import buildcraft.core.network.PacketHandler;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.triggers.BCAction;
import buildcraft.core.triggers.BCTrigger;
@ -26,8 +39,8 @@ import buildcraft.transport.BlockFilteredBuffer;
import buildcraft.transport.BlockGenericPipe;
import buildcraft.transport.GuiHandler;
import buildcraft.transport.ItemFacade;
import buildcraft.transport.gates.ItemGate;
import buildcraft.transport.ItemPipe;
import buildcraft.transport.ItemPipeWire;
import buildcraft.transport.ItemPlug;
import buildcraft.transport.ItemRobotStation;
import buildcraft.transport.Pipe;
@ -35,19 +48,11 @@ import buildcraft.transport.PipeIconProvider;
import buildcraft.transport.PipeTriggerProvider;
import buildcraft.transport.TransportProxy;
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.api.gates.GateExpansions;
import buildcraft.api.transport.PipeWire;
import buildcraft.transport.ItemPipeWire;
import buildcraft.transport.gates.GateExpansionRedstoneFader;
import buildcraft.transport.gates.GateExpansionTimer;
import buildcraft.transport.gates.ItemGate;
import buildcraft.transport.network.PacketHandlerTransport;
import buildcraft.transport.network.PacketPipeTransportTraveler;
import buildcraft.transport.pipes.PipeFluidsCobblestone;
import buildcraft.transport.pipes.PipeFluidsEmerald;
import buildcraft.transport.pipes.PipeFluidsGold;
@ -60,9 +65,9 @@ import buildcraft.transport.pipes.PipeItemsCobblestone;
import buildcraft.transport.pipes.PipeItemsDaizuli;
import buildcraft.transport.pipes.PipeItemsDiamond;
import buildcraft.transport.pipes.PipeItemsEmerald;
import buildcraft.transport.pipes.PipeItemsEmzuli;
import buildcraft.transport.pipes.PipeItemsGold;
import buildcraft.transport.pipes.PipeItemsIron;
import buildcraft.transport.pipes.PipeItemsEmzuli;
import buildcraft.transport.pipes.PipeItemsLapis;
import buildcraft.transport.pipes.PipeItemsObsidian;
import buildcraft.transport.pipes.PipeItemsQuartz;
@ -85,15 +90,15 @@ import buildcraft.transport.triggers.ActionExtractionPreset;
import buildcraft.transport.triggers.ActionPipeColor;
import buildcraft.transport.triggers.ActionPipeDirection;
import buildcraft.transport.triggers.ActionPowerLimiter;
import buildcraft.transport.triggers.ActionRedstoneFaderOutput;
import buildcraft.transport.triggers.ActionSignalOutput;
import buildcraft.transport.triggers.ActionSingleEnergyPulse;
import buildcraft.transport.triggers.TriggerPipeContents;
import buildcraft.transport.triggers.TriggerClockTimer;
import buildcraft.transport.triggers.TriggerClockTimer.Time;
import buildcraft.transport.triggers.TriggerPipeContents;
import buildcraft.transport.triggers.TriggerPipeContents.PipeContents;
import buildcraft.transport.triggers.TriggerPipeSignal;
import buildcraft.transport.triggers.TriggerRedstoneFaderInput;
import buildcraft.transport.triggers.ActionRedstoneFaderOutput;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
@ -105,19 +110,6 @@ import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import java.util.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.common.config.Property;
@Mod(version = Version.VERSION, modid = "BuildCraft|Transport", name = "Buildcraft Transport", dependencies = DefaultProps.DEPENDENCY_CORE)
public class BuildCraftTransport extends BuildCraftMod {
@ -211,7 +203,7 @@ public class BuildCraftTransport extends BuildCraftMod {
return testStrings(liquids, world, i, j, k);
}
private boolean testStrings(String[] excludedBlocks, World world, int i, int j, int k) {
private boolean testStrings(String[] excludedBlocks, World world, int i, int j, int k) {
Block block = world.getBlock(i, j, k);
if (block == null)
return false;
@ -342,12 +334,10 @@ public class BuildCraftTransport extends BuildCraftMod {
filteredBufferBlock = new BlockFilteredBuffer();
CoreProxy.proxy.registerBlock(filteredBufferBlock.setBlockName("filteredBufferBlock"));
CoreProxy.proxy.addName(filteredBufferBlock, "Filtered Buffer");
for (PipeContents kind : PipeContents.values()) {
triggerPipe[kind.ordinal()] = new TriggerPipeContents(kind);
}
for (PipeWire wire : PipeWire.values()) {
triggerPipeWireActive[wire.ordinal()] = new TriggerPipeSignal(true, wire);
triggerPipeWireInactive[wire.ordinal()] = new TriggerPipeSignal(false, wire);
@ -383,7 +373,7 @@ public class BuildCraftTransport extends BuildCraftMod {
public void init(FMLInitializationEvent evt) {
channels = NetworkRegistry.INSTANCE.newChannel
(DefaultProps.NET_CHANNEL_NAME + "-TRANSPORT", new PacketHandlerTransport());
// Register connection handler
// MinecraftForge.registerConnectionHandler(new ConnectionHandler());

View file

@ -77,7 +77,7 @@ public class GuiBlueprintLibrary extends GuiBuildCraft {
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
// fontRenderer.drawString(library.owner + "'s Library", 6, 6,
// 0x404040);
String title = StringUtils.localize("tile.libraryBlock");
String title = StringUtils.localize("tile.libraryBlock.name");
fontRendererObj.drawString(title, getCenteredOffset(title), 6, 0x404040);
int c = 0;

View file

@ -50,7 +50,7 @@ public class GuiBuilder extends GuiAdvancedInterface {
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
super.drawGuiContainerForegroundLayer(par1, par2);
String title = StringUtils.localize("tile.builderBlock");
String title = StringUtils.localize("tile.builderBlock.name");
fontRendererObj.drawString(title, getCenteredOffset(title), 12, 0x404040);
fontRendererObj.drawString(StringUtils.localize("gui.building.resources"), 8, 60, 0x404040);
fontRendererObj.drawString(StringUtils.localize("gui.inventory"), 8, ySize - 97, 0x404040);

View file

@ -61,7 +61,7 @@ public class GuiFiller extends GuiBuildCraft {
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
String title = StringUtils.localize("tile.fillerBlock");
String title = StringUtils.localize("tile.fillerBlock.name");
fontRendererObj.drawString(title, getCenteredOffset(title), 6, 0x404040);
fontRendererObj.drawString(StringUtils.localize("gui.filling.resources"), 8, 74, 0x404040);
fontRendererObj.drawString(StringUtils.localize("gui.inventory"), 8, 142, 0x404040);

View file

@ -44,7 +44,7 @@ public class GuiTemplate extends GuiBuildCraft {
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
String title = StringUtils.localize("tile.architectBlock");
String title = StringUtils.localize("tile.architectBlock.name");
fontRendererObj.drawString(title, getCenteredOffset(title), 6, 0x404040);
fontRendererObj.drawString(StringUtils.localize("gui.inventory"), 8, ySize - 152, 0x404040);

View file

@ -1,16 +1,13 @@
package buildcraft.core;
import buildcraft.BuildCraftCore;
import buildcraft.core.utils.Localization;
import buildcraft.transport.ItemFacade;
import java.util.Locale;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import buildcraft.BuildCraftCore;
import buildcraft.transport.ItemFacade;
public enum CreativeTabBuildCraft {
@ -30,10 +27,6 @@ public enum CreativeTabBuildCraft {
return "buildcraft." + name().toLowerCase(Locale.ENGLISH);
}
private String translate() {
return Localization.get("tab." + name().toLowerCase(Locale.ENGLISH));
}
private ItemStack getItem() {
switch (this) {
case FACADES:
@ -55,11 +48,6 @@ public enum CreativeTabBuildCraft {
return getItem();
}
@Override
public String getTranslatedTabLabel() {
return translate();
}
@Override
public Item getTabIconItem() {
return getItem().getItem();

View file

@ -23,9 +23,4 @@ public class ItemBlockBuildCraft extends ItemBlock {
public int getMetadata(int i) {
return i;
}
@Override
public String getItemStackDisplayName(ItemStack itemstack) {
return StringUtils.localize(getUnlocalizedName(itemstack));
}
}

View file

@ -27,11 +27,6 @@ public class ItemBuildCraft extends Item {
setCreativeTab(CreativeTabBuildCraft.MACHINES.get());
}
@Override
public String getItemStackDisplayName(ItemStack itemstack) {
return StringUtils.localize(getUnlocalizedName(itemstack));
}
@Override
public Item setUnlocalizedName(String par1Str) {
iconName = par1Str;

View file

@ -1,24 +0,0 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* 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.fluids;
import buildcraft.core.utils.StringUtils;
import net.minecraftforge.fluids.Fluid;
public class BCFluid extends Fluid {
public BCFluid(String name) {
super(name);
}
@Override
public String getLocalizedName() {
return StringUtils.localize("fluid." + fluidName);
}
}

View file

@ -26,6 +26,9 @@ public class PacketGuiReturn extends BuildCraftPacket {
private IGuiReturnHandler obj;
private byte[] extraData;
public PacketGuiReturn() {
}
public PacketGuiReturn(EntityPlayer sender) {
this.sender = sender;
}

View file

@ -16,7 +16,7 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.entity.player.EntityPlayer;
public class PacketGuiWidget extends BuildCraftPacket {
@ -45,7 +45,7 @@ public class PacketGuiWidget extends BuildCraftPacket {
windowId = data.readByte();
widgetId = data.readByte();
EntityClientPlayerMP player = FMLClientHandler.instance().getClient().thePlayer;
EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
if (player.openContainer instanceof BuildCraftContainer && player.openContainer.windowId == windowId) {
((BuildCraftContainer) player.openContainer).handleWidgetClientData(widgetId, data);

View file

@ -65,10 +65,6 @@ public class CoreProxy {
return null;
}
public String getCurrentLanguage() {
return null;
}
/* ENTITY HANDLING */
public void removeEntity(Entity entity) {
entity.worldObj.removeEntity(entity);
@ -79,13 +75,6 @@ public class CoreProxy {
public void feedSubBlocks(Block block, CreativeTabs tab, List itemList) {
}
/* LOCALIZATION */
public void addName(Object obj, String s) {
}
public void addLocalization(String s1, String string) {
}
public String getItemDisplayName(ItemStack newStack) {
return "";
}

View file

@ -80,22 +80,6 @@ public class CoreProxyClient extends CoreProxy {
block.getSubBlocks(Item.getItemFromBlock(block), tab, itemList);
}
/* LOCALIZATION */
@Override
public String getCurrentLanguage() {
return Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode();
}
@Override
public void addName(Object obj, String s) {
LanguageRegistry.addName(obj, s);
}
@Override
public void addLocalization(String s1, String string) {
LanguageRegistry.instance().addStringLocalization(s1, string);
}
@Override
public String getItemDisplayName(ItemStack stack) {
if (stack.getItem() == null)

View file

@ -1,140 +0,0 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* 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.utils;
import buildcraft.core.proxy.CoreProxy;
import java.io.IOException;
import java.io.InputStream;
import java.util.LinkedList;
import java.util.Properties;
/**
* Simple mod localization class.
*/
public class Localization {
private static class modInfo {
final String modName, defaultLanguage;
public modInfo(String modName, String defaultLanguage) {
this.modName = modName;
this.defaultLanguage = defaultLanguage;
}
}
private static String loadedLanguage = getCurrentLanguage();
private static Properties defaultMappings = new Properties();
private static Properties mappings = new Properties();
private static LinkedList<modInfo> mods = new LinkedList<modInfo>();
/**
* Adds localization from a given directory. The files must have the same name as the corresponding language file in minecraft and a ".properties" file
* extention e.g "en_US.properties"
*
* @param path
* The path to the localization files
* @param defaultLanguage
* The default localization to be used when there is no localization for the selected language or if a string is missing (e.g. "en_US")
*/
public static void addLocalization(String path, String defaultLanguage) {
mods.add(new modInfo(path, defaultLanguage));
load(path, defaultLanguage);
}
/**
* Get a string for the given key, in the currently active translation.
*
* @param key
* @return
*/
public static synchronized String get(String key) {
if (getCurrentLanguage() == null) {
return key;
}
if (!getCurrentLanguage().equals(loadedLanguage)) {
defaultMappings.clear();
mappings.clear();
for (modInfo mInfo : mods) {
load(mInfo.modName, mInfo.defaultLanguage);
}
loadedLanguage = getCurrentLanguage();
}
return mappings.getProperty(key, defaultMappings.getProperty(key, key));
}
public static synchronized boolean hasKey(String key) {
if (getCurrentLanguage() == null) {
return false;
}
if (!getCurrentLanguage().equals(loadedLanguage)) {
defaultMappings.clear();
mappings.clear();
for (modInfo mInfo : mods) {
load(mInfo.modName, mInfo.defaultLanguage);
}
loadedLanguage = getCurrentLanguage();
}
return mappings.getProperty(key, defaultMappings.getProperty(key)) != null;
}
private static void load(String path, String default_language) {
InputStream langStream = null;
Properties modMappings = new Properties();
try {
// Load the default language mappings
langStream = Localization.class.getResourceAsStream(path + default_language + ".properties");
modMappings.load(langStream);
defaultMappings.putAll(modMappings);
langStream.close();
// Try to load the current language mappings.
// If the file doesn't exist use the default mappings.
langStream = Localization.class.getResourceAsStream(path + getCurrentLanguage() + ".properties");
if (langStream != null) {
modMappings.clear();
modMappings.load(langStream);
}
// If the selected language inherits mappings from another language
// we use those first and then we overwrite the common ones with
// those in the selected language
if (modMappings.containsKey("language.parent")) {
langStream = Localization.class.getResourceAsStream(path + modMappings.get("language.parent") + ".properties");
if (langStream != null) {
Properties parentModMappings = new Properties();
parentModMappings.load(langStream);
mappings.putAll(parentModMappings);
}
}
mappings.putAll(modMappings);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (langStream != null) {
langStream.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
private static String getCurrentLanguage() {
return CoreProxy.proxy.getCurrentLanguage();
}
}

View file

@ -8,9 +8,19 @@
*/
package buildcraft.core.utils;
import com.google.common.base.Splitter;
import net.minecraft.util.StatCollector;
public class StringUtils {
public static String localize(String key) {
return Localization.get(key);
}
}
public static final Splitter newLineSplitter = Splitter.on("\\n");
public static String localize(String key) {
return StatCollector.translateToLocal(key);
}
public static boolean canLocalize(String key) {
return StatCollector.canTranslate(key);
}
}

View file

@ -29,11 +29,6 @@ public class ItemBucketBuildcraft extends ItemBucket {
setContainerItem(Items.bucket);
}
@Override
public String getItemStackDisplayName(ItemStack itemstack) {
return StringUtils.localize(getUnlocalizedName(itemstack));
}
@Override
public Item setUnlocalizedName(String par1Str) {
iconName = par1Str;

View file

@ -35,7 +35,7 @@ public class GuiCombustionEngine extends GuiEngine {
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
super.drawGuiContainerForegroundLayer(par1, par2);
String title = StringUtils.localize("tile.engineIron");
String title = StringUtils.localize("tile.engineIron.name");
fontRendererObj.drawString(title, getCenteredOffset(title), 6, 0x404040);
fontRendererObj.drawString(StringUtils.localize("gui.inventory"), 8, (ySize - 96) + 2, 0x404040);
}

View file

@ -29,7 +29,7 @@ public class GuiStoneEngine extends GuiEngine {
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
super.drawGuiContainerForegroundLayer(par1, par2);
String title = StringUtils.localize("tile.engineStone");
String title = StringUtils.localize("tile.engineStone.name");
fontRendererObj.drawString(title, getCenteredOffset(title), 6, 0x404040);
fontRendererObj.drawString(StringUtils.localize("gui.inventory"), 8, (ySize - 96) + 2, 0x404040);
}

View file

@ -16,6 +16,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidBase;
import net.minecraftforge.fluids.IFluidBlock;
@SideOnly(Side.CLIENT)
public class EntityDropParticleFX extends EntityFX {
@ -96,8 +97,8 @@ public class EntityDropParticleFX extends EntityFX {
Material material = block.getMaterial();
if (material.isLiquid() || material.isSolid()) {
double d0 = (double) ((float) (MathHelper.floor_double(this.posY) + 1) - ((BlockFluidBase) block)
if ((material.isLiquid() || material.isSolid()) && block instanceof IFluidBlock) {
double d0 = (double) ((float) (MathHelper.floor_double(this.posY) + 1) - ((IFluidBlock) block)
.getFilledPercentage(worldObj, x, y, z));
if (this.posY < d0) {

View file

@ -37,7 +37,7 @@ public class GuiAutoCrafting extends GuiBuildCraft {
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
String title = StringUtils.localize("tile.autoWorkbenchBlock");
String title = StringUtils.localize("tile.autoWorkbenchBlock.name");
fontRendererObj.drawString(title, getCenteredOffset(title), 6, 0x404040);
fontRendererObj.drawString(StringUtils.localize("gui.inventory"), 8, (ySize - 96) + 2, 0x404040);
}

View file

@ -45,7 +45,7 @@ public class GuiRefinery extends GuiAdvancedInterface {
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
String title = StringUtils.localize("tile.refineryBlock");
String title = StringUtils.localize("tile.refineryBlock.name");
fontRendererObj.drawString(title, getCenteredOffset(title), 6, 0x404040);
fontRendererObj.drawString("->", 63, 59, 0x404040);
fontRendererObj.drawString("<-", 106, 59, 0x404040);

View file

@ -218,7 +218,7 @@ public class TileAdvancedCraftingTable extends TileLaserTableBase implements IIn
@Override
public String getInventoryName() {
return StringUtils.localize("tile.assemblyWorkbenchBlock");
return StringUtils.localize("tile.assemblyWorkbenchBlock.name");
}
@Override

View file

@ -130,7 +130,7 @@ public class TileAssemblyTable extends TileLaserTableBase implements IMachine, I
@Override
public String getInventoryName() {
return StringUtils.localize("tile.assemblyTableBlock");
return StringUtils.localize("tile.assemblyTableBlock.name");
}
@Override

View file

@ -164,7 +164,7 @@ public class TileIntegrationTable extends TileLaserTableBase implements ISidedIn
@Override
public String getInventoryName() {
return StringUtils.localize("tile.integrationTableBlock");
return StringUtils.localize("tile.integrationTableBlock.name");
}
@Override

View file

@ -139,7 +139,7 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
super.drawGuiContainerForegroundLayer(par1, par2);
String title = StringUtils.localize("tile.assemblyTableBlock");
String title = StringUtils.localize("tile.assemblyTableBlock.name");
fontRendererObj.drawString(title, getCenteredOffset(title), 15, 0x404040);
fontRendererObj.drawString(StringUtils.localize("gui.inventory"), 8, ySize - 97, 0x404040);
drawForegroundSelection(par1, par2);

View file

@ -8,15 +8,19 @@
*/
package buildcraft.transport;
import buildcraft.core.utils.Localization;
import buildcraft.core.utils.StringUtils;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
@SideOnly(Side.CLIENT)
public class PipeToolTipManager {
@ -35,13 +39,13 @@ public class PipeToolTipManager {
public static List<String> getToolTip(Class<? extends Pipe> pipe) {
List<String> tips = new ArrayList<String>();
String tipTag = "tip." + pipe.getSimpleName();
if (Localization.hasKey(tipTag)) {
String localized = Localization.get(tipTag);
if (localized != null) {
String[] lines = localized.split("\\n");
if (StringUtils.canLocalize(tipTag)) {
String localized = StringUtils.localize(tipTag);
if (localized != null) {
String[] lines = (String[])Iterables.toArray(StringUtils.newLineSplitter.split(localized), String.class);
tips.addAll(Arrays.asList(lines));
}
}
}
String tip = toolTips.get(pipe);
if (tip != null)
tips.add(tip);

View file

@ -16,7 +16,7 @@ import buildcraft.api.gates.IAction;
import buildcraft.api.gates.ITrigger;
import buildcraft.core.ItemBuildCraft;
import buildcraft.core.inventory.InvUtils;
import buildcraft.core.utils.Localization;
import buildcraft.core.utils.StringUtils;
import buildcraft.core.utils.Utils;
import buildcraft.transport.Gate;
import buildcraft.transport.gates.GateDefinition.GateLogic;
@ -39,6 +39,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
public class ItemGate extends ItemBuildCraft {
@ -174,6 +175,12 @@ public class ItemGate extends ItemBuildCraft {
public String getUnlocalizedName(ItemStack stack) {
return GateDefinition.getLocalizedName(getMaterial(stack), getLogic(stack));
}
@Override
public String getItemStackDisplayName(ItemStack stack)
{
return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack))).trim();
}
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
@ -216,12 +223,12 @@ public class ItemGate extends ItemBuildCraft {
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean adv) {
super.addInformation(stack, player, list, adv);
list.add("§9§o" + Localization.get("tip.gate.wires"));
list.add(Localization.get("tip.gate.wires." + getMaterial(stack).getTag()));
list.add(StringUtils.localize("tip.gate.wires"));
list.add(StringUtils.localize("tip.gate.wires." + getMaterial(stack).getTag()));
Set<IGateExpansion> expansions = getInstalledExpansions(stack);
if (!expansions.isEmpty()) {
list.add("§9§o" + Localization.get("tip.gate.expansions"));
list.add(StringUtils.localize("tip.gate.expansions"));
for (IGateExpansion expansion : expansions) {
list.add(expansion.getDisplayName());

View file

@ -53,7 +53,7 @@ public class GuiFilteredBuffer extends GuiContainer {
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
String title = StringUtils.localize("tile.filteredBufferBlock");
String title = StringUtils.localize("tile.filteredBufferBlock.name");
int xPos = (xSize - fontRendererObj.getStringWidth(title)) / 2;
fontRendererObj.drawString(title, xPos, 10, 0x404040);
}