summaryrefslogtreecommitdiff
path: root/ihl
diff options
context:
space:
mode:
authorFoghrye4 <foghrye4@gmail.com>2017-04-14 07:58:16 +0300
committerFoghrye4 <foghrye4@gmail.com>2017-04-14 07:58:16 +0300
commitaa42aedecd2d2842351088085e8fd9d69ec79565 (patch)
tree94c888b3d362868f427980dd37765f9bb166dba9 /ihl
parentfb29b09822057ae7b1b913993dc1fa3a67345eec (diff)
Colourful lights
Diffstat (limited to 'ihl')
-rw-r--r--ihl/ClientProxy.java24
-rw-r--r--ihl/IHLMod.java303
-rw-r--r--ihl/IHLModInfo.java2
-rw-r--r--ihl/ServerProxy.java46
-rw-r--r--ihl/enviroment/GlowningAirBlock.java34
-rw-r--r--ihl/enviroment/LightBulbBlock.java60
-rw-r--r--ihl/enviroment/LightBulbRender.java2
-rw-r--r--ihl/enviroment/LightBulbTileEntity.java88
-rw-r--r--ihl/enviroment/LightHandler.java76
-rw-r--r--ihl/enviroment/LightSource.java167
-rw-r--r--ihl/enviroment/SpotlightBlock.java49
-rw-r--r--ihl/enviroment/SpotlightRender.java1
-rw-r--r--ihl/enviroment/SpotlightTileEntity.java451
-rw-r--r--ihl/explosion/ExplosionVectorBlockV2.java50
-rw-r--r--ihl/items_blocks/ItemSubstance.java4
-rw-r--r--ihl/model/RenderBlocksExt.java301
-rw-r--r--ihl/model/TileEntityRendererDispatcherExt.java58
-rw-r--r--ihl/nei_integration/FluidizedBedReactorRecipeHandler.java6
-rw-r--r--ihl/nei_integration/LabElectrolyzerRecipeHandler.java24
-rw-r--r--ihl/nei_integration/PaperMachineRecipeHandler.java9
-rw-r--r--ihl/processing/chemistry/BasicElectricMotorContainer.java74
-rw-r--r--ihl/processing/chemistry/ChemicalReactorContainer.java114
-rw-r--r--ihl/processing/chemistry/CryogenicDistillerContainer.java60
-rw-r--r--ihl/processing/chemistry/CryogenicDistillerGui.java2
-rw-r--r--ihl/processing/chemistry/FluidizedBedReactorContainer.java68
-rw-r--r--ihl/processing/chemistry/FluidizedBedReactorGui.java88
-rw-r--r--ihl/processing/chemistry/LabElectrolyzerContainer.java162
-rw-r--r--ihl/processing/chemistry/LabElectrolyzerGui.java119
-rw-r--r--ihl/processing/chemistry/PaperMachineContainer.java70
-rw-r--r--ihl/processing/invslots/InvSlotUpgradeIHL.java61
-rw-r--r--ihl/processing/metallurgy/BasicElectricMotorTileEntity.java27
-rw-r--r--ihl/utils/BlockItemRender.java12
-rw-r--r--ihl/utils/GuiMultiTextureButton.java3
-rw-r--r--ihl/utils/IHLItemRenderer.java3
-rw-r--r--ihl/utils/IHLMathUtils.java8
-rw-r--r--ihl/utils/IHLRenderUtils.java3
-rw-r--r--ihl/utils/IHLUtils.java6
37 files changed, 1516 insertions, 1119 deletions
diff --git a/ihl/ClientProxy.java b/ihl/ClientProxy.java
index b3583db..b257264 100644
--- a/ihl/ClientProxy.java
+++ b/ihl/ClientProxy.java
@@ -16,6 +16,7 @@ import ihl.enviroment.LightBulbModel;
import ihl.enviroment.LightBulbRender;
import ihl.enviroment.LightBulbTileEntity;
import ihl.enviroment.LightHandler;
+import ihl.enviroment.LightSource;
import ihl.enviroment.MirrorRender;
import ihl.enviroment.MirrorTileEntity;
import ihl.enviroment.SpotlightModel;
@@ -103,6 +104,7 @@ import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
+import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -151,7 +153,7 @@ public class ClientProxy extends ServerProxy {
}
this.renderUtils = new IHLRenderUtils();
MinecraftForge.EVENT_BUS.register(this.renderUtils);
-
+ TileEntityRendererDispatcher.instance = new TileEntityRendererDispatcherExt();
registerBlockHandler(new ImpregnatingMachineBlockRender(), MachineType.BronzeTub);
registerBlockHandler(new RefluxCondenserBlockRender(), MachineType.RefluxCondenser);
registerBlockHandler(new RectifierTransformerUnitBlockRender(), MachineType.RectifierTransformerUnit);
@@ -431,6 +433,26 @@ public class ClientProxy extends ServerProxy {
float pitch = byteBufInputStream.readFloat();
this.playSound(world, soundId, x, y, z, volume, pitch);
break;
+ case 4:
+ posX = byteBufInputStream.readInt();
+ posY = byteBufInputStream.readInt();
+ posZ = byteBufInputStream.readInt();
+ for (LightSource lightSource : ((ClientProxy) IHLMod.proxy).getLightHandler().lightSources) {
+ if (lightSource.isBlockIlluminated(posX, posY, posZ)) {
+ lightSource.provideLight(world, posX, posY, posZ);
+ }
+ }
+ break;
+ case 5:
+ posX = byteBufInputStream.readInt();
+ posY = byteBufInputStream.readInt();
+ posZ = byteBufInputStream.readInt();
+ for (LightSource lightSource : ((ClientProxy) IHLMod.proxy).getLightHandler().lightSources) {
+ if (lightSource.isBlockIlluminated(posX, posY, posZ)) {
+ lightSource.castShadow(world, posX, posY, posZ);
+ }
+ }
+ break;
}
byteBufInputStream.close();
}
diff --git a/ihl/IHLMod.java b/ihl/IHLMod.java
index b8b7231..cae4657 100644
--- a/ihl/IHLMod.java
+++ b/ihl/IHLMod.java
@@ -119,6 +119,7 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.BiomeDictionary.Type;
@@ -174,7 +175,7 @@ public class IHLMod implements IFuelHandler {
public static FluidDictionary fluidDictionary;
public static Map<String, Integer> moltenAmounts = new HashMap<String, Integer>();
public static ExplosionVectorBlockV2 explosionHandler;
-
+
@EventHandler
public void preInit(FMLPreInitializationEvent evt) throws IOException, ParserConfigurationException {
fluidDictionary = new FluidDictionary();
@@ -258,7 +259,7 @@ public class IHLMod implements IFuelHandler {
OreDictionary.registerOre("ingotBrick", Items.brick);
OreDictionary.registerOre("dustGunpowder", Items.gunpowder);
OreDictionary.registerOre("toolLighter", Items.flint_and_steel);
- OreDictionary.registerOre("charcoal", new ItemStack(Items.coal,1,1));
+ OreDictionary.registerOre("charcoal", new ItemStack(Items.coal, 1, 1));
OreDictionary.registerOre("blockDirt", new ItemStack(Blocks.dirt, 1, OreDictionary.WILDCARD_VALUE));
OreDictionary.registerOre("blockDirt", new ItemStack(Blocks.grass, 1, OreDictionary.WILDCARD_VALUE));
OreDictionary.registerOre("platePaper", new ItemStack(Items.paper, 1, OreDictionary.WILDCARD_VALUE));
@@ -422,8 +423,8 @@ public class IHLMod implements IFuelHandler {
IHLUtils.getOreDictItemStack("dustTin"), IHLUtils.getThisModItemStack("dustTinyAntimony") });
Recipes.advRecipes.addRecipe(IHLUtils.getThisModItemStack("achesonFurnance"),
new Object[] { "BPB", "S S", "B B", Character.valueOf('B'), new RecipeInputOreDict("ingotBrick"),
- Character.valueOf('P'), new RecipeInputOreDict("plateSteel"),
- Character.valueOf('S'), new RecipeInputOreDict("stickCoal")});
+ Character.valueOf('P'), new RecipeInputOreDict("plateSteel"), Character.valueOf('S'),
+ new RecipeInputOreDict("stickCoal") });
Recipes.advRecipes.addRecipe(IHLUtils.getThisModItemStack("muffleFurnance"),
new Object[] { "BCB", "SDP", "BSB", Character.valueOf('B'), new RecipeInputOreDict("ingotBrick"),
Character.valueOf('P'), new RecipeInputOreDict("plateSteel"), Character.valueOf('C'),
@@ -530,6 +531,8 @@ public class IHLMod implements IFuelHandler {
IHLUtils.getOreDictItemStack("plateCoal"), 20F);
FurnaceRecipes.smelting().func_151394_a(IHLUtils.getOreDictItemStackWithSize("dustCalcite", 3),
IHLUtils.getOreDictItemStack("dustQuicklime"), 2F);
+ FurnaceRecipes.smelting().func_151394_a(IHLUtils.getThisModItemStack("catalystRawIronOxide"),
+ IHLUtils.getThisModItemStack("catalystIronOxide"), 2F);
ItemSubstance.postInit();
ItemStack lathingTool = Ic2Items.LathingTool.copy();
lathingTool.setItemDamage(OreDictionary.WILDCARD_VALUE);
@@ -755,8 +758,7 @@ public class IHLMod implements IFuelHandler {
new ItemStack(Items.stick, 8), IHLUtils.getThisModItemStackWithSize("nailSteel", 8) }),
Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("loom") })));
IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(
- Arrays.asList(
- new ItemStack[] { IHLUtils.getThisModItemStack("hammer")}),
+ Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("hammer") }),
Arrays.asList(new ItemStack[] {
IHLUtils.getThisModItemStack("detonationSprayingMachineSetOfMoldedPartsBronze"),
new ItemStack(Blocks.planks), IHLUtils.getThisModItemStackWithSize("nailSteel", 8) }),
@@ -832,24 +834,27 @@ public class IHLMod implements IFuelHandler {
IHLUtils.getThisModItemStackWithSize("barD10Steel", 4) }),
Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("chemicalReactor") }),
Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("gasWeldingStation") })));
- IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(
- Arrays.asList(new IRecipeInput[] {
- new RecipeInputItemStack(IHLUtils.getThisModItemStack("handDrillBronze")),
- new RecipeInputItemStack(IHLUtils.getThisModItemStack("drillSteelHardened"))
- }),
- Arrays.asList(new IRecipeInput[] {
- new RecipeInputItemStack(IHLUtils.getThisModItemStack("electricMotorLVLEDC")),
- new RecipeInputItemStack(IHLUtils.getThisModItemStack("pipelineAccessoriesSteel")),
- new RecipeInputOreDict("foilRubber"),
- new RecipeInputItemStack(IHLUtils.getThisModItemStack("highPressureVesselSteel")),
- new RecipeInputItemStack(IHLUtils.getThisModItemStack("pistonCylinderSteel")),
- new RecipeInputItemStack(IHLUtils.getThisModItemStackWithSize("boltM10x1Steel",8)),
- new RecipeInputItemStack(IHLUtils.getThisModItemStackWithSize("nutM10x1Steel",8))}),
- Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("dosingPump") })));
+ IronWorkbenchTileEntity.addRecipe(
+ new IronWorkbenchRecipe(
+ Arrays.asList(
+ new IRecipeInput[] {
+ new RecipeInputItemStack(IHLUtils.getThisModItemStack("handDrillBronze")),
+ new RecipeInputItemStack(
+ IHLUtils.getThisModItemStack("drillSteelHardened")) }),
+ Arrays.asList(new IRecipeInput[] {
+ new RecipeInputItemStack(IHLUtils.getThisModItemStack("electricMotorLVLEDC")),
+ new RecipeInputItemStack(IHLUtils.getThisModItemStack("pipelineAccessoriesSteel")),
+ new RecipeInputOreDict("foilRubber"),
+ new RecipeInputItemStack(IHLUtils.getThisModItemStack("highPressureVesselSteel")),
+ new RecipeInputItemStack(IHLUtils.getThisModItemStack("pistonCylinderSteel")),
+ new RecipeInputItemStack(IHLUtils.getThisModItemStackWithSize("boltM10x1Steel", 8)),
+ new RecipeInputItemStack(
+ IHLUtils.getThisModItemStackWithSize("nutM10x1Steel", 8)) }),
+ Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("dosingPump") })));
IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(Arrays.asList(new ItemStack[] {
IHLUtils.getThisModItemStack("hammer"), IHLUtils.getThisModItemStack("handDrillBronze"),
IHLUtils.getThisModItemStack("hackSawSteel"), IHLUtils.getThisModItemStack("drillSteelHardened"),
- IHLUtils.getThisModItemStack("diceM10x1SteelHardened")}),
+ IHLUtils.getThisModItemStack("diceM10x1SteelHardened") }),
Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStackWithSize("barD10SteelHot", 7),
IHLUtils.getOreDictItemStack("plateSteel"), new ItemStack(Items.leather),
IHLUtils.getThisModItemStackWithSize("nailSteel", 8), new ItemStack(Blocks.log) }),
@@ -1166,6 +1171,40 @@ public class IHLMod implements IFuelHandler {
new RecipeInputItemStack(new ItemStack(Blocks.wool)) }),
Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStackWithSize("mirror", 16) })));
}
+ Map<String, Integer> dyeMap = new HashMap<String, Integer>();
+ dyeMap.put("dyePurple", 0xff00ff);
+ dyeMap.put("dyeCyan", 0x00ffff);
+ dyeMap.put("dyeLightGray", 0xaaaaaa);
+ dyeMap.put("dyeGray", 0x888888);
+ dyeMap.put("dyePink", 0xff8888);
+ dyeMap.put("dyeLime", 0x88ff88);
+ dyeMap.put("dyeLightBlue", 0x8888ff);
+ dyeMap.put("dyeBlue", 0x0000ff);
+ dyeMap.put("dyeGreen", 0x00ff00);
+ dyeMap.put("dyeRed", 0xff0000);
+ dyeMap.put("dyeBlack", 0x000000);
+ dyeMap.put("dyeMagenta", 0xff88ff);
+ dyeMap.put("dyeOrange", 0xff8800);
+ dyeMap.put("dyeWhite", 0xffffff);
+ dyeMap.put("dyeBrown", 0x804000);
+ dyeMap.put("dyeYellow", 0xffff00);
+ Map<String, Integer> paneGlassMap = new HashMap<String, Integer>();
+ paneGlassMap.put("paneGlassPurple", 0xff00ff);
+ paneGlassMap.put("paneGlassCyan", 0x00ffff);
+ paneGlassMap.put("paneGlassLightGray", 0xaaaaaa);
+ paneGlassMap.put("paneGlassGray", 0x888888);
+ paneGlassMap.put("paneGlassPink", 0xff8888);
+ paneGlassMap.put("paneGlassLime", 0x88ff88);
+ paneGlassMap.put("paneGlassLightBlue", 0x8888ff);
+ paneGlassMap.put("paneGlassBlue", 0x0000ff);
+ paneGlassMap.put("paneGlassGreen", 0x00ff00);
+ paneGlassMap.put("paneGlassRed", 0xff0000);
+ paneGlassMap.put("paneGlassBlack", 0x000000);
+ paneGlassMap.put("paneGlassMagenta", 0xff88ff);
+ paneGlassMap.put("paneGlassOrange", 0xff8800);
+ paneGlassMap.put("paneGlassWhite", 0xffffff);
+ paneGlassMap.put("paneGlassBrown", 0x804000);
+ paneGlassMap.put("paneGlassYellow", 0xffff00);
IronWorkbenchTileEntity.addRecipe(
new IronWorkbenchRecipe(
Arrays.asList(
@@ -1179,6 +1218,25 @@ public class IHLMod implements IFuelHandler {
Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStackWithSize("lightBulb", 16) }),
Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("gasWeldingStation"),
IHLUtils.getThisModItemStack("gaedesMercuryRotaryPump") })));
+ for (Map.Entry<String, Integer> dyeEntry : dyeMap.entrySet()) {
+ ItemStack lightBulb = IHLUtils.getThisModItemStackWithSize("lightBulb", 16);
+ lightBulb.stackTagCompound = new NBTTagCompound();
+ lightBulb.stackTagCompound.setInteger("colour", dyeEntry.getValue());
+ IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(
+ Arrays.asList(
+ new ItemStack[] { IHLUtils.getThisModItemStack("tinSnipsSteel"),
+ IHLUtils.getThisModItemStack("glassBlowingTubeSteel"),
+ IHLUtils.getThisModItemStack("hackSawSteel") }),
+ Arrays.asList(new IRecipeInput[] { new RecipeInputOreDict("foilTungsten"),
+ new RecipeInputOreDict("foilCopper"),
+ new RecipeInputItemStack(
+ IHLUtils.getThisModItemStackWithSize("lampHolderPorcelain", 16)),
+ new RecipeInputOreDict("dustGlass"), new RecipeInputOreDict(dyeEntry.getKey()) }),
+ Arrays.asList(new ItemStack[] { lightBulb }),
+ Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("gasWeldingStation"),
+ IHLUtils.getThisModItemStack("gaedesMercuryRotaryPump") })));
+ }
+
IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(
Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("hammer"),
IHLUtils.getThisModItemStack("tinSnipsSteel"), IHLUtils.getThisModItemStack("hackSawSteel"),
@@ -1189,6 +1247,24 @@ public class IHLMod implements IFuelHandler {
IHLUtils.getInsulatedWire("Copper", 1, 15, "Rubber", 100),
IHLUtils.getOreDictItemStack("plateSteel"), new ItemStack(Blocks.glass_pane) }),
Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("spotlight") })));
+
+ for (Map.Entry<String, Integer> paneGlassEntry : paneGlassMap.entrySet()) {
+ ItemStack spotlight = IHLUtils.getThisModItemStack("spotlight");
+ spotlight.stackTagCompound = new NBTTagCompound();
+ spotlight.stackTagCompound.setInteger("colour", paneGlassEntry.getValue());
+ IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(Arrays.asList(new ItemStack[] {
+ IHLUtils.getThisModItemStack("hammer"), IHLUtils.getThisModItemStack("tinSnipsSteel"),
+ IHLUtils.getThisModItemStack("hackSawSteel"), IHLUtils.getThisModItemStack("setOfFilesSteel"),
+ IHLUtils.getThisModItemStack("viseSteel") }),
+ Arrays.asList(new IRecipeInput[] {
+ new RecipeInputItemStack(IHLUtils.getThisModItemStack("lightBulb")),
+ new RecipeInputOreDict("foilSteel"),
+ new RecipeInputWire(IHLUtils.getInsulatedWire("Copper", 1, 15, "Rubber", 100)),
+ new RecipeInputOreDict("plateSteel"),
+ new RecipeInputOreDict(paneGlassEntry.getKey()) }),
+ Arrays.asList(new ItemStack[] { spotlight })));
+
+ }
IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(Arrays.asList(
new IRecipeInput[] { RecipeInputs.cutter, RecipeInputs.saw, RecipeInputs.vise, RecipeInputs.file }),
Arrays.asList(new IRecipeInput[] { new RecipeInputOreDict("plateSteel", 2),
@@ -1204,7 +1280,7 @@ public class IHLMod implements IFuelHandler {
Arrays.asList(new IRecipeInput[] { new RecipeInputOreDict("dustIronOxide", 8),
new RecipeInputOreDict("dustBauxite"), new RecipeInputOreDict("dustPotassiumOxide"), }),
Arrays.asList(
- new ItemStack[] { IHLUtils.getThisModItemStackWithSize("dustIronOxideCatalystMix", 10) })));
+ new ItemStack[] { IHLUtils.getThisModItemStackWithSize("catalystRawIronOxide", 10) })));
IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(
Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("hackSawSteel"),
IHLUtils.getThisModItemStack("viseSteel"), IHLUtils.getThisModItemStack("setOfFilesSteel"),
@@ -1320,35 +1396,33 @@ public class IHLMod implements IFuelHandler {
Arrays.asList(new IRecipeInput[] { new RecipeInputOreDict("platePaper", 2),
new RecipeInputItemStack(new ItemStack(Items.string)),
new RecipeInputOreDict("dustGunpowder", 1),
- new RecipeInputOreDictionaryList(new String[] {"dustPentaerythritolTetranitrate", "dustMercuryFulminate"}, 1),
+ new RecipeInputOreDictionaryList(
+ new String[] { "dustPentaerythritolTetranitrate", "dustMercuryFulminate" }, 1),
new RecipeInputOreDict("ingotTarPitch", 1) }),
Arrays.asList(new ItemStack[] { detonator }), null));
IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(null,
- Arrays.asList(
- new IRecipeInput[] { new RecipeInputOreDict("platePaper", 2),
- new RecipeInputOreDict("dustPentaerythritolTetranitrate", 4),
- new RecipeInputOreDict("ingotTarPitch", 1), new RecipeInputDetonator(detonator) }),
- Arrays.asList(
- new ItemStack[] { IHLUtils.getItemStackWithTag("ihlExplosive", "explosionPower", 15*config.explosionPowerBase) }),
+ Arrays.asList(new IRecipeInput[] { new RecipeInputOreDict("platePaper", 2),
+ new RecipeInputOreDict("dustPentaerythritolTetranitrate", 4),
+ new RecipeInputOreDict("ingotTarPitch", 1), new RecipeInputDetonator(detonator) }),
+ Arrays.asList(new ItemStack[] { IHLUtils.getItemStackWithTag("ihlExplosive", "explosionPower",
+ 15 * config.explosionPowerBase) }),
null));
IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(null,
- Arrays.asList(
- new IRecipeInput[] { new RecipeInputOreDict("platePaper", 2),
- new RecipeInputOreDict("dustWood", 4),
- new RecipeInputFluidContainer(FluidRegistry.getFluid("nitroglycerin"), 1),
- new RecipeInputOreDict("ingotTarPitch", 1), new RecipeInputDetonator(detonator) }),
- Arrays.asList(
- new ItemStack[] { IHLUtils.getItemStackWithTag("ihlExplosive", "explosionPower", 10*config.explosionPowerBase) }),
+ Arrays.asList(new IRecipeInput[] { new RecipeInputOreDict("platePaper", 2),
+ new RecipeInputOreDict("dustWood", 4),
+ new RecipeInputFluidContainer(FluidRegistry.getFluid("nitroglycerin"), 1),
+ new RecipeInputOreDict("ingotTarPitch", 1), new RecipeInputDetonator(detonator) }),
+ Arrays.asList(new ItemStack[] { IHLUtils.getItemStackWithTag("ihlExplosive", "explosionPower",
+ 10 * config.explosionPowerBase) }),
null));
IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(null,
- Arrays.asList(
- new IRecipeInput[] { new RecipeInputOreDict("platePaper", 2),
- new RecipeInputOreDict("dustGunpowder", 8),
- new RecipeInputOreDict("ingotTarPitch", 1), new RecipeInputDetonator(detonator) }),
- Arrays.asList(
- new ItemStack[] { IHLUtils.getItemStackWithTag("ihlExplosive", "explosionPower", 3*config.explosionPowerBase) }),
+ Arrays.asList(new IRecipeInput[] { new RecipeInputOreDict("platePaper", 2),
+ new RecipeInputOreDict("dustGunpowder", 8), new RecipeInputOreDict("ingotTarPitch", 1),
+ new RecipeInputDetonator(detonator) }),
+ Arrays.asList(new ItemStack[] { IHLUtils.getItemStackWithTag("ihlExplosive", "explosionPower",
+ 3 * config.explosionPowerBase) }),
null));
-
+
AchesonFurnanceTileEntity.addRecipe(new RecipeInputOreDict("dustSiliconDioxide", 2),
new RecipeInputOreDict("dustCoal", 4), "dustCarborundum");
AchesonFurnanceTileEntity.addRecipe(new RecipeInputOreDict("dustQuicklime"),
@@ -1362,15 +1436,15 @@ public class IHLMod implements IFuelHandler {
AchesonFurnanceTileEntity.addRecipe(new RecipeInputOreDict("plateCoal"),
new RecipeInputOreDict("dustCoal", 1), "plateGraphite");
LeadOvenTileEntity.addRecipe(
- new UniversalRecipeInput(new FluidStack[] {IHLUtils.getFluidStackWithSize("water", 400)},
+ new UniversalRecipeInput(new FluidStack[] { IHLUtils.getFluidStackWithSize("water", 400) },
new IRecipeInput[] { new RecipeInputOreDict("dustSulfur"),
new RecipeInputOreDict("dustSaltpeter") }),
IHLUtils.getFluidStackWithSize("sulfuricacid", 100));
LeadOvenTileEntity.addRecipe(
- new UniversalRecipeInput(new FluidStack[] {IHLUtils.getFluidStackWithSize("water", 100)},
+ new UniversalRecipeInput(new FluidStack[] { IHLUtils.getFluidStackWithSize("water", 100) },
new IRecipeInput[] { new RecipeInputOreDict("crushedPurifiedCinnabar") }),
IHLUtils.getFluidStackWithSize("mercury", 36));
- LeadOvenTileEntity.addRecipe(new RecipeInputOreDict("dustStibnite",1),
+ LeadOvenTileEntity.addRecipe(new RecipeInputOreDict("dustStibnite", 1),
IHLUtils.getThisModItemStack("dustAntimonyOxide"));
LeadOvenTileEntity.addRecipe(new RecipeInputOreDict("dustSodiumHydrogenSulfate", 2),
IHLUtils.getFluidStackWithSize("sulfuricacid", 20),
@@ -1414,36 +1488,45 @@ public class IHLMod implements IFuelHandler {
ItemStack drill = Ic2Items.miningDrill.copy();
drill.setItemDamage(OreDictionary.WILDCARD_VALUE);
DetonationSprayingMachineTileEntity.addRecipe(drill, Ic2Items.diamondDrill.copy());
- MuffleFurnanceTileEntity.addRecipe(new RecipeInputOreDict("plateSteel",1),
+ MuffleFurnanceTileEntity.addRecipe(new RecipeInputOreDict("plateSteel", 1),
IHLUtils.getThisModItemStack("plateHotSteel"));
- MuffleFurnanceTileEntity.addRecipe(new RecipeInputOreDict("ingotSteel",1),
+ MuffleFurnanceTileEntity.addRecipe(new RecipeInputOreDict("ingotSteel", 1),
IHLUtils.getOreDictItemStack("ingotHotSteel"));
- MuffleFurnanceTileEntity.addRecipe(new RecipeInputOreDict("plateTungsten",1),
+ MuffleFurnanceTileEntity.addRecipe(new RecipeInputOreDict("plateTungsten", 1),
IHLUtils.getThisModItemStack("plateHotTungsten"));
- MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("gaedesPumpBarrelRawPorcelain"),1),
+ MuffleFurnanceTileEntity.addRecipe(
+ new RecipeInputItemStack(IHLUtils.getThisModItemStack("gaedesPumpBarrelRawPorcelain"), 1),
IHLUtils.getThisModItemStack("gaedesPumpBarrelPorcelain"));
- MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(new ItemStack(IHLMod.crucible, 1, OreDictionary.WILDCARD_VALUE),1),
+ MuffleFurnanceTileEntity.addRecipe(
+ new RecipeInputItemStack(new ItemStack(IHLMod.crucible, 1, OreDictionary.WILDCARD_VALUE), 1),
new ItemStack(IHLMod.crucible, 1, 1));
- MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStackWithSize("injectionMold", 1),1),
+ MuffleFurnanceTileEntity.addRecipe(
+ new RecipeInputItemStack(IHLUtils.getThisModItemStackWithSize("injectionMold", 1), 1),
IHLUtils.getThisModItemStackWithSize("injectionMold", 1));
- MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("sawBladeSteel"),1),
+ MuffleFurnanceTileEntity.addRecipe(
+ new RecipeInputItemStack(IHLUtils.getThisModItemStack("sawBladeSteel"), 1),
IHLUtils.getThisModItemStack("sawBladeSteelHot"));
- MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("barD10Steel"),1),
+ MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("barD10Steel"), 1),
IHLUtils.getThisModItemStack("barD10SteelHot"));
- MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("linerIronGraphite"),1),
+ MuffleFurnanceTileEntity.addRecipe(
+ new RecipeInputItemStack(IHLUtils.getThisModItemStack("linerIronGraphite"), 1),
IHLUtils.getThisModItemStack("linerIronGraphiteHot"));
MuffleFurnanceTileEntity.addRecipe(
new UniversalRecipeInput(null,
- new IRecipeInput[] { new RecipeInputOreDict("dustIronOxide",1),
- new RecipeInputOreDict("dustLithiumOxide",1) }),
+ new IRecipeInput[] { new RecipeInputOreDict("dustIronOxide", 1),
+ new RecipeInputOreDict("dustLithiumOxide", 1) }),
new UniversalRecipeOutput(null,
- new RecipeOutputItemStack[] { new RecipeOutputItemStack(IHLUtils.getOreDictItemStackWithSize("dustFerrite", 2)) }, 200));
+ new RecipeOutputItemStack[] {
+ new RecipeOutputItemStack(IHLUtils.getOreDictItemStackWithSize("dustFerrite", 2)) },
+ 200));
MuffleFurnanceTileEntity.addRecipe(
new UniversalRecipeInput(null,
new IRecipeInput[] { new RecipeInputOreDict("dustBauxite"),
new RecipeInputOreDict("dustSodiumHydroxide") }),
new UniversalRecipeOutput(null,
- new RecipeOutputItemStack[] { new RecipeOutputItemStack(IHLUtils.getOreDictItemStack("dustSodiumAluminate")) }, 200));
+ new RecipeOutputItemStack[] {
+ new RecipeOutputItemStack(IHLUtils.getOreDictItemStack("dustSodiumAluminate")) },
+ 200));
MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("drillSteel")),
IHLUtils.getThisModItemStack("drillSteelHot"));
MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("tapM10x1Steel")),
@@ -1482,7 +1565,8 @@ public class IHLMod implements IFuelHandler {
(new ItemStack[] { IHLUtils.getThisModItemStack("linerIronGraphiteHot") })),
new UniversalRecipeOutput(null,
(new ItemStack[] { IHLUtils.getThisModItemStack("linerIronGraphiteGreased") }), 2));
- MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("foilRubberWithSulfur")),
+ MuffleFurnanceTileEntity.addRecipe(
+ new RecipeInputItemStack(IHLUtils.getThisModItemStack("foilRubberWithSulfur")),
IHLUtils.getThisModItemStack("foilRubber"));
MuffleFurnanceTileEntity
.addRecipe(
@@ -1646,17 +1730,22 @@ public class IHLMod implements IFuelHandler {
200));
MuffleFurnanceTileEntity.addRecipe(new RecipeInputOreDict("dustTungsticAcid", 2),
IHLUtils.getOreDictItemStack("dustTungstenOxide"), 1.14f);
- MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("electrolysisBathRawPorcelain")),
+ MuffleFurnanceTileEntity.addRecipe(
+ new RecipeInputItemStack(IHLUtils.getThisModItemStack("electrolysisBathRawPorcelain")),
IHLUtils.getThisModItemStack("electrolysisBathPorcelain"));
- MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("ovenRawPorcelain")),
+ MuffleFurnanceTileEntity.addRecipe(
+ new RecipeInputItemStack(IHLUtils.getThisModItemStack("ovenRawPorcelain")),
IHLUtils.getThisModItemStack("leadOven"));
- MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("ringRawPorcelain")),
+ MuffleFurnanceTileEntity.addRecipe(
+ new RecipeInputItemStack(IHLUtils.getThisModItemStack("ringRawPorcelain")),
IHLUtils.getThisModItemStack("ringPorcelain"));
MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("ringRawFerrite")),
IHLUtils.getThisModItemStack("ringFerrite"));
- MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("insulatorRawPorcelain")),
+ MuffleFurnanceTileEntity.addRecipe(
+ new RecipeInputItemStack(IHLUtils.getThisModItemStack("insulatorRawPorcelain")),
IHLUtils.getThisModItemStack("insulatorPorcelain"));
- MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("lampHolderRawPorcelain")),
+ MuffleFurnanceTileEntity.addRecipe(
+ new RecipeInputItemStack(IHLUtils.getThisModItemStack("lampHolderRawPorcelain")),
IHLUtils.getThisModItemStack("lampHolderPorcelain"));
LabElectrolyzerTileEntity.addRecipe(IHLUtils.getFluidStackWithSize("water", 300),
IHLUtils.getFluidStackWithSize("hydrogen", 200), IHLUtils.getFluidStackWithSize("oxygen", 100),
@@ -1786,7 +1875,7 @@ public class IHLMod implements IFuelHandler {
new UniversalRecipeInput(
new FluidStack[] { IHLUtils.getFluidStackWithSize("hydrogen", 90) },
new IRecipeInput[] { new RecipeInputItemStack(
- IHLUtils.getThisModItemStack("dustIronOxideCatalystMix")) }),
+ IHLUtils.getThisModItemStack("catalystIronOxide")) }),
new UniversalRecipeOutput(null, new RecipeOutputItemStack[] {
new RecipeOutputItemStack(IHLUtils.getThisModItemStack("catalystIron"), 1f) },
200));
@@ -1802,7 +1891,7 @@ public class IHLMod implements IFuelHandler {
new UniversalRecipeInput(
new FluidStack[] { IHLUtils.getFluidStackWithSize("ammonia", 100),
IHLUtils.getFluidStackWithSize("oxygen", 150) },
- new IRecipeInput[] { new RecipeInputOreDictionaryList(new String[] {"dustIridium", "dustPlatinum"}, 0) }),
+ new IRecipeInput[] { new RecipeInputOreDict("dustIridium", 0) }),
new UniversalRecipeOutput(new FluidStack[] { IHLUtils.getFluidStackWithSize("nitricacid", 250) },
null, 200));
ChemicalReactorTileEntity.addRecipe(
@@ -1815,28 +1904,22 @@ public class IHLMod implements IFuelHandler {
new RecipeOutputItemStack[] { new RecipeOutputItemStack(
IHLUtils.getOreDictItemStack("dustPentaerythritolTetranitrate"), 1f) },
200, false));
- if(FluidRegistry.isFluidRegistered("bioethanol")){
+ if (FluidRegistry.isFluidRegistered("bioethanol")) {
ChemicalReactorTileEntity.addRecipe(
- new UniversalRecipeInput(
- new FluidStack[] { IHLUtils.getFluidStackWithSize("bioethanol", 450),
- IHLUtils.getFluidStackWithSize("mercury", 144),
- IHLUtils.getFluidStackWithSize("nitricacid", 300)},
- null),
+ new UniversalRecipeInput(new FluidStack[] { IHLUtils.getFluidStackWithSize("bioethanol", 450),
+ IHLUtils.getFluidStackWithSize("mercury", 144),
+ IHLUtils.getFluidStackWithSize("nitricacid", 300) }, null),
new UniversalRecipeOutput(
- new FluidStack[] { IHLUtils.getFluidStackWithSize("acetaldehyde", 300) },
- new RecipeOutputItemStack[] {
- new RecipeOutputItemStack(IHLUtils.getOreDictItemStack("dustMercuryFulminate"),1f) },
+ new FluidStack[] { IHLUtils.getFluidStackWithSize("acetaldehyde", 300) },
+ new RecipeOutputItemStack[] { new RecipeOutputItemStack(
+ IHLUtils.getOreDictItemStack("dustMercuryFulminate"), 1f) },
200));
}
ChemicalReactorTileEntity.addRecipe(
- new UniversalRecipeInput(
- new FluidStack[] { IHLUtils.getFluidStackWithSize("glycerol", 100),
- IHLUtils.getFluidStackWithSize("nitricacid", 300)},
- null),
- new UniversalRecipeOutput(
- new FluidStack[] { IHLUtils.getFluidStackWithSize("nitroglycerin", 400) },
- null,
- 200));
+ new UniversalRecipeInput(new FluidStack[] { IHLUtils.getFluidStackWithSize("glycerol", 100),
+ IHLUtils.getFluidStackWithSize("nitricacid", 300) }, null),
+ new UniversalRecipeOutput(new FluidStack[] { IHLUtils.getFluidStackWithSize("nitroglycerin", 400) },
+ null, 200));
Crucible.addRecipe("ingotSteel", IHLUtils.getFluidStackWithSize("molten.steel", 144));
Crucible.addRecipe("ingotBronze", IHLUtils.getFluidStackWithSize("molten.bronze", 144));
@@ -2114,27 +2197,30 @@ public class IHLMod implements IFuelHandler {
OreDictionary.registerOre("toolLighter", IL.Tool_MatchBox_Used.get(1));
OreDictionary.registerOre("toolLighter", IL.Tool_Matches.get(1));
OreDictionary.registerOre("toolLighter", IL.Tool_Fire_Starter.get(1));
-
- gregapi.util.UT.Crafting.shaped(IHLUtils.getThisModItemStack(MachineBaseBlock.MachineType.ChemicalReactor.unlocalizedName),
- new Object[] { " R ", "PVP", " Mw",
- Character.valueOf('R'), gregapi.data.OP.stick.dat(gregapi.data.MT.StainlessSteel),
- Character.valueOf('V'), gregapi.data.OP.rotor.dat(gregapi.data.MT.StainlessSteel),
- Character.valueOf('P'), gregapi.data.OP.plateCurved.dat(gregapi.data.MT.StainlessSteel),
- Character.valueOf('M'), gregapi.data.OP.casingMachine.dat(gregapi.data.MT.Steel)});
- gregapi.util.UT.Crafting.shaped(IHLUtils.getThisModItemStack(MachineBaseBlock.MachineType.CryogenicDistiller.unlocalizedName),
- new Object[] { " R ", "P P", " Mw",
- Character.valueOf('R'), gregapi.data.OP.pipeTiny.dat(gregapi.data.MT.Copper),
- Character.valueOf('P'), gregapi.data.OP.plateCurved.dat(gregapi.data.MT.Copper),
- Character.valueOf('M'), gregapi.data.OP.casingMachine.dat(gregapi.data.MT.Steel)});
-
- gregapi.util.UT.Crafting.shaped(IHLUtils.getThisModItemStack(MachineBaseBlock.MachineType.FluidizedBedReactor.unlocalizedName),
- new Object[] { " ", "RPR", "VMw",
- Character.valueOf('R'), gregapi.data.OP.pipeTiny.dat(gregapi.data.MT.Titanium),
- Character.valueOf('P'), gregapi.data.OP.pipeHuge.dat(gregapi.data.MT.Titanium),
- Character.valueOf('V'), gregapi.data.OP.rotor.dat(gregapi.data.MT.Titanium),
- Character.valueOf('M'), gregapi.data.OP.casingMachine.dat(gregapi.data.MT.Steel)});
-
+ gregapi.util.UT.Crafting.shaped(
+ IHLUtils.getThisModItemStack(MachineBaseBlock.MachineType.ChemicalReactor.unlocalizedName),
+ new Object[] { " R ", "PVP", " Mw", Character.valueOf('R'),
+ gregapi.data.OP.stick.dat(gregapi.data.MT.StainlessSteel), Character.valueOf('V'),
+ gregapi.data.OP.rotor.dat(gregapi.data.MT.StainlessSteel), Character.valueOf('P'),
+ gregapi.data.OP.plateCurved.dat(gregapi.data.MT.StainlessSteel), Character.valueOf('M'),
+ gregapi.data.OP.casingMachine.dat(gregapi.data.MT.Steel) });
+
+ gregapi.util.UT.Crafting.shaped(
+ IHLUtils.getThisModItemStack(MachineBaseBlock.MachineType.CryogenicDistiller.unlocalizedName),
+ new Object[] { " R ", "P P", " Mw", Character.valueOf('R'),
+ gregapi.data.OP.pipeTiny.dat(gregapi.data.MT.Copper), Character.valueOf('P'),
+ gregapi.data.OP.plateCurved.dat(gregapi.data.MT.Copper), Character.valueOf('M'),
+ gregapi.data.OP.casingMachine.dat(gregapi.data.MT.Steel) });
+
+ gregapi.util.UT.Crafting.shaped(
+ IHLUtils.getThisModItemStack(MachineBaseBlock.MachineType.FluidizedBedReactor.unlocalizedName),
+ new Object[] { " ", "RPR", "VMw", Character.valueOf('R'),
+ gregapi.data.OP.pipeTiny.dat(gregapi.data.MT.Titanium), Character.valueOf('P'),
+ gregapi.data.OP.pipeHuge.dat(gregapi.data.MT.Titanium), Character.valueOf('V'),
+ gregapi.data.OP.rotor.dat(gregapi.data.MT.Titanium), Character.valueOf('M'),
+ gregapi.data.OP.casingMachine.dat(gregapi.data.MT.Steel) });
+
IRecipeInput[] dsmInputs1 = new IRecipeInput[3];
ItemStack gregtechfile = IHLUtils.getOtherModItemStackWithDamage("gregtech", "gt.metatool.01", 18, 1);
dsmInputs1[0] = new RecipeInputItemStack(gregtechfile);
@@ -2259,7 +2345,7 @@ public class IHLMod implements IFuelHandler {
new FluidStack(FluidRegistry.getFluid("glue"), 240),
new FluidStack(FluidRegistry.getFluid("water"), 100) },
64, 32, 0);
-
+
ExtruderTileEntity.addRecipe(IHLUtils.getOreDictItemStackWithSize("dustRubber", 5),
IHLUtils.getOreDictItemStackWithSize("dustTinySulfur", 1),
IHLUtils.getFluidStackWithSize("molten.rubber", 144 * 5));
@@ -2291,7 +2377,7 @@ public class IHLMod implements IFuelHandler {
Character.valueOf('F'), IC2Items.getItem("electroFurnace") });
Recipes.advRecipes.addRecipe(new ItemStack(electricEvaporatorBlock, 1),
new Object[] { " ", " C ", " F ", Character.valueOf('C'), Ic2Items.electronicCircuit.copy(),
- Character.valueOf('F'), new ItemStack(evaporatorBlock, 1)});
+ Character.valueOf('F'), new ItemStack(evaporatorBlock, 1) });
if (IHLMod.config.enableFlexibleCablesCrafting) {
ItemStack cutter = Ic2Items.cutter.copy();
cutter.setItemDamage(OreDictionary.WILDCARD_VALUE);
@@ -2302,9 +2388,8 @@ public class IHLMod implements IFuelHandler {
Recipes.advRecipes.addRecipe(IHLUtils.getItemStackWithTag("setOfDies1_5sqmm", "transverseSection", 240),
new Object[] { " C ", " P ", " ", Character.valueOf('P'), Ic2Items.plateadviron,
Character.valueOf('C'), cutter });
- Recipes.advRecipes.addRecipe(IHLUtils.getThisModItemStack("ironWorkbench"),
- new Object[] { "P ", "P ", "P H", Character.valueOf('P'), Ic2Items.plateadviron,
- Character.valueOf('H'), forgeHammer});
+ Recipes.advRecipes.addRecipe(IHLUtils.getThisModItemStack("ironWorkbench"), new Object[] { "P ", "P ",
+ "P H", Character.valueOf('P'), Ic2Items.plateadviron, Character.valueOf('H'), forgeHammer });
}
ExtruderTileEntity.addRecipe(IHLUtils.getOreDictItemStackWithSize("itemRubber", 5),
IHLUtils.getOreDictItemStackWithSize("dustTinySulfur", 1),
diff --git a/ihl/IHLModInfo.java b/ihl/IHLModInfo.java
index 2e05255..314e76b 100644
--- a/ihl/IHLModInfo.java
+++ b/ihl/IHLModInfo.java
@@ -3,5 +3,5 @@ package ihl;
public class IHLModInfo {
public static final String MODID = "ihl";
public static final String MODNAME = "IHL Tools & Machines for IC2V2";
- public static final String MODVERSION = "0.628";
+ public static final String MODVERSION = "0.630";
}
diff --git a/ihl/ServerProxy.java b/ihl/ServerProxy.java
index 385bcec..d22751c 100644
--- a/ihl/ServerProxy.java
+++ b/ihl/ServerProxy.java
@@ -38,6 +38,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.client.event.TextureStitchEvent.Pre;
+import net.minecraftforge.event.world.BlockEvent.BreakEvent;
+import net.minecraftforge.event.world.BlockEvent.PlaceEvent;
public class ServerProxy {
@@ -273,6 +275,50 @@ public class ServerProxy {
}
}
}
+ @SubscribeEvent
+ public void onBlockBreak(BreakEvent event) {
+ int x = event.x;
+ int y = event.y;
+ int z = event.z;
+ ByteBuf bb = Unpooled.buffer(20);
+ ByteBufOutputStream byteBufOutputStream = new ByteBufOutputStream(bb);
+ try
+ {
+ byteBufOutputStream.write(4);
+ byteBufOutputStream.writeInt(x);
+ byteBufOutputStream.writeInt(y);
+ byteBufOutputStream.writeInt(z);
+ channel.sendToAllAround(new FMLProxyPacket(byteBufOutputStream.buffer(),IHLModInfo.MODID), new TargetPoint(event.world.provider.dimensionId, x, y, z, 256d));
+ byteBufOutputStream.close();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ @SubscribeEvent
+ public void onBlockPlace(PlaceEvent event) {
+ int x = event.x;
+ int y = event.y;
+ int z = event.z;
+ ByteBuf bb = Unpooled.buffer(20);
+ ByteBufOutputStream byteBufOutputStream = new ByteBufOutputStream(bb);
+ try
+ {
+ byteBufOutputStream.write(5);
+ byteBufOutputStream.writeInt(x);
+ byteBufOutputStream.writeInt(y);
+ byteBufOutputStream.writeInt(z);
+ channel.sendToAllAround(new FMLProxyPacket(byteBufOutputStream.buffer(),IHLModInfo.MODID), new TargetPoint(event.world.provider.dimensionId, x, y, z, 256d));
+ byteBufOutputStream.close();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
public void addEntityToServerList(INetworkListener entity)
{
diff --git a/ihl/enviroment/GlowningAirBlock.java b/ihl/enviroment/GlowningAirBlock.java
deleted file mode 100644
index e6dfb8e..0000000
--- a/ihl/enviroment/GlowningAirBlock.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package ihl.enviroment;
-
-import net.minecraft.block.BlockAir;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.EnumCreatureAttribute;
-import net.minecraft.world.IBlockAccess;
-import net.minecraft.world.World;
-
-public class GlowningAirBlock extends BlockAir
-{
- public GlowningAirBlock()
- {
- super();
- this.setBlockName("glowningAir");
- this.setLightLevel(1.0f);
- this.setBlockTextureName("glass");
- }
-
- @Override
- public boolean isAir(IBlockAccess world, int x, int y, int z)
- {
- return true;
- }
-
- @Override
- public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
- {
- if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)
- {
- entity.setFire(20);
- }
- }
-}
diff --git a/ihl/enviroment/LightBulbBlock.java b/ihl/enviroment/LightBulbBlock.java
index 720ca4e..7c95001 100644
--- a/ihl/enviroment/LightBulbBlock.java
+++ b/ihl/enviroment/LightBulbBlock.java
@@ -1,20 +1,29 @@
package ihl.enviroment;
+import java.util.List;
import java.util.Random;
import cpw.mods.fml.common.registry.GameRegistry;
-
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
import ihl.IHLCreativeTab;
+import ihl.flexible_cable.AnchorTileEntity;
import ihl.items_blocks.IHLItemBlock;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemDye;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class LightBulbBlock extends Block implements ITileEntityProvider {
- public static GlowningAirBlock glowningAir;
public LightBulbBlock(String unlocalizedName1) {
super(Material.glass);
@@ -25,7 +34,7 @@ public class LightBulbBlock extends Block implements ITileEntityProvider {
this.setResistance(0.5F);
this.setCreativeTab(IHLCreativeTab.tab);
this.setBlockTextureName("glass");
- this.setLightOpacity(16);
+ this.setLightOpacity(0);
}
@Override
@@ -34,13 +43,22 @@ public class LightBulbBlock extends Block implements ITileEntityProvider {
}
public static void init() {
- glowningAir = new GlowningAirBlock();
new LightBulbBlock("lightBulb");
new SpotlightBlock("spotlight");
- GameRegistry.registerBlock(glowningAir, "glowningAir");
GameRegistry.registerTileEntity(LightBulbTileEntity.class, "lightBulb");
GameRegistry.registerTileEntity(SpotlightTileEntity.class, "spotlight");
- SpotlightTileEntity.createLightSphereVectors();
+ }
+
+ @Override
+ public void onBlockPreDestroy(World world, int x, int y, int z, int meta) {
+ if (world.isRemote) {
+ TileEntity te = world.getTileEntity(x, y, z);
+ if (te != null && te instanceof LightBulbTileEntity) {
+ LightBulbTileEntity ate = (LightBulbTileEntity) te;
+ ate.invalidate();
+ }
+ }
+ super.onBlockPreDestroy(world, x, y, z, meta);
}
/**
@@ -73,6 +91,27 @@ public class LightBulbBlock extends Block implements ITileEntityProvider {
}
}
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item item, CreativeTabs tab, List itemlist) {
+ for (int colour : ItemDye.field_150922_c) {
+ ItemStack stack = new ItemStack(item);
+ stack.stackTagCompound = new NBTTagCompound();
+ stack.stackTagCompound.setInteger("colour", colour);
+ itemlist.add(stack);
+ }
+ }
+
+ @Override
+ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
+ super.onBlockPlacedBy(world, x, y, z, player, stack);
+ if (!world.isRemote) {
+ TileEntity tile = world.getTileEntity(x, y, z);
+ if (tile instanceof LightBulbTileEntity && stack.stackTagCompound != null)
+ ((LightBulbTileEntity)tile).colour=stack.stackTagCompound.getInteger("colour");
+ }
+ }
+
private void setBlockBoundsBasedOnFacing(int facing) {
int var2 = facing & 7;
float var6 = 0.1875F;
@@ -109,11 +148,10 @@ public class LightBulbBlock extends Block implements ITileEntityProvider {
}
public int getLightValue(IBlockAccess world, int x, int y, int z) {
-/* TileEntity te = world.getTileEntity(x, y, z);
- if (te != null && te instanceof LightBulbTileEntity) {
- LightBulbTileEntity ate = (LightBulbTileEntity) te;
- return ate.getActive() ? 15 : 0;
- }*/
+ TileEntity te = world.getTileEntity(x, y, z);
+ if(te instanceof LightBulbTileEntity && ((LightBulbTileEntity)te).getActive()){
+ return 15;
+ }
return 0;
}
}
diff --git a/ihl/enviroment/LightBulbRender.java b/ihl/enviroment/LightBulbRender.java
index 97104f7..caa5f65 100644
--- a/ihl/enviroment/LightBulbRender.java
+++ b/ihl/enviroment/LightBulbRender.java
@@ -60,7 +60,7 @@ private final float scale=1F/16F;
bindTexture(tex);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- GL11.glColor4f(1f, 1f, 1f, 1f);
+ GL11.glColor4f((cte.colour>>>16)/255f,((cte.colour>>>8)&255)/255f, (cte.colour&255)/255f,1f);
if(cte.getActive())
{
GL11.glDisable(GL11.GL_LIGHTING);
diff --git a/ihl/enviroment/LightBulbTileEntity.java b/ihl/enviroment/LightBulbTileEntity.java
index f2c229b..8695bd7 100644
--- a/ihl/enviroment/LightBulbTileEntity.java
+++ b/ihl/enviroment/LightBulbTileEntity.java
@@ -26,7 +26,8 @@ import ihl.IHLModInfo;
import ihl.model.RenderBlocksExt;
import ihl.utils.IHLUtils;
-public class LightBulbTileEntity extends TileEntity implements IEnergySink, IWrenchable, INetworkDataProvider, INetworkTileEntityEventListener {
+public class LightBulbTileEntity extends TileEntity
+ implements IEnergySink, IWrenchable, INetworkDataProvider {
private boolean active = false;
private short facing = 0;
public boolean prevActive = false;
@@ -35,6 +36,8 @@ public class LightBulbTileEntity extends TileEntity implements IEnergySink, IWre
public boolean addedToEnergyNet = false;
private boolean loaded = false;
private int ticker;
+ public int colour = 0xffffff;
+
@SideOnly(value = Side.CLIENT)
LightSource lightSource;
@@ -43,6 +46,7 @@ public class LightBulbTileEntity extends TileEntity implements IEnergySink, IWre
super.readFromNBT(nbttagcompound);
this.energy = nbttagcompound.getDouble("energy");
this.facing = nbttagcompound.getShort("facing");
+ this.colour = nbttagcompound.getInteger("colour");
}
@Override
@@ -50,28 +54,7 @@ public class LightBulbTileEntity extends TileEntity implements IEnergySink, IWre
super.writeToNBT(nbttagcompound);
nbttagcompound.setDouble("energy", this.energy);
nbttagcompound.setShort("facing", this.facing);
- }
-
- /**
- * validates a tile entity
- */
- @Override
- public void validate() {
- super.validate();
- IC2.tickHandler.addSingleTickCallback(this.worldObj, new ITickCallback() {
- @SuppressWarnings("unchecked")
- @Override
- public void tickCallback(World world) {
- if (!LightBulbTileEntity.this.isInvalid() && world.blockExists(LightBulbTileEntity.this.xCoord,
- LightBulbTileEntity.this.yCoord, LightBulbTileEntity.this.zCoord)) {
- LightBulbTileEntity.this.onLoaded();
-
- if (LightBulbTileEntity.this.enableUpdateEntity()) {
- world.loadedTileEntityList.add(LightBulbTileEntity.this);
- }
- }
- }
- });
+ nbttagcompound.setInteger("colour", this.colour);
}
/**
@@ -94,6 +77,9 @@ public class LightBulbTileEntity extends TileEntity implements IEnergySink, IWre
}
public void onLoaded() {
+ if (!this.worldObj.isRemote) {
+ IC2.network.get().updateTileEntityField(this, "colour");
+ }
if (IC2.platform.isSimulating() && !this.addedToEnergyNet) {
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
this.addedToEnergyNet = true;
@@ -107,19 +93,28 @@ public class LightBulbTileEntity extends TileEntity implements IEnergySink, IWre
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
this.addedToEnergyNet = false;
}
- this.active = false;
- this.updateLightState();
}
+ this.active = false;
+ this.updateLightState();
}
@Override
public final boolean canUpdate() {
- return false;
+ return true;
}
@Override
public void updateEntity() {
- if (++this.ticker % 4 == 0) {
+ if (this.worldObj.isRemote) {
+ if(this.prevActive != active){
+ updateLightState();
+ this.prevActive = active;
+ }
+ }
+ if(!this.loaded){
+ this.onLoaded();
+ }
+ if (!this.worldObj.isRemote && ++this.ticker % 4 == 0) {
if (this.prevFacing != facing) {
this.setFacing(facing);
}
@@ -136,9 +131,22 @@ public class LightBulbTileEntity extends TileEntity implements IEnergySink, IWre
if (IC2.platform.isSimulating()) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
} else if (IC2.platform.isRendering()) {
- if (lightSource == null && this.getActive()) {
- lightSource = ((ClientProxy) IHLMod.proxy).getLightHandler().calculateOmniLightSource(worldObj, xCoord,
- yCoord, zCoord, 8096, 255, 255, 0);
+ if (this.getActive()) {
+ if(lightSource != null)
+ ((ClientProxy) IHLMod.proxy).getLightHandler().removeLightSource(lightSource);
+ int red = colour >>> 16;
+ int green = (colour >>> 8) & 255;
+ int blue = colour & 255;
+ int max = red;
+ if (max < green)
+ max = green;
+ if (max < blue)
+ max = blue;
+ max -= 255;
+ red -= max;// Normalize colours
+ blue -= max;
+ green -= max;
+ lightSource = this.createLightSource(red, green, blue);
((ClientProxy) IHLMod.proxy).getLightHandler().addLightSource(lightSource);
} else if (lightSource != null) {
((ClientProxy) IHLMod.proxy).getLightHandler().removeLightSource(lightSource);
@@ -147,8 +155,10 @@ public class LightBulbTileEntity extends TileEntity implements IEnergySink, IWre
}
}
- public boolean enableUpdateEntity() {
- return IC2.platform.isSimulating();
+ @SideOnly(value = Side.CLIENT)
+ protected LightSource createLightSource(int red, int green, int blue) {
+ return ((ClientProxy) IHLMod.proxy).getLightHandler().calculateLightSource(worldObj, xCoord, yCoord, zCoord,
+ 64, red, green, blue, null);
}
@Override
@@ -205,6 +215,7 @@ public class LightBulbTileEntity extends TileEntity implements IEnergySink, IWre
Vector<String> ret = new Vector<String>(2);
ret.add("active");
ret.add("facing");
+ ret.add("colour");
return ret;
}
@@ -250,7 +261,6 @@ public class LightBulbTileEntity extends TileEntity implements IEnergySink, IWre
this.active = active1;
if (this.prevActive != active1) {
IC2.network.get().updateTileEntityField(this, "active");
- IC2.network.get().initiateTileEntityEvent(this, active1?1:0, true);
updateLightState();
}
this.prevActive = active1;
@@ -260,16 +270,4 @@ public class LightBulbTileEntity extends TileEntity implements IEnergySink, IWre
this.active = active1;
this.prevActive = active1;
}
-
- @Override
- public void onNetworkEvent(int event)
- {
- boolean active1 = event==1;
- this.active = active1;
- if (this.prevActive != active1) {
- updateLightState();
- }
- this.prevActive = active1;
- }
-
}
diff --git a/ihl/enviroment/LightHandler.java b/ihl/enviroment/LightHandler.java
index c89ffb7..31a921e 100644
--- a/ihl/enviroment/LightHandler.java
+++ b/ihl/enviroment/LightHandler.java
@@ -7,7 +7,9 @@ import java.util.Set;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ihl.IHLMod;
+import ihl.utils.IHLMathUtils;
import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
@@ -41,27 +43,28 @@ public class LightHandler {
((l >>> lightBitsPerDimension) & bitmask) - maxLightRadius, (l & bitmask) - maxLightRadius };
}
- public LightSource calculateOmniLightSource(World world, int sourceX, int sourceY, int sourceZ, int power, int red,
- int green, int blue) {
+ public LightSource calculateLightSource(World world, int sourceX, int sourceY, int sourceZ, int power, int red,
+ int green, int blue, double[] ds) {
LightSource lightSource = new LightSource(sourceX, sourceY, sourceZ, red, green, blue, power);
int[] borders = { sourceX, sourceY, sourceZ, sourceX, sourceY, sourceZ };
int[] evSource = { sourceX, sourceY, sourceZ };
int[] lightSourceXYZ = { sourceX, sourceY, sourceZ };
for (int i = 0; i < directionMasks.length; i++) {
int[] directionMask = directionMasks[i];
- this.litBlocksAndGetDescendants(world, evSource, lightSourceXYZ, lightSource.illuminatedBlocks, 0, power,
- directionMask, borders);
+ this.litBlocksAndGetDescendants(world, evSource, lightSourceXYZ, lightSource.illuminatedBlocks, 0, power>>1,
+ directionMask, borders, ds);
}
lightSource.setBorders(borders[0], borders[1], borders[2], borders[3], borders[4], borders[5]);
return lightSource;
}
private void litBlocksAndGetDescendants(World world, int[] evSource, int[] lightSource, BitSet illuminatedBlocksSet,
- int ev, int power, int[] directionMask, int[] borders) {
- power = this.getNewPower(world, ev, evSource, lightSource, power, directionMask, illuminatedBlocksSet, borders);
- power = (power<<4)/17 - 1;
+ int ev, int power, int[] directionMask, int[] borders, double[] ds) {
+ power = this.getNewPower(world, ev, evSource, lightSource, power, directionMask, illuminatedBlocksSet, borders,
+ ds);
+ power--;
if (power > 1) {
- if (vectors[ev][0] == 0) {
+ if (vectors[ev].length == 0) {
int[] xyz = IHLMod.explosionHandler.decodeXYZ(ev);
int xb = xyz[0] >> bits - 1;
int yb = xyz[1] >> bits - 1;
@@ -78,13 +81,11 @@ public class LightHandler {
evSource[1] + yb * halfValue * directionMask[1],
evSource[2] + zb * halfValue * directionMask[2] };
litBlocksAndGetDescendants(world, nextEVSource, lightSource, illuminatedBlocksSet, ev2, power,
- directionMask, borders);
+ directionMask, borders, ds);
} else {
for (int d1 : this.vectors[ev]) {
- if (d1 != 0) {
litBlocksAndGetDescendants(world, evSource, lightSource, illuminatedBlocksSet, d1, power,
- directionMask, borders);
- }
+ directionMask, borders, ds);
}
}
}
@@ -92,7 +93,7 @@ public class LightHandler {
}
private int getNewPower(World world, int ev, int[] evSource, int[] lightSource, int power, int[] directionMask,
- BitSet illuminatedBlocksSet, int[] borders) {
+ BitSet illuminatedBlocksSet, int[] borders, double[] ds) {
int power1 = power;
int[] xyz = IHLMod.explosionHandler.decodeXYZ(ev);
int absX = xyz[0] * directionMask[0] + evSource[0];
@@ -111,24 +112,55 @@ public class LightHandler {
} else if (absZ > borders[5]) {
borders[5] = absZ;
}
- Block block = world.getBlock(absX, absY, absZ);
- if (block.equals(Blocks.air) || block.isAir(world, absX, absY, absZ)) {
- return power;
- }
- power1 *= world.getBlockLightOpacity(absX, absY, absZ) / 16;
+ power1 = power1 * (255 - world.getBlockLightOpacity(absX, absY, absZ)) / 255;
int lightBitAddress = this.encodeXYZ(absX - lightSource[0], absY - lightSource[1], absZ - lightSource[2]);
illuminatedBlocksSet.set(lightBitAddress);
+ if (ds != null) {
+ float dx = (float) (absX - ds[0]);
+ float dy = (float) (absY - ds[1]);
+ float dz = (float) (absZ - ds[2]);
+ float sqd = dx * dx + dy * dy + dz * dz;
+ float d = IHLMathUtils.sqrt(sqd);
+ float dx1 = (float) (ds[3] * d);
+ float dy1 = (float) (ds[4] * d);
+ float dz1 = (float) (ds[5] * d);
+ float ddx = dx - dx1;
+ float ddy = dy - dy1;
+ float ddz = dz - dz1;
+ float sqr = ddx * ddx + ddy * ddy + ddz * ddz;
+ float sqrmax = (float) ds[6] * sqd + 4f;
+ if (sqr > sqrmax) {
+ return 0;
+ }
+ }
return power1;
}
public void addLightSource(LightSource lightSource) {
- System.out.println("Adding light source. Borders:");
- System.out.println("from " + lightSource.fromX + ";" + lightSource.fromY + ";" + lightSource.fromZ);
- System.out.println("to " + lightSource.toX + ";" + lightSource.toY + ";" + lightSource.toZ);
+/* IHLMod.log.info("Added light source at area from "+lightSource.fromX+";"+lightSource.fromY+";"+lightSource.fromZ+
+ " to "+lightSource.toX+";"+lightSource.toY+";"+lightSource.toZ);*/
this.lightSources.add(lightSource);
+ Minecraft.getMinecraft().theWorld.markBlockRangeForRenderUpdate(
+ lightSource.fromX,
+ lightSource.fromY,
+ lightSource.fromZ,
+ lightSource.toX,
+ lightSource.toY,
+ lightSource.toZ);
}
public void removeLightSource(LightSource lightSource) {
- this.lightSources.remove(lightSource);
+ if(!this.lightSources.remove(lightSource)){
+ throw new IllegalArgumentException("Requested light source is not presented.");
+ }
+/* IHLMod.log.info("Removing light source at area from "+lightSource.fromX+";"+lightSource.fromY+";"+lightSource.fromZ+
+ " to "+lightSource.toX+";"+lightSource.toY+";"+lightSource.toZ);*/
+ Minecraft.getMinecraft().theWorld.markBlockRangeForRenderUpdate(
+ lightSource.fromX,
+ lightSource.fromY,
+ lightSource.fromZ,
+ lightSource.toX,
+ lightSource.toY,
+ lightSource.toZ);
}
}
diff --git a/ihl/enviroment/LightSource.java b/ihl/enviroment/LightSource.java
index ff4a91f..55f7c6c 100644
--- a/ihl/enviroment/LightSource.java
+++ b/ihl/enviroment/LightSource.java
@@ -6,8 +6,10 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ihl.ClientProxy;
import ihl.IHLMod;
+import ihl.utils.IHLMathUtils;
+import net.minecraft.world.World;
-@SideOnly(value=Side.CLIENT)
+@SideOnly(value = Side.CLIENT)
public class LightSource {
private final int centerX;
private final int centerY;
@@ -24,8 +26,7 @@ public class LightSource {
private final int power;
public final BitSet illuminatedBlocks = new BitSet();
- public LightSource(int centerX1, int centerY1, int centerZ1,
- int red1, int green1, int blue1, int power1) {
+ public LightSource(int centerX1, int centerY1, int centerZ1, int red1, int green1, int blue1, int power1) {
centerX = centerX1;
centerY = centerY1;
centerZ = centerZ1;
@@ -34,45 +35,149 @@ public class LightSource {
blue = blue1;
power = power1;
}
-
- public void setBorders(int fromX1, int fromY1, int fromZ1,
- int toX1, int toY1, int toZ1)
- {
- fromX=fromX1;
- fromY=fromY1;
- fromZ=fromZ1;
- toX=toX1;
- toY=toY1;
- toZ=toZ1;
+
+ public void setBorders(int fromX1, int fromY1, int fromZ1, int toX1, int toY1, int toZ1) {
+ fromX = fromX1;
+ fromY = fromY1;
+ fromZ = fromZ1;
+ toX = toX1;
+ toY = toY1;
+ toZ = toZ1;
}
public boolean isBlockIlluminated(int x, int y, int z) {
- if(x<fromX || x>toX || y<fromY || y>toY || z<fromZ || z>toZ)
- {
+ if (x < fromX || x > toX || y < fromY || y > toY || z < fromZ || z > toZ) {
return false;
- }
- else
- {
+ } else {
int rx = x - centerX;
int ry = y - centerY;
int rz = z - centerZ;
- int l = ((ClientProxy)IHLMod.proxy).getLightHandler().encodeXYZ(rx, ry, rz);
+ int l = ((ClientProxy) IHLMod.proxy).getLightHandler().encodeXYZ(rx, ry, rz);
return illuminatedBlocks.get(l);
}
}
public int[] getLightValue(int x, int y, int z, int[] normal) {
- int dx = centerX-x;
- int dy = centerY-y;
- int dz = centerZ-z;
- int d = dx*dx+dy*dy+dz*dz;
- dx=normal[0]*dx;
- dy=normal[1]*dy;
- dz=normal[2]*dz;
- dx=dx>0?(dx<<16)/d:0;
- dy=dy>0?(dy<<16)/d:0;
- dz=dz>0?(dz<<16)/d:0;
- int brightness = Math.min(power*(dx+dy+dz)>>16,16);
- return new int[]{brightness, this.red, this.blue, this.green};
+ int dx = centerX - x;
+ int dy = centerY - y;
+ int dz = centerZ - z;
+ int d = dx * dx + dy * dy + dz * dz;
+ if (d == 0) {
+ return new int[] { 0xf0, this.red, this.blue, this.green };
+ }
+ if (normal[0] + normal[1] + normal[2] == 0) {
+ dx = dx < 0 ? -dx : dx;
+ dy = dy < 0 ? -dy : dy;
+ dz = dz < 0 ? -dz : dz;
+ } else {
+ dx = normal[0] * dx;
+ dy = normal[1] * dy;
+ dz = normal[2] * dz;
+ dx = dx > 0 ? dx : 0;
+ dy = dy > 0 ? dy : 0;
+ dz = dz > 0 ? dz : 0;
+ }
+ int r = power * (dx + dy + dz) / d;
+ r = r<0?0:r;
+ int brightness = r > 15 ? 15 : r;
+ return new int[] { brightness << 4, this.red*r, this.green*r, this.blue*r};
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof LightSource) {
+ LightSource otherLS = (LightSource) o;
+ return this.centerX == otherLS.centerX && this.centerY == otherLS.centerY && this.centerZ == otherLS.centerZ
+ && this.fromX == otherLS.fromX && this.fromY == otherLS.fromY && this.fromZ == otherLS.fromZ
+ && this.toX == otherLS.toX && this.toY == otherLS.toY && this.toZ == otherLS.toZ;
+ }
+ return false;
+ }
+
+ public void provideLight(World world, int x, int y, int z) {
+ int dx = x-centerX;//100 10 20
+ int dy = y-centerY;
+ int dz = z-centerZ;
+ int sqd = dx*dx+dy*dy+dz*dz;
+ float d = IHLMathUtils.sqrt(sqd);
+ float dx1 = dx/d;
+ float dy1 = dy/d;
+ float dz1 = dz/d;
+ float x1 = x+0.5f;
+ float y1 = y+0.5f;
+ float z1 = z+0.5f;
+ for(int i=0;i<64;i++){
+ x1+=dx1;
+ y1+=dy1;
+ z1+=dz1;
+ int absX = (int)x1;
+ int absY = (int)y1;
+ int absZ = (int)z1;
+ int ddx = absX-centerX;
+ int ddy = absY-centerY;
+ int ddz = absZ-centerZ;
+ this.illuminatedBlocks.set(((ClientProxy) IHLMod.proxy).getLightHandler().encodeXYZ(ddx, ddy, ddz));
+ if (absX < fromX) {
+ fromX = absX;
+ } else if (absY < fromY) {
+ fromY = absY;
+ } else if (absZ < fromZ) {
+ fromZ = absZ;
+ } else if (absX > toX) {
+ toX = absX;
+ } else if (absY > toY) {
+ toY = absY;
+ } else if (absZ > toZ) {
+ toZ = absZ;
+ }
+ if(world.getBlockLightOpacity(absX, absY, absZ)>192) {
+ break;
+ }
+ }
+ }
+
+ public void castShadow(World world, int x, int y, int z) {
+ int dx = x-centerX;
+ int dy = y-centerY;
+ int dz = z-centerZ;
+ int sqd = dx*dx+dy*dy+dz*dz;
+ float d = IHLMathUtils.sqrt(sqd);
+ float dx1 = dx/d;
+ float dy1 = dy/d;
+ float dz1 = dz/d;
+ float x1 = x+0.5f;
+ float y1 = y+0.5f;
+ float z1 = z+0.5f;
+ x1+=dx1;
+ y1+=dy1;
+ z1+=dz1;
+ for(int i=0;i<64;i++){
+ x1+=dx1;
+ y1+=dy1;
+ z1+=dz1;
+ int absX = (int)x1;
+ int absY = (int)y1;
+ int absZ = (int)z1;
+ int ddx = absX-centerX;
+ int ddy = absY-centerY;
+ int ddz = absZ-centerZ;
+ this.illuminatedBlocks.clear(((ClientProxy) IHLMod.proxy).getLightHandler().encodeXYZ(ddx, ddy, ddz));
+ if (absX < fromX) {
+ fromX = absX;
+ } else if (absY < fromY) {
+ fromY = absY;
+ } else if (absZ < fromZ) {
+ fromZ = absZ;
+ } else if (absX > toX) {
+ toX = absX;
+ } else if (absY > toY) {
+ toY = absY;
+ } else if (absZ > toZ) {
+ toZ = absZ;
+ }
+ if(world.getBlockLightOpacity(absX, absY, absZ)>192) {
+ break;
+ }
+ }
}
}
diff --git a/ihl/enviroment/SpotlightBlock.java b/ihl/enviroment/SpotlightBlock.java
index 2cabecf..02cafd1 100644
--- a/ihl/enviroment/SpotlightBlock.java
+++ b/ihl/enviroment/SpotlightBlock.java
@@ -4,17 +4,25 @@ import ic2.core.IC2;
import ihl.IHLCreativeTab;
import ihl.items_blocks.IHLItemBlock;
+import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
+import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
public class SpotlightBlock extends Block implements ITileEntityProvider
{
@@ -36,7 +44,20 @@ public class SpotlightBlock extends Block implements ITileEntityProvider
{
return true;
}
-
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item item, CreativeTabs tab, List itemlist) {
+ for (int colour : ItemDye.field_150922_c) {
+ ItemStack stack = new ItemStack(item);
+ stack.stackTagCompound = new NBTTagCompound();
+ stack.stackTagCompound.setInteger("colour", colour);
+ itemlist.add(stack);
+ }
+ }
+
+
+
/**
* Returns the quantity of items to drop on block destruction.
*/
@@ -80,17 +101,31 @@ public class SpotlightBlock extends Block implements ITileEntityProvider
}
@Override
- public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack)
+ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack)
{
TileEntity t = world.getTileEntity(x, y, z);
if(IC2.platform.isSimulating() && t instanceof SpotlightTileEntity)
{
SpotlightTileEntity te = (SpotlightTileEntity)t;
te.setDirectionVector(player);
+ if(stack.stackTagCompound!=null)
+ te.colour=stack.stackTagCompound.getInteger("colour");
}
}
@Override
+ public void onBlockPreDestroy(World world, int x, int y, int z, int meta) {
+ if (world.isRemote) {
+ TileEntity te = world.getTileEntity(x, y, z);
+ if (te != null && te instanceof LightBulbTileEntity) {
+ LightBulbTileEntity ate = (LightBulbTileEntity) te;
+ ate.invalidate();
+ }
+ }
+ super.onBlockPreDestroy(world, x, y, z, meta);
+ }
+
+ @Override
public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int i,float pos_x,float pos_y,float pos_z)
{
TileEntity te = world.getTileEntity(x,y,z);
@@ -102,7 +137,11 @@ public class SpotlightBlock extends Block implements ITileEntityProvider
return false;
}
-
-
-
+ public int getLightValue(IBlockAccess world, int x, int y, int z) {
+ TileEntity te = world.getTileEntity(x, y, z);
+ if(te instanceof LightBulbTileEntity && ((LightBulbTileEntity)te).getActive()){
+ return 15;
+ }
+ return 0;
+ }
} \ No newline at end of file
diff --git a/ihl/enviroment/SpotlightRender.java b/ihl/enviroment/SpotlightRender.java
index e38e251..8f48e1a 100644
--- a/ihl/enviroment/SpotlightRender.java
+++ b/ihl/enviroment/SpotlightRender.java
@@ -70,6 +70,7 @@ private final float scale=1F/16F;
GL11.glColor4f(1f, 1f, 1f, 1f);
model.Base.render(scale);
GL11.glTranslatef(model.RotatingPart1.rotationPointX*scale, model.RotatingPart1.rotationPointY*scale, model.RotatingPart1.rotationPointZ*scale);
+ GL11.glColor4f((cte.colour>>>16)/255f,((cte.colour>>>8)&255)/255f, (cte.colour&255)/255f,1f);
switch(cte.getFacing())
{
case 0:
diff --git a/ihl/enviroment/SpotlightTileEntity.java b/ihl/enviroment/SpotlightTileEntity.java
index ab18ebe..d8e55df 100644
--- a/ihl/enviroment/SpotlightTileEntity.java
+++ b/ihl/enviroment/SpotlightTileEntity.java
@@ -1,6 +1,9 @@
package ihl.enviroment;
+
import ic2.api.network.INetworkTileEntityEventListener;
import ic2.core.IC2;
+import ihl.ClientProxy;
+import ihl.IHLMod;
import ihl.IHLModInfo;
import ihl.handpump.XYZ;
import ihl.utils.IHLUtils;
@@ -9,6 +12,9 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
@@ -19,315 +25,188 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection;
-public class SpotlightTileEntity extends LightBulbTileEntity implements INetworkTileEntityEventListener
-{
- Vec3 directionVector=Vec3.createVectorHelper(1, 0, 0);
- private static final int maxLightRange=128;
- private final Set<XYZ> xyzGlowningAir = new HashSet<XYZ>();
- private static final Set<Vec3> lightSphereVectors = new HashSet<Vec3>();
- public float rotationPitch=0f;
- public float rotationYaw=0f;
- public float prevRotationPitch=0f;
- public float prevRotationYaw=0f;
- boolean needLightTargetUpdate=false;
-
- public static void createLightSphereVectors()
- {
- for(double y=-1d;y<=1d;y+=0.2d)
- {
- double sqr = 1-y*y;
- double x,z;
- for(double alpha=0;alpha<Math.PI*2;alpha+=Math.PI*2d/(sqr*16d+0.1d))
- {
- x=Math.cos(alpha)*sqr;
- z=Math.sin(alpha)*sqr;
- lightSphereVectors.add(Vec3.createVectorHelper(x*0.5d, y*0.5d, z*0.5d));
- }
- }
+public class SpotlightTileEntity extends LightBulbTileEntity implements INetworkTileEntityEventListener {
+ public float directionX = 0f;
+ public float directionY = -1f;
+ public float directionZ = 0f;
+ public float prevDirectionX = 0f;
+ public float prevDirectionY = -1f;
+ public float prevDirectionZ = 0f;
+ public float rotationPitch = 0f;
+ public float rotationYaw = 0f;
+ public float prevRotationPitch = 0f;
+ public float prevRotationYaw = 0f;
+ boolean needLightTargetUpdate = false;
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound) {
+ super.readFromNBT(nbttagcompound);
+ directionX = nbttagcompound.getFloat("directionX");
+ directionY = nbttagcompound.getFloat("directionY");
+ directionZ = nbttagcompound.getFloat("directionZ");
+ this.rotationPitch = this.getVectorPitchAngle(directionX,directionY,directionZ);
+ this.rotationYaw = this.getVectorYawAngle(directionX,directionY,directionZ);
+ needLightTargetUpdate = true;
}
-
- @Override
- public void readFromNBT(NBTTagCompound nbttagcompound)
- {
- super.readFromNBT(nbttagcompound);
- directionVector.xCoord = nbttagcompound.getDouble("directionVector.xCoord");
- directionVector.yCoord = nbttagcompound.getDouble("directionVector.yCoord");
- directionVector.zCoord = nbttagcompound.getDouble("directionVector.zCoord");
- this.rotationPitch=this.getVectorPitchAngle(directionVector);
- this.rotationYaw=this.getVectorYawAngle(directionVector);
- needLightTargetUpdate=true;
- }
- @Override
- public void writeToNBT(NBTTagCompound nbttagcompound)
- {
- super.writeToNBT(nbttagcompound);
- nbttagcompound.setDouble("directionVector.xCoord", directionVector.xCoord);
- nbttagcompound.setDouble("directionVector.yCoord", directionVector.yCoord);
- nbttagcompound.setDouble("directionVector.zCoord", directionVector.zCoord);
- }
-
- @Override
- public List<String> getNetworkedFields()
- {
- List<String> list = super.getNetworkedFields();
- list.add("rotationPitch");
- list.add("rotationYaw");
- return list;
- }
-
- public void setLightOn()
- {
- Iterator<XYZ> gai = xyzGlowningAir.iterator();
- while(gai.hasNext())
- {
- XYZ xyz = gai.next();
- Block block = worldObj.getBlock(xyz.x,xyz.y,xyz.z);
- if(block==Blocks.air || block.isAir(this.worldObj, xyz.x,xyz.y,xyz.z))
- {
- worldObj.setBlock(xyz.x, xyz.y, xyz.z, LightBulbBlock.glowningAir);
- }
- }
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound) {
+ super.writeToNBT(nbttagcompound);
+ nbttagcompound.setDouble("directionX", directionX);
+ nbttagcompound.setDouble("directionY", directionY);
+ nbttagcompound.setDouble("directionZ", directionZ);
}
-
- public void setLightOff()
- {
- Iterator<XYZ> gai = xyzGlowningAir.iterator();
- while(gai.hasNext())
- {
- XYZ xyz = gai.next();
- Block block = worldObj.getBlock(xyz.x,xyz.y,xyz.z);
- if(block == LightBulbBlock.glowningAir)
- {
- worldObj.setBlockToAir(xyz.x, xyz.y, xyz.z);
- }
- }
+
+ @Override
+ public List<String> getNetworkedFields() {
+ List<String> list = super.getNetworkedFields();
+ list.add("needLightTargetUpdate");
+ list.add("rotationPitch");
+ list.add("rotationYaw");
+ list.add("directionX");
+ list.add("directionY");
+ list.add("directionZ");
+ return list;
}
-
+
@Override
- public void updateEntity()
- {
+ public void updateEntity() {
super.updateEntity();
- if(needLightTargetUpdate)
- {
- this.generateGlowningAirList();
+ if (this.worldObj.isRemote) {
+ if(this.directionX!=this.prevDirectionX ||
+ this.directionY!=this.prevDirectionY ||
+ this.directionZ!=this.prevDirectionZ){
+ updateLightState();
+ this.prevDirectionX=this.directionX;
+ this.prevDirectionY=this.directionY;
+ this.prevDirectionZ=this.directionZ;
+ }
+ } else if (needLightTargetUpdate) {
this.updateLightState();
- needLightTargetUpdate=false;
- }
- if(this.prevRotationPitch!=this.rotationPitch)
- {
- IC2.network.get().updateTileEntityField(this, "rotationPitch");
- this.prevRotationPitch=this.rotationPitch;
+ needLightTargetUpdate = false;
}
- if(this.prevRotationYaw!=this.rotationYaw)
- {
- IC2.network.get().updateTileEntityField(this, "rotationYaw");
- this.prevRotationYaw=this.rotationYaw;
+ if (!this.worldObj.isRemote) {
+ if (this.prevRotationPitch != this.rotationPitch) {
+ IC2.network.get().updateTileEntityField(this, "rotationPitch");
+ this.prevRotationPitch = this.rotationPitch;
+ }
+ if (this.prevRotationYaw != this.rotationYaw) {
+ IC2.network.get().updateTileEntityField(this, "rotationYaw");
+ this.prevRotationYaw = this.rotationYaw;
+ }
}
- }
-
+ }
+
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return IHLUtils.getThisModItemStack("spotlight");
}
-
- public void setDirectionVector(EntityLivingBase player)
- {
- ForgeDirection dir = ForgeDirection.getOrientation(this.getFacing());
- Vec3 lookVec = player.getLookVec();
- if(lookVec.xCoord*dir.offsetX+lookVec.yCoord*dir.offsetY+lookVec.zCoord*dir.offsetZ<0)
- {
- double x=player.posX-this.xCoord-0.5D;
- double y=player.posY+player.getEyeHeight()-this.yCoord-0.5D;
- double z=player.posZ-this.zCoord-0.5D;
- double d=Math.sqrt(x*x+y*y+z*z);
- directionVector=Vec3.createVectorHelper(x/d, y/d, z/d);
- }
- else
- {
- directionVector=player.getLookVec();
- }
- this.rotationPitch=this.getVectorPitchAngle(directionVector);
- this.rotationYaw=this.getVectorYawAngle(directionVector);
- this.needLightTargetUpdate=true;
- IC2.network.get().initiateTileEntityEvent(this, 0, true);
- }
-
- private void generateGlowningAirList()
- {
- this.setLightOff();
- xyzGlowningAir.clear();
- Iterator<Vec3> lvi = lightSphereVectors.iterator();
- while(lvi.hasNext())
- {
- traceVectorToLastAirBlock(lvi.next());
+
+ public void setDirectionVector(EntityLivingBase player) {
+ ForgeDirection dir = ForgeDirection.getOrientation(this.getFacing());
+ Vec3 lookVec = player.getLookVec();
+ if (lookVec.xCoord * dir.offsetX + lookVec.yCoord * dir.offsetY + lookVec.zCoord * dir.offsetZ < 0) {
+ double x = player.posX - this.xCoord - 0.5D;
+ double y = player.posY + player.getEyeHeight() - this.yCoord - 0.5D;
+ double z = player.posZ - this.zCoord - 0.5D;
+ double d = Math.sqrt(x * x + y * y + z * z);
+ directionX = (float) (x / d);
+ directionY = (float) (y / d);
+ directionZ = (float) (z / d);
+ } else {
+ Vec3 plook = player.getLookVec();
+ directionX = (float) (plook.xCoord);
+ directionY = (float) (plook.yCoord);
+ directionZ = (float) (plook.zCoord);
}
+ IC2.network.get().updateTileEntityField(this, "directionX");
+ IC2.network.get().updateTileEntityField(this, "directionY");
+ IC2.network.get().updateTileEntityField(this, "directionZ");
+ this.rotationPitch = this.getVectorPitchAngle(directionX,directionY,directionZ);
+ this.rotationYaw = this.getVectorYawAngle(directionX,directionY,directionZ);
+ this.needLightTargetUpdate = true;
+ IC2.network.get().initiateTileEntityEvent(this, 0, true);
}
-
- private void traceVectorToLastAirBlock(Vec3 vector)
- {
- double dx=directionVector.xCoord;
- double dy=directionVector.yCoord;
- double dz=directionVector.zCoord;
- double dx1=vector.xCoord;
- double dy1=vector.yCoord;
- double dz1=vector.zCoord;
- if(2*dx*dx1+dx1*dx1+2*dy*dy1+dy1*dy1+2*dz*dz1+dz1*dz1>0d)
- {
- double x1=xCoord+0.5d;
- double y1=yCoord+0.5d;
- double z1=zCoord+0.5d;
- int xi1=xCoord;
- int yi1=yCoord;
- int zi1=zCoord;
- int airx=xCoord;
- int airy=yCoord;
- int airz=zCoord;
- for(int i=0;i<maxLightRange;i++)
- {
- int xi = (int)Math.floor(x1+(dx+dx1)*i*0.79);
- int yi = (int)Math.floor(y1+(dy+dy1)*i*0.79);
- int zi = (int)Math.floor(z1+(dz+dz1)*i*0.79);
- if(xi!=xi1||yi!=yi1||zi!=zi1)
- {
- Block block = worldObj.getBlock(xi,yi,zi);
- if(block!=Blocks.air && !block.isAir(worldObj, xi, yi, zi) && block.getMaterial()!=Material.glass && block.getMaterial()!=Material.air)
- {
- xyzGlowningAir.add(new XYZ(airx,airy,airz));
- break;
- }
- else
- {
- if(block.isAir(worldObj, xi, yi, zi) || block==Blocks.air)
- {
- airx=xi;
- airy=yi;
- airz=zi;
- }
- xi1=xi;
- yi1=yi;
- zi1=zi;
- }
- }
- }
+
+ private float getVectorPitchAngle(float x, float y, float z) {
+ switch (this.getFacing()) {
+ case 0:
+ return (float) -(Math.abs(Math.asin(z)) + Math.abs(Math.asin(x)));
+ case 1:
+ return (float) (Math.abs(Math.asin(z)) + Math.abs(Math.asin(x)));
+ case 2:
+ return (float) (Math.abs(Math.asin(y)) + Math.abs(Math.asin(x)));
+ case 3:
+ return (float) (Math.abs(Math.asin(y)) + Math.abs(Math.asin(x)));
+ case 4:
+ return (float) (Math.abs(Math.asin(y)) + Math.abs(Math.asin(z)));
+ case 5:
+ return (float) (Math.abs(Math.asin(y)) + Math.abs(Math.asin(z)));
+ default:
+ return (float) (-Math.asin(y));
}
}
-
+
+ @SideOnly(value = Side.CLIENT)
@Override
- protected void updateLightState()
- {
- if(this.getActive())
- {
- setLightOn();
- }
- else
- {
- setLightOff();
- }
- }
-
- private float getVectorPitchAngle(Vec3 vector)
- {
- double x=vector.xCoord;
- double y=vector.yCoord;
- double z=vector.zCoord;
- switch(this.getFacing())
- {
- case 0:
- return (float)-(Math.abs(Math.asin(z))+Math.abs(Math.asin(x)));
- case 1:
- return (float)(Math.abs(Math.asin(z))+Math.abs(Math.asin(x)));
- case 2:
- return (float)(Math.abs(Math.asin(y))+Math.abs(Math.asin(x)));
- case 3:
- return (float)(Math.abs(Math.asin(y))+Math.abs(Math.asin(x)));
- case 4:
- return (float)(Math.abs(Math.asin(y))+Math.abs(Math.asin(z)));
- case 5:
- return (float)(Math.abs(Math.asin(y))+Math.abs(Math.asin(z)));
- default:
- return (float)(-Math.asin(y));
- }
+ protected LightSource createLightSource(int red, int green, int blue) {
+ return ((ClientProxy) IHLMod.proxy).getLightHandler().calculateLightSource(worldObj, xCoord, yCoord, zCoord,
+ 256, red, green, blue, new double[] { this.xCoord + 0.5f, this.yCoord + 0.5f, this.zCoord + 0.5f,
+ this.directionX, this.directionY, this.directionZ, 0.8d });
}
-
- private float getVectorYawAngle(Vec3 vector)
- {
- double x=vector.xCoord;
- double y=vector.yCoord;
- double z=vector.zCoord;
- switch(this.getFacing())
- {
- case 0:
- if(z>=0)
- {
- return (float)(Math.acos(x/Math.sqrt(x*x+z*z))-Math.PI/2);
- }
- else
- {
- return (float)(-Math.acos(x/Math.sqrt(x*x+z*z))-Math.PI/2);
- }
- case 1:
- if(z>=0)
- {
- return (float)(Math.acos(x/Math.sqrt(x*x+z*z))-Math.PI/2);
- }
- else
- {
- return (float)(-Math.acos(x/Math.sqrt(x*x+z*z))-Math.PI/2);
- }
- case 2:
- if(y>=0)
- {
- return (float)(-Math.acos(x/Math.sqrt(x*x+y*y))-Math.PI/2);
- }
- else
- {
- return (float)(Math.acos(x/Math.sqrt(x*x+y*y))-Math.PI/2);
- }
- case 3:
- if(y>=0)
- {
- return (float)(-Math.acos(x/Math.sqrt(x*x+y*y))-Math.PI/2);
- }
- else
- {
- return (float)(Math.acos(x/Math.sqrt(x*x+y*y))-Math.PI/2);
- }
- case 4:
- if(y>=0)
- {
- return (float)(-Math.acos(z/Math.sqrt(z*z+y*y))-Math.PI/2);
- }
- else
- {
- return (float)(Math.acos(z/Math.sqrt(z*z+y*y))-Math.PI/2);
- }
- case 5:
- if(y>=0)
- {
- return (float)(-Math.acos(z/Math.sqrt(z*z+y*y))-Math.PI/2);
- }
- else
- {
- return (float)(Math.acos(z/Math.sqrt(z*z+y*y))-Math.PI/2);
- }
- default:
- return 0f;
+
+ private float getVectorYawAngle(float x, float y, float z) {
+ switch (this.getFacing()) {
+ case 0:
+ if (z >= 0) {
+ return (float) (Math.acos(x / Math.sqrt(x * x + z * z)) - Math.PI / 2);
+ } else {
+ return (float) (-Math.acos(x / Math.sqrt(x * x + z * z)) - Math.PI / 2);
+ }
+ case 1:
+ if (z >= 0) {
+ return (float) (Math.acos(x / Math.sqrt(x * x + z * z)) - Math.PI / 2);
+ } else {
+ return (float) (-Math.acos(x / Math.sqrt(x * x + z * z)) - Math.PI / 2);
+ }
+ case 2:
+ if (y >= 0) {
+ return (float) (-Math.acos(x / Math.sqrt(x * x + y * y)) - Math.PI / 2);
+ } else {
+ return (float) (Math.acos(x / Math.sqrt(x * x + y * y)) - Math.PI / 2);
+ }
+ case 3:
+ if (y >= 0) {
+ return (float) (-Math.acos(x / Math.sqrt(x * x + y * y)) - Math.PI / 2);
+ } else {
+ return (float) (Math.acos(x / Math.sqrt(x * x + y * y)) - Math.PI / 2);
+ }
+ case 4:
+ if (y >= 0) {
+ return (float) (-Math.acos(z / Math.sqrt(z * z + y * y)) - Math.PI / 2);
+ } else {
+ return (float) (Math.acos(z / Math.sqrt(z * z + y * y)) - Math.PI / 2);
+ }
+ case 5:
+ if (y >= 0) {
+ return (float) (-Math.acos(z / Math.sqrt(z * z + y * y)) - Math.PI / 2);
+ } else {
+ return (float) (Math.acos(z / Math.sqrt(z * z + y * y)) - Math.PI / 2);
+ }
+ default:
+ return 0f;
}
}
@Override
- public void onNetworkEvent(int event)
- {
- this.worldObj.playSound(xCoord+0.5d, yCoord+0.5d, zCoord+0.5d, IHLModInfo.MODID+":spotlightRotating", 10F, 1f, true);
+ public void onNetworkEvent(int event) {
+ this.worldObj.playSound(xCoord + 0.5d, yCoord + 0.5d, zCoord + 0.5d, IHLModInfo.MODID + ":spotlightRotating",
+ 10F, 1f, true);
}
}
-
-/* -Y DOWN(0, -1, 0) 0
-/* +Y UP(0, 1, 0) 1
-/* -Z NORTH(0, 0, -1) 2
-/* +Z SOUTH(0, 0, 1) 3
-/* -X WEST(-1, 0, 0), 4
-/* +X EAST(1, 0, 0), 5
-//VALID_DIRECTIONS = {DOWN, UP, NORTH, SOUTH, WEST, EAST};*/
+/*
+ * -Y DOWN(0, -1, 0) 0 /* +Y UP(0, 1, 0) 1 /* -Z NORTH(0, 0, -1) 2 /* +Z
+ * SOUTH(0, 0, 1) 3 /* -X WEST(-1, 0, 0), 4 /* +X EAST(1, 0, 0), 5
+ * //VALID_DIRECTIONS = {DOWN, UP, NORTH, SOUTH, WEST, EAST};
+ */
diff --git a/ihl/explosion/ExplosionVectorBlockV2.java b/ihl/explosion/ExplosionVectorBlockV2.java
index f766a09..1a65aef 100644
--- a/ihl/explosion/ExplosionVectorBlockV2.java
+++ b/ihl/explosion/ExplosionVectorBlockV2.java
@@ -1,6 +1,7 @@
package ihl.explosion;
import ihl.IHLMod;
+import ihl.utils.IHLMathUtils;
import ihl.utils.IHLUtils;
import java.util.ArrayList;
@@ -37,7 +38,8 @@ public class ExplosionVectorBlockV2 {
private final int maxValue = (1 << bits) - 1;
public final int halfValue = (1 << bits - 1) - 1;
private final int maxArraySize = 1 << bits * 3;
- public final int[][] vectors = new int[maxArraySize][2];
+// public final int[][] vectors = new int[maxArraySize][2];
+ public final int[][] vectors = new int[maxArraySize][0];
private final Set<Chunk> chunksToUpdate = new HashSet<Chunk>(64);
private final Map<Integer, ItemStack> cachedDrops = new HashMap<Integer, ItemStack>(128);
final Map<Integer, WorldSavedDataBlastWave> blastWaveByDimensionId = new HashMap<Integer, WorldSavedDataBlastWave>();
@@ -64,41 +66,45 @@ public class ExplosionVectorBlockV2 {
public int[] decodeXYZ(int l) {
return new int[] { l >> bits * 2, l >> bits & maxValue, l & maxValue };
}
-
+
public void precalculateExplosion() {
for (int levelRadius = 1; levelRadius <= this.maxValue; levelRadius++)
for (int ix = 0; ix <= levelRadius; ix++)
- for (int iy = 0; iy <= levelRadius; iy++)
+ for (int iy = 0; iy <= levelRadius; iy++) {
for (int iz = (ix == levelRadius || iy == levelRadius) ? 0 : levelRadius; iz <= levelRadius; iz++) {
int vxyz = encodeXYZ(ix, iy, iz);
int[] prevXYZ = new int[] { ix, iy, iz };
- reduceCoordinate(prevXYZ);
+ reduceCoordinate(prevXYZ, levelRadius);
int pvxyz = encodeXYZ(prevXYZ[0], prevXYZ[1], prevXYZ[2]);
findFreeSpace(pvxyz, vxyz);
}
+ }
}
private void findFreeSpace(int pvxyz, int vxyz) {
- if (vectors[pvxyz][0] == 0) {
- vectors[pvxyz][0] = vxyz;
- } else if (vectors[pvxyz][1] == 0) {
- vectors[pvxyz][1] = vxyz;
- } else {
- findFreeSpace(vectors[pvxyz][0], vxyz);
+ int[] nV = new int[vectors[pvxyz].length+1];
+ for(int i=0;i<vectors[pvxyz].length;i++){
+ nV[i]=vectors[pvxyz][i];
}
+ nV[vectors[pvxyz].length] = vxyz;
+ vectors[pvxyz] = nV;
}
- private void reduceCoordinate(int[] pxyz) {
-
- if (pxyz[0] >= pxyz[1] && pxyz[0] >= pxyz[2] && pxyz[0] > 0) {
- pxyz[0]--;
- }
- if (pxyz[1] >= pxyz[0] && pxyz[1] >= pxyz[2] && pxyz[1] > 0) {
- pxyz[1]--;
- }
- if (pxyz[2] >= pxyz[1] && pxyz[2] >= pxyz[0] && pxyz[2] > 0) {
- pxyz[2]--;
+ private void reduceCoordinate(int[] pxyz, int levelRadius) {
+ float x = pxyz[0]+0.5f;
+ float y = pxyz[1]+0.5f;
+ float z = pxyz[2]+0.5f;
+ float rx = x/levelRadius;
+ float ry = y/levelRadius;
+ float rz = z/levelRadius;
+ while(x>=pxyz[0] && y>=pxyz[1] && z>=pxyz[2]){
+ x-=rx;
+ y-=ry;
+ z-=rz;
}
+ pxyz[0]=x<0?0:(int)x;
+ pxyz[1]=y<0?0:(int)y;
+ pxyz[2]=z<0?0:(int)z;
}
public void breakBlocksAndGetDescendants(World world, int sourceX, int sourceY, int sourceZ, Explosion explosion,
@@ -106,7 +112,7 @@ public class ExplosionVectorBlockV2 {
power = this.getNewPowerAndProcessBlocks(world, ev, sourceX, sourceY, sourceZ, explosion, power, directionMask);
power = (int) (power * 0.94) - 1;
if (power > 1) {
- if (this.vectors[ev][0] == 0) {
+ if (this.vectors[ev].length==0) {
int[] xyz = decodeXYZ(ev);
int xb = xyz[0] >> bits - 1;
int yb = xyz[1] >> bits - 1;
@@ -124,10 +130,8 @@ public class ExplosionVectorBlockV2 {
explosion, ev2, power, directionMask);
} else {
for (int d1 : this.vectors[ev]) {
- if (d1 != 0) {
breakBlocksAndGetDescendants(world, sourceX, sourceY, sourceZ, explosion, d1, power,
directionMask);
- }
}
}
}
diff --git a/ihl/items_blocks/ItemSubstance.java b/ihl/items_blocks/ItemSubstance.java
index 528f453..9c55e36 100644
--- a/ihl/items_blocks/ItemSubstance.java
+++ b/ihl/items_blocks/ItemSubstance.java
@@ -190,8 +190,8 @@ public class ItemSubstance extends Item implements IItemHasMiniGUI {
DustPotassiumOxide(191, "dustPotassiumOxide", true, "K\u2082O"),
IngotPotassium(190, "ingotPotassium", true, "K"),
catalystIron(189, "catalystIron", false, "Fe (foam) + Al\u2082O\u2083 + K\u2082O"),
-// catalystIronOxide(188, "catalystIronOxide", false, "Fe\u2082O\u2083 + Al\u2082O\u2083 + K\u2082O"),
-// catalystRawIronOxide(187, "catalystRawIronOxide", false, "Fe\u2082O\u2083 + Al\u2082O\u2083 + K\u2082O"),
+ catalystIronOxide(188, "catalystIronOxide", false, "Fe\u2082O\u2083 + Al\u2082O\u2083 + K\u2082O"),
+ catalystRawIronOxide(187, "catalystRawIronOxide", false, "Fe\u2082O\u2083 + Al\u2082O\u2083 + K\u2082O"),
IronOxideCatalystMix(186, "dustIronOxideCatalystMix", false, "Fe\u2082O\u2083 + Al\u2082O\u2083 + K\u2082O"),
SodiumFormate(185, "dustSodiumFormate", true, "HCO\u2082Na"),
MercuryChloride(184, "dustMercuryChloride", true, "HgCl\u2082"),
diff --git a/ihl/model/RenderBlocksExt.java b/ihl/model/RenderBlocksExt.java
index b4b334a..5355b13 100644
--- a/ihl/model/RenderBlocksExt.java
+++ b/ihl/model/RenderBlocksExt.java
@@ -2,8 +2,11 @@ package ihl.model;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
+import net.minecraftforge.common.util.ForgeDirection;
import java.util.HashSet;
import java.util.Set;
@@ -14,82 +17,308 @@ import ihl.ClientProxy;
import ihl.IHLMod;
import ihl.enviroment.LightSource;
-@SideOnly(value=Side.CLIENT)
+@SideOnly(value = Side.CLIENT)
public class RenderBlocksExt extends RenderBlocks {
public static RenderBlocksExt instance;
- private final int[] YNEG = new int[] { 0, -1, 0 };
- private final int[] YPOS = new int[] { 0, 1, 0 };
- private final int[] XNEG = new int[] { -1, 0, 0 };
- private final int[] XPOS = new int[] { 1, 0, 0 };
- private final int[] ZNEG = new int[] { 0, 0, -1 };
- private final int[] ZPOS = new int[] { 0, 0, 1 };
- private final int BRIGHT = 0x0000FF;
- private final int DARK = 0x000000;
+ final static int[][] NULL_NORMAL = new int[][] { new int[] { 0, 0, 0 },
+
+ new int[] { 1, 0, 0 }, // Top left
+ new int[] { 0, 0, 1 }, new int[] { 1, 0, 1 },
+
+ new int[] { -1, 0, 0 }, // Top Right
+ new int[] { 0, 0, 1 }, new int[] { -1, 0, 1 },
+
+ new int[] { 1, 0, 0 }, // Bottom Left
+ new int[] { 0, 0, -1 }, new int[] { 1, 0, -1 },
+
+ new int[] { -1, 0, 0 }, // Bottom Right
+ new int[] { 0, 0, -1 }, new int[] { -1, 0, -1 },
+
+ };
+ private final static int[][] YNEG = new int[][] { new int[] { 0, -1, 0 }, // 0
+
+ new int[] { -1, 0, 0 }, // Top left
+ new int[] { 0, 0, 1 }, new int[] { -1, 0, 1 },
+
+ new int[] { 1, 0, 0 }, // Top Right
+ new int[] { 0, 0, 1 }, new int[] { 1, 0, 1 },
+
+ new int[] { -1, 0, 0 }, // Bottom Left
+ new int[] { 0, 0, -1 }, new int[] { -1, 0, -1 },
+
+ new int[] { 1, 0, 0 }, // Bottom Right
+ new int[] { 0, 0, -1 }, new int[] { 1, 0, -1 }, };
+ private final static int[][] YPOS = new int[][] { new int[] { 0, 1, 0 },
+
+ new int[] { 1, 0, 0 }, // Top left
+ new int[] { 0, 0, 1 }, new int[] { 1, 0, 1 },
+
+ new int[] { -1, 0, 0 }, // Top Right
+ new int[] { 0, 0, 1 }, new int[] { -1, 0, 1 },
+
+ new int[] { 1, 0, 0 }, // Bottom Left
+ new int[] { 0, 0, -1 }, new int[] { 1, 0, -1 },
+
+ new int[] { -1, 0, 0 }, // Bottom Right
+ new int[] { 0, 0, -1 }, new int[] { -1, 0, -1 },
+
+ };
+ private final static int[][] XNEG = new int[][] { new int[] { -1, 0, 0 }, // 4
+
+ new int[] { 0, 1, 0 }, // Top left
+ new int[] { 0, 0, 1 }, new int[] { 0, 1, 1 },
+
+ new int[] { 0, -1, 0 }, // Top Right
+ new int[] { 0, 0, 1 }, new int[] { 0, -1, 1 },
+
+ new int[] { 0, 1, 0 }, // Bottom Left
+ new int[] { 0, 0, -1 }, new int[] { 0, 1, -1 },
+
+ new int[] { 0, -1, 0 }, // Bottom Right
+ new int[] { 0, 0, -1 }, new int[] { 0, -1, -1 }, };
+ private final static int[][] XPOS = new int[][] { new int[] { 1, 0, 0 }, // 5
+
+ new int[] { 0, -1, 0 }, // Top left
+ new int[] { 0, 0, 1 }, new int[] { 0, -1, 1 },
+
+ new int[] { 0, 1, 0 }, // Top Right
+ new int[] { 0, 0, 1 }, new int[] { 0, 1, 1 },
+
+ new int[] { 0, -1, 0 }, // Bottom Left
+ new int[] { 0, 0, -1 }, new int[] { 0, -1, -1 },
+
+ new int[] { 0, 1, 0 }, // Bottom Right
+ new int[] { 0, 0, -1 }, new int[] { 0, 1, -1 }, };
+ private final static int[][] ZNEG = new int[][] { new int[] { 0, 0, -1 }, // 2
+
+ new int[] { -1, 0, 0 }, // Top left
+ new int[] { 0, 1, 0 }, new int[] { -1, 1, 0 },
+
+ new int[] { -1, 0, 0 }, // Top Right
+ new int[] { 0, -1, 0 }, new int[] { -1, -1, 0 },
+
+ new int[] { 1, 0, 0 }, // Bottom Left
+ new int[] { 0, 1, 0 }, new int[] { 1, 1, 0 },
+
+ new int[] { 1, 0, 0 }, // Bottom Right
+ new int[] { 0, -1, 0 }, new int[] { 1, -1, 0 },
+
+ };
+ private final static int[][] ZPOS = new int[][] { new int[] { 0, 0, 1 }, // 3
+
+ new int[] { -1, 0, 0 }, // Top left
+ new int[] { 0, 1, 0 }, new int[] { -1, 1, 0 },
+
+ new int[] { 1, 0, 0 }, // Top Right
+ new int[] { 0, 1, 0 }, new int[] { 1, 1, 0 },
+
+ new int[] { -1, 0, 0 }, // Bottom Left
+ new int[] { 0, -1, 0 }, new int[] { -1, -1, 0 },
+
+ new int[] { 1, 0, 0 }, // Bottom Right
+ new int[] { 0, -1, 0 }, new int[] { 1, -1, 0 }, };
+ private final static int BRIGHT = 0xFF00F7;
+ final static int MASK = 0xFF0003;
public RenderBlocksExt(IBlockAccess blockAccess) {
super(blockAccess);
instance = this;
}
- private void transformColour(int x, int y, int z, int[] normal) {
- /* for (LightSource lightSource : ((ClientProxy)IHLMod.proxy).getLightHandler().lightSources) {
+ private void transformColour(Block block, int x, int y, int z, int[][] normal) {
+ int brightnessBase = block.getMixedBrightnessForBlock(this.blockAccess, x + normal[0][0], y + normal[0][1],
+ z + normal[0][2]);
+ int brightnessBase1 = brightnessBase;
+ int l = block.colorMultiplier(this.blockAccess, x, y, z);
+ float redF = (float) (l >> 16 & 255) / 255f;
+ float greenF = (float) (l >> 8 & 255) / 255f;
+ float blueF = (float) (l & 255) / 255f;
+ int baseColourValue = 255;
+ int[] baseColour = new int[] { baseColourValue, baseColourValue, baseColourValue };
+ int[] topLeft = new int[] { baseColourValue, baseColourValue, baseColourValue };
+ int[] topRight = new int[] { baseColourValue, baseColourValue, baseColourValue };
+ int[] bottomLeft = new int[] { baseColourValue, baseColourValue, baseColourValue };
+ int[] bottomRight = new int[] { baseColourValue, baseColourValue, baseColourValue };
+ int brightnessTopLeft1 = this.brightnessTopLeft;
+ int brightnessTopRight1 = this.brightnessTopRight;
+ int brightnessBottomLeft1 = this.brightnessBottomLeft;
+ int brightnessBottomRight1 = this.brightnessBottomRight;
+ boolean lightAffected = false;
+ for (LightSource lightSource : ((ClientProxy) IHLMod.proxy).getLightHandler().lightSources) {
if (lightSource.isBlockIlluminated(x, y, z)) {
- int[] lightValue = lightSource.getLightValue((int) x, (int) y, (int) z, normal);
- System.out.println("this.brightnessBottomRight="+this.brightnessBottomRight);
- this.brightnessTopLeft |= lightValue[0];
- this.brightnessBottomLeft |= lightValue[0];
- this.brightnessTopRight |= lightValue[0];
- this.brightnessBottomRight |= lightValue[0];
- this.colorRedTopLeft *= (255 - lightValue[0]) * lightValue[1] / 255 / 255f;
- this.colorRedBottomLeft *= (255 - lightValue[0]) * lightValue[1] / 255 / 255f;
- this.colorRedTopRight *= (255 - lightValue[0]) * lightValue[1] / 255 / 255f;
- this.colorRedBottomRight *= (255 - lightValue[0]) * lightValue[1] / 255 / 255f;
- this.colorBlueTopLeft *= (255 - lightValue[0]) * lightValue[2] / 255 / 255f;
- this.colorBlueBottomLeft *= (255 - lightValue[0]) * lightValue[2] / 255 / 255f;
- this.colorBlueTopRight *= (255 - lightValue[0]) * lightValue[2] / 255 / 255f;
- this.colorBlueBottomRight *= (255 - lightValue[0]) * lightValue[2] / 255 / 255f;
- this.colorGreenTopLeft *= (255 - lightValue[0]) * lightValue[3] / 255 / 255f;
- this.colorGreenBottomLeft *= (255 - lightValue[0]) * lightValue[3] / 255 / 255f;
- this.colorGreenTopRight *= (255 - lightValue[0]) * lightValue[3] / 255 / 255f;
- this.colorGreenBottomRight *= (255 - lightValue[0]) * lightValue[3] / 255 / 255f;
+ lightAffected = true;
+ int[] lightValue = lightSource.getLightValue(x, y, z, normal[0]);
+ if ((brightnessBase & 240) < lightValue[0]) {
+ int colourFactor = lightValue[0] - (brightnessBase & 240);
+ if ((brightnessBase1 & 240) < lightValue[0]) {
+ brightnessBase1 &= MASK;
+ brightnessBase1 |= lightValue[0];
+ }
+ baseColour[0] += lightValue[1] * colourFactor / 255;
+ baseColour[1] += lightValue[2] * colourFactor / 255;
+ baseColour[2] += lightValue[3] * colourFactor / 255;
+ }
+ if (this.enableAO) {
+ if (lightSource.isBlockIlluminated(x + normal[1][0], y + normal[1][1], z + normal[1][2])
+ && lightSource.isBlockIlluminated(x + normal[2][0], y + normal[2][1], z + normal[2][2])
+ && lightSource.isBlockIlluminated(x + normal[3][0], y + normal[3][1], z + normal[3][2])) {
+ lightValue = lightSource.getLightValue(x + normal[3][0], y + normal[3][1], z + normal[3][2],
+ normal[0]);
+ if ((this.brightnessTopLeft & 240) < lightValue[0]) {
+ int colourFactor = lightValue[0] - (this.brightnessTopLeft & 240);
+ if ((brightnessTopLeft1 & 240) < lightValue[0]) {
+ brightnessTopLeft1 &= MASK;
+ brightnessTopLeft1 |= lightValue[0];
+ }
+ topLeft[0] += lightValue[1] * colourFactor / 255;
+ topLeft[1] += lightValue[2] * colourFactor / 255;
+ topLeft[2] += lightValue[3] * colourFactor / 255;
+ }
+ }
+ if (lightSource.isBlockIlluminated(x + normal[4][0], y + normal[4][1], z + normal[4][2])
+ && lightSource.isBlockIlluminated(x + normal[5][0], y + normal[5][1], z + normal[5][2])
+ && lightSource.isBlockIlluminated(x + normal[6][0], y + normal[6][1], z + normal[6][2])) {
+ lightValue = lightSource.getLightValue(x + normal[6][0], y + normal[6][1], z + normal[6][2],
+ normal[0]);
+ if ((this.brightnessTopRight & 240) < lightValue[0]) {
+ int colourFactor = lightValue[0] - (this.brightnessTopRight & 240);
+ if ((brightnessTopRight1 & 240) < lightValue[0]) {
+ brightnessTopRight1 &= MASK;
+ brightnessTopRight1 |= lightValue[0];
+ }
+ topRight[0] += lightValue[1] * colourFactor / 255;
+ topRight[1] += lightValue[2] * colourFactor / 255;
+ topRight[2] += lightValue[3] * colourFactor / 255;
+ }
+ }
+ if (lightSource.isBlockIlluminated(x + normal[7][0], y + normal[7][1], z + normal[7][2])
+ && lightSource.isBlockIlluminated(x + normal[8][0], y + normal[8][1], z + normal[8][2])
+ && lightSource.isBlockIlluminated(x + normal[9][0], y + normal[9][1], z + normal[9][2])) {
+ lightValue = lightSource.getLightValue(x + normal[9][0], y + normal[9][1], z + normal[9][2],
+ normal[0]);
+ if ((this.brightnessBottomLeft & 240) < lightValue[0]) {
+ int colourFactor = lightValue[0] - (this.brightnessBottomLeft & 240);
+ if ((brightnessBottomLeft1 & 240) < lightValue[0]) {
+ brightnessBottomLeft1 &= MASK;
+ brightnessBottomLeft1 |= lightValue[0];
+ }
+ bottomLeft[0] += lightValue[1] * colourFactor / 255;
+ bottomLeft[1] += lightValue[2] * colourFactor / 255;
+ bottomLeft[2] += lightValue[3] * colourFactor / 255;
+ }
+ }
+ if (lightSource.isBlockIlluminated(x + normal[10][0], y + normal[10][1], z + normal[10][2])
+ && lightSource.isBlockIlluminated(x + normal[11][0], y + normal[11][1], z + normal[11][2])
+ && lightSource.isBlockIlluminated(x + normal[12][0], y + normal[12][1],
+ z + normal[12][2])) {
+ lightValue = lightSource.getLightValue(x + normal[12][0], y + normal[12][1], z + normal[12][2],
+ normal[0]);
+ if ((this.brightnessBottomRight & 240) < lightValue[0]) {
+ int colourFactor = lightValue[0] - (this.brightnessBottomRight & 240);
+ if ((brightnessBottomRight1 & 240) < lightValue[0]) {
+ brightnessBottomRight1 &= MASK;
+ brightnessBottomRight1 |= lightValue[0];
+ }
+ bottomRight[0] += lightValue[1] * colourFactor / 255;
+ bottomRight[1] += lightValue[2] * colourFactor / 255;
+ bottomRight[2] += lightValue[3] * colourFactor / 255;
+ }
+ }
+ }
}
- }*/
+ }
+ if (lightAffected) {
+ normalizeColour(baseColour);
+ normalizeColour(topLeft);
+ normalizeColour(topRight);
+ normalizeColour(bottomLeft);
+ normalizeColour(bottomRight);
+ redF = mixLightColour(redF, baseColour[0]);
+ greenF = mixLightColour(greenF, baseColour[1]);
+ blueF = mixLightColour(blueF, baseColour[2]);
+ this.colorRedTopLeft = mixLightColour(colorRedTopLeft, topLeft[0]);
+ this.colorGreenTopLeft = mixLightColour(colorGreenTopLeft, topLeft[1]);
+ this.colorBlueTopLeft = mixLightColour(colorBlueTopLeft, topLeft[2]);
+ this.colorRedTopRight = mixLightColour(colorRedTopRight, topRight[0]);
+ this.colorGreenTopRight = mixLightColour(colorGreenTopRight, topRight[1]);
+ this.colorBlueTopRight = mixLightColour(colorBlueTopRight, topRight[2]);
+ this.colorRedBottomLeft = mixLightColour(colorRedBottomLeft, bottomLeft[0]);
+ this.colorGreenBottomLeft = mixLightColour(colorGreenBottomLeft, bottomLeft[1]);
+ this.colorBlueBottomLeft = mixLightColour(colorBlueBottomLeft, bottomLeft[2]);
+ this.colorRedBottomRight = mixLightColour(colorRedBottomRight, bottomRight[0]);
+ this.colorGreenBottomRight = mixLightColour(colorGreenBottomRight, bottomRight[1]);
+ this.colorBlueBottomRight = mixLightColour(colorBlueBottomRight, bottomRight[2]);
+ this.brightnessTopLeft = brightnessTopLeft1;
+ this.brightnessTopRight = brightnessTopRight1;
+ this.brightnessBottomLeft = brightnessBottomLeft1;
+ this.brightnessBottomRight = brightnessBottomRight1;
+ Tessellator.instance.setBrightness(brightnessBase1);
+ Tessellator.instance.setColorOpaque_F(redF, greenF, blueF);
+ }
+ }
+
+ static void normalizeColour(int[] colour) {
+ int max = colour[0];
+ if (max < colour[1])
+ max = colour[1];
+ if (max < colour[2])
+ max = colour[2];
+ if (max != 0) {
+ colour[0] = colour[0] * 255 / max;
+ colour[1] = colour[1] * 255 / max;
+ colour[2] = colour[2] * 255 / max;
+ } else {
+ colour[0] = 255;
+ colour[1] = 255;
+ colour[2] = 255;
+ }
+ }
+
+ static float mixLightColour(float original, int colour) {
+ return original * colour / 255f;
+ }
+
+ @Override
+ public void drawCrossedSquares(IIcon icon, double x, double y, double z, float f) {
+ this.transformColour(this.blockAccess.getBlock((int) x, (int) y, (int) z), (int) x, (int) y, (int) z,
+ NULL_NORMAL);
+ super.drawCrossedSquares(icon, x, y, z, f);
}
@Override
public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) {
- this.transformColour((int) x, (int) y, (int) z, YNEG);
+ this.transformColour(block, (int) x, (int) y, (int) z, YNEG);
super.renderFaceYNeg(block, x, y, z, icon);
}
@Override
public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) {
- this.transformColour((int) x, (int) y, (int) z, YPOS);
+ this.transformColour(block, (int) x, (int) y, (int) z, YPOS);
super.renderFaceYPos(block, x, y, z, icon);
}
@Override
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) {
- this.transformColour((int) x, (int) y, (int) z, ZNEG);
+ this.transformColour(block, (int) x, (int) y, (int) z, ZNEG);
super.renderFaceZNeg(block, x, y, z, icon);
}
@Override
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) {
- this.transformColour((int) x, (int) y, (int) z, ZPOS);
+ this.transformColour(block, (int) x, (int) y, (int) z, ZPOS);
super.renderFaceZPos(block, x, y, z, icon);
}
@Override
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) {
- this.transformColour((int) x, (int) y, (int) z, XNEG);
+ this.transformColour(block, (int) x, (int) y, (int) z, XNEG);
super.renderFaceXNeg(block, x, y, z, icon);
}
@Override
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) {
- this.transformColour((int) x, (int) y, (int) z, XPOS);
+ this.transformColour(block, (int) x, (int) y, (int) z, XPOS);
super.renderFaceXPos(block, x, y, z, icon);
}
}
diff --git a/ihl/model/TileEntityRendererDispatcherExt.java b/ihl/model/TileEntityRendererDispatcherExt.java
new file mode 100644
index 0000000..d051a3b
--- /dev/null
+++ b/ihl/model/TileEntityRendererDispatcherExt.java
@@ -0,0 +1,58 @@
+package ihl.model;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ihl.ClientProxy;
+import ihl.IHLMod;
+import ihl.enviroment.LightSource;
+import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
+import net.minecraft.tileentity.TileEntity;
+
+@SideOnly(Side.CLIENT)
+public class TileEntityRendererDispatcherExt extends TileEntityRendererDispatcher {
+
+ @Override
+ public void renderTileEntity(TileEntity tile, float partialTick) {
+ if (tile.getDistanceFrom(this.field_147560_j, this.field_147561_k, this.field_147558_l) < tile
+ .getMaxRenderDistanceSquared()) {
+ int x = tile.xCoord;
+ int y = tile.yCoord;
+ int z = tile.zCoord;
+ int brightnessBase = this.field_147550_f.getLightBrightnessForSkyBlocks(x, y, z, 0);
+ float red = 1f;
+ float green = 1f;
+ float blue = 1f;
+ int[] baseColour = new int[3];
+ boolean lightAffected = false;
+ for (LightSource lightSource : ((ClientProxy) IHLMod.proxy).getLightHandler().lightSources) {
+ if (lightSource.isBlockIlluminated(x, y, z)) {
+ lightAffected = true;
+ int[] lightValue = lightSource.getLightValue(x, y, z, RenderBlocksExt.NULL_NORMAL[0]);
+ if ((brightnessBase & 240) < lightValue[0]) {
+ int colourFactor = lightValue[0] - (brightnessBase & 240);
+ brightnessBase &= RenderBlocksExt.MASK;
+ brightnessBase |= lightValue[0];
+ baseColour[0] += lightValue[1] * colourFactor / 255;
+ baseColour[1] += lightValue[2] * colourFactor / 255;
+ baseColour[2] += lightValue[3] * colourFactor / 255;
+ }
+ }
+ }
+ if (lightAffected) {
+ RenderBlocksExt.normalizeColour(baseColour);
+ red = RenderBlocksExt.mixLightColour(red, baseColour[0]);
+ green = RenderBlocksExt.mixLightColour(green, baseColour[1]);
+ blue = RenderBlocksExt.mixLightColour(blue, baseColour[2]);
+ }
+ int j = brightnessBase % 65536;
+ int k = brightnessBase / 65536;
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F);
+ GL11.glColor4f(red, green, blue, 1.0F);
+ this.renderTileEntityAt(tile, (double) x - staticPlayerX, (double) y - staticPlayerY,
+ (double) z - staticPlayerZ, partialTick);
+ }
+ }
+}
diff --git a/ihl/nei_integration/FluidizedBedReactorRecipeHandler.java b/ihl/nei_integration/FluidizedBedReactorRecipeHandler.java
index 9f90536..e5dba3d 100644
--- a/ihl/nei_integration/FluidizedBedReactorRecipeHandler.java
+++ b/ihl/nei_integration/FluidizedBedReactorRecipeHandler.java
@@ -22,7 +22,7 @@ public class FluidizedBedReactorRecipeHandler extends MachineRecipeHandler
@Override
protected int[] getInputPosX()
{
- return new int[]{8-5};
+ return new int[]{41-5};
}
@Override
@@ -46,7 +46,7 @@ public class FluidizedBedReactorRecipeHandler extends MachineRecipeHandler
@Override
protected int[] getOutputPosX()
{
- return new int[]{43-5};
+ return new int[]{76-5};
}
@Override
@@ -95,7 +95,7 @@ public class FluidizedBedReactorRecipeHandler extends MachineRecipeHandler
@Override
public void loadTransferRects()
{
- this.transferRects.add(new RecipeTransferRect(new Rectangle(25-5,34-10, 17, 13), this.getRecipeId(), new Object[0]));
+ this.transferRects.add(new RecipeTransferRect(new Rectangle(58-5,34-10, 17, 13), this.getRecipeId(), new Object[0]));
}
@Override
diff --git a/ihl/nei_integration/LabElectrolyzerRecipeHandler.java b/ihl/nei_integration/LabElectrolyzerRecipeHandler.java
index ad40647..5e28067 100644
--- a/ihl/nei_integration/LabElectrolyzerRecipeHandler.java
+++ b/ihl/nei_integration/LabElectrolyzerRecipeHandler.java
@@ -3,6 +3,9 @@ package ihl.nei_integration;
import java.awt.Rectangle;
import java.util.Map;
+import org.lwjgl.opengl.GL11;
+
+import codechicken.lib.gui.GuiDraw;
import ihl.processing.chemistry.LabElectrolyzerGui;
import ihl.processing.chemistry.LabElectrolyzerTileEntity;
import ihl.recipes.UniversalRecipeInput;
@@ -17,22 +20,22 @@ public class LabElectrolyzerRecipeHandler extends MachineRecipeHandler {
@Override
protected int[] getInputPosX() {
- return new int[] { 42 - 5, 60 - 5, 78 - 5 };
+ return new int[] { 63 - 5, 46 - 5, 29 - 5 };
}
@Override
protected int[] getInputPosY() {
- return new int[] { 15 - 11 };
+ return new int[] { 11 - 10 };
}
@Override
protected int[] getOutputPosX() {
- return new int[] { 8 - 5, 87 - 5, 106 - 5 };
+ return new int[] { 29 - 5, 63 - 5, 109 - 5 };
}
@Override
protected int[] getOutputPosY() {
- return new int[] { 15 - 11, 51 - 11, 15 - 11 };
+ return new int[] { 47 - 10 };
}
@Override
@@ -53,15 +56,24 @@ public class LabElectrolyzerRecipeHandler extends MachineRecipeHandler {
@Override
public void loadTransferRects() {
this.transferRects
- .add(new RecipeTransferRect(new Rectangle(7 - 5, 32 - 10, 18, 18), this.getRecipeId(), new Object[0]));
+ .add(new RecipeTransferRect(new Rectangle(28 - 5, 28 - 10, 18, 18), this.getRecipeId(), new Object[0]));
this.transferRects
- .add(new RecipeTransferRect(new Rectangle(86 - 5, 32 - 10, 37, 18), this.getRecipeId(), new Object[0]));
+ .add(new RecipeTransferRect(new Rectangle(108 - 5, 32 - 10, 18, 18), this.getRecipeId(), new Object[0]));
}
@Override
public String getOverlayIdentifier() {
return "labElectrolyzer";
}
+
+ @Override
+ public void drawBackground(int recipeNumber)
+ {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GuiDraw.changeTexture(this.getGuiTexture());
+ GuiDraw.drawTexturedModalRect(0, 0, 5, 10, 140, 54);
+ GuiDraw.drawTexturedModalRect(46-5, 10-10, 62, 10, 18, 18);
+ }
@Override
public Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipeList() {
diff --git a/ihl/nei_integration/PaperMachineRecipeHandler.java b/ihl/nei_integration/PaperMachineRecipeHandler.java
index 5a6e0e2..2357da8 100644
--- a/ihl/nei_integration/PaperMachineRecipeHandler.java
+++ b/ihl/nei_integration/PaperMachineRecipeHandler.java
@@ -1,7 +1,9 @@
package ihl.nei_integration;
+import java.awt.Rectangle;
import java.util.Map;
+import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect;
import ihl.processing.chemistry.PaperMachineGui;
import ihl.processing.chemistry.PaperMachineTileEntity;
import ihl.recipes.UniversalRecipeInput;
@@ -59,6 +61,13 @@ public class PaperMachineRecipeHandler extends MachineRecipeHandler
{
return "ihl:textures/gui/GUIPaperMachine.png";
}
+
+ @Override
+ public void loadTransferRects()
+ {
+ this.transferRects.add(new RecipeTransferRect(new Rectangle(25-5, 11-11, 52, 74), this.getRecipeId(), new Object[0]));
+ }
+
@Override
public String getOverlayIdentifier()
diff --git a/ihl/processing/chemistry/BasicElectricMotorContainer.java b/ihl/processing/chemistry/BasicElectricMotorContainer.java
new file mode 100644
index 0000000..a32e006
--- /dev/null
+++ b/ihl/processing/chemistry/BasicElectricMotorContainer.java
@@ -0,0 +1,74 @@
+package ihl.processing.chemistry;
+
+import ic2.core.ContainerBase;
+import ic2.core.slot.SlotInvSlot;
+import ihl.processing.metallurgy.BasicElectricMotorTileEntity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+
+public class BasicElectricMotorContainer<T extends BasicElectricMotorTileEntity> extends ContainerBase<T> {
+
+ protected BasicElectricMotorTileEntity tileEntity;
+ public short lastProgress = -1;
+ public short lastEnergy = -1;
+ private final static int height = 166;
+
+ public BasicElectricMotorContainer(EntityPlayer entityPlayer, T tileEntity1) {
+ super(tileEntity1);
+ this.tileEntity = tileEntity1;
+ int col;
+ for (col = 0; col < 3; ++col) {
+ for (int col1 = 0; col1 < 9; ++col1) {
+ this.addSlotToContainer(
+ new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+ for (col = 0; col < 9; ++col) {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.dischargeSlot, 0, 8, 33));
+ for (col = 0; col < 4; ++col) {
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.upgradeSlot, col, 152, 8 + col * 18));
+ }
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+
+ if (this.tileEntity.progress != this.lastProgress) {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
+ }
+
+ if ((short) this.tileEntity.energy != this.lastEnergy) {
+ icrafting.sendProgressBarUpdate(this, 2, (short) this.tileEntity.energy);
+ }
+ }
+
+ this.lastProgress = this.tileEntity.progress;
+ this.lastEnergy = (short) this.tileEntity.energy;
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value) {
+ super.updateProgressBar(index, value);
+ switch (index) {
+ case 0:
+ this.tileEntity.progress = (short) value;
+ break;
+ case 1:
+ break;
+ case 2:
+ this.tileEntity.energy = value;
+ break;
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer var1) {
+ return tileEntity.isUseableByPlayer(var1);
+ }
+}
diff --git a/ihl/processing/chemistry/ChemicalReactorContainer.java b/ihl/processing/chemistry/ChemicalReactorContainer.java
index a20cc01..a1cc0b4 100644
--- a/ihl/processing/chemistry/ChemicalReactorContainer.java
+++ b/ihl/processing/chemistry/ChemicalReactorContainer.java
@@ -10,100 +10,34 @@ import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraftforge.fluids.FluidStack;
-public class ChemicalReactorContainer extends ContainerBase<ChemicalReactorTileEntity> {
+public class ChemicalReactorContainer extends BasicElectricMotorContainer<ChemicalReactorTileEntity> {
- protected ChemicalReactorTileEntity tileEntity;
- public int lastFluidAmount = -1;
+ protected ChemicalReactorTileEntity tileEntity;
+ public int lastFluidAmount = -1;
public int lastNumberOfFluids = -1;
- public short lastProgress = -1;
- public short lastTemperature = -1;
- public short lastEnergy = -1;
- private final static int height=166;
- public List<FluidStack> fluidTankFluidList;
-
- public ChemicalReactorContainer(EntityPlayer entityPlayer, ChemicalReactorTileEntity tileEntity1){
- super(tileEntity1);
- this.tileEntity = tileEntity1;
- fluidTankFluidList=tileEntity.getFluidTank().getFluidList();
- int col;
- for (col = 0; col < 3; ++col)
- {
- for (int col1 = 0; col1 < 9; ++col1)
- {
- this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
- }
- }
- for (col = 0; col < 9; ++col)
- {
- this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
- }
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot, 0, 60, 51));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 60, 15));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 60, 33));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 122-18, 15));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 122, 15));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 122-18, 51));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 1, 122, 51));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.dischargeSlot, 0, 8, 33));
- }
+ public List<FluidStack> fluidTankFluidList;
- @Override
- public void detectAndSendChanges()
- {
- super.detectAndSendChanges();
- for (int i = 0; i < this.crafters.size(); ++i)
- {
- ICrafting icrafting = (ICrafting)this.crafters.get(i);
-
- if (this.tileEntity.getTankAmount() != this.lastFluidAmount || this.tileEntity.getNumberOfFluidsInTank() != this.lastNumberOfFluids)
- {
- IC2.network.get().sendContainerField(this, "fluidTankFluidList");
- }
-
- if (this.tileEntity.progress != this.lastProgress)
- {
- icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
- }
-
- if (this.tileEntity.temperature != this.lastTemperature)
- {
- icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.temperature);
- }
-
-
- if ((short) this.tileEntity.energy != this.lastEnergy)
- {
- icrafting.sendProgressBarUpdate(this, 2, (short) this.tileEntity.energy);
- }
- }
+ public ChemicalReactorContainer(EntityPlayer entityPlayer, ChemicalReactorTileEntity tileEntity1) {
+ super(entityPlayer, tileEntity1);
+ this.tileEntity = tileEntity1;
+ fluidTankFluidList = tileEntity.getFluidTank().getFluidList();
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot, 0, 60, 51));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 60, 15));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 60, 33));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 122 - 18, 15));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 122, 15));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 122 - 18, 51));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 1, 122, 51));
+ }
- this.lastNumberOfFluids = this.tileEntity.getNumberOfFluidsInTank();
- this.lastFluidAmount = this.tileEntity.getTankAmount();
- this.lastProgress = this.tileEntity.progress;
- this.lastTemperature = this.tileEntity.temperature;
- this.lastEnergy = (short) this.tileEntity.energy;
- }
-
- @Override
- public void updateProgressBar(int index, int value)
- {
- super.updateProgressBar(index, value);
- switch (index)
- {
- case 0:
- this.tileEntity.progress=(short) value;
- break;
- case 1:
- this.tileEntity.temperature=(short) value;
- break;
- case 2:
- this.tileEntity.energy=value;
- break;
- }
- }
-
@Override
- public boolean canInteractWith(EntityPlayer var1) {
- return tileEntity.isUseableByPlayer(var1);
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if (this.tileEntity.getTankAmount() != this.lastFluidAmount
+ || this.tileEntity.getNumberOfFluidsInTank() != this.lastNumberOfFluids) {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
+ }
+ this.lastNumberOfFluids = this.tileEntity.getNumberOfFluidsInTank();
+ this.lastFluidAmount = this.tileEntity.getTankAmount();
}
}
diff --git a/ihl/processing/chemistry/CryogenicDistillerContainer.java b/ihl/processing/chemistry/CryogenicDistillerContainer.java
index be35e2a..d04ec4e 100644
--- a/ihl/processing/chemistry/CryogenicDistillerContainer.java
+++ b/ihl/processing/chemistry/CryogenicDistillerContainer.java
@@ -10,36 +10,18 @@ import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraftforge.fluids.FluidStack;
-public class CryogenicDistillerContainer extends ContainerBase<CryogenicDistillerTileEntity> {
+public class CryogenicDistillerContainer extends BasicElectricMotorContainer<CryogenicDistillerTileEntity> {
public CryogenicDistillerTileEntity tileEntity;
- public int lastProgress = -1;
- private short lastEnergy = -1;
private int lastNumberOfFluids = -1;
private int lastFluidAmount = -1;
- private final static int height=166;
public List<FluidStack> fluidTankFluidList;
public CryogenicDistillerContainer(EntityPlayer entityPlayer,
CryogenicDistillerTileEntity lathePart1TileEntity) {
- super(lathePart1TileEntity);
+ super(entityPlayer, lathePart1TileEntity);
tileEntity=lathePart1TileEntity;
fluidTankFluidList=tileEntity.fluidTankProducts.getFluidList();
- int col;
-
- for (col = 0; col < 3; ++col)
- {
- for (int col1 = 0; col1 < 9; ++col1)
- {
- this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
- }
- }
-
- for (col = 0; col < 9; ++col)
- {
- this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
- }
- this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.dischargeSlot,0, 8, 32));
this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.fillInputSlotInput,0, 58, 51));
this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.fillInputSlotProducts,0, 103, 51));
this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.fluidItemsSlot,0, 58, 15));
@@ -50,41 +32,11 @@ public class CryogenicDistillerContainer extends ContainerBase<CryogenicDistille
public void detectAndSendChanges()
{
super.detectAndSendChanges();
- for (int i = 0; i < this.crafters.size(); ++i)
- {
- ICrafting icrafting = (ICrafting)this.crafters.get(i);
- if (this.tileEntity.progress != this.lastProgress)
- {
- icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
- }
- if (this.tileEntity.getEnergy() != this.lastEnergy)
- {
- icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.getEnergy());
- }
- if (this.tileEntity.fluidTankProducts.getFluidAmount() != this.lastFluidAmount || this.tileEntity.fluidTankProducts.getNumberOfFluids() != this.lastNumberOfFluids)
- {
- IC2.network.get().sendContainerField(this, "fluidTankFluidList");
- }
- }
- this.lastProgress = this.tileEntity.progress;
+ if (this.tileEntity.fluidTankProducts.getFluidAmount() != this.lastFluidAmount || this.tileEntity.fluidTankProducts.getNumberOfFluids() != this.lastNumberOfFluids)
+ {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
+ }
this.lastNumberOfFluids = this.tileEntity.fluidTankProducts.getNumberOfFluids();
this.lastFluidAmount = this.tileEntity.fluidTankProducts.getFluidAmount();
- this.lastEnergy = (short) this.tileEntity.getEnergy();
- }
-
- @Override
- public void updateProgressBar(int index, int value)
- {
- super.updateProgressBar(index, value);
- switch (index)
- {
- case 0:
- this.tileEntity.progress=(short) value;
- break;
- case 1:
- this.tileEntity.setEnergy(value);
- break;
- }
}
-
}
diff --git a/ihl/processing/chemistry/CryogenicDistillerGui.java b/ihl/processing/chemistry/CryogenicDistillerGui.java
index 2bfd969..a8f9f0f 100644
--- a/ihl/processing/chemistry/CryogenicDistillerGui.java
+++ b/ihl/processing/chemistry/CryogenicDistillerGui.java
@@ -24,7 +24,7 @@ public class CryogenicDistillerGui extends GuiContainer {
super.initGui();
int x = (width - xSize) / 2;
int y = (height - ySize) / 2;
- this.buttonList.add(new GuiButton(0, x + 7, y + 49, 49, 20, "Empty"));
+ this.buttonList.add(new GuiButton(0, x + 7, y + 50, 49, 20, "Empty"));
}
@Override
diff --git a/ihl/processing/chemistry/FluidizedBedReactorContainer.java b/ihl/processing/chemistry/FluidizedBedReactorContainer.java
index f1bdb3e..f8ea002 100644
--- a/ihl/processing/chemistry/FluidizedBedReactorContainer.java
+++ b/ihl/processing/chemistry/FluidizedBedReactorContainer.java
@@ -10,88 +10,34 @@ import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraftforge.fluids.FluidStack;
-public class FluidizedBedReactorContainer extends ContainerBase<FluidizedBedReactorTileEntity> {
+public class FluidizedBedReactorContainer extends BasicElectricMotorContainer<FluidizedBedReactorTileEntity> {
protected FluidizedBedReactorTileEntity tileEntity;
public int lastFluidsHash = -1;
- public short lastProgress = -1;
- public short lastTemperature = -1;
- public short lastEnergy = -1;
private final static int height=166;
public List<FluidStack> fluidTankFluidList;
public FluidizedBedReactorContainer(EntityPlayer entityPlayer, FluidizedBedReactorTileEntity tileEntity1){
- super(tileEntity1);
+ super(entityPlayer, tileEntity1);
this.tileEntity = tileEntity1;
fluidTankFluidList = this.tileEntity.getFluidTank().getFluidList();
- int col;
- for (col = 0; col < 3; ++col)
- {
- for (int col1 = 0; col1 < 9; ++col1)
- {
- this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
- }
- }
- for (col = 0; col < 9; ++col)
- {
- this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
- }
this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot, 0, 102, 51));
this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 102, 15));
this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 102, 33));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 8, 23));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 8, 41));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 43, 33));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.dischargeSlot, 0, 151, 33));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 41, 23));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 41, 41));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 76, 33));
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
- for (int i = 0; i < this.crafters.size(); ++i)
+ if (fluidTankFluidList.hashCode() != this.lastFluidsHash)
{
- ICrafting icrafting = (ICrafting)this.crafters.get(i);
- if (fluidTankFluidList.hashCode() != this.lastFluidsHash)
- {
- IC2.network.get().sendContainerField(this, "fluidTankFluidList");
- }
- if (this.tileEntity.progress != this.lastProgress)
- {
- icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
- }
-
- if (this.tileEntity.temperature != this.lastTemperature)
- {
- icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.temperature);
- }
- if ((short) this.tileEntity.energy != this.lastEnergy)
- {
- icrafting.sendProgressBarUpdate(this, 2, (short) this.tileEntity.energy);
- }
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
}
this.lastFluidsHash = fluidTankFluidList.hashCode();
- this.lastProgress = this.tileEntity.progress;
- this.lastTemperature = this.tileEntity.temperature;
- this.lastEnergy = (short) this.tileEntity.energy;
- }
-
- @Override
- public void updateProgressBar(int index, int value)
- {
- super.updateProgressBar(index, value);
- switch (index)
- {
- case 0:
- this.tileEntity.progress=(short) value;
- break;
- case 1:
- this.tileEntity.temperature=(short) value;
- break;
- case 2:
- this.tileEntity.energy=value;
- break;
- }
}
@Override
diff --git a/ihl/processing/chemistry/FluidizedBedReactorGui.java b/ihl/processing/chemistry/FluidizedBedReactorGui.java
index 3b52c38..d79a09d 100644
--- a/ihl/processing/chemistry/FluidizedBedReactorGui.java
+++ b/ihl/processing/chemistry/FluidizedBedReactorGui.java
@@ -10,52 +10,50 @@ import ihl.utils.IHLRenderUtils;
@SideOnly(Side.CLIENT)
public class FluidizedBedReactorGui extends GuiContainer {
- private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUIFluidizedBedReactor.png");
+ private static final ResourceLocation background = new ResourceLocation("ihl",
+ "textures/gui/GUIFluidizedBedReactor.png");
private FluidizedBedReactorContainer container;
- private int mixerFrame=0;
+ private int mixerFrame = 0;
- public FluidizedBedReactorGui (FluidizedBedReactorContainer container1) {
- //the container is instanciated and passed to the superclass for handling
- super(container1);
- this.container=container1;
- }
-
- @Override
- protected void drawGuiContainerForegroundLayer(int par1, int par2) {
- int xOffset = (this.width - xSize) / 2;
- int yOffset = (this.height - ySize) / 2;
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- this.mc.renderEngine.bindTexture(background);
- int i1;
- if (this.container.tileEntity.getEnergy() > 0D)
- {
- i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
- this.drawTexturedModalRect(155, 17 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
- }
- if (this.container.tileEntity.progress > 0)
- {
- i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(17),17);
- this.drawTexturedModalRect(25, 34, 198, 0,i1,13);
- if(mixerFrame++>3)
- {
- mixerFrame=0;
- }
- this.drawTexturedModalRect(126, 31, 244, 126+26*mixerFrame,12,26);
- }
- if (this.container.tileEntity.getTankAmount() > 0)
- {
- IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.getFluidTank(), 126, 28, 138, 59, zLevel, par1, par2, xOffset, yOffset);
- }
- }
+ public FluidizedBedReactorGui(FluidizedBedReactorContainer container1) {
+ // the container is instanciated and passed to the superclass for
+ // handling
+ super(container1);
+ this.container = container1;
+ }
- @Override
- protected void drawGuiContainerBackgroundLayer(float par1, int par2,
- int par3) {
- //draw your Gui here, only thing you need to change is the path
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- this.mc.renderEngine.bindTexture(background);
- int x = (width - xSize) / 2;
- int y = (height - ySize) / 2;
- this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
- }
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D) {
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12), 12);
+ this.drawTexturedModalRect(12, 16 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0) {
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(17), 17);
+ this.drawTexturedModalRect(58, 34, 198, 0, i1, 13);
+ if (mixerFrame++ > 3) {
+ mixerFrame = 0;
+ }
+ this.drawTexturedModalRect(126, 31, 244, 126 + 26 * mixerFrame, 12, 26);
+ }
+ if (this.container.tileEntity.getTankAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.getFluidTank(), 126, 28, 138, 59,
+ zLevel, par1, par2, xOffset, yOffset);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ // draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
} \ No newline at end of file
diff --git a/ihl/processing/chemistry/LabElectrolyzerContainer.java b/ihl/processing/chemistry/LabElectrolyzerContainer.java
index b1fec2f..1be5e01 100644
--- a/ihl/processing/chemistry/LabElectrolyzerContainer.java
+++ b/ihl/processing/chemistry/LabElectrolyzerContainer.java
@@ -2,130 +2,70 @@ package ihl.processing.chemistry;
import java.util.List;
-import ic2.core.ContainerBase;
import ic2.core.IC2;
import ic2.core.slot.SlotInvSlot;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.inventory.ICrafting;
-import net.minecraft.inventory.Slot;
import net.minecraftforge.fluids.FluidStack;
-public class LabElectrolyzerContainer extends ContainerBase<LabElectrolyzerTileEntity> {
+public class LabElectrolyzerContainer extends BasicElectricMotorContainer<LabElectrolyzerTileEntity> {
- protected LabElectrolyzerTileEntity tileEntity;
- public short lastProgress = -1;
- public short lastTemperature = -1;
- public short lastEnergy = -1;
- private final static int height=166;
- public int lastFluidAmount = -1;
+ protected LabElectrolyzerTileEntity tileEntity;
+ public short lastProgress = -1;
+ public short lastTemperature = -1;
+ public short lastEnergy = -1;
+ public int lastFluidAmount = -1;
public int lastNumberOfFluids = -1;
- public int lastFluidAmount2 = -1;
+ public int lastFluidAmount2 = -1;
public int lastNumberOfFluids2 = -1;
- public int lastFluidAmount3 = -1;
+ public int lastFluidAmount3 = -1;
public int lastNumberOfFluids3 = -1;
- public List<FluidStack> fluidTankFluidList;
- public List<FluidStack> fluidTankFluidList2;
- public List<FluidStack> fluidTankFluidList3;
-
- public LabElectrolyzerContainer(EntityPlayer entityPlayer, LabElectrolyzerTileEntity tileEntity1){
- super(tileEntity1);
- this.tileEntity = tileEntity1;
- fluidTankFluidList = this.tileEntity.getFluidTank().getFluidList();
- fluidTankFluidList2 = this.tileEntity.fluidTankAnodeOutput.getFluidList();
- fluidTankFluidList3 = this.tileEntity.fluidTankCathodeOutput.getFluidList();
- int col;
- for (col = 0; col < 3; ++col)
- {
- for (int col1 = 0; col1 < 9; ++col1)
- {
- this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
- }
- }
- for (col = 0; col < 9; ++col)
- {
- this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
- }
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot, 0, 42, 51));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlotAnodeOutput, 0, 106, 51));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlotCathodeOutput, 0, 8, 51));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 42, 15));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 8, 15));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 1, 42, 33));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 2, 106, 15));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 1, 87, 51));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.dischargeSlot, 0, 152, 15));
- }
+ public List<FluidStack> fluidTankFluidList;
+ public List<FluidStack> fluidTankFluidList2;
+ public List<FluidStack> fluidTankFluidList3;
- @Override
- public void detectAndSendChanges()
- {
- super.detectAndSendChanges();
- for (int i = 0; i < this.crafters.size(); ++i)
- {
- ICrafting icrafting = (ICrafting)this.crafters.get(i);
+ public LabElectrolyzerContainer(EntityPlayer entityPlayer, LabElectrolyzerTileEntity tileEntity1) {
+ super(entityPlayer, tileEntity1);
+ this.tileEntity = tileEntity1;
+ fluidTankFluidList = this.tileEntity.getFluidTank().getFluidList();
+ fluidTankFluidList2 = this.tileEntity.fluidTankAnodeOutput.getFluidList();
+ fluidTankFluidList3 = this.tileEntity.fluidTankCathodeOutput.getFluidList();
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot, 0, 63, 47));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlotAnodeOutput, 0, 109, 47));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlotCathodeOutput, 0, 29, 47));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 63, 11));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 29, 11));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 1, 63, 29));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 2, 109, 11));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 1, 63, 65));
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if (this.tileEntity.getTankAmount() != this.lastFluidAmount
+ || this.tileEntity.getNumberOfFluidsInTank() != this.lastNumberOfFluids) {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
+ }
- if (this.tileEntity.getTankAmount() != this.lastFluidAmount || this.tileEntity.getNumberOfFluidsInTank() != this.lastNumberOfFluids)
- {
- IC2.network.get().sendContainerField(this, "fluidTankFluidList");
- }
-
- if (this.tileEntity.fluidTankAnodeOutput.getFluidAmount() != this.lastFluidAmount2 || this.tileEntity.fluidTankAnodeOutput.getNumberOfFluids() != this.lastNumberOfFluids2)
- {
- IC2.network.get().sendContainerField(this, "fluidTankFluidList2");
- }
-
- if (this.tileEntity.fluidTankCathodeOutput.getFluidAmount() != this.lastFluidAmount3 || this.tileEntity.fluidTankCathodeOutput.getNumberOfFluids() != this.lastNumberOfFluids3)
- {
- IC2.network.get().sendContainerField(this, "fluidTankFluidList3");
- }
-
- if (this.tileEntity.progress != this.lastProgress)
- {
- icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
- }
-
- if (this.tileEntity.temperature != this.lastTemperature)
- {
- icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.temperature);
- }
-
-
- if ((short) this.tileEntity.energy != this.lastEnergy)
- {
- icrafting.sendProgressBarUpdate(this, 2, (short) this.tileEntity.energy);
- }
- }
+ if (this.tileEntity.fluidTankAnodeOutput.getFluidAmount() != this.lastFluidAmount2
+ || this.tileEntity.fluidTankAnodeOutput.getNumberOfFluids() != this.lastNumberOfFluids2) {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList2");
+ }
- this.lastNumberOfFluids = this.tileEntity.getNumberOfFluidsInTank();
- this.lastFluidAmount = this.tileEntity.getTankAmount();
- this.lastProgress = this.tileEntity.progress;
- this.lastTemperature = this.tileEntity.temperature;
- this.lastEnergy = (short) this.tileEntity.energy;
- this.lastNumberOfFluids2 = this.tileEntity.fluidTankAnodeOutput.getNumberOfFluids();
- this.lastFluidAmount2 = this.tileEntity.fluidTankAnodeOutput.getFluidAmount();
- this.lastNumberOfFluids3 = this.tileEntity.fluidTankCathodeOutput.getNumberOfFluids();
- this.lastFluidAmount3 = this.tileEntity.fluidTankCathodeOutput.getFluidAmount();
+ if (this.tileEntity.fluidTankCathodeOutput.getFluidAmount() != this.lastFluidAmount3
+ || this.tileEntity.fluidTankCathodeOutput.getNumberOfFluids() != this.lastNumberOfFluids3) {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList3");
+ }
+
+ this.lastNumberOfFluids = this.tileEntity.getNumberOfFluidsInTank();
+ this.lastFluidAmount = this.tileEntity.getTankAmount();
+ this.lastNumberOfFluids2 = this.tileEntity.fluidTankAnodeOutput.getNumberOfFluids();
+ this.lastFluidAmount2 = this.tileEntity.fluidTankAnodeOutput.getFluidAmount();
+ this.lastNumberOfFluids3 = this.tileEntity.fluidTankCathodeOutput.getNumberOfFluids();
+ this.lastFluidAmount3 = this.tileEntity.fluidTankCathodeOutput.getFluidAmount();
+
+ }
- }
-
- @Override
- public void updateProgressBar(int index, int value)
- {
- super.updateProgressBar(index, value);
- switch (index)
- {
- case 0:
- this.tileEntity.progress=(short) value;
- break;
- case 1:
- this.tileEntity.temperature=(short) value;
- break;
- case 2:
- this.tileEntity.energy=value;
- break;
- }
- }
-
@Override
public boolean canInteractWith(EntityPlayer var1) {
return tileEntity.isUseableByPlayer(var1);
diff --git a/ihl/processing/chemistry/LabElectrolyzerGui.java b/ihl/processing/chemistry/LabElectrolyzerGui.java
index aea51f8..8690257 100644
--- a/ihl/processing/chemistry/LabElectrolyzerGui.java
+++ b/ihl/processing/chemistry/LabElectrolyzerGui.java
@@ -10,68 +10,65 @@ import ihl.utils.IHLRenderUtils;
@SideOnly(Side.CLIENT)
public class LabElectrolyzerGui extends GuiContainer {
- private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUILabElectrolyzer.png");
+ private static final ResourceLocation background = new ResourceLocation("ihl",
+ "textures/gui/GUILabElectrolyzer.png");
private LabElectrolyzerContainer container;
- public LabElectrolyzerGui (LabElectrolyzerContainer container1) {
- //the container is instanciated and passed to the superclass for handling
- super(container1);
- this.container=container1;
- }
-
- @Override
- protected void drawGuiContainerForegroundLayer(int par1, int par2) {
- int xOffset = (this.width - xSize) / 2;
- int yOffset = (this.height - ySize) / 2;
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- this.mc.renderEngine.bindTexture(background);
- int i1;
- if (this.container.tileEntity.getEnergy() > 0D)
- {
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
- this.drawTexturedModalRect(142, 16 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
- }
- if (this.container.tileEntity.progress > 0)
- {
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(27),27);
- this.drawTexturedModalRect(142, 38, getFrameX(i1), getFrameY(i1),24,24);
- }
- if (this.container.tileEntity.getTankAmount() > 0)
- {
- IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.getFluidTank(), 61, 19, 84, 67, zLevel, par1, par2, xOffset, yOffset);
- }
- if (this.container.tileEntity.fluidTankCathodeOutput.getFluidAmount() > 0)
- {
- IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.fluidTankCathodeOutput, 27, 28, 39, 67, zLevel, par1, par2, xOffset, yOffset);
- }
- if (this.container.tileEntity.fluidTankAnodeOutput.getFluidAmount() > 0)
- {
- IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.fluidTankAnodeOutput, 125, 28, 137, 67, zLevel, par1, par2, xOffset, yOffset);
- }
- }
+ public LabElectrolyzerGui(LabElectrolyzerContainer container1) {
+ // the container is instanciated and passed to the superclass for
+ // handling
+ super(container1);
+ this.container = container1;
+ }
- @Override
- protected void drawGuiContainerBackgroundLayer(float par1, int par2,
- int par3) {
- //draw your Gui here, only thing you need to change is the path
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- this.mc.renderEngine.bindTexture(background);
- int x = (width - xSize) / 2;
- int y = (height - ySize) / 2;
- this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
- }
-
- private int getFrameY(int number)
- {
- return (number % 10) * 24 + 14;
- }
-
- private int getFrameX(int number)
- {
- return (number / 10) * 24 + 176;
- }
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D) {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12), 12);
+ this.drawTexturedModalRect(12, 16 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0) {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(27), 27);
+ this.drawTexturedModalRect(81, 31, getFrameX(i1), getFrameY(i1), 24, 24);
+ }
+ if (this.container.tileEntity.getTankAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.getFluidTank(), 83, 15, 104, 81, zLevel,
+ par1, par2, xOffset, yOffset);
+ }
+ if (this.container.tileEntity.fluidTankCathodeOutput.getFluidAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.fluidTankCathodeOutput, 48, 24, 59, 81,
+ zLevel, par1, par2, xOffset, yOffset);
+ }
+ if (this.container.tileEntity.fluidTankAnodeOutput.getFluidAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.fluidTankAnodeOutput, 128, 24, 139, 81,
+ zLevel, par1, par2, xOffset, yOffset);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ // draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+
+ private int getFrameY(int number) {
+ return (number % 10) * 24 + 14;
+ }
+
+ private int getFrameX(int number) {
+ return (number / 10) * 24 + 176;
+ }
} \ No newline at end of file
diff --git a/ihl/processing/chemistry/PaperMachineContainer.java b/ihl/processing/chemistry/PaperMachineContainer.java
index ea07afc..0969649 100644
--- a/ihl/processing/chemistry/PaperMachineContainer.java
+++ b/ihl/processing/chemistry/PaperMachineContainer.java
@@ -10,7 +10,7 @@ import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraftforge.fluids.FluidStack;
-public class PaperMachineContainer extends ContainerBase<PaperMachineTileEntity> {
+public class PaperMachineContainer extends BasicElectricMotorContainer<PaperMachineTileEntity> {
protected PaperMachineTileEntity tileEntity;
public int lastFluidAmount = -1;
@@ -18,89 +18,27 @@ public class PaperMachineContainer extends ContainerBase<PaperMachineTileEntity>
public short lastProgress = -1;
public short lastTemperature = -1;
public short lastEnergy = -1;
- private final static int height=166;
public List<FluidStack> fluidTankFluidList;
public PaperMachineContainer(EntityPlayer entityPlayer, PaperMachineTileEntity tileEntity1){
- super(tileEntity1);
+ super(entityPlayer, tileEntity1);
this.tileEntity = tileEntity1;
fluidTankFluidList=this.tileEntity.getFluidTank().getFluidList();
- int col;
- for (col = 0; col < 3; ++col)
- {
- for (int col1 = 0; col1 < 9; ++col1)
- {
- this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
- }
- }
- for (col = 0; col < 9; ++col)
- {
- this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
- }
this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot, 0, 78, 51));
this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 78, 15));
this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 78, 33));
this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 122, 51));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.dischargeSlot, 0, 8, 32));
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
- for (int i = 0; i < this.crafters.size(); ++i)
+ if (this.tileEntity.getTankAmount() != this.lastFluidAmount || this.tileEntity.getNumberOfFluidsInTank() != this.lastNumberOfFluids)
{
- ICrafting icrafting = (ICrafting)this.crafters.get(i);
-
- if (this.tileEntity.getTankAmount() != this.lastFluidAmount || this.tileEntity.getNumberOfFluidsInTank() != this.lastNumberOfFluids)
- {
- IC2.network.get().sendContainerField(this, "fluidTankFluidList");
- }
-
- if (this.tileEntity.progress != this.lastProgress)
- {
- icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
- }
-
- if (this.tileEntity.temperature != this.lastTemperature)
- {
- icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.temperature);
- }
-
-
- if ((short) this.tileEntity.energy != this.lastEnergy)
- {
- icrafting.sendProgressBarUpdate(this, 2, (short) this.tileEntity.energy);
- }
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
}
-
this.lastNumberOfFluids = this.tileEntity.getNumberOfFluidsInTank();
this.lastFluidAmount = this.tileEntity.getTankAmount();
- this.lastProgress = this.tileEntity.progress;
- this.lastTemperature = this.tileEntity.temperature;
- this.lastEnergy = (short) this.tileEntity.energy;
}
-
- @Override
- public void updateProgressBar(int index, int value)
- {
- super.updateProgressBar(index, value);
- switch (index)
- {
- case 0:
- this.tileEntity.progress=(short) value;
- break;
- case 1:
- this.tileEntity.temperature=(short) value;
- break;
- case 2:
- this.tileEntity.energy=value;
- break;
- }
- }
-
- @Override
- public boolean canInteractWith(EntityPlayer var1) {
- return tileEntity.isUseableByPlayer(var1);
- }
}
diff --git a/ihl/processing/invslots/InvSlotUpgradeIHL.java b/ihl/processing/invslots/InvSlotUpgradeIHL.java
new file mode 100644
index 0000000..5c1fff9
--- /dev/null
+++ b/ihl/processing/invslots/InvSlotUpgradeIHL.java
@@ -0,0 +1,61 @@
+package ihl.processing.invslots;
+
+import ic2.core.Ic2Items;
+import ic2.core.block.TileEntityInventory;
+import ic2.core.block.invslot.InvSlot;
+import ihl.utils.IHLUtils;
+import net.minecraft.item.ItemStack;
+
+public class InvSlotUpgradeIHL extends InvSlot {
+
+ public InvSlotUpgradeIHL(int count) {
+ super(count);
+ }
+
+ public InvSlotUpgradeIHL(TileEntityInventory base, int oldStartIndex, Access access, int count, InvSide side) {
+ super(base, "invSlotUpgrade", oldStartIndex, access, count, side);
+ }
+
+ public double getPowerConsumtionMultiplier() {
+ double base = 1d;
+ for (int i = 0; i < this.size(); i++) {
+ if (IHLUtils.isItemStacksIsEqual(this.get(i), Ic2Items.overclockerUpgrade, false)) {
+ int i1 = this.get(i).stackSize;
+ while (i1-- > 0 && base < 600) {
+ base *= 1.6f;
+ }
+ }
+ }
+ return base;
+ }
+
+ public float getProgressMultiplier() {
+ float base = 1f;
+ for (int i = 0; i < this.size(); i++) {
+ if (IHLUtils.isItemStacksIsEqual(this.get(i), Ic2Items.overclockerUpgrade, false)) {
+ int i1 = this.get(i).stackSize;
+ while (i1-- > 0 && base < 600) {
+ base *= 1.428571429f;
+ }
+ }
+ }
+ return base;
+ }
+
+ public int getAdditionalEnergyStorage() {
+ int base = 0;
+ for (int i = 0; i < this.size(); i++) {
+ if (IHLUtils.isItemStacksIsEqual(this.get(i), Ic2Items.energyStorageUpgrade, false)) {
+ base += this.get(i).stackSize * 10000;
+ }
+ }
+ return base;
+ }
+
+ @Override
+ public boolean accepts(ItemStack stack) {
+ return IHLUtils.isItemStacksIsEqual(stack, Ic2Items.overclockerUpgrade, false) ||
+ IHLUtils.isItemStacksIsEqual(stack, Ic2Items.energyStorageUpgrade, false);
+ }
+
+}
diff --git a/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java b/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java
index 125b6be..14a9e71 100644
--- a/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java
+++ b/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java
@@ -14,6 +14,7 @@ import ic2.core.block.invslot.InvSlot.Access;
import ihl.IHLMod;
import ihl.flexible_cable.FlexibleCableHolderBaseTileEntity;
import ihl.flexible_cable.NodeEntity;
+import ihl.processing.invslots.InvSlotUpgradeIHL;
import ihl.utils.IHLInvSlotDischarge;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
@@ -26,8 +27,9 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa
implements IHasGui, INetworkClientTileEntityEventListener, IEnergySink {
public final IHLInvSlotDischarge dischargeSlot;
+ public final InvSlotUpgradeIHL upgradeSlot;
public short progress;
- protected short operationLength = 600;
+ protected short operationLength = 6000;
protected double energyConsume = 1d;
public double energy;
public int maxStorage = 128;
@@ -37,6 +39,7 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa
super();
energyConsume = IHLMod.config.machineryEnergyConsume/100d;
dischargeSlot = new IHLInvSlotDischarge(this, 1, Access.IO, 4, InvSlot.InvSide.BOTTOM);
+ upgradeSlot = new InvSlotUpgradeIHL(this, 1, Access.IO, 4, InvSlot.InvSide.BOTTOM);
}
@Override
@@ -127,11 +130,11 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa
@Override
public double getDemandedEnergy() {
- if(this.maxStorage - this.energy <= 1d)
+ if(this.getMaxStorage() - this.energy <= 1d)
{
return 0d;
}
- return this.maxStorage - this.energy;
+ return this.getMaxStorage() - this.energy;
}
@Override
@@ -141,7 +144,7 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa
@Override
public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) {
- if (this.energy < this.maxStorage) {
+ if (this.energy < this.getMaxStorage()) {
this.energy += amount;
return 0.0D;
} else {
@@ -184,16 +187,16 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa
double amount = this.dischargeSlot.discharge(this.getDemandedEnergy(), false);
this.energy += amount;
}
- if (this.gridID != -1 && this.getGrid().energy > 0D && this.energy < this.maxStorage) {
+ if (this.gridID != -1 && this.getGrid().energy > 0D && this.energy < this.getMaxStorage()) {
this.energy += energyConsume * 10D;
this.getGrid().drawEnergy(energyConsume * 10D, this);
}
if (this.canOperate() && this.energy >= this.energyConsume) {
- this.energy -= this.energyConsume;
+ this.energy -= this.energyConsume * this.upgradeSlot.getPowerConsumtionMultiplier();
if (this.progress == 0) {
IC2.network.get().initiateTileEntityEvent(this, 0, true);
}
- ++this.progress;
+ this.progress+=(short)(10*this.upgradeSlot.getProgressMultiplier());
if (this.progress >= this.operationLength) {
this.operate();
this.progress = 0;
@@ -210,6 +213,10 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa
}
+ private double getMaxStorage() {
+ return maxStorage+this.upgradeSlot.getAdditionalEnergyStorage();
+ }
+
public abstract List<?>[] getInput();
public abstract boolean canOperate();
@@ -224,9 +231,9 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa
public int getGUIEnergy(int i) {
if (this.energy < Float.MAX_VALUE) {
- return Math.round((float) this.energy / this.maxStorage * i);
+ return Math.round((float) (this.energy / this.getMaxStorage() * i));
} else {
- return Math.round((float) (this.energy / this.maxStorage) * i);
+ return Math.round((float) (this.energy / this.getMaxStorage()) * i);
}
}
@@ -250,7 +257,7 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa
@Override
public double getEnergyAmountThisNodeWant() {
- return this.energy - this.maxStorage;
+ return this.energy - this.getMaxStorage();
}
public double drawEnergyToGrid(double amount) {
diff --git a/ihl/utils/BlockItemRender.java b/ihl/utils/BlockItemRender.java
index 5a0c6de..870ab21 100644
--- a/ihl/utils/BlockItemRender.java
+++ b/ihl/utils/BlockItemRender.java
@@ -16,6 +16,10 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+@SideOnly(value = Side.CLIENT)
public class BlockItemRender implements IItemRenderer{
private ModelBase model;
private ResourceLocation tex;
@@ -86,6 +90,10 @@ public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
IHLItemBlock bItem =(IHLItemBlock) item.getItem();
Block block = bItem.getBlockContained();
GL11.glScalef(1F, -1F+amendment, -1F);
+ if(item.stackTagCompound!=null && item.stackTagCompound.hasKey("colour")){
+ int colour = item.stackTagCompound.getInteger("colour");
+ GL11.glColor4f((colour>>>16)/255f,((colour>>>8)&255)/255f, (colour&255)/255f,1f);
+ }
switch (type) {
case ENTITY:
GL11.glTranslatef(0,-1.5F,0);
@@ -151,6 +159,10 @@ public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
GL11.glTranslatef(0.0F,0.2F,0F);
}
GL11.glTranslatef(-0.25F,-2.0F-amendment,0F);
+ if(item.stackTagCompound!=null && item.stackTagCompound.hasKey("colour")){
+ int colour = item.stackTagCompound.getInteger("colour");
+ GL11.glColor4f((colour>>>16)/255f,((colour>>>8)&255)/255f, (colour&255)/255f,1f);
+ }
if(model!=null)
{
for(int i = this.renderFrom;i<model.boxList.size()-this.renderTo;i++)
diff --git a/ihl/utils/GuiMultiTextureButton.java b/ihl/utils/GuiMultiTextureButton.java
index eb160cd..009c57f 100644
--- a/ihl/utils/GuiMultiTextureButton.java
+++ b/ihl/utils/GuiMultiTextureButton.java
@@ -2,10 +2,13 @@ package ihl.utils;
import org.lwjgl.opengl.GL11;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.ResourceLocation;
+@SideOnly(value = Side.CLIENT)
public class GuiMultiTextureButton extends GuiButton {
private ResourceLocation texture;
diff --git a/ihl/utils/IHLItemRenderer.java b/ihl/utils/IHLItemRenderer.java
index 38e98b2..2ebbdb1 100644
--- a/ihl/utils/IHLItemRenderer.java
+++ b/ihl/utils/IHLItemRenderer.java
@@ -5,6 +5,8 @@ import java.util.Random;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
@@ -23,6 +25,7 @@ import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
+@SideOnly(value = Side.CLIENT)
public class IHLItemRenderer {
private Random random = new Random();
private RenderBlocks renderBlocks = new RenderBlocks();
diff --git a/ihl/utils/IHLMathUtils.java b/ihl/utils/IHLMathUtils.java
index 47f3913..8cab3c9 100644
--- a/ihl/utils/IHLMathUtils.java
+++ b/ihl/utils/IHLMathUtils.java
@@ -6,12 +6,12 @@ public class IHLMathUtils {
public static float sqrt(float value) {
float value1 = value;
- int multiplier = 2;
+ int multiplier = 1;
while (value1 >= 1.0f) {
- multiplier *= multiplier;
- value1 /= multiplier * multiplier;
+ multiplier=multiplier<<2;
+ value1 = value / (multiplier * multiplier);
}
- return ((multiplier > 2) ? multiplier : 1) * sqrt_table[(int) (value1 * accuracy_level)];
+ return multiplier * sqrt_table[(int) (value1 * accuracy_level)];
}
public static float[] vector_vector_multiply(float[] v1, float[] v2) {
diff --git a/ihl/utils/IHLRenderUtils.java b/ihl/utils/IHLRenderUtils.java
index af5fe2a..d0d13f4 100644
--- a/ihl/utils/IHLRenderUtils.java
+++ b/ihl/utils/IHLRenderUtils.java
@@ -9,6 +9,8 @@ import java.util.Map;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
import ic2.core.util.DrawUtil;
import ihl.IHLMod;
import net.minecraft.block.Block;
@@ -30,6 +32,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
+@SideOnly(value = Side.CLIENT)
public class IHLRenderUtils
{
private FloatBuffer colorBuffer;
diff --git a/ihl/utils/IHLUtils.java b/ihl/utils/IHLUtils.java
index f47673c..519f265 100644
--- a/ihl/utils/IHLUtils.java
+++ b/ihl/utils/IHLUtils.java
@@ -453,6 +453,12 @@ public class IHLUtils {
}
public static boolean isItemStacksIsEqual(ItemStack stack1, ItemStack stack2, boolean useOreDictionary) {
+ if(stack2==null && stack1==null){
+ return true;
+ }
+ else if(stack2==null || stack1==null){
+ return false;
+ }
if (useOreDictionary && isItemsHaveSameOreDictionaryEntry(stack1, stack2)) {
return true;
} else {