diff options
| author | Foghrye4 <foghrye4@gmail.com> | 2017-03-21 17:34:07 +0300 |
|---|---|---|
| committer | Foghrye4 <foghrye4@gmail.com> | 2017-03-21 17:34:07 +0300 |
| commit | 7305ba719930ea3fbf8aa987aeec48b33cdbd82e (patch) | |
| tree | 2307517925d965cd9228c8649013b07639987846 | |
| parent | 5cb4c6e24033cf337812390d99a6817d24d21eab (diff) | |
Oregen
105 files changed, 2270 insertions, 4655 deletions
diff --git a/assets/ihl/lang/en_US.lang b/assets/ihl/lang/en_US.lang index 430d7c2..c373c8d 100644 --- a/assets/ihl/lang/en_US.lang +++ b/assets/ihl/lang/en_US.lang @@ -2,7 +2,10 @@ language.name=HAYO language.region=US language.code=en_US +ihl.powerCableTooltip=This cable could be used to provide power thru unloaded chunks. ihl.detonator_delay=Detonation delay: +ihl.explosionPower=Explosion power: +ihl.mTNT=gram of TNT ihl.seconds=s tile.pileBlock.name=Pile of something detonator.name=Detonator @@ -28,32 +31,10 @@ item.advanced_handpump.name=IHL advanced handpump item.collector.name=IHL Collector item.collectorHeavy.name=IHL Heavy Collector item.handpump_discharged.name=IHL handpump -tile.IHLShieldAssemblyUnitBlock.name=IHL TS-02 AU -item.IHLDriver.name=IHL TS-02 Driver -ihl.gui.ts02=IHL TS-02 -ihl.gui.ts02reverse_on=Reverse mode on -ihl.gui.ts02reverse_off=Reverse mode off -ihl.gui.ts02auto_reverse_on=Auto reverse mode on -ihl.gui.ts02auto_reverse_off=Auto reverse mode off -ihl.gui.charger_ejector=IHL ACE -ihl.gui.charger_ejector_auto_eject=Activate fully charged collectors. -ihl.gui.charger_ejector_do_not_auto_eject=Do not activate fully charged collectors. -ihl.gui.charger_ejector_call_collectors=Send gathering signal to collectors in range of 64 m. -ihl.gui.charger_ejector_erase_memory=Erase collectors memory. -item.chargerEjectorItem.name=IHL ACE -tile.IHLDriverBlock.name=IHL TS-02 driver -tile.IHLShieldBlock.name=IHL TS-02 -tile.chargerEjectorBlock.name=IHL ACE tile.boneBlock.name=Bone pillar entity.LostHead.name=Wailer -tile.basicHarvestorBlock.name=IHL Auto crop harvestor -tile.blowerBlock.name=IHL Industrial fan tile.ihlExplosive.name=Explosive pack -ihl.gui.blower=Air speed: -ihl.gui.blowerUnits=m/s -tile.glassBox.name=Glass box -item.glassBox.name=Glass box tile.evaporatorBlock.name=Evaporator tile.electricEvaporatorBlock.name=Electric evaporator tile.sackBlock.name=Rubber tree sap gathering sack @@ -88,11 +69,6 @@ itemDustIridiumAndSodiumOxide.name=Iridium and sodium oxide tile.tditBlock.name=Transdimensional item teleporter item.tditFrequencyTransmitter.name=T.D.I.T. frequency transmitter -item.flexibleCableWithClamp.name=Hank of cable -item.flexibleCableCopper2x.name=Hank of cable -item.flexibleCableCopper4x.name=Hank of cable -item.flexibleCableCopper8x.name=Hank of cable -item.flexibleCableCopper16x.name=Hank of cable tile.cableAnchor.name=Junction box wire.name=Uninsulated wire cable.name=Cable @@ -173,7 +149,6 @@ pipeRubberWithSulfur.name=Non-vulcanized rubber pipe pipeVulcanizedRubber.name=Vulcanized rubber pipe tinSnipsSteel.name=Tin snips hammer.name=Hammer -pencil.name=Pencil grindstone.name=Grindstone chisel.name=Chisel needleFile.name=Needle file @@ -504,7 +479,6 @@ fluid.solution.calciumchloride=Calcium chloride dissolved in water ihl.use_with_cryogenic_distiller=Use with cryogenic distiller ihl.dsmhint=Use flint & steel on this block to get result. ihl.gui.lathe=Lathe -ihl.gui.missing.engine=Missing electric engine. /n Put engine here to start machine. tile.glowningAir.name=Air tile.glassBoxBlock.name=Glass box tile.spotlight.name=Spotlight @@ -569,24 +543,4 @@ ihl.viseSetOfMoldedParts=set of parts for vise ihl.rollingMachineSetOfMoldedParts=parts for rolling machine ihl.polishingPucks=polishing pucks ihl.turboCompressorSetOfMoldedParts=parts for turbo compressor -ihl.extruderSetOfMoldedParts=set of parts for extruder -EightPinDataCable.name=8 pin data transfering cable -tile.redstoneSignalConverter.name=Switch unit -ihl.guidebook.title01=Getting started -ihl.guidebook.section01.1=Iron workbench is a main crafting device for all realistic parts of IHL. GUI of workbench contain 4 separated parts. -ihl.guidebook.section01.2=/n 1. First left one - iron workbench and crafting devices, which are surrounding workbench in a range of 1 block. A red exclamation mark under device icon means, that by some reason device is not ready for use. For Gaedes mercury rotary pump it means missing engine or missing electricity or simple previous operation is not ended. For gas welding station - not enough acetylene or oxygen in gas cylinders to perform an operation. If status of crafting device is changed while player is still looking into GUI, visible status will not change accordingly. You may reopen GUI or put away or add new material/tool to reset outputs and crafting devices status. /n 2. Second one - is a tools slots. Tools will not be spent on a craft process, nethertheless they will be damaged after crafting. /n 3. Third one - is a materials slots. Depending on which recipe is choosed, material will be consumed accordingly. Note, that if recipe need 128 m of copper wire, there will be exactly that amount cutted from wire, leaving remaining quantity on its place. /n 4. Fourth. This is possible results of current combination of crafting devices, tools and materials. By clicking slot player will choose one certain output. All possible outputs differs from each other with colored frames. A result of operation will be added to players' inventory. If there is no free space, slot clicking will not result in anything. -ihl.guidebook.title02=Distillation column -ihl.guidebook.section02.1=The distillation column is a setup, which is used for separating fluids on a fraction. For example - separate raw oil in diesel fuel and fueloil (mazute). -ihl.guidebook.section02.2=For working distillation column you need heat source (for example electric heat generator), fractionator bottom, fractionator cover, reflux condenser and any amount of fractionator sections you want (more sections - faster process). Also you need 2 fluid tank at outputs (basically bronze tub is ok) and at least 2 IC2 fluid regulator devices, which can be replaced with gregtech pumps with pipes, or any other block, who could output fluids in tanks. -ihl.guidebook.title03=Cable production -ihl.guidebook.section03.1=For fast and effectively flexible cable production you may use following setup: -ihl.guidebook.section03.2=Assembly production line as shown on picture. There is no discharge slot in those machines, but there is electric motor slot instead, which is must be filled with electric motor for machines to work. Most of machines are created via casting. Use muffle furnace for injection mold, if it was crafted with stearin, before placing it. Melt metals in crucible, using muffle furnace to obtain molten metal. Right click with filled crucible on placed injection mold, wait for 2–3 seconds and destroy mold. Tar pitch can be obtained from bucket with spruce resin, which is gained by placing sap gathering sack on spruce tree. To get glass fibers use fiberglass spinnerets, oleic acid or seed oil and glass blocks and place coiler near machine as showed on picture, but without vulcanization mold. Mutton lard can be gained from sheep, if you kill them with sharpened carving knife. Everything else is showed in NEI. -ihl.guidebook.title04=HVDC line -ihl.guidebook.section04.1=High Voltage Direct Current line allow you to transfer alomost losslessly huge amounts of energy via flexible cables. -ihl.guidebook.section04.2=At first you need frequency generator. This device will generate alternating voltage, which are nessesary for a second device - rectifier/transformer (RTU). Both of them have no GUI. By right-clicking RTU you can raise output voltage, and by pressing "IC2 mode" button (which are "M" by default on keyboard) and right-clicking with this key pressed you can lower one. At a other side of map you must place as much battery-switch units (BSU) as nessesary to lower voltage to standart 400V. A number of BSU must be so n=V/500. For example for 8000 V you need 8000/500=16 BSU connected to each other side-by-side. -ihl.guidebook.title05=Sulfuric acid -ihl.guidebook.section05.1=IHL itself use a more or less scientifically accurate way of chemical synthesis. Thus, to synthesise sulfuric acid you need to reproduce a vintage so-called "chamber method" by assembling setup according picture below. -ihl.guidebook.section05.2=You need to burn down sulfur with saltpeter in chemically resistant oven (made from porcelain) and at the same time let steam in chimney knee with integrated steam injector (100 mb/tick will be enough) and in a same time cool down precipitator with any cold liquid (a cheapest one, of course, is water and 10 mb per tick is enough). Using liquid nitrogen, for example, does not give you any benefits. If you did everything right you will get a lot of sulfuric acid very fast. -ihl.guidebook.title06=Sap gathering -ihl.guidebook.section06.1=You can gather either rubber tree sap from IC2 rubber tree or you can gather spruce resin from vanilla spruce trees. -ihl.guidebook.section06.2=Place a sack correctly on rubber tree trunk or spruce. If you made everything right, soon you will see a sap drops falling into sack. You can drain sack with ic2 fluid cell or universal fluid cell, or use gregtech or buildcraft pipes or just place evaporator right under it - sack will autoutput at tileentity below it. Use evaporator or coagulator (GT6) or centrifuge (GT5) to convert rubber tree sap to sticky resin item. Conversion rate for solid fuel evaporator is 100 mB per one sticky resin item. +ihl.extruderSetOfMoldedParts=set of parts for extruder
\ No newline at end of file diff --git a/assets/ihl/sounds.json b/assets/ihl/sounds.json index d1369e7..c51e488 100644 --- a/assets/ihl/sounds.json +++ b/assets/ihl/sounds.json @@ -5,12 +5,6 @@ "handpumpOne"
]
},
- "collectorHurt": {
- "category": "neutral",
- "sounds": [
- "collectorHurt"
- ]
- },
"lostHeadCry": {
"category": "hostile",
"sounds": [
diff --git a/assets/ihl/textures/blocks/fluidGlycerylFlowing.png b/assets/ihl/textures/blocks/fluidGlycerolFlowing.png Binary files differindex 47b9fc0..47b9fc0 100644 --- a/assets/ihl/textures/blocks/fluidGlycerylFlowing.png +++ b/assets/ihl/textures/blocks/fluidGlycerolFlowing.png diff --git a/assets/ihl/textures/blocks/fluidGlycerylFlowing.png.mcmeta b/assets/ihl/textures/blocks/fluidGlycerolFlowing.png.mcmeta index e9b67fc..e9b67fc 100644 --- a/assets/ihl/textures/blocks/fluidGlycerylFlowing.png.mcmeta +++ b/assets/ihl/textures/blocks/fluidGlycerolFlowing.png.mcmeta diff --git a/assets/ihl/textures/blocks/fluidGlycerylStill.png b/assets/ihl/textures/blocks/fluidGlycerolStill.png Binary files differindex d533b1c..d533b1c 100644 --- a/assets/ihl/textures/blocks/fluidGlycerylStill.png +++ b/assets/ihl/textures/blocks/fluidGlycerolStill.png diff --git a/assets/ihl/textures/blocks/fluidGlycerylStill.png.mcmeta b/assets/ihl/textures/blocks/fluidGlycerolStill.png.mcmeta index e9b67fc..e9b67fc 100644 --- a/assets/ihl/textures/blocks/fluidGlycerylStill.png.mcmeta +++ b/assets/ihl/textures/blocks/fluidGlycerolStill.png.mcmeta diff --git a/assets/ihl/textures/blocks/glassBoxBottom.png b/assets/ihl/textures/blocks/glassBoxBottom.png Binary files differdeleted file mode 100644 index 11b2b9e..0000000 --- a/assets/ihl/textures/blocks/glassBoxBottom.png +++ /dev/null diff --git a/assets/ihl/textures/blocks/glassBoxInnerBottom.png b/assets/ihl/textures/blocks/glassBoxInnerBottom.png Binary files differdeleted file mode 100644 index 994d5d9..0000000 --- a/assets/ihl/textures/blocks/glassBoxInnerBottom.png +++ /dev/null diff --git a/assets/ihl/textures/blocks/glassBoxInnerSide.png b/assets/ihl/textures/blocks/glassBoxInnerSide.png Binary files differdeleted file mode 100644 index 0c85694..0000000 --- a/assets/ihl/textures/blocks/glassBoxInnerSide.png +++ /dev/null diff --git a/assets/ihl/textures/blocks/glassBoxSide.png b/assets/ihl/textures/blocks/glassBoxSide.png Binary files differdeleted file mode 100644 index 469d21f..0000000 --- a/assets/ihl/textures/blocks/glassBoxSide.png +++ /dev/null diff --git a/assets/ihl/textures/blocks/glassBoxTop.png b/assets/ihl/textures/blocks/glassBoxTop.png Binary files differdeleted file mode 100644 index 561daf4..0000000 --- a/assets/ihl/textures/blocks/glassBoxTop.png +++ /dev/null diff --git a/assets/ihl/textures/blocks/pileTextureSpace.png b/assets/ihl/textures/blocks/pileTextureSpace.png Binary files differnew file mode 100644 index 0000000..352c02b --- /dev/null +++ b/assets/ihl/textures/blocks/pileTextureSpace.png diff --git a/assets/ihl/textures/gui/GUIAchesonFurnace.png b/assets/ihl/textures/gui/GUIAchesonFurnace.png Binary files differnew file mode 100644 index 0000000..f21421e --- /dev/null +++ b/assets/ihl/textures/gui/GUIAchesonFurnace.png diff --git a/assets/ihl/textures/gui/GUIAchesonFurnaceNEI.png b/assets/ihl/textures/gui/GUIAchesonFurnaceNEI.png Binary files differdeleted file mode 100644 index 4b292fb..0000000 --- a/assets/ihl/textures/gui/GUIAchesonFurnaceNEI.png +++ /dev/null diff --git a/assets/ihl/textures/gui/GUIAchesonFurnance.png b/assets/ihl/textures/gui/GUIAchesonFurnance.png Binary files differdeleted file mode 100644 index 8cf99f0..0000000 --- a/assets/ihl/textures/gui/GUIAchesonFurnance.png +++ /dev/null diff --git a/assets/ihl/textures/gui/GUILeadOven.png b/assets/ihl/textures/gui/GUILeadOven.png Binary files differindex c508ca6..87c3fd8 100644 --- a/assets/ihl/textures/gui/GUILeadOven.png +++ b/assets/ihl/textures/gui/GUILeadOven.png diff --git a/assets/ihl/textures/gui/GUIMuffleFurnace.png b/assets/ihl/textures/gui/GUIMuffleFurnace.png Binary files differdeleted file mode 100644 index cbaa358..0000000 --- a/assets/ihl/textures/gui/GUIMuffleFurnace.png +++ /dev/null diff --git a/assets/ihl/textures/items/chimneyKneeRawPorcelain.png b/assets/ihl/textures/items/chimneyKneeRawPorcelain.png Binary files differdeleted file mode 100644 index 1249949..0000000 --- a/assets/ihl/textures/items/chimneyKneeRawPorcelain.png +++ /dev/null diff --git a/assets/ihl/textures/items/itemCellGlyceryl.png b/assets/ihl/textures/items/itemCellGlycerol.png Binary files differindex b81ede2..b81ede2 100644 --- a/assets/ihl/textures/items/itemCellGlyceryl.png +++ b/assets/ihl/textures/items/itemCellGlycerol.png diff --git a/assets/ihl/textures/items/precipitatorCondenserRawPorcelain.png b/assets/ihl/textures/items/precipitatorCondenserRawPorcelain.png Binary files differdeleted file mode 100644 index 15222e7..0000000 --- a/assets/ihl/textures/items/precipitatorCondenserRawPorcelain.png +++ /dev/null diff --git a/ihl/ClientProxy.java b/ihl/ClientProxy.java index 6b0dac0..974a7c4 100644 --- a/ihl/ClientProxy.java +++ b/ihl/ClientProxy.java @@ -2,7 +2,6 @@ package ihl; import java.io.File;
import java.io.IOException;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@@ -52,14 +51,8 @@ import ihl.processing.chemistry.FractionatorSectionModel; import ihl.processing.chemistry.FractionatorSectionTileEntity;
import ihl.processing.chemistry.GaedesMercuryRotaryPumpModel;
import ihl.processing.chemistry.GaedesMercuryRotaryPumpTileEntity;
-import ihl.processing.chemistry.GoldChimneyKneeModel;
-import ihl.processing.chemistry.GoldChimneyKneeRender;
-import ihl.processing.chemistry.GoldChimneyKneeTileEntity;
import ihl.processing.chemistry.LoomModel;
import ihl.processing.chemistry.LoomTileEntity;
-import ihl.processing.chemistry.PrecipitatorCondenserModel;
-import ihl.processing.chemistry.PrecipitatorCondenserRender;
-import ihl.processing.chemistry.PrecipitatorCondenserTileEntity;
import ihl.processing.chemistry.RefluxCondenserModel;
import ihl.processing.chemistry.RefluxCondenserTileEntity;
import ihl.processing.metallurgy.CoilerModel;
@@ -115,7 +108,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
@@ -130,24 +122,24 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly;
public class ClientProxy extends ServerProxy {
-
- public boolean loadMirrorRender=true;
+
+ public boolean loadMirrorRender = true;
public IHLRenderUtils renderUtils;
- public Map<MachineType,Integer> sharedBlockRenders = new HashMap<MachineType,Integer>();
- public Map<Class<? extends TileEntity>,ISelectionBoxSpecialRenderer> selectionBoxSpecialRendererRegistry = new HashMap<Class<? extends TileEntity>,ISelectionBoxSpecialRenderer>();
- public ClientProxy() {}
-
+ public Map<MachineType, Integer> sharedBlockRenders = new HashMap<MachineType, Integer>();
+ public Map<Class<? extends TileEntity>, ISelectionBoxSpecialRenderer> selectionBoxSpecialRendererRegistry = new HashMap<Class<? extends TileEntity>, ISelectionBoxSpecialRenderer>();
+
+ public ClientProxy() {
+ }
+
@Override
- public void load() throws ParserConfigurationException
- {
- if(channel==null)
- {
- channel = NetworkRegistry.INSTANCE.newEventDrivenChannel(IHLModInfo.MODID);
- channel.register(this);
- }
- this.renderUtils=new IHLRenderUtils();
+ public void load() throws ParserConfigurationException {
+ if (channel == null) {
+ channel = NetworkRegistry.INSTANCE.newEventDrivenChannel(IHLModInfo.MODID);
+ channel.register(this);
+ }
+ this.renderUtils = new IHLRenderUtils();
MinecraftForge.EVENT_BUS.register(this.renderUtils);
-
+
registerBlockHandler(new ImpregnatingMachineBlockRender(), MachineType.BronzeTub);
registerBlockHandler(new RefluxCondenserBlockRender(), MachineType.RefluxCondenser);
registerBlockHandler(new RectifierTransformerUnitBlockRender(), MachineType.RectifierTransformerUnit);
@@ -155,292 +147,334 @@ public class ClientProxy extends ServerProxy { PileBlockRender pileBlockRender = new PileBlockRender();
RenderingRegistry.registerBlockHandler(pileBlockRender);
ClientRegistry.bindTileEntitySpecialRenderer(PileTileEntity.class, pileBlockRender.pileTileEntityRender);
-
+
RenderingRegistry.registerEntityRenderingHandler(IHLEntityFallingPile.class, new IHLEntityFallingPileRender());
ClientRegistry.bindTileEntitySpecialRenderer(SackTileEntity.class, new SackRender());
- ClientRegistry.bindTileEntitySpecialRenderer(LathePart1TileEntity.class, new UniversalTileRender(new LathePart1Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png")));
- ClientRegistry.bindTileEntitySpecialRenderer(LathePart2TileEntity.class, new UniversalTileRender(new LathePart2Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png")));
- ClientRegistry.bindTileEntitySpecialRenderer(LoomTileEntity.class, new UniversalTileRender(new LoomModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/detonationSprayingMachine.png")));
- ClientRegistry.bindTileEntitySpecialRenderer(ImpregnatingMachineTileEntity.class, new ImpregnatingMachineRender());
- ClientRegistry.bindTileEntitySpecialRenderer(DetonationSprayingMachineTileEntity.class, new DetonationSprayingMachineRender());
- ClientRegistry.bindTileEntitySpecialRenderer(GoldChimneyKneeTileEntity.class, new GoldChimneyKneeRender());
- ClientRegistry.bindTileEntitySpecialRenderer(PrecipitatorCondenserTileEntity.class, new PrecipitatorCondenserRender());
+ ClientRegistry.bindTileEntitySpecialRenderer(LathePart1TileEntity.class, new UniversalTileRender(
+ new LathePart1Model(), new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/coiler.png")));
+ ClientRegistry.bindTileEntitySpecialRenderer(LathePart2TileEntity.class, new UniversalTileRender(
+ new LathePart2Model(), new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/coiler.png")));
+ ClientRegistry.bindTileEntitySpecialRenderer(LoomTileEntity.class, new UniversalTileRender(new LoomModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/detonationSprayingMachine.png")));
+ ClientRegistry.bindTileEntitySpecialRenderer(ImpregnatingMachineTileEntity.class,
+ new ImpregnatingMachineRender());
+ ClientRegistry.bindTileEntitySpecialRenderer(DetonationSprayingMachineTileEntity.class,
+ new DetonationSprayingMachineRender());
ClientRegistry.bindTileEntitySpecialRenderer(CoilerTileEntity.class, new CoilerRender());
ClientRegistry.bindTileEntitySpecialRenderer(IronWorkbenchTileEntity.class, new IronWorkbenchRender());
ClientRegistry.bindTileEntitySpecialRenderer(RollingMachinePart1TileEntity.class, new RollingMachineRender());
- ClientRegistry.bindTileEntitySpecialRenderer(RollingMachinePart2TileEntity.class, new UniversalTileRender(new RollingMachinePart2Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png")));
- ClientRegistry.bindTileEntitySpecialRenderer(VulcanizationExtrudingMoldTileEntity.class, new UniversalTileRender(new VulcanizationExtrudingMoldModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png")));
- ClientRegistry.bindTileEntitySpecialRenderer(ExtruderTileEntity.class, new UniversalTileRender(new ExtruderModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png")));
- ClientRegistry.bindTileEntitySpecialRenderer(WoodenRollingMachinePart1TileEntity.class, new WoodenRollingMachineRender());
- ClientRegistry.bindTileEntitySpecialRenderer(WoodenRollingMachinePart2TileEntity.class, new UniversalTileRender(new WoodenRollingMachinePart2Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/woodenRollingMachine.png")));
- ClientRegistry.bindTileEntitySpecialRenderer(GasWeldingStationTileEntity.class, new UniversalTileRender(new GasWeldingStationModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/gasWeldingStation.png")));
- ClientRegistry.bindTileEntitySpecialRenderer(GaedesMercuryRotaryPumpTileEntity.class, new UniversalTileRender(new GaedesMercuryRotaryPumpModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/extruder.png")));
- ClientRegistry.bindTileEntitySpecialRenderer(FractionatorBottomTileEntity.class, new UniversalTileRender(new FractionatorBottomModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/splitInjectionMold.png")));
- ClientRegistry.bindTileEntitySpecialRenderer(FractionatorSectionTileEntity.class, new UniversalTileRender(new FractionatorSectionModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/splitInjectionMold.png")));
- ClientRegistry.bindTileEntitySpecialRenderer(FractionatorCoverTileEntity.class, new UniversalTileRender(new FractionatorCoverModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/splitInjectionMold.png")));
- ClientRegistry.bindTileEntitySpecialRenderer(RefluxCondenserTileEntity.class, new UniversalTileRender(new RefluxCondenserModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/splitInjectionMold.png")));
- ClientRegistry.bindTileEntitySpecialRenderer(BatterySwitchUnitTileEntity.class, new UniversalTileRender(new BatterySwitchUnitModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/batterySwitchUnit.png")));
- ClientRegistry.bindTileEntitySpecialRenderer(ElectrolysisBathTileEntity.class, new UniversalTileRender(new ElectrolysisBathModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/electrolysisBath.png")));
- if(loadMirrorRender && IHLMod.config.mirrorReflectionRange>0)
- {
+ ClientRegistry.bindTileEntitySpecialRenderer(RollingMachinePart2TileEntity.class,
+ new UniversalTileRender(new RollingMachinePart2Model(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/coiler.png")));
+ ClientRegistry.bindTileEntitySpecialRenderer(VulcanizationExtrudingMoldTileEntity.class,
+ new UniversalTileRender(new VulcanizationExtrudingMoldModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/coiler.png")));
+ ClientRegistry.bindTileEntitySpecialRenderer(ExtruderTileEntity.class, new UniversalTileRender(
+ new ExtruderModel(), new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/coiler.png")));
+ ClientRegistry.bindTileEntitySpecialRenderer(WoodenRollingMachinePart1TileEntity.class,
+ new WoodenRollingMachineRender());
+ ClientRegistry.bindTileEntitySpecialRenderer(WoodenRollingMachinePart2TileEntity.class,
+ new UniversalTileRender(new WoodenRollingMachinePart2Model(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/woodenRollingMachine.png")));
+ ClientRegistry.bindTileEntitySpecialRenderer(GasWeldingStationTileEntity.class,
+ new UniversalTileRender(new GasWeldingStationModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/gasWeldingStation.png")));
+ ClientRegistry.bindTileEntitySpecialRenderer(GaedesMercuryRotaryPumpTileEntity.class,
+ new UniversalTileRender(new GaedesMercuryRotaryPumpModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/extruder.png")));
+ ClientRegistry.bindTileEntitySpecialRenderer(FractionatorBottomTileEntity.class,
+ new UniversalTileRender(new FractionatorBottomModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/splitInjectionMold.png")));
+ ClientRegistry.bindTileEntitySpecialRenderer(FractionatorSectionTileEntity.class,
+ new UniversalTileRender(new FractionatorSectionModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/splitInjectionMold.png")));
+ ClientRegistry.bindTileEntitySpecialRenderer(FractionatorCoverTileEntity.class,
+ new UniversalTileRender(new FractionatorCoverModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/splitInjectionMold.png")));
+ ClientRegistry.bindTileEntitySpecialRenderer(RefluxCondenserTileEntity.class,
+ new UniversalTileRender(new RefluxCondenserModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/splitInjectionMold.png")));
+ ClientRegistry.bindTileEntitySpecialRenderer(BatterySwitchUnitTileEntity.class,
+ new UniversalTileRender(new BatterySwitchUnitModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/batterySwitchUnit.png")));
+ ClientRegistry.bindTileEntitySpecialRenderer(ElectrolysisBathTileEntity.class,
+ new UniversalTileRender(new ElectrolysisBathModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/electrolysisBath.png")));
+ if (loadMirrorRender && IHLMod.config.mirrorReflectionRange > 0) {
ClientRegistry.bindTileEntitySpecialRenderer(MirrorTileEntity.class, new MirrorRender());
}
ClientRegistry.bindTileEntitySpecialRenderer(LightBulbTileEntity.class, new LightBulbRender());
ClientRegistry.bindTileEntitySpecialRenderer(SpotlightTileEntity.class, new SpotlightRender());
selectionBoxSpecialRendererRegistry.put(AnchorTileEntity.class, new CableHolderSelectionBoxSpecialRenderer());
- selectionBoxSpecialRendererRegistry.put(RectifierTransformerUnitTileEntity.class, new RectifierTransformerUnitSelectionBoxSpecialRenderer());
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("goldPrecipitatorCondenser"), new BlockItemRender(new PrecipitatorCondenserModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/porcelainBox.png"), 0, 0, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("goldChimneyKnee"), new BlockItemRender(new GoldChimneyKneeModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/porcelainBox.png"), 0, 0, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("cannonBronze"), new BlockItemRender(new DetonationSprayingMachineModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/detonationSprayingMachine.png"), 0, 0, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("lathePart1"), new BlockItemRender(new LathePart1Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"), 0, 0, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("lathePart2"), new BlockItemRender(new LathePart2Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"), 0, 0, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("rollingMachinePart1"), new BlockItemRender(new RollingMachinePart1Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"), 0, 5, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("rollingMachinePart2"), new BlockItemRender(new RollingMachinePart2Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"), 0, 0, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("coiler"), new BlockItemRender(new CoilerModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"), 0, 6, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("loom"), new BlockItemRender(new LoomModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/detonationSprayingMachine.png"), 0, 0, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("vulcanizationExtrudingMold"), new BlockItemRender(new VulcanizationExtrudingMoldModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"), 0, 0, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("extruder"), new BlockItemRender(new ExtruderModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"), 0, 0, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("woodenRollingMachinePart1"), new BlockItemRender(new WoodenRollingMachinePart2Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/woodenRollingMachine.png"), 0, 0, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("woodenRollingMachinePart2"), new BlockItemRender(new WoodenRollingMachinePart2Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/woodenRollingMachine.png"), 0, 0, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("gasWeldingStation"), new BlockItemRender(new GasWeldingStationModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/gasWeldingStation.png"), 0, 0, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("gaedesMercuryRotaryPump"), new BlockItemRender(new GaedesMercuryRotaryPumpModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/extruder.png"), 0, 0, 0.0F, 0.0F));
+ selectionBoxSpecialRendererRegistry.put(RectifierTransformerUnitTileEntity.class,
+ new RectifierTransformerUnitSelectionBoxSpecialRenderer());
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("cannonBronze"),
+ new BlockItemRender(new DetonationSprayingMachineModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/detonationSprayingMachine.png"), 0, 0,
+ 0.0F, 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("lathePart1"),
+ new BlockItemRender(new LathePart1Model(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/coiler.png"), 0, 0, 0.0F, 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("lathePart2"),
+ new BlockItemRender(new LathePart2Model(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/coiler.png"), 0, 0, 0.0F, 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("rollingMachinePart1"),
+ new BlockItemRender(new RollingMachinePart1Model(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/coiler.png"), 0, 5, 0.0F, 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("rollingMachinePart2"),
+ new BlockItemRender(new RollingMachinePart2Model(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/coiler.png"), 0, 0, 0.0F, 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("coiler"),
+ new BlockItemRender(new CoilerModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/coiler.png"), 0, 6, 0.0F, 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("loom"),
+ new BlockItemRender(new LoomModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/detonationSprayingMachine.png"), 0, 0,
+ 0.0F, 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("vulcanizationExtrudingMold"),
+ new BlockItemRender(new VulcanizationExtrudingMoldModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/coiler.png"), 0, 0, 0.0F, 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("extruder"),
+ new BlockItemRender(new ExtruderModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/coiler.png"), 0, 0, 0.0F, 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("woodenRollingMachinePart1"),
+ new BlockItemRender(new WoodenRollingMachinePart2Model(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/woodenRollingMachine.png"), 0, 0,
+ 0.0F, 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("woodenRollingMachinePart2"),
+ new BlockItemRender(new WoodenRollingMachinePart2Model(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/woodenRollingMachine.png"), 0, 0,
+ 0.0F, 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("gasWeldingStation"),
+ new BlockItemRender(new GasWeldingStationModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/gasWeldingStation.png"), 0, 0, 0.0F,
+ 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("gaedesMercuryRotaryPump"),
+ new BlockItemRender(new GaedesMercuryRotaryPumpModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/extruder.png"), 0, 0, 0.0F, 0.0F));
MinecraftForgeClient.registerItemRenderer(IHLMod.ihlSkull, new SkullItemRender());
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("fractionatorBottom"), new BlockItemRender(new FractionatorBottomModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/splitInjectionMold.png"), 0, 0, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("fractionatorSection"), new BlockItemRender(new FractionatorSectionModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/splitInjectionMold.png"), 0, 0, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("fractionatorCover"), new BlockItemRender(new FractionatorCoverModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/splitInjectionMold.png"), 0, 0, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("refluxCondenser"), new BlockItemRender(new RefluxCondenserModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/splitInjectionMold.png"), 0, 0, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("batterySwitchUnit"), new BlockItemRender(new BatterySwitchUnitModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/batterySwitchUnit.png"), 0, 0, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("electrolysisBath"), new BlockItemRender(new ElectrolysisBathModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/electrolysisBath.png"), 0, 0, 0.0F, 0.0F));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("lightBulb"), new BlockItemRender(new LightBulbModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/lightBulb.png"), 0, 1, 0.0F, 0.0F, true));
- MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("spotlight"), new BlockItemRender(new SpotlightModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/spotlight.png"), 0, 1, 0.0F, 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("fractionatorBottom"),
+ new BlockItemRender(new FractionatorBottomModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/splitInjectionMold.png"), 0, 0, 0.0F,
+ 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("fractionatorSection"),
+ new BlockItemRender(new FractionatorSectionModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/splitInjectionMold.png"), 0, 0, 0.0F,
+ 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("fractionatorCover"),
+ new BlockItemRender(new FractionatorCoverModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/splitInjectionMold.png"), 0, 0, 0.0F,
+ 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("refluxCondenser"),
+ new BlockItemRender(new RefluxCondenserModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/splitInjectionMold.png"), 0, 0, 0.0F,
+ 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("batterySwitchUnit"),
+ new BlockItemRender(new BatterySwitchUnitModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/batterySwitchUnit.png"), 0, 0, 0.0F,
+ 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("electrolysisBath"),
+ new BlockItemRender(new ElectrolysisBathModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/electrolysisBath.png"), 0, 0, 0.0F,
+ 0.0F));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("lightBulb"),
+ new BlockItemRender(new LightBulbModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/lightBulb.png"), 0, 1, 0.0F, 0.0F,
+ true));
+ MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("spotlight"),
+ new BlockItemRender(new SpotlightModel(),
+ new ResourceLocation(IHLModInfo.MODID + ":textures/blocks/spotlight.png"), 0, 1, 0.0F, 0.0F));
MinecraftForgeClient.registerItemRenderer(IHLTool.instance, new IHLToolRenderer());
MinecraftForgeClient.registerItemRenderer(FlexibleCableItem.instance, new FlexibleCableItemRender());
RenderingRegistry.registerEntityRenderingHandler(LostHeadEntity.class, new LostHeadRender());
- RenderingRegistry.registerEntityRenderingHandler(FlameEntityFX.class, new FlameRenderFX(IHLModInfo.MODID+":textures/particles/flameTongue.png"));
- RenderingRegistry.registerEntityRenderingHandler(BlastEntityFX.class, new FlameRenderFX(IHLModInfo.MODID+":textures/particles/blast.png"));
+ RenderingRegistry.registerEntityRenderingHandler(FlameEntityFX.class,
+ new FlameRenderFX(IHLModInfo.MODID + ":textures/particles/flameTongue.png"));
+ RenderingRegistry.registerEntityRenderingHandler(BlastEntityFX.class,
+ new FlameRenderFX(IHLModInfo.MODID + ":textures/particles/blast.png"));
RenderingRegistry.registerEntityRenderingHandler(BlobEntityFX.class, new BlobRenderFX());
- RenderingRegistry.registerEntityRenderingHandler(ExplosionEntityFX.class, new ExplosionRenderFX(IHLModInfo.MODID+":textures/particles/explosion.png"));
+ RenderingRegistry.registerEntityRenderingHandler(ExplosionEntityFX.class,
+ new ExplosionRenderFX(IHLModInfo.MODID + ":textures/particles/explosion.png"));
RenderingRegistry.registerEntityRenderingHandler(NodeEntity.class, new NodeRender());
}
-
+
@Override
- public void spawnParticle(int particle, World world, double x, double y, double z, double mx, double my, double mz, float particleScale)
- {
- switch(particle)
- {
- case 0:
- FlameEntityFX flamePEFX1 = new FlameEntityFX(world,x,y,z,mx,my,mz,particleScale);
- world.spawnEntityInWorld(flamePEFX1);
- break;
- case 1:
- BlobEntityFX blob = new BlobEntityFX(world,x,y,z,mx,my,mz,particleScale, FluidType.RESIN);
- world.spawnEntityInWorld(blob);
- break;
- case 2:
- BlobEntityFX blob2 = new BlobEntityFX(world,x,y,z,mx,my,mz,particleScale, FluidType.SAP);
- world.spawnEntityInWorld(blob2);
- break;
- case 3:
- BlastEntityFX blast = new BlastEntityFX(world,x,y,z,mx,my,mz,particleScale);
- world.spawnEntityInWorld(blast);
- break;
- case 4:
- world.spawnParticle("smoke",x,y,z,mx,my,mz);
- break;
- default:
- FlameEntityFX flamePEFX2 = new FlameEntityFX(world,x,y,z,mx,my,mz,particleScale);
- world.spawnEntityInWorld(flamePEFX2);
- break;
+ public void spawnParticle(int particle, World world, double x, double y, double z, double mx, double my, double mz,
+ float particleScale) {
+ switch (particle) {
+ case 0:
+ FlameEntityFX flamePEFX1 = new FlameEntityFX(world, x, y, z, mx, my, mz, particleScale);
+ world.spawnEntityInWorld(flamePEFX1);
+ break;
+ case 1:
+ BlobEntityFX blob = new BlobEntityFX(world, x, y, z, mx, my, mz, particleScale, FluidType.RESIN);
+ world.spawnEntityInWorld(blob);
+ break;
+ case 2:
+ BlobEntityFX blob2 = new BlobEntityFX(world, x, y, z, mx, my, mz, particleScale, FluidType.SAP);
+ world.spawnEntityInWorld(blob2);
+ break;
+ case 3:
+ BlastEntityFX blast = new BlastEntityFX(world, x, y, z, mx, my, mz, particleScale);
+ world.spawnEntityInWorld(blast);
+ break;
+ case 4:
+ world.spawnParticle("smoke", x, y, z, mx, my, mz);
+ break;
+ default:
+ FlameEntityFX flamePEFX2 = new FlameEntityFX(world, x, y, z, mx, my, mz, particleScale);
+ world.spawnEntityInWorld(flamePEFX2);
+ break;
}
}
-
+
@Override
- public void createExplosionEffect(World world, int x, int y, int z, float radius)
- {
- world.playSound(x, y, z, IHLModInfo.MODID+":explosion", 100f, 1f, false);
+ public void createExplosionEffect(World world, int x, int y, int z, float radius) {
+ world.playSound(x, y, z, IHLModInfo.MODID + ":explosion", 100f, 1f, false);
ExplosionEntityFX explosionFX = new ExplosionEntityFX(world, x, y, z, radius);
- world.spawnEntityInWorld(explosionFX);
+ world.spawnEntityInWorld(explosionFX);
}
-
@Override
@SideOnly(Side.CLIENT)
@SubscribeEvent
- public void registerIcons(TextureStitchEvent.Pre event)
- {
- if (event.map.getTextureType() == 0)
- {
+ public void registerIcons(TextureStitchEvent.Pre event) {
+ if (event.map.getTextureType() == 0) {
IHLFluid.registerIcons(event.map);
}
}
@Override
- public Render getRenderForEntityClass(Class<? extends Entity> entityClass)
- {
+ public Render getRenderForEntityClass(Class<? extends Entity> entityClass) {
return (Render) RenderManager.instance.entityRenderMap.get(entityClass);
}
-
+
@Override
- public void initBlockRenderer()
- {
+ public void initBlockRenderer() {
new IHLBlockRenderer();
}
@Override
- public int getGLDisplayList()
- {
+ public int getGLDisplayList() {
return GLAllocation.generateDisplayLists(1);
}
-
+
@Override
- public File getMinecraftDir()
- {
- return Minecraft.getMinecraft().mcDataDir;
- }
+ public File getMinecraftDir() {
+ return Minecraft.getMinecraft().mcDataDir;
+ }
@Override
- public int shareBlockRendererByMachineType(MachineType type)
- {
+ public int shareBlockRendererByMachineType(MachineType type) {
return sharedBlockRenders.get(type);
}
-
- public void registerBlockHandler(ISimpleBlockRenderingHandler handler, MachineType... types)
- {
+
+ public void registerBlockHandler(ISimpleBlockRenderingHandler handler, MachineType... types) {
RenderingRegistry.registerBlockHandler(handler);
- for(MachineType type:types)
- {
+ for (MachineType type : types) {
sharedBlockRenders.put(type, handler.getRenderId());
}
}
-
- @SubscribeEvent
- public void onPacketFromServerToClient(FMLNetworkEvent.ClientCustomPacketEvent event) throws IOException
- {
- World world = Minecraft.getMinecraft().theWorld;
- ByteBuf data = event.packet.payload();
- ByteBufInputStream byteBufInputStream = new ByteBufInputStream(data);
- switch(byteBufInputStream.read())
- {
- case 0:
- int particleId = byteBufInputStream.read();
- float x=byteBufInputStream.readFloat();
- float y=byteBufInputStream.readFloat();
- float z=byteBufInputStream.readFloat();
- float mx=byteBufInputStream.readFloat();
- float my=byteBufInputStream.readFloat();
- float mz=byteBufInputStream.readFloat();
- float particleScale=byteBufInputStream.readFloat();
- this.spawnParticle(particleId, world, x, y, z, mx, my, mz, particleScale);
- break;
- case 1:
- int entityId = byteBufInputStream.readInt();
- INetworkListener listener = (INetworkListener) world.getEntityByID(entityId);
- if(listener!=null)
- {
- listener.recieveData(byteBufInputStream);
- IHLMod.log.debug("Data delivered to client");
- }
- else
- {
- delayedEntityDataPacket.put(entityId, data);
- IHLMod.log.debug("Data delayed. Entity ID="+entityId);
- }
- break;
- case 2:
- int posX=byteBufInputStream.readInt();
- int posY=byteBufInputStream.readInt();
- int posZ=byteBufInputStream.readInt();
- float radius=byteBufInputStream.readFloat();
- this.createExplosionEffect(world, posX, posY, posZ, radius);
- break;
- case 3:
- int soundId = byteBufInputStream.read();
- x=byteBufInputStream.readFloat();
- y=byteBufInputStream.readFloat();
- z=byteBufInputStream.readFloat();
- float volume=byteBufInputStream.readFloat();
- float pitch=byteBufInputStream.readFloat();
- this.playSound(Minecraft.getMinecraft().theWorld, soundId, x, y, z, volume, pitch);
- break;
- case 4:
- int chunkNum = byteBufInputStream.read();
- for(int i=0;i<chunkNum;i++)
- {
- long chunkXZKey = byteBufInputStream.readLong();
- int chunkX = (int)(chunkXZKey & 0xFFFFFFFF);
- int chunkZ = (int)((chunkXZKey>>32) & 0xFFFFFFFF);
- Chunk chunk = world.getChunkProvider().provideChunk(chunkX, chunkZ);
- chunk.generateSkylightMap();
- Arrays.fill(chunk.updateSkylightColumns, true);
- chunk.func_150804_b(true);
- }
- break;
- }
- byteBufInputStream.close();
+
+ @SubscribeEvent
+ public void onPacketFromServerToClient(FMLNetworkEvent.ClientCustomPacketEvent event) throws IOException {
+ WorldClient world = Minecraft.getMinecraft().theWorld;
+ ByteBuf data = event.packet.payload();
+ ByteBufInputStream byteBufInputStream = new ByteBufInputStream(data);
+ switch (byteBufInputStream.read()) {
+ case 0:
+ int particleId = byteBufInputStream.read();
+ float x = byteBufInputStream.readFloat();
+ float y = byteBufInputStream.readFloat();
+ float z = byteBufInputStream.readFloat();
+ float mx = byteBufInputStream.readFloat();
+ float my = byteBufInputStream.readFloat();
+ float mz = byteBufInputStream.readFloat();
+ float particleScale = byteBufInputStream.readFloat();
+ this.spawnParticle(particleId, world, x, y, z, mx, my, mz, particleScale);
+ break;
+ case 1:
+ int entityId = byteBufInputStream.readInt();
+ INetworkListener listener = (INetworkListener) world.getEntityByID(entityId);
+ if (listener != null) {
+ listener.recieveData(byteBufInputStream);
+ IHLMod.log.debug("Data delivered to client");
+ } else {
+ delayedEntityDataPacket.put(entityId, data);
+ IHLMod.log.debug("Data delayed. Entity ID=" + entityId);
+ }
+ break;
+ case 2:
+ int posX = byteBufInputStream.readInt();
+ int posY = byteBufInputStream.readInt();
+ int posZ = byteBufInputStream.readInt();
+ float radius = byteBufInputStream.readFloat();
+ this.createExplosionEffect(world, posX, posY, posZ, radius);
+ break;
+ case 3:
+ int soundId = byteBufInputStream.read();
+ x = byteBufInputStream.readFloat();
+ y = byteBufInputStream.readFloat();
+ z = byteBufInputStream.readFloat();
+ float volume = byteBufInputStream.readFloat();
+ float pitch = byteBufInputStream.readFloat();
+ this.playSound(world, soundId, x, y, z, volume, pitch);
+ break;
+ }
+ byteBufInputStream.close();
}
-
- private void playSound(WorldClient world, int soundId, float x, float y, float z, float volume, float pitch) {
- world.playSound(x, y, z, IHLModInfo.MODID+":fuse", 1f, 1f, false);
+
+ private void playSound(WorldClient world, int soundId, float x, float y, float z, float volume, float pitch) {
+ world.playSound(x, y, z, IHLModInfo.MODID + ":fuse", 1f, 1f, false);
}
@Override
- public boolean renderTESpecialSelectionBox(TileEntity te, EntityPlayer player, ItemStack currentItem, MovingObjectPosition target, float partialTicks)
- {
- ISelectionBoxSpecialRenderer ssbr = selectionBoxSpecialRendererRegistry.get(te.getClass());
- if(ssbr!=null)
- {
+ public boolean renderTESpecialSelectionBox(TileEntity te, EntityPlayer player, ItemStack currentItem,
+ MovingObjectPosition target, float partialTicks) {
+ ISelectionBoxSpecialRenderer ssbr = selectionBoxSpecialRendererRegistry.get(te.getClass());
+ if (ssbr != null) {
ssbr.drawSelectionBox(player, currentItem, target, partialTicks);
return true;
- }
- else
- {
+ } else {
return false;
}
}
-
- @Override
- public void sendItemStackNBTTagFromClientToServerPlayer(EntityPlayer player, int slotNumber, String fieldName, int fieldValue)
- {
- ByteBuf bb = Unpooled.buffer(36);
+
+ @Override
+ public void sendItemStackNBTTagFromClientToServerPlayer(EntityPlayer player, int slotNumber, String fieldName,
+ int fieldValue) {
+ ByteBuf bb = Unpooled.buffer(36);
ByteBufOutputStream byteBufOutputStream = new ByteBufOutputStream(bb);
- try
- {
+ try {
byteBufOutputStream.write(0);
byteBufOutputStream.writeInt(player.getEntityId());
byteBufOutputStream.writeInt(player.worldObj.provider.dimensionId);
byteBufOutputStream.writeInt(slotNumber);
byteBufOutputStream.writeInt(fieldValue);
byteBufOutputStream.writeUTF(fieldName);
- channel.sendToServer(new FMLProxyPacket(byteBufOutputStream.buffer(),IHLModInfo.MODID));
+ channel.sendToServer(new FMLProxyPacket(byteBufOutputStream.buffer(), IHLModInfo.MODID));
byteBufOutputStream.close();
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
e.printStackTrace();
}
- }
-
- @Override
- public void requestTileEntityInitdataFromClientToServer(int x, int y, int z)
- {
- EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
- ByteBuf bb = Unpooled.buffer(36);
+ }
+
+ @Override
+ public void requestTileEntityInitdataFromClientToServer(int x, int y, int z) {
+ EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
+ ByteBuf bb = Unpooled.buffer(36);
ByteBufOutputStream byteBufOutputStream = new ByteBufOutputStream(bb);
- try
- {
+ try {
byteBufOutputStream.write(1);
byteBufOutputStream.writeInt(player.getEntityId());
byteBufOutputStream.writeInt(player.worldObj.provider.dimensionId);
byteBufOutputStream.writeInt(x);
byteBufOutputStream.writeInt(y);
byteBufOutputStream.writeInt(z);
- channel.sendToServer(new FMLProxyPacket(byteBufOutputStream.buffer(),IHLModInfo.MODID));
+ channel.sendToServer(new FMLProxyPacket(byteBufOutputStream.buffer(), IHLModInfo.MODID));
byteBufOutputStream.close();
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
e.printStackTrace();
}
- }
+ }
}
diff --git a/ihl/IHL3dPathFinder.java b/ihl/IHL3dPathFinder.java deleted file mode 100644 index 3f0605b..0000000 --- a/ihl/IHL3dPathFinder.java +++ /dev/null @@ -1,119 +0,0 @@ -package ihl;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import net.minecraft.block.Block;
-import net.minecraft.entity.Entity;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.MathHelper;
-
-public class IHL3dPathFinder {
- public double waypointX;
- public double waypointY;
- public double waypointZ;
-
- public int lowestPointX;
- public int lowestPointY;
- public int lowestPointZ;
-
- public double targetX;
- public double targetY;
- public double targetZ;
-
- private Entity entity;
-
- public IHL3dPathFinder(Entity entity1)
- {
- this.entity=entity1;
- }
-
- public boolean findPath(double x2, double y2, double z2)
- {
- if(this.isCourseTraversable(x2, y2, z2, this.entity.posX, this.entity.posY, this.entity.posZ))
- {
- this.waypointX=x2;
- this.waypointY=y2;
- this.waypointZ=z2;
- return true;
- }
- else
- {
- return this.takeVector(x2, y2, z2);
- }
- }
-
- private boolean isCourseTraversable(double toX, double toY, double toZ, double fromX, double fromY, double fromZ)
- {
- double var9 = toX - fromX;
- double var11 = toY - fromY;
- double var13 = toZ - fromZ;
- double var7 = MathHelper.sqrt_double(var9 * var9 + var11 * var11 + var13 * var13);
- var9 /= var7;
- var11 /= var7;
- var13 /= var7;
- AxisAlignedBB var15 = this.entity.boundingBox.copy();
- for (int var16 = 1; var16 < var7; ++var16)
- {
- var15.offset(var9, var11, var13);
- if (!this.entity.worldObj.getCollidingBoundingBoxes(this.entity, var15).isEmpty())
- {
- return false;
- }
- }
- return true;
- }
-
- private boolean takeVector(double toX, double toY, double toZ)
- {
- int x=Math.round((float)toX);
- int y=Math.round((float)toY);
- int z=Math.round((float)toZ);
- int xyz[] = {0,0,1,0,0,-1,0,0};
- Set<Long> list = new HashSet<Long>();
- for(int thread=0;thread<=256;thread++)
- {
- if(this.isCourseTraversable(x+0.5D, y+0.5D, z+0.5D, this.entity.posX, this.entity.posY, this.entity.posZ))
- {
- this.waypointX=x+0.5D;
- this.waypointY=y+0.5D;
- this.waypointZ=z+0.5D;
- return true;
- }
- Block block;
- long number = new Long(x*256L*256L+y*256L+z);
- list.add(number);
- double lastDistanceSquared = this.entity.getDistanceSq(x, y, z);
- boolean skip=false;
- for(int i=0;i<=5;i++)
- {
- block = entity.worldObj.getBlock(x+xyz[i], y+xyz[i+1], z+xyz[i+2]);
- number = new Long((x+xyz[i])*256L*256L+(y+xyz[i+1])*256L+z+xyz[i+2]);
- if(block.isAir(entity.worldObj, x+xyz[i], y+xyz[i+1], z+xyz[i+2]) && !list.contains(number) && this.entity.getDistanceSq((double)x+xyz[i], (double)y+xyz[i+1], (double)z+xyz[i+2])<lastDistanceSquared)
- {
- x+=xyz[i];
- y+=xyz[i+1];
- z+=xyz[i+2];
- skip=true;
- break;
- }
- }
- if(!skip)
- {
- for(int i=0;i<=5;i++)
- {
- block = entity.worldObj.getBlock(x+xyz[i], y+xyz[i+1], z+xyz[i+2]);
- number = new Long((x+xyz[i])*256L*256L+(y+xyz[i+1])*256L+z+xyz[i+2]);
- if(block.isAir(entity.worldObj, x+xyz[i], y+xyz[i+1], z+xyz[i+2]) && !list.contains(number))
- {
- x+=xyz[i];
- y+=xyz[i+1];
- z+=xyz[i+2];
- break;
- }
- }
- }
- }
- return false;
- }
-}
diff --git a/ihl/IHLMod.java b/ihl/IHLMod.java index c9470b5..6483856 100644 --- a/ihl/IHLMod.java +++ b/ihl/IHLMod.java @@ -69,12 +69,10 @@ import ihl.processing.chemistry.EvaporatorBlock; import ihl.processing.chemistry.EvaporatorTileEntity; import ihl.processing.chemistry.FluidizedBedReactorTileEntity; import ihl.processing.chemistry.FractionatorBottomTileEntity; -import ihl.processing.chemistry.GoldChimneyKneeTileEntity; import ihl.processing.chemistry.LabElectrolyzerTileEntity; import ihl.processing.chemistry.LeadOvenTileEntity; import ihl.processing.chemistry.LoomTileEntity; import ihl.processing.chemistry.PaperMachineTileEntity; -import ihl.processing.chemistry.PrecipitatorCondenserTileEntity; import ihl.processing.metallurgy.AchesonFurnanceTileEntity; import ihl.processing.metallurgy.Crucible; import ihl.processing.metallurgy.DetonationSprayingMachineTileEntity; @@ -140,7 +138,6 @@ import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = IHLModInfo.MODID, name = IHLModInfo.MODNAME, version = IHLModInfo.MODVERSION, dependencies = "required-after:IC2@[2.2.767-experimental,)") - public class IHLMod implements IFuelHandler { @SidedProxy(clientSide = "ihl.ClientProxy", serverSide = "ihl.ServerProxy") @@ -177,7 +174,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(); @@ -426,8 +423,9 @@ public class IHLMod implements IFuelHandler { GameRegistry.addShapelessRecipe(IHLUtils.getThisModItemStack("dustSolderingAlloy"), new Object[] { IHLUtils.getOreDictItemStack("dustTin"), IHLUtils.getThisModItemStack("dustTinyAntimony") }); Recipes.advRecipes.addRecipe(IHLUtils.getThisModItemStack("achesonFurnance"), - new Object[] { "BPB", " ", "B B", Character.valueOf('B'), new RecipeInputOreDict("ingotBrick"), - Character.valueOf('P'), new RecipeInputOreDict("plateSteel") }); + 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")}); 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'), @@ -515,7 +513,7 @@ public class IHLMod implements IFuelHandler { Recipes.FluidHeatGenerator.addFluid("oleicacid", 10, 16); Recipes.FluidHeatGenerator.addFluid("mineraloil", 10, 16); Recipes.FluidHeatGenerator.addFluid("acetylene", 10, 64); - Recipes.FluidHeatGenerator.addFluid("glyceryl", 10, 16); + Recipes.FluidHeatGenerator.addFluid("glycerol", 10, 16); Recipes.FluidHeatGenerator.addFluid("turpentine", 10, 16); Recipes.FluidHeatGenerator.addFluid("fueloil", 10, 32); Recipes.FluidHeatGenerator.addFluid("crackinggas", 10, 32); @@ -755,57 +753,14 @@ public class IHLMod implements IFuelHandler { IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("hammer"), IHLUtils.getThisModItemStack("handDrillBronze"), IHLUtils.getThisModItemStack("hackSawSteel"), IHLUtils.getThisModItemStack("drillSteelHardened"), - IHLUtils.getThisModItemStack("diceM10x1SteelHardened"), Ic2Items.bronzeAxe }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStackWithSize("barD10Steel", 4), - IHLUtils.getThisModItemStackWithSize("nutM10x1Steel", 8), new ItemStack(Items.leather), - 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"), IHLUtils.getThisModItemStack("handDrillBronze"), - IHLUtils.getThisModItemStack("hackSawSteel"), IHLUtils.getThisModItemStack("drillSteelHardened"), - IHLUtils.getThisModItemStack("diceM10x1SteelHardened"), new ItemStack(Items.iron_axe) }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStackWithSize("barD10Steel", 4), - IHLUtils.getThisModItemStackWithSize("nutM10x1Steel", 8), new ItemStack(Items.leather), - 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"), IHLUtils.getThisModItemStack("handDrillBronze"), - IHLUtils.getThisModItemStack("hackSawSteel"), IHLUtils.getThisModItemStack("drillSteelHardened"), - IHLUtils.getThisModItemStack("diceM10x1SteelHardened"), new ItemStack(Items.golden_axe) }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStackWithSize("barD10Steel", 4), - IHLUtils.getThisModItemStackWithSize("nutM10x1Steel", 8), new ItemStack(Items.leather), - 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"), IHLUtils.getThisModItemStack("handDrillBronze"), - IHLUtils.getThisModItemStack("hackSawSteel"), IHLUtils.getThisModItemStack("drillSteelHardened"), - IHLUtils.getThisModItemStack("diceM10x1SteelHardened"), new ItemStack(Items.diamond_axe) }), + IHLUtils.getThisModItemStack("diceM10x1SteelHardened") }), Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStackWithSize("barD10Steel", 4), IHLUtils.getThisModItemStackWithSize("nutM10x1Steel", 8), new ItemStack(Items.leather), 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"), Ic2Items.bronzeAxe.copy() }), - Arrays.asList(new ItemStack[] { - IHLUtils.getThisModItemStack("detonationSprayingMachineSetOfMoldedPartsBronze"), - new ItemStack(Blocks.planks), IHLUtils.getThisModItemStackWithSize("nailSteel", 8) }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("cannonBronze") }))); - IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe( - Arrays.asList( - new ItemStack[] { IHLUtils.getThisModItemStack("hammer"), new ItemStack(Items.iron_axe) }), - Arrays.asList(new ItemStack[] { - IHLUtils.getThisModItemStack("detonationSprayingMachineSetOfMoldedPartsBronze"), - new ItemStack(Blocks.planks), IHLUtils.getThisModItemStackWithSize("nailSteel", 8) }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("cannonBronze") }))); - IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(Arrays.asList( - new ItemStack[] { IHLUtils.getThisModItemStack("hammer"), new ItemStack(Items.golden_axe) }), - Arrays.asList(new ItemStack[] { - IHLUtils.getThisModItemStack("detonationSprayingMachineSetOfMoldedPartsBronze"), - new ItemStack(Blocks.planks), IHLUtils.getThisModItemStackWithSize("nailSteel", 8) }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("cannonBronze") }))); - IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(Arrays.asList( - new ItemStack[] { IHLUtils.getThisModItemStack("hammer"), new ItemStack(Items.diamond_axe) }), + new ItemStack[] { IHLUtils.getThisModItemStack("hammer")}), Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("detonationSprayingMachineSetOfMoldedPartsBronze"), new ItemStack(Blocks.planks), IHLUtils.getThisModItemStackWithSize("nailSteel", 8) }), @@ -884,34 +839,7 @@ public class IHLMod implements IFuelHandler { IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("hammer"), IHLUtils.getThisModItemStack("handDrillBronze"), IHLUtils.getThisModItemStack("hackSawSteel"), IHLUtils.getThisModItemStack("drillSteelHardened"), - IHLUtils.getThisModItemStack("diceM10x1SteelHardened"), Ic2Items.bronzeAxe }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStackWithSize("barD10SteelHot", 7), - IHLUtils.getOreDictItemStack("plateSteel"), new ItemStack(Items.leather), - IHLUtils.getThisModItemStackWithSize("nailSteel", 8), new ItemStack(Blocks.log) }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("woodenRollingMachinePart1"), - IHLUtils.getThisModItemStack("woodenRollingMachinePart2") }))); - IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(Arrays.asList(new ItemStack[] { - IHLUtils.getThisModItemStack("hammer"), IHLUtils.getThisModItemStack("handDrillBronze"), - IHLUtils.getThisModItemStack("hackSawSteel"), IHLUtils.getThisModItemStack("drillSteelHardened"), - IHLUtils.getThisModItemStack("diceM10x1SteelHardened"), new ItemStack(Items.iron_axe) }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStackWithSize("barD10SteelHot", 7), - IHLUtils.getOreDictItemStack("plateSteel"), new ItemStack(Items.leather), - IHLUtils.getThisModItemStackWithSize("nailSteel", 8), new ItemStack(Blocks.log) }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("woodenRollingMachinePart1"), - IHLUtils.getThisModItemStack("woodenRollingMachinePart2") }))); - IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(Arrays.asList(new ItemStack[] { - IHLUtils.getThisModItemStack("hammer"), IHLUtils.getThisModItemStack("handDrillBronze"), - IHLUtils.getThisModItemStack("hackSawSteel"), IHLUtils.getThisModItemStack("drillSteelHardened"), - IHLUtils.getThisModItemStack("diceM10x1SteelHardened"), new ItemStack(Items.golden_axe) }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStackWithSize("barD10SteelHot", 7), - IHLUtils.getOreDictItemStack("plateSteel"), new ItemStack(Items.leather), - IHLUtils.getThisModItemStackWithSize("nailSteel", 8), new ItemStack(Blocks.log) }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("woodenRollingMachinePart1"), - IHLUtils.getThisModItemStack("woodenRollingMachinePart2") }))); - IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(Arrays.asList(new ItemStack[] { - IHLUtils.getThisModItemStack("hammer"), IHLUtils.getThisModItemStack("handDrillBronze"), - IHLUtils.getThisModItemStack("hackSawSteel"), IHLUtils.getThisModItemStack("drillSteelHardened"), - IHLUtils.getThisModItemStack("diceM10x1SteelHardened"), new ItemStack(Items.diamond_axe) }), + 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) }), @@ -972,15 +900,6 @@ public class IHLMod implements IFuelHandler { IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(null, Arrays.asList(new IRecipeInput[] { new RecipeInputFluidContainer(FluidRegistry.WATER, 1), new RecipeInputOreDict("dustPorcelain") }), - Arrays.asList( - new ItemStack[] { IHLUtils.getThisModItemStack("precipitatorCondenserRawPorcelain") }))); - IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(null, - Arrays.asList(new IRecipeInput[] { new RecipeInputFluidContainer(FluidRegistry.WATER, 1), - new RecipeInputOreDict("dustPorcelain") }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("chimneyKneeRawPorcelain") }))); - IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(null, - Arrays.asList(new IRecipeInput[] { new RecipeInputFluidContainer(FluidRegistry.WATER, 1), - new RecipeInputOreDict("dustPorcelain") }), Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("gaedesPumpBarrelRawPorcelain") }))); IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(null, Arrays.asList(new IRecipeInput[] { new RecipeInputFluidContainer(FluidRegistry.WATER, 1), @@ -1400,7 +1319,7 @@ public class IHLMod implements IFuelHandler { new RecipeInputOreDict("dustPentaerythritolTetranitrate", 4), new RecipeInputOreDict("ingotTarPitch", 1), new RecipeInputDetonator(detonator) }), Arrays.asList( - new ItemStack[] { IHLUtils.getItemStackWithTag("ihlExplosive", "explosionPower", 1500) }), + new ItemStack[] { IHLUtils.getItemStackWithTag("ihlExplosive", "explosionPower", 15*config.explosionPowerBase) }), null)); IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(null, Arrays.asList( @@ -1409,7 +1328,15 @@ public class IHLMod implements IFuelHandler { new RecipeInputFluidContainer(FluidRegistry.getFluid("nitroglycerin"), 1), new RecipeInputOreDict("ingotTarPitch", 1), new RecipeInputDetonator(detonator) }), Arrays.asList( - new ItemStack[] { IHLUtils.getItemStackWithTag("ihlExplosive", "explosionPower", 1000) }), + 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) }), null)); AchesonFurnanceTileEntity.addRecipe(new RecipeInputOreDict("dustSiliconDioxide", 2), @@ -1424,36 +1351,21 @@ public class IHLMod implements IFuelHandler { new RecipeInputOreDict("dustCoal", 8), "dustBoronCarbide"); AchesonFurnanceTileEntity.addRecipe(new RecipeInputOreDict("plateCoal"), new RecipeInputOreDict("dustCoal", 1), "plateGraphite"); - GoldChimneyKneeTileEntity.addRecipe( - new UniversalRecipeInput((new FluidStack[] { IHLUtils.getFluidStackWithSize("ic2steam", 1), - IHLUtils.getFluidStackWithSize("sulfuricanhydride", 1) }), null), - IHLUtils.getFluidStackWithSize("vapour.sulfuricacid", 1)); - if (FluidRegistry.isFluidRegistered("steam")) - GoldChimneyKneeTileEntity.addRecipe( - new UniversalRecipeInput((new FluidStack[] { IHLUtils.getFluidStackWithSize("steam", 1), - IHLUtils.getFluidStackWithSize("sulfuricanhydride", 1) }), null), - IHLUtils.getFluidStackWithSize("vapour.sulfuricacid", 1)); - GoldChimneyKneeTileEntity.addRecipe( - new UniversalRecipeInput( - (new FluidStack[] { IHLUtils.getFluidStackWithSize("ic2superheatedsteam", 15), - IHLUtils.getFluidStackWithSize("sulfuricanhydride", 4) }), - null), - IHLUtils.getFluidStackWithSize("vapour.sulfuricacid", 4)); LeadOvenTileEntity.addRecipe( - new UniversalRecipeInput(null, - (new ItemStack[] { IHLUtils.getOreDictItemStack("dustSulfur"), - IHLUtils.getOreDictItemStack("dustSaltpeter") })), - IHLUtils.getFluidStackWithSize("sulfuricanhydride", 23000)); + new UniversalRecipeInput(new FluidStack[] {IHLUtils.getFluidStackWithSize("water", 400)}, + new IRecipeInput[] { new RecipeInputOreDict("dustSulfur"), + new RecipeInputOreDict("dustSaltpeter") }), + IHLUtils.getFluidStackWithSize("sulfuricacid", 100)); LeadOvenTileEntity.addRecipe( - new UniversalRecipeInput(null, - (new ItemStack[] { IHLUtils.getOreDictItemStack("crushedPurifiedCinnabar") })), - IHLUtils.getFluidStackWithSize("vapour.mercury", 3600)); - LeadOvenTileEntity.addRecipe(IHLUtils.getThisModItemStack("dustStibnite"), + new UniversalRecipeInput(new FluidStack[] {IHLUtils.getFluidStackWithSize("water", 100)}, + new IRecipeInput[] { new RecipeInputOreDict("crushedPurifiedCinnabar") }), + IHLUtils.getFluidStackWithSize("mercury", 36)); + LeadOvenTileEntity.addRecipe(new RecipeInputOreDict("dustStibnite",1), IHLUtils.getThisModItemStack("dustAntimonyOxide")); - LeadOvenTileEntity.addRecipe(IHLUtils.getOreDictItemStackWithSize("dustSodiumHydrogenSulfate", 2), - IHLUtils.getFluidStackWithSize("vapour.sulfuricacid", 20000), + LeadOvenTileEntity.addRecipe(new RecipeInputOreDict("dustSodiumHydrogenSulfate", 2), + IHLUtils.getFluidStackWithSize("sulfuricacid", 20), IHLUtils.getOreDictItemStack("dustSodiumSulfate")); - LeadOvenTileEntity.addRecipe(IHLUtils.getThisModItemStackWithSize("dustSodiumZeoliteCoked", 2), + LeadOvenTileEntity.addRecipe(new RecipeInputOreDict("dustSodiumZeoliteCoked", 2), IHLUtils.getThisModItemStack("dustSodiumZeolite")); ImpregnatingMachineTileEntity.addChemicalRecipe( new UniversalRecipeInput((new FluidStack[] { new FluidStack(FluidRegistry.WATER, 1500) }), @@ -1465,7 +1377,7 @@ public class IHLMod implements IFuelHandler { (new FluidStack[] { new FluidStack(FluidRegistry.WATER, 130), IHLUtils.getFluidStackWithSize("limemilk", 142) }), (new ItemStack[] { IHLUtils.getThisModItemStackWithSize("muttonLard", 6) })), - new UniversalRecipeOutput((new FluidStack[] { IHLUtils.getFluidStackWithSize("glyceryl", 130) }), + new UniversalRecipeOutput((new FluidStack[] { IHLUtils.getFluidStackWithSize("glycerol", 130) }), (new ItemStack[] { IHLUtils.getThisModItemStackWithSize("ingotCalciumSoap", 5) }), 200)); ImpregnatingMachineTileEntity.addChemicalRecipe( new UniversalRecipeInput( @@ -1492,47 +1404,41 @@ public class IHLMod implements IFuelHandler { ItemStack drill = Ic2Items.miningDrill.copy(); drill.setItemDamage(OreDictionary.WILDCARD_VALUE); DetonationSprayingMachineTileEntity.addRecipe(drill, Ic2Items.diamondDrill.copy()); - MuffleFurnanceTileEntity.addRecipe(Ic2Items.plateadviron.copy(), + MuffleFurnanceTileEntity.addRecipe(new RecipeInputOreDict("plateSteel",1), IHLUtils.getThisModItemStack("plateHotSteel")); - MuffleFurnanceTileEntity.addRecipe(Ic2Items.advIronIngot.copy(), + MuffleFurnanceTileEntity.addRecipe(new RecipeInputOreDict("ingotSteel",1), IHLUtils.getOreDictItemStack("ingotHotSteel")); - MuffleFurnanceTileEntity.addRecipe(IHLUtils.getOreDictItemStack("plateTungsten"), + MuffleFurnanceTileEntity.addRecipe(new RecipeInputOreDict("plateTungsten",1), IHLUtils.getThisModItemStack("plateHotTungsten")); - MuffleFurnanceTileEntity.addRecipe(IHLUtils.getThisModItemStack("gaedesPumpBarrelRawPorcelain"), + MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("gaedesPumpBarrelRawPorcelain"),1), IHLUtils.getThisModItemStack("gaedesPumpBarrelPorcelain")); - MuffleFurnanceTileEntity.addRecipe(new ItemStack(IHLMod.crucible, 1, OreDictionary.WILDCARD_VALUE), + MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(new ItemStack(IHLMod.crucible, 1, OreDictionary.WILDCARD_VALUE),1), new ItemStack(IHLMod.crucible, 1, 1)); - MuffleFurnanceTileEntity.addRecipe(IHLUtils.getThisModItemStackWithSize("injectionMold", 1), + MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStackWithSize("injectionMold", 1),1), IHLUtils.getThisModItemStackWithSize("injectionMold", 1)); - MuffleFurnanceTileEntity.addRecipe(IHLUtils.getThisModItemStack("sawBladeSteel"), + MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("sawBladeSteel"),1), IHLUtils.getThisModItemStack("sawBladeSteelHot")); - MuffleFurnanceTileEntity.addRecipe(IHLUtils.getThisModItemStack("barD10Steel"), + MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("barD10Steel"),1), IHLUtils.getThisModItemStack("barD10SteelHot")); - MuffleFurnanceTileEntity.addRecipe(IHLUtils.getThisModItemStack("linerIronGraphite"), + MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("linerIronGraphite"),1), IHLUtils.getThisModItemStack("linerIronGraphiteHot")); MuffleFurnanceTileEntity.addRecipe( new UniversalRecipeInput(null, - (new ItemStack[] { IHLUtils.getOreDictItemStack("dustIronOxide"), - IHLUtils.getOreDictItemStack("dustLithiumOxide") })), + new IRecipeInput[] { new RecipeInputOreDict("dustIronOxide",1), + new RecipeInputOreDict("dustLithiumOxide",1) }), new UniversalRecipeOutput(null, - (new ItemStack[] { IHLUtils.getOreDictItemStackWithSize("dustFerrite", 2) }), 200)); + new RecipeOutputItemStack[] { new RecipeOutputItemStack(IHLUtils.getOreDictItemStackWithSize("dustFerrite", 2)) }, 200)); MuffleFurnanceTileEntity.addRecipe( new UniversalRecipeInput(null, - (new ItemStack[] { IHLUtils.getOreDictItemStackWithSize("dustSiliconDioxide", 3), - IHLUtils.getOreDictItemStackWithSize("dustMagnesium", 2) })), - new UniversalRecipeOutput(null, (new ItemStack[] { IHLUtils.getOreDictItemStack("dustSilicon"), - IHLUtils.getOreDictItemStackWithSize("dustMagnesiumOxide", 4) }), 200)); - MuffleFurnanceTileEntity.addRecipe( - new UniversalRecipeInput(null, - (new ItemStack[] { IHLUtils.getOreDictItemStack("dustBauxite"), - IHLUtils.getOreDictItemStack("dustSodiumHydroxide") })), + new IRecipeInput[] { new RecipeInputOreDict("dustBauxite"), + new RecipeInputOreDict("dustSodiumHydroxide") }), new UniversalRecipeOutput(null, - (new ItemStack[] { IHLUtils.getOreDictItemStack("dustSodiumAluminate") }), 200)); - MuffleFurnanceTileEntity.addRecipe(IHLUtils.getThisModItemStack("drillSteel"), + new RecipeOutputItemStack[] { new RecipeOutputItemStack(IHLUtils.getOreDictItemStack("dustSodiumAluminate")) }, 200)); + MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("drillSteel")), IHLUtils.getThisModItemStack("drillSteelHot")); - MuffleFurnanceTileEntity.addRecipe(IHLUtils.getThisModItemStack("tapM10x1Steel"), + MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("tapM10x1Steel")), IHLUtils.getThisModItemStack("tapM10x1SteelHot")); - MuffleFurnanceTileEntity.addRecipe(IHLUtils.getThisModItemStack("diceM10x1Steel"), + MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("diceM10x1Steel")), IHLUtils.getThisModItemStack("diceM10x1SteelHot")); LoomTileEntity.addRecipe(IHLUtils.getThisModWireItemStackWithLength("fiberGlass", 1024), IHLUtils.getThisModItemStack("meshGlass")); @@ -1566,7 +1472,7 @@ public class IHLMod implements IFuelHandler { (new ItemStack[] { IHLUtils.getThisModItemStack("linerIronGraphiteHot") })), new UniversalRecipeOutput(null, (new ItemStack[] { IHLUtils.getThisModItemStack("linerIronGraphiteGreased") }), 2)); - MuffleFurnanceTileEntity.addRecipe(IHLUtils.getThisModItemStack("foilRubberWithSulfur"), + MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("foilRubberWithSulfur")), IHLUtils.getThisModItemStack("foilRubber")); MuffleFurnanceTileEntity .addRecipe( @@ -1590,12 +1496,9 @@ public class IHLMod implements IFuelHandler { new UniversalRecipeOutput( (new FluidStack[] { IHLUtils.getFluidStackWithSize("liquidglass", 500) }), null, 200)); - PrecipitatorCondenserTileEntity.addRecipe("vapour.sulfuricacid", "sulfuricacid", 50); - PrecipitatorCondenserTileEntity.addRecipe("vapour.mercury", "mercury", 50); - PrecipitatorCondenserTileEntity.addRecipe("ic2steam", "ic2distilledwater", 100); ChemicalReactorTileEntity.addRecipe( new UniversalRecipeInput((new FluidStack[] { IHLUtils.getFluidStackWithSize("spruceresin", 1000), - IHLUtils.getFluidStackWithSize("glyceryl", 50) }), null), + IHLUtils.getFluidStackWithSize("glycerol", 50) }), null), new UniversalRecipeOutput( (new FluidStack[] { IHLUtils.getFluidStackWithSize("cablingcolophony", 600) }), null, 200, true)); @@ -1731,23 +1634,19 @@ public class IHLMod implements IFuelHandler { (new RecipeOutputItemStack[] { new RecipeOutputItemStack( IHLUtils.getOreDictItemStack("dustTungsticAcid"), 1.0f) }), 200)); - MuffleFurnanceTileEntity.addRecipe(IHLUtils.getOreDictItemStackWithSize("dustTungsticAcid", 2), + MuffleFurnanceTileEntity.addRecipe(new RecipeInputOreDict("dustTungsticAcid", 2), IHLUtils.getOreDictItemStack("dustTungstenOxide"), 1.14f); - MuffleFurnanceTileEntity.addRecipe(IHLUtils.getThisModItemStack("electrolysisBathRawPorcelain"), + MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("electrolysisBathRawPorcelain")), IHLUtils.getThisModItemStack("electrolysisBathPorcelain")); - MuffleFurnanceTileEntity.addRecipe(IHLUtils.getThisModItemStack("ovenRawPorcelain"), + MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("ovenRawPorcelain")), IHLUtils.getThisModItemStack("leadOven")); - MuffleFurnanceTileEntity.addRecipe(IHLUtils.getThisModItemStack("precipitatorCondenserRawPorcelain"), - IHLUtils.getThisModItemStack("goldPrecipitatorCondenser")); - MuffleFurnanceTileEntity.addRecipe(IHLUtils.getThisModItemStack("chimneyKneeRawPorcelain"), - IHLUtils.getThisModItemStack("goldChimneyKnee")); - MuffleFurnanceTileEntity.addRecipe(IHLUtils.getThisModItemStack("ringRawPorcelain"), + MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("ringRawPorcelain")), IHLUtils.getThisModItemStack("ringPorcelain")); - MuffleFurnanceTileEntity.addRecipe(IHLUtils.getThisModItemStack("ringRawFerrite"), + MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("ringRawFerrite")), IHLUtils.getThisModItemStack("ringFerrite")); - MuffleFurnanceTileEntity.addRecipe(IHLUtils.getThisModItemStack("insulatorRawPorcelain"), + MuffleFurnanceTileEntity.addRecipe(new RecipeInputItemStack(IHLUtils.getThisModItemStack("insulatorRawPorcelain")), IHLUtils.getThisModItemStack("insulatorPorcelain")); - MuffleFurnanceTileEntity.addRecipe(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), @@ -1921,7 +1820,7 @@ public class IHLMod implements IFuelHandler { } ChemicalReactorTileEntity.addRecipe( new UniversalRecipeInput( - new FluidStack[] { IHLUtils.getFluidStackWithSize("glyceryl", 100), + new FluidStack[] { IHLUtils.getFluidStackWithSize("glycerol", 100), IHLUtils.getFluidStackWithSize("nitricacid", 300)}, null), new UniversalRecipeOutput( @@ -2381,10 +2280,15 @@ public class IHLMod implements IFuelHandler { Recipes.advRecipes.addRecipe(new ItemStack(electricEvaporatorBlock, 1), new Object[] { "CCC", "CCC", " F ", Character.valueOf('C'), IC2Items.getItem("platecopper"), 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)}); } if (IHLMod.config.enableFlexibleCablesCrafting) { ItemStack cutter = Ic2Items.cutter.copy(); cutter.setItemDamage(OreDictionary.WILDCARD_VALUE); + ItemStack forgeHammer = Ic2Items.ForgeHammer.copy(); + forgeHammer.setItemDamage(OreDictionary.WILDCARD_VALUE); Recipes.advRecipes.addRecipe(IHLUtils.getThisModItemStack("setOfDies1_5sqmm"), new Object[] { " ", " PC", " ", Character.valueOf('P'), Ic2Items.plateadviron, Character.valueOf('C'), cutter }); Recipes.advRecipes.addRecipe(IHLUtils.getItemStackWithTag("setOfDies1_5sqmm", "transverseSection", 240), @@ -2392,7 +2296,7 @@ public class IHLMod implements IFuelHandler { Character.valueOf('C'), cutter }); Recipes.advRecipes.addRecipe(IHLUtils.getThisModItemStack("ironWorkbench"), new Object[] { "P ", "P ", "P H", Character.valueOf('P'), Ic2Items.plateadviron, - Character.valueOf('H'), Ic2Items.ForgeHammer }); + Character.valueOf('H'), forgeHammer}); } ExtruderTileEntity.addRecipe(IHLUtils.getOreDictItemStackWithSize("itemRubber", 5), IHLUtils.getOreDictItemStackWithSize("dustTinySulfur", 1), diff --git a/ihl/IHLModConfig.java b/ihl/IHLModConfig.java index 99739c9..ef219bc 100644 --- a/ihl/IHLModConfig.java +++ b/ihl/IHLModConfig.java @@ -38,6 +38,7 @@ import net.minecraft.nbt.NBTTagCompound; public class IHLModConfig
{
public int explosionVectorSizeBits=7;
+ public int explosionPowerBase=100;
public int handpumpTier=1;
public int handpumpMaxCharge=30000;
@@ -58,7 +59,6 @@ public class IHLModConfig public boolean enableFlexibleCablesCrafting=true;
public boolean enableFlexibleCablesGridPowerLossCalculations=true;
- public double additionalPowerLossesAtFrequencyGenerator = 0.01D;
public boolean generateApatiteOre=true;
public boolean generateSaltpeterOre=true;
public boolean generateLimestone=true;
@@ -75,10 +75,12 @@ public class IHLModConfig public boolean generateDatolite=true;
public boolean generateSaltwater=true;
public boolean generateBischofite=true;
+ public int chanceOreWillNotBeGenerated = 100;
public int mirrorReflectionRange=14;
public int mirrorReflectionUpdateSpeed=128;
public String preventMachineBlockRegistrationName="null";
public boolean skipRecipeLoad=false;
+ public int machineryEnergyConsume=100;
public IHLModConfig(FMLPreInitializationEvent evt) throws IOException
{
@@ -120,13 +122,15 @@ public class IHLModConfig tditEnergyConsumePerStack = config.get(Configuration.CATEGORY_GENERAL, "tditEnergyConsumePerStack", tditEnergyConsumePerStack).getInt();
enableFlexibleCablesGridPowerLossCalculations = config.get(Configuration.CATEGORY_GENERAL, "enableFlexibleCablesGridPowerLossCalculations", enableFlexibleCablesGridPowerLossCalculations).getBoolean(enableFlexibleCablesGridPowerLossCalculations);
- additionalPowerLossesAtFrequencyGenerator = config.get(Configuration.CATEGORY_GENERAL, "additionalPowerLossesAtFrequencyGenerator", additionalPowerLossesAtFrequencyGenerator).getDouble(additionalPowerLossesAtFrequencyGenerator);
enableFlexibleCablesCrafting = config.get(Configuration.CATEGORY_GENERAL, "enableFlexibleCablesCrafting", enableFlexibleCablesCrafting).getBoolean(enableFlexibleCablesCrafting);
mirrorReflectionRange = config.get(Configuration.CATEGORY_GENERAL, "mirrorReflectionRange", mirrorReflectionRange).getInt();
mirrorReflectionUpdateSpeed = config.get(Configuration.CATEGORY_GENERAL, "mirrorReflectionUpdateSpeed", mirrorReflectionUpdateSpeed).getInt();
explosionVectorSizeBits = config.get(Configuration.CATEGORY_GENERAL, "explosionVectorSizeBits", explosionVectorSizeBits).getInt();
+ explosionPowerBase = config.get(Configuration.CATEGORY_GENERAL, "explosionPowerBase", explosionPowerBase).getInt();
+ chanceOreWillNotBeGenerated = config.get(Configuration.CATEGORY_GENERAL, "chanceOreWillNotBeGenerated", chanceOreWillNotBeGenerated).getInt();
+ machineryEnergyConsume = config.get(Configuration.CATEGORY_GENERAL, "machineryEnergyConsume", machineryEnergyConsume).getInt();
config.save();
}
diff --git a/ihl/IHLModInfo.java b/ihl/IHLModInfo.java index 58bd594..42fcd88 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.619";
+ public static final String MODVERSION = "0.624";
}
diff --git a/ihl/ServerProxy.java b/ihl/ServerProxy.java index 3af8fbd..24fa937 100644 --- a/ihl/ServerProxy.java +++ b/ihl/ServerProxy.java @@ -275,26 +275,4 @@ public class ServerProxy { public void requestTileEntityInitdataFromClientToServer(int x, int y, int z){}
- public void sendChunksLightUpdateQuery(World world, int x, int y, int z, Set<Long> clientSideChunkXZKeySet)
- {
- int chunkNum = clientSideChunkXZKeySet.size();
- ByteBuf bb = Unpooled.buffer(8+(chunkNum<<3));
- ByteBufOutputStream byteBufOutputStream = new ByteBufOutputStream(bb);
- try
- {
- byteBufOutputStream.write(4);
- byteBufOutputStream.write(chunkNum);
- Iterator<Long> cluI = clientSideChunkXZKeySet.iterator();
- while(cluI.hasNext())
- {
- byteBufOutputStream.writeLong(cluI.next());
- }
- channel.sendToAllAround(new FMLProxyPacket(byteBufOutputStream.buffer(),IHLModInfo.MODID), new TargetPoint(world.provider.dimensionId, x, y, z, 256d));
- byteBufOutputStream.close();
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- }
}
diff --git a/ihl/enviroment/LightBulbBlock.java b/ihl/enviroment/LightBulbBlock.java index d78b667..77ee8f8 100644 --- a/ihl/enviroment/LightBulbBlock.java +++ b/ihl/enviroment/LightBulbBlock.java @@ -13,30 +13,26 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-public class LightBulbBlock extends Block implements ITileEntityProvider
-{
+public class LightBulbBlock extends Block implements ITileEntityProvider {
public static GlowningAirBlock glowningAir;
-
- public LightBulbBlock(String unlocalizedName1)
- {
- super(Material.glass);
- this.setStepSound(soundTypeGlass);
+
+ public LightBulbBlock(String unlocalizedName1) {
+ super(Material.glass);
+ this.setStepSound(soundTypeGlass);
this.setBlockName(unlocalizedName1);
- GameRegistry.registerBlock(this,IHLItemBlock.class, unlocalizedName1);
- this.setHardness(0.3F);
- this.setResistance(0.5F);
- this.setCreativeTab(IHLCreativeTab.tab);
- this.setBlockTextureName("glass");
- }
-
+ GameRegistry.registerBlock(this, IHLItemBlock.class, unlocalizedName1);
+ this.setHardness(0.3F);
+ this.setResistance(0.5F);
+ this.setCreativeTab(IHLCreativeTab.tab);
+ this.setBlockTextureName("glass");
+ }
+
@Override
- public boolean hasTileEntity(int metadata)
- {
- return true;
+ public boolean hasTileEntity(int metadata) {
+ return true;
}
-
- public static void init()
- {
+
+ public static void init() {
glowningAir = new GlowningAirBlock();
new LightBulbBlock("lightBulb");
new SpotlightBlock("spotlight");
@@ -46,88 +42,77 @@ public class LightBulbBlock extends Block implements ITileEntityProvider SpotlightTileEntity.createLightSphereVectors();
}
- /**
- * Returns the quantity of items to drop on block destruction.
- */
- @Override
- public int quantityDropped(Random random)
- {
- return 0;
- }
-
- @Override
- public boolean renderAsNormalBlock()
- {
- return false;
- }
-
- /**
- * The type of render function that is called for this block
- */
- @Override
- public int getRenderType()
- {
- return -2;
- }
-
- @Override
- public void setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z)
- {
- TileEntity te = iBlockAccess.getTileEntity(x, y, z);
- if(te!=null && te instanceof LightBulbTileEntity)
- {
- LightBulbTileEntity ate = (LightBulbTileEntity) te;
- setBlockBoundsBasedOnFacing(ate.getFacing());
- }
- }
-
- private void setBlockBoundsBasedOnFacing(int facing)
- {
- int var2 = facing & 7;
- float var6 = 0.1875F;
- float var7 = 0.5F;
-
- if (var2 == 0)
- {
- this.setBlockBounds(0.5F - var6, 1.0F - var7, 0.5F - var6, 0.5F + var6, 1.0F, 0.5F + var6);
- }
- else if (var2 == 1)
- {
- this.setBlockBounds(0.5F - var6, 0.0F, 0.5F - var6, 0.5F + var6, var7, 0.5F + var6);
- }
- else if (var2 == 2)
- {
- this.setBlockBounds(0.5F - var6, 0.5F - var6, 1.0F - var7, 0.5F + var6, 0.5F + var6, 1.0F);
- }
- else if (var2 == 3)
- {
- this.setBlockBounds(0.5F - var6, 0.5F - var6, 0.0F, 0.5F + var6, 0.5F + var6, var7);
- }
- else if (var2 == 4)
- {
- this.setBlockBounds(1.0F - var7, 0.5F - var6, 0.5F - var6, 1.0F, 0.5F + var6, 0.5F + var6);
- }
- else if (var2 == 5)
- {
- this.setBlockBounds(0.0F, 0.5F - var6, 0.5F - var6, var7, 0.5F + var6, 0.5F + var6);
- }
- }
-
- @Override
- public boolean isOpaqueCube()
- {
- return false;
- }
-
- @Override
- public boolean isNormalCube()
- {
- return false;
- }
+ /**
+ * Returns the quantity of items to drop on block destruction.
+ */
+ @Override
+ public int quantityDropped(Random random) {
+ return 0;
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ /**
+ * The type of render function that is called for this block
+ */
+ @Override
+ public int getRenderType() {
+ return -2;
+ }
+
+ @Override
+ public void setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z) {
+ TileEntity te = iBlockAccess.getTileEntity(x, y, z);
+ if (te != null && te instanceof LightBulbTileEntity) {
+ LightBulbTileEntity ate = (LightBulbTileEntity) te;
+ setBlockBoundsBasedOnFacing(ate.getFacing());
+ }
+ }
+
+ private void setBlockBoundsBasedOnFacing(int facing) {
+ int var2 = facing & 7;
+ float var6 = 0.1875F;
+ float var7 = 0.5F;
+
+ if (var2 == 0) {
+ this.setBlockBounds(0.5F - var6, 1.0F - var7, 0.5F - var6, 0.5F + var6, 1.0F, 0.5F + var6);
+ } else if (var2 == 1) {
+ this.setBlockBounds(0.5F - var6, 0.0F, 0.5F - var6, 0.5F + var6, var7, 0.5F + var6);
+ } else if (var2 == 2) {
+ this.setBlockBounds(0.5F - var6, 0.5F - var6, 1.0F - var7, 0.5F + var6, 0.5F + var6, 1.0F);
+ } else if (var2 == 3) {
+ this.setBlockBounds(0.5F - var6, 0.5F - var6, 0.0F, 0.5F + var6, 0.5F + var6, var7);
+ } else if (var2 == 4) {
+ this.setBlockBounds(1.0F - var7, 0.5F - var6, 0.5F - var6, 1.0F, 0.5F + var6, 0.5F + var6);
+ } else if (var2 == 5) {
+ this.setBlockBounds(0.0F, 0.5F - var6, 0.5F - var6, var7, 0.5F + var6, 0.5F + var6);
+ }
+ }
@Override
- public TileEntity createNewTileEntity(World arg0, int arg1)
- {
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public boolean isNormalCube() {
+ return false;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World arg0, int arg1) {
return new LightBulbTileEntity();
}
+
+ 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;
+ }
+ return 0;
+ }
}
diff --git a/ihl/enviroment/LightBulbTileEntity.java b/ihl/enviroment/LightBulbTileEntity.java index c82bc57..283a72f 100644 --- a/ihl/enviroment/LightBulbTileEntity.java +++ b/ihl/enviroment/LightBulbTileEntity.java @@ -3,7 +3,6 @@ package ihl.enviroment; import java.util.List;
import java.util.Vector;
-import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -20,229 +19,176 @@ import ic2.core.IC2; import ic2.core.ITickCallback;
import ihl.utils.IHLUtils;
-public class LightBulbTileEntity extends TileEntity implements IEnergySink, IWrenchable, INetworkDataProvider
-{
- private boolean active = false;
- private short facing = 0;
- public boolean prevActive = false;
- public short prevFacing = 0;
- private double maxEnergy=1.1d;
+public class LightBulbTileEntity extends TileEntity implements IEnergySink, IWrenchable, INetworkDataProvider {
+ private boolean active = false;
+ private short facing = 0;
+ public boolean prevActive = false;
+ public short prevFacing = 0;
private double energy;
- public boolean addedToEnergyNet = false;
+ public boolean addedToEnergyNet = false;
private boolean loaded = false;
private int ticker;
- @Override
- public void readFromNBT(NBTTagCompound nbttagcompound)
- {
- super.readFromNBT(nbttagcompound);
- this.energy = nbttagcompound.getDouble("energy");
- this.facing = nbttagcompound.getShort("facing");
- }
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound) {
+ super.readFromNBT(nbttagcompound);
+ this.energy = nbttagcompound.getDouble("energy");
+ this.facing = nbttagcompound.getShort("facing");
+ }
- @Override
- public void writeToNBT(NBTTagCompound nbttagcompound)
- {
- super.writeToNBT(nbttagcompound);
- nbttagcompound.setDouble("energy", this.energy);
- nbttagcompound.setShort("facing", this.facing);
- }
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound) {
+ 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")
+ /**
+ * 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();
+ 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);
+ }
+ }
+ }
+ });
+ }
- if (LightBulbTileEntity.this.enableUpdateEntity())
- {
- world.loadedTileEntityList.add(LightBulbTileEntity.this);
- }
- }
- }
- });
- }
+ /**
+ * invalidates a tile entity
+ */
+ @Override
+ public void invalidate() {
+ super.invalidate();
+ if (this.loaded) {
+ this.onUnloaded();
+ }
+ }
- /**
- * invalidates a tile entity
- */
- @Override
- public void invalidate()
- {
- super.invalidate();
- if (this.loaded)
- {
- this.onUnloaded();
- }
- }
+ @Override
+ public void onChunkUnload() {
+ super.onChunkUnload();
+ if (this.loaded) {
+ this.onUnloaded();
+ }
+ }
- @Override
- public void onChunkUnload()
- {
- super.onChunkUnload();
- if (this.loaded)
- {
- this.onUnloaded();
- }
- }
+ public void onLoaded() {
+ if (IC2.platform.isSimulating() && !this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
+ this.addedToEnergyNet = true;
+ }
+ this.loaded = true;
+ }
- public void onLoaded()
- {
- if (IC2.platform.isSimulating() && !this.addedToEnergyNet)
- {
- MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
- this.addedToEnergyNet = true;
- }
- this.loaded = true;
- }
+ public void onUnloaded() {
+ if (IC2.platform.isSimulating()) {
+ if (this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
+ this.addedToEnergyNet = false;
+ }
+ this.active = false;
+ this.updateLightState(true);
+ }
+ }
- public void onUnloaded()
- {
- if (IC2.platform.isSimulating())
- {
- if(this.addedToEnergyNet)
- {
- MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
- this.addedToEnergyNet = false;
- }
- this.active=false;
- this.updateLightState();
- }
- }
+ @Override
+ public final boolean canUpdate() {
+ return false;
+ }
- @Override
- public final boolean canUpdate()
- {
- return false;
- }
-
- @Override
- public void updateEntity()
- {
- if(++this.ticker % 4 == 0)
- {
- if(this.prevFacing != facing)
- {
+ @Override
+ public void updateEntity() {
+ if (++this.ticker % 4 == 0) {
+ if (this.prevFacing != facing) {
this.setFacing(facing);
}
- if(this.energy>0)
- {
+ if (this.energy > 0) {
this.energy--;
- this.setActive(this.energy>0);
- }
- else
- {
+ this.setActive(true);
+ } else {
this.setActive(false);
}
}
- }
-
- protected void updateLightState()
- {
- int x,y,z;
- int xyz[] = {0,0,1,0,0,-1,0,0};
- Block block;
- for(int i=0;i<=5;i++)
- {
- x=xCoord+xyz[i];
- y=yCoord+xyz[i+1];
- z=zCoord+xyz[i+2];
- block = this.worldObj.getBlock(x,y,z);
- if(block.isAir(this.worldObj, x,y,z))
- {
- if(this.getActive())
- {
- worldObj.setBlock(x, y, z, LightBulbBlock.glowningAir);
- }
- if(!this.getActive())
- {
- worldObj.setBlockToAir(x, y, z);
- }
- }
+ }
+
+ protected void updateLightState(boolean spreadDarkness) {
+ if (IC2.platform.isSimulating()) {
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
-
- public boolean enableUpdateEntity()
- {
- return IC2.platform.isSimulating();
- }
-
+
+ public boolean enableUpdateEntity() {
+ return IC2.platform.isSimulating();
+ }
+
@Override
- public boolean acceptsEnergyFrom(TileEntity emitter,
- ForgeDirection direction) {
- switch(direction)
- {
+ public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) {
+ switch (direction) {
case UP:
- return this.getFacing()==0;
+ return this.getFacing() == 0;
case DOWN:
- return this.getFacing()==1;
+ return this.getFacing() == 1;
case SOUTH:
- return this.getFacing()==2;
+ return this.getFacing() == 2;
case NORTH:
- return this.getFacing()==3;
+ return this.getFacing() == 3;
case EAST:
- return this.getFacing()==4;
+ return this.getFacing() == 4;
case WEST:
- return this.getFacing()==5;
+ return this.getFacing() == 5;
default:
return false;
}
}
@Override
- public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side)
- {
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
- return this.facing;
+ return this.facing;
}
@Override
- public void setFacing(short facing1)
- {
- if (IC2.platform.isSimulating()&&this.addedToEnergyNet)
- {
- MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
- this.addedToEnergyNet = false;
- }
- this.facing=facing1;
- if(IC2.platform.isSimulating())
- {
- if (this.prevFacing != facing)
- {
- IC2.network.get().updateTileEntityField(this, "facing");
- }
+ public void setFacing(short facing1) {
+ if (IC2.platform.isSimulating() && this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
+ this.addedToEnergyNet = false;
+ }
+ this.facing = facing1;
+ if (IC2.platform.isSimulating()) {
+ if (this.prevFacing != facing) {
+ IC2.network.get().updateTileEntityField(this, "facing");
+ }
}
this.prevFacing = facing;
- if (IC2.platform.isSimulating()&&!this.addedToEnergyNet)
- {
- MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
- this.addedToEnergyNet = true;
- }
+ if (IC2.platform.isSimulating() && !this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
+ this.addedToEnergyNet = true;
+ }
+ }
+
+ @Override
+ public List<String> getNetworkedFields() {
+ Vector<String> ret = new Vector<String>(2);
+ ret.add("active");
+ ret.add("facing");
+ return ret;
}
-
- @Override
- public List<String> getNetworkedFields()
- {
- Vector<String> ret = new Vector<String>(2);
- ret.add("active");
- ret.add("facing");
- return ret;
- }
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
@@ -260,9 +206,11 @@ public class LightBulbTileEntity extends TileEntity implements IEnergySink, IWre }
@Override
- public double getDemandedEnergy()
- {
- return this.maxEnergy-this.energy;
+ public double getDemandedEnergy() {
+ if (energy > 10d) {
+ return 0d;
+ }
+ return Integer.MAX_VALUE;
}
@Override
@@ -271,38 +219,27 @@ public class LightBulbTileEntity extends TileEntity implements IEnergySink, IWre }
@Override
- public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage)
- {
- if (this.energy >= this.maxEnergy)
- {
- return amount;
- }
- else
- {
- this.energy += amount;
- return 0.0D;
- }
+ public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) {
+ this.energy += amount;
+ return 0.0D;
}
- public boolean getActive()
- {
- return this.active;
- }
+ public boolean getActive() {
+ return this.active;
+ }
- public void setActive(boolean active1)
- {
- this.active = active1;
+ public void setActive(boolean active1) {
+ this.active = active1;
- if (this.prevActive != active1)
- {
- IC2.network.get().updateTileEntityField(this, "active");
- updateLightState();
- }
- this.prevActive = active1;
- }
- public void setActiveWithoutNotify(boolean active1)
- {
- this.active = active1;
- this.prevActive = active1;
- }
+ if (this.prevActive != active1) {
+ IC2.network.get().updateTileEntityField(this, "active");
+ updateLightState(!active1);
+ }
+ this.prevActive = active1;
+ }
+
+ public void setActiveWithoutNotify(boolean active1) {
+ this.active = active1;
+ this.prevActive = active1;
+ }
}
diff --git a/ihl/enviroment/SpotlightTileEntity.java b/ihl/enviroment/SpotlightTileEntity.java index ab18ebe..287ef9f 100644 --- a/ihl/enviroment/SpotlightTileEntity.java +++ b/ihl/enviroment/SpotlightTileEntity.java @@ -111,7 +111,7 @@ public class SpotlightTileEntity extends LightBulbTileEntity implements INetwork if(needLightTargetUpdate)
{
this.generateGlowningAirList();
- this.updateLightState();
+ this.updateLightState(this.getActive());
needLightTargetUpdate=false;
}
if(this.prevRotationPitch!=this.rotationPitch)
@@ -214,7 +214,7 @@ public class SpotlightTileEntity extends LightBulbTileEntity implements INetwork }
@Override
- protected void updateLightState()
+ protected void updateLightState(boolean spreadDarkness)
{
if(this.getActive())
{
diff --git a/ihl/explosion/ChunkAndWorldLoadEventHandler.java b/ihl/explosion/ChunkAndWorldLoadEventHandler.java index b85e636..2f49484 100644 --- a/ihl/explosion/ChunkAndWorldLoadEventHandler.java +++ b/ihl/explosion/ChunkAndWorldLoadEventHandler.java @@ -37,10 +37,6 @@ public class ChunkAndWorldLoadEventHandler { IHLMod.explosionHandler.breakBlocksAndGetDescendants(event.world, bwArray[1], bwArray[2], bwArray[3], explosion, bwArray[0], bwArray[4], directionMask); } - if (!IHLMod.explosionHandler.isCalculating) { - IHLMod.explosionHandler.sendChunkUpdateToPlayersInExplosionAffectedZone(event.world, bwArray[1], - bwArray[2], bwArray[3]); - } } } } diff --git a/ihl/explosion/ExplosionVectorBlockV2.java b/ihl/explosion/ExplosionVectorBlockV2.java index 4489e55..daa16ce 100644 --- a/ihl/explosion/ExplosionVectorBlockV2.java +++ b/ihl/explosion/ExplosionVectorBlockV2.java @@ -13,6 +13,7 @@ import java.util.Map; import java.util.Set;
import java.util.Map.Entry;
+import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
@@ -26,6 +27,8 @@ import net.minecraft.world.Explosion; import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.world.ExplosionEvent;
public class ExplosionVectorBlockV2 {
final Set<Integer> startVectors = new HashSet<Integer>();
@@ -39,7 +42,7 @@ public class ExplosionVectorBlockV2 { private final Map<Integer, ItemStack> cachedDrops = new HashMap<Integer, ItemStack>(128);
final Map<Integer, WorldSavedDataBlastWave> blastWaveByDimensionId = new HashMap<Integer, WorldSavedDataBlastWave>();
private final Map<ExtendedBlockStorage, Entity[]> cachedEntities = new HashMap<ExtendedBlockStorage, Entity[]>();
- public boolean isCalculating = false;
+ private final Random random = new Random();
public ExplosionVectorBlockV2() {
this.precalculateExplosion();
@@ -219,11 +222,13 @@ public class ExplosionVectorBlockV2 { }
} else {
block.onNeighborBlockChange(world, absX, absY, absZ, block);
- if ((++absY & 15) != 0) {
- int array_index = (absY & 15) << 8 | (absZ & 15) << 4 | (absX & 15);
- if (ebs.getBlockLSBArray()[array_index] == 0 && (ebs.getBlockMSBArray() == null
- || ebs.getBlockMSBArray().get(absX & 15, absY & 15, absZ & 15) == 0)) {
- this.placeDrops(world, absX, absY, absZ);
+ if (random.nextInt(8) == 0) {
+ if ((++absY & 15) != 0) {
+ int array_index = (absY & 15) << 8 | (absZ & 15) << 4 | (absX & 15);
+ if (ebs.getBlockLSBArray()[array_index] == 0 && (ebs.getBlockMSBArray() == null
+ || ebs.getBlockMSBArray().get(absX & 15, absY & 15, absZ & 15) == 0)) {
+ this.placeDrops(world, absX, absY, absZ);
+ }
}
}
}
@@ -275,6 +280,9 @@ public class ExplosionVectorBlockV2 { Iterator<Entry<Integer, ItemStack>> di = this.cachedDrops.entrySet().iterator();
if (di.hasNext()) {
Entry<Integer, ItemStack> cde = di.next();
+ while (di.hasNext()) {
+ cde = di.next();
+ }
ItemStack stack = cde.getValue();
if (stack != null && stack.getItem() != null && stack.stackSize > 0) {
if (stack.stackSize <= stack.getMaxStackSize()) {
@@ -328,19 +336,27 @@ public class ExplosionVectorBlockV2 { startPower, directionMask);
}
// Free and clean resources
- this.cachedDrops.clear();
this.cachedEntities.clear();
}
public void doExplosion(World world, int sourceX, int sourceY, int sourceZ, final Set<Integer> startVectors1,
int startPower) {
IHLMod.log.info("Starting explosion server");
- isCalculating = true;
Explosion explosion = new Explosion(world, null, sourceX, sourceY, sourceZ, 100f);
- for (int[] directionMask : directionMasks) {
- this.doExplosion(world, sourceX, sourceY, sourceZ, startVectors1, startPower, directionMask, explosion);
+ if (!MinecraftForge.EVENT_BUS.post(new ExplosionEvent.Start(world, explosion))) {
+ for (int[] directionMask : directionMasks) {
+ this.doExplosion(world, sourceX, sourceY, sourceZ, startVectors1, startPower, directionMask, explosion);
+ }
+ sendChunkUpdateToPlayersInExplosionAffectedZone(world, sourceX, sourceY, sourceZ);
+ for (Entry<Integer, ItemStack> entry : this.cachedDrops.entrySet()) {
+ IHLEntityFallingPile fallingPile = new IHLEntityFallingPile(world);
+ fallingPile.setPosition(sourceX + 0.5d, sourceY + 0.5d, sourceZ + 0.5d);
+ fallingPile.setEntityItemStack(entry.getValue());
+ fallingPile.setVelocity(random.nextDouble() - 0.5d, random.nextDouble() * 2,
+ random.nextDouble() - 0.5d);
+ world.spawnEntityInWorld(fallingPile);
+ }
+ this.cachedDrops.clear();
}
- sendChunkUpdateToPlayersInExplosionAffectedZone(world, sourceX, sourceY, sourceZ);
- isCalculating = false;
}
}
\ No newline at end of file diff --git a/ihl/explosion/ExplosiveTileEntity.java b/ihl/explosion/ExplosiveTileEntity.java index cfae646..b211d3b 100644 --- a/ihl/explosion/ExplosiveTileEntity.java +++ b/ihl/explosion/ExplosiveTileEntity.java @@ -63,11 +63,11 @@ public class ExplosiveTileEntity extends TileEntity { for (int oid : OreDictionary.getOreIDs(player.getCurrentEquippedItem())) { if (OreDictionary.getOreName(oid).matches("toolLighter")) { ignite(); - return true; + return false; } } } - return false; + return true; } public void ignite() { diff --git a/ihl/explosion/PileBlock.java b/ihl/explosion/PileBlock.java index a2c56c3..f9ea862 100644 --- a/ihl/explosion/PileBlock.java +++ b/ihl/explosion/PileBlock.java @@ -1,5 +1,7 @@ package ihl.explosion; +import java.util.ArrayList; + import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -10,6 +12,7 @@ import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; @@ -71,7 +74,7 @@ public class PileBlock extends Block implements ITileEntityProvider @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister par1IconRegister) { - this.blockIcon = par1IconRegister.registerIcon(IHLModInfo.MODID + ":fluidAcetyleneFlowing"); + this.blockIcon = par1IconRegister.registerIcon(IHLModInfo.MODID + ":pileTextureSpace"); } @Override @@ -122,4 +125,9 @@ public class PileBlock extends Block implements ITileEntityProvider @Override public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float chance, int flag){} + + @Override + public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune) { + return new ArrayList<ItemStack>(); + } } diff --git a/ihl/explosion/PileBlockRender.java b/ihl/explosion/PileBlockRender.java index 307cf3c..c5c8060 100644 --- a/ihl/explosion/PileBlockRender.java +++ b/ihl/explosion/PileBlockRender.java @@ -6,10 +6,8 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import cpw.mods.fml.client.registry.RenderingRegistry;
import ihl.utils.IHLMathUtils;
import net.minecraft.block.Block;
-import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -17,326 +15,271 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
-public class PileBlockRender implements ISimpleBlockRenderingHandler
-{
- public static int renderId;
- public final PileTileEntityRender pileTileEntityRender;
+public class PileBlockRender implements ISimpleBlockRenderingHandler {
+ public static int renderId;
+ public final PileTileEntityRender pileTileEntityRender;
- public PileBlockRender()
- {
- renderId = RenderingRegistry.getNextAvailableRenderId();
+ public PileBlockRender() {
+ renderId = RenderingRegistry.getNextAvailableRenderId();
pileTileEntityRender = new PileTileEntityRender(this);
- }
+ }
@Override
- public int getRenderId()
- {
+ public int getRenderId() {
return renderId;
}
@Override
- public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderblocks)
- {
- Tessellator tessellator = Tessellator.instance;
- block.setBlockBoundsForItemRender();
- renderblocks.setRenderBoundsFromBlock(block);
- GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, -1.0F, 0.0F);
- renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderblocks.getBlockIconFromSideAndMetadata(block, 0, metadata));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 1.0F, 0.0F);
- renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderblocks.getBlockIconFromSideAndMetadata(block, 1, metadata));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F, -1.0F);
- renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderblocks.getBlockIconFromSideAndMetadata(block, 2, metadata));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F, 1.0F);
- renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderblocks.getBlockIconFromSideAndMetadata(block, 3, metadata));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(-1.0F, 0.0F, 0.0F);
- renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderblocks.getBlockIconFromSideAndMetadata(block, 4, metadata));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(1.0F, 0.0F, 0.0F);
- renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderblocks.getBlockIconFromSideAndMetadata(block, 5, metadata));
- tessellator.draw();
- GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderblocks) {
+ Tessellator tessellator = Tessellator.instance;
+ block.setBlockBoundsForItemRender();
+ renderblocks.setRenderBoundsFromBlock(block);
+ GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, -1.0F, 0.0F);
+ renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D,
+ renderblocks.getBlockIconFromSideAndMetadata(block, 0, metadata));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D,
+ renderblocks.getBlockIconFromSideAndMetadata(block, 1, metadata));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, -1.0F);
+ renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D,
+ renderblocks.getBlockIconFromSideAndMetadata(block, 2, metadata));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D,
+ renderblocks.getBlockIconFromSideAndMetadata(block, 3, metadata));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(-1.0F, 0.0F, 0.0F);
+ renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D,
+ renderblocks.getBlockIconFromSideAndMetadata(block, 4, metadata));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D,
+ renderblocks.getBlockIconFromSideAndMetadata(block, 5, metadata));
+ tessellator.draw();
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
@Override
- public boolean renderWorldBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int meta, RenderBlocks blockRenderer)
- {
- TileEntity te = blockAccess.getTileEntity(x, y, z);
- if(te instanceof PileTileEntity)
- {
- PileTileEntity pte = (PileTileEntity) te;
- long itemHash = getItemStackHash(pte.content);
- if(this.pileTileEntityRender.textureIdMap.containsKey(itemHash))
- {
- Tessellator tessellator = Tessellator.instance;
- tessellator.draw();
- int texture=this.pileTileEntityRender.textureIdMap.get(itemHash);
- GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
- int[][][] brightness = new int[3][3][3];
- this.generateBrightnessMatrix(blockAccess, x, y, z, brightness);
- tessellator.startDrawing(GL11.GL_TRIANGLES);
- tessellator.setColorOpaque_F(1f, 1f, 1f);
- boolean[] blocksViewAround = this.getBlocksViewAround(blockAccess, x, y, z);
- if( blocksViewAround[0] &&
- blocksViewAround[1] &&
- blocksViewAround[2] &&
- blocksViewAround[3])
- {
- this.addFlatTop(tessellator, x, y, z, brightness);
- }
- else if(!blocksViewAround[0] &&
- blocksViewAround[1] &&
- blocksViewAround[2] &&
- blocksViewAround[3])
- {
- this.addSlope(tessellator, x, y, z, 1, 1, 0, 1, brightness);
- }
- else if(blocksViewAround[0] &&
- !blocksViewAround[1] &&
- blocksViewAround[2] &&
- blocksViewAround[3])
- {
- this.addSlope(tessellator, x, y, z, 0, 1, 1, 1, brightness);
- }
- else if(blocksViewAround[0] &&
- blocksViewAround[1] &&
- !blocksViewAround[2] &&
- blocksViewAround[3])
- {
- this.addSlope(tessellator, x, y, z, 1, 1, 1, 0, brightness);
- }
- else if(blocksViewAround[0] &&
- blocksViewAround[1] &&
- blocksViewAround[2] &&
- !blocksViewAround[3])
- {
- this.addSlope(tessellator, x, y, z, 1, 0, 1, 1, brightness);
- }
- // 2-sided piramid
- else if(blocksViewAround[0] &&
- blocksViewAround[1] &&
- !blocksViewAround[2] &&
- !blocksViewAround[3])
- {
- this.addSlope(tessellator, x, y, z, 1, 0, 1, 0, brightness);
- }
- else if(!blocksViewAround[0] &&
- blocksViewAround[1] &&
- blocksViewAround[2] &&
- !blocksViewAround[3])
- {
- this.addSlope(tessellator, x, y, z, 1, 0, 0, 1, brightness);
- }
- else if(!blocksViewAround[0] &&
- !blocksViewAround[1] &&
- blocksViewAround[2] &&
- blocksViewAround[3])
- {
- this.addSlope(tessellator, x, y, z, 0, 1, 0, 1, brightness);
- }
- else if(blocksViewAround[0] &&
- !blocksViewAround[1] &&
- !blocksViewAround[2] &&
- blocksViewAround[3])
- {
- this.addSlope(tessellator, x, y, z, 0, 1, 1, 0, brightness);
- }
- else
- {
- this.addPyramid(tessellator, x, y, z, brightness);
- }
- if(!blockAccess.getBlock(x, y-1, z).isOpaqueCube())
- {
- this.addBottom(tessellator, x, y, z, brightness);
- }
- tessellator.draw();
- Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
- tessellator.startDrawingQuads();
- }
- return true;
- }
- else
- {
- return false;
- }
+ public boolean renderWorldBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int meta,
+ RenderBlocks blockRenderer) {
+ TileEntity te = blockAccess.getTileEntity(x, y, z);
+ if (te instanceof PileTileEntity) {
+ PileTileEntity pte = (PileTileEntity) te;
+ long itemHash = getItemStackHash(pte.content);
+ if (this.pileTileEntityRender.subIconIdMap.containsKey(itemHash)) {
+ Tessellator tessellator = Tessellator.instance;
+ int subIconId = this.pileTileEntityRender.subIconIdMap.get(itemHash);
+ int[][][] brightness = new int[3][3][3];
+ this.generateBrightnessMatrix(blockAccess, x, y, z, brightness);
+ tessellator.setColorOpaque_F(1f, 1f, 1f);
+ boolean[] blocksViewAround = this.getBlocksViewAround(blockAccess, x, y, z);
+ if (blocksViewAround[0] && blocksViewAround[1] && blocksViewAround[2] && blocksViewAround[3]) {
+ this.addFlatTop(tessellator, x, y, z, brightness, subIconId);
+ } else if (!blocksViewAround[0] && blocksViewAround[1] && blocksViewAround[2] && blocksViewAround[3]) {
+ this.addSlope(tessellator, x, y, z, 0, brightness, subIconId);
+ } else if (blocksViewAround[0] && !blocksViewAround[1] && blocksViewAround[2] && blocksViewAround[3]) {
+ this.addSlope(tessellator, x, y, z, 1, brightness, subIconId);
+ } else if (blocksViewAround[0] && blocksViewAround[1] && !blocksViewAround[2] && blocksViewAround[3]) {
+ this.addSlope(tessellator, x, y, z, 2, brightness, subIconId);
+ } else if (blocksViewAround[0] && blocksViewAround[1] && blocksViewAround[2] && !blocksViewAround[3]) {
+ this.addSlope(tessellator, x, y, z, 3, brightness, subIconId);
+ }
+ // 2-sided piramid
+ else if (blocksViewAround[0] && blocksViewAround[1] && !blocksViewAround[2] && !blocksViewAround[3]) {
+ this.addTwoSidedPyramid(tessellator, x, y, z, 2, brightness, subIconId);
+ } else if (!blocksViewAround[0] && blocksViewAround[1] && blocksViewAround[2] && !blocksViewAround[3]) {
+ this.addTwoSidedPyramid(tessellator, x, y, z, 3, brightness, subIconId);
+ } else if (!blocksViewAround[0] && !blocksViewAround[1] && blocksViewAround[2] && blocksViewAround[3]) {
+ this.addTwoSidedPyramid(tessellator, x, y, z, 0, brightness, subIconId);
+ } else if (blocksViewAround[0] && !blocksViewAround[1] && !blocksViewAround[2] && blocksViewAround[3]) {
+ this.addTwoSidedPyramid(tessellator, x, y, z, 1, brightness, subIconId);
+ } else {
+ this.addPyramid(tessellator, x, y, z, brightness, subIconId);
+ }
+ if (!blockAccess.getBlock(x, y - 1, z).isOpaqueCube()) {
+ this.addBottom(tessellator, x, y, z, brightness, subIconId);
+ }
+ }
+ return true;
+ } else {
+ return false;
+ }
}
-
- private boolean[] getBlocksViewAround(IBlockAccess blockAccess, int x, int y, int z)
- {
- // +Z
- // ^
- //[ ][0][ ]
- //[3][x][1] ->+X
- //[ ][2][ ]
- return new boolean[] {
- blockAccess.getBlock(x, y, z+1).isOpaqueCube(),
- blockAccess.getBlock(x+1, y, z).isOpaqueCube(),
- blockAccess.getBlock(x, y, z-1).isOpaqueCube(),
- blockAccess.getBlock(x-1, y, z).isOpaqueCube(),
- };
+
+ private boolean[] getBlocksViewAround(IBlockAccess blockAccess, int x, int y, int z) {
+ // +Z
+ // ^
+ // [ ][0][ ]
+ // [3][x][1] ->+X
+ // [ ][2][ ]
+ return new boolean[] { blockAccess.getBlock(x, y, z + 1).isOpaqueCube(),
+ blockAccess.getBlock(x + 1, y, z).isOpaqueCube(), blockAccess.getBlock(x, y, z - 1).isOpaqueCube(),
+ blockAccess.getBlock(x - 1, y, z).isOpaqueCube(), };
}
- private void addBottom(Tessellator tessellator, int x, int y, int z, int[][][] brightness)
- {
- double[][] triangle1 = new double[3][3];
- double[][] triangle2 = new double[3][3];
- triangle1[0] = new double[] {0D,0D,1D};
- triangle1[1] = new double[] {0D,0D,0D};
- triangle1[2] = new double[] {1D,0D,0D};
- triangle2[0] = triangle1[0];
- triangle2[1] = triangle1[2];
- triangle2[2] = new double[] {1D,0D,1D};
- this.addTriangle(tessellator, triangle1, x, y, z, ForgeDirection.UP, brightness);
- this.addTriangle(tessellator, triangle2, x, y, z, ForgeDirection.UP, brightness);
+ private void addBottom(Tessellator tessellator, int x, int y, int z, int[][][] brightness, int subIconId) {
+ double[][] quad1 = new double[4][3];
+ quad1[0] = new double[] { 0D, 0D, 1D };
+ quad1[1] = new double[] { 0D, 0D, 0D };
+ quad1[2] = new double[] { 1D, 0D, 0D };
+ quad1[3] = new double[] { 1D, 0D, 1D };
+ this.addQuad(tessellator, quad1, x, y, z, ForgeDirection.UP, brightness, subIconId);
}
-
- private void addFlatTop(Tessellator tessellator, int x, int y, int z, int[][][] brightness)
- {
- double[][] triangle1 = new double[3][3];
- double[][] triangle2 = new double[3][3];
+
+ private void addFlatTop(Tessellator tessellator, int x, int y, int z, int[][][] brightness, int subIconId) {
+ double[][] quad1 = new double[4][3];
double height = 0.9D;
- triangle1[0] = new double[] {1D,height,0D};
- triangle1[1] = new double[] {0D,height,0D};
- triangle1[2] = new double[] {0D,height,1D};
- triangle2[0] = triangle1[2];
- triangle2[1] = new double[] {1D,height,1D};
- triangle2[2] = triangle1[0];
- this.addTriangle(tessellator, triangle1, x, y, z, ForgeDirection.UP, brightness);
- this.addTriangle(tessellator, triangle2, x, y, z, ForgeDirection.UP, brightness);
+ quad1[0] = new double[] { 1D, height, 0D };
+ quad1[1] = new double[] { 0D, height, 0D };
+ quad1[2] = new double[] { 0D, height, 1D };
+ quad1[3] = new double[] { 1D, height, 1D };
+ this.addQuad(tessellator, quad1, x, y, z, ForgeDirection.UP, brightness, subIconId);
}
-
- private void addSlope(Tessellator tessellator, int x, int y, int z, int px, int nx, int pz, int nz, int[][][] brightness)
- {
- double[][] triangle1 = new double[3][3];
- double[][] triangle2 = new double[3][3];
- if(px*pz+nx*nz==1)
- {
- triangle1[0] = new double[] {1D,px*nz,0D}; //+X -Z
- triangle1[1] = new double[] {0D,nx*nz,0D}; //-X -Z
- triangle1[2] = new double[] {1D,px*pz,1D}; //-X +Z
- triangle2[0] = triangle1[2];
- triangle2[1] = triangle1[1]; //+X +Z
- triangle2[2] = new double[] {0D,nx*pz,1D};
- }
- else
- {
- triangle1[0] = new double[] {1D,px*nz,0D}; //+X -Z
- triangle1[1] = new double[] {0D,nx*nz,0D}; //-X -Z
- triangle1[2] = new double[] {0D,nx*pz,1D}; //-X +Z
- triangle2[0] = triangle1[2];
- triangle2[1] = new double[] {1D,px*pz,1D}; //+X +Z
- triangle2[2] = triangle1[0];
+
+ private void addSlope(Tessellator tessellator, int x, int y, int z, int rotation,
+ int[][][] brightness, int subIconId) {
+ double[][] quad = new double[4][3];
+ quad[0] = new double[] { 1D,1D, 0D }; // +X -Z
+ quad[1] = new double[] { 0D, 1D, 0D }; // -X -Z
+ quad[2] = new double[] { 0D, 0D, 1D }; // -X +Z
+ quad[3] = new double[] { 1D, 0D, 1D };
+ while (rotation-- > 0) {
+ rotateQuadByYAxis(quad);
}
- this.addTriangle(tessellator, triangle1, x, y, z, ForgeDirection.UP, brightness);
- this.addTriangle(tessellator, triangle2, x, y, z, ForgeDirection.UP, brightness);
+ this.addQuad(tessellator, quad, x, y, z, ForgeDirection.UP, brightness, subIconId);
}
- private void addPyramid(Tessellator tessellator, int x, int y, int z, int[][][] brightness)
- {
- double[][] triangle1 = new double[3][3];
- double[][] triangle2 = new double[3][3];
- double[][] triangle3 = new double[3][3];
- double[][] triangle4 = new double[3][3];
+ private void addTwoSidedPyramid(Tessellator tessellator, int x, int y, int z, int rotation,
+ int[][][] brightness, int subIconId) {
+ double[][] quad = new double[4][3];
+ quad[0] = new double[] { 1D, 0D, 0D }; // +X -Z
+ quad[1] = new double[] { 0D, 1D, 0D }; // -X -Z
+ quad[2] = new double[] { 0D, 0D, 1D }; // -X +Z
+ quad[3] = new double[] { 1D, 0D, 1D };
+ while (rotation-- > 0) {
+ rotateQuadByYAxis(quad);
+ }
+ this.addQuad(tessellator, quad, x, y, z, ForgeDirection.UP, brightness, subIconId);
+ }
+
+ private void addPyramid(Tessellator tessellator, int x, int y, int z, int[][][] brightness, int subIconId) {
+ double[][] quad1 = new double[4][3];
+ double[][] quad2 = new double[4][3];
double pileHeight = 0.3D;
- triangle1[0] = new double[] {1D,0D,0D};
- triangle1[1] = new double[] {0D,0D,0D};
- triangle1[2] = new double[] {0.5D,pileHeight,0.5D};
- triangle2[0] = triangle1[1];
- triangle2[1] = new double[] {0D,0D,1D};
- triangle2[2] = triangle1[2];
- triangle3[0] = triangle2[1];
- triangle3[1] = new double[] {1D,0D,1D};
- triangle3[2] = triangle1[2];
- triangle4[0] = triangle3[1];
- triangle4[1] = triangle1[0];
- triangle4[2] = triangle1[2];
- this.addTriangle(tessellator, triangle1, x, y, z, ForgeDirection.UP, brightness);
- this.addTriangle(tessellator, triangle2, x, y, z, ForgeDirection.UP, brightness);
- this.addTriangle(tessellator, triangle3, x, y, z, ForgeDirection.UP, brightness);
- this.addTriangle(tessellator, triangle4, x, y, z, ForgeDirection.UP, brightness);
+ quad1[0] = new double[] { 1D, 0D, 1D };
+ quad1[1] = new double[] { 1D, 0D, 0D };
+ quad1[2] = new double[] { 0D, 0D, 0D };
+ quad1[3] = new double[] { 0.5D, pileHeight, 0.5D };
+ quad2 = copyAndRotateQuadByYAxis(quad1,2);
+ this.addQuad(tessellator, quad1, x, y, z, ForgeDirection.UP, brightness, subIconId);
+ this.addQuad(tessellator, quad2, x, y, z, ForgeDirection.UP, brightness, subIconId);
}
-
- private void addTriangle(Tessellator tessellator, double[][] triangle, int x, int y, int z, ForgeDirection uvmapping, int[][][] brightness)
- {
+
+ private void rotateQuadByYAxis(double[][] quad) {
+ for (double[] v : quad) {
+ double newV2 = 1 - v[0];
+ v[0] = v[2];
+ v[2] = newV2;
+ }
+ }
+
+ private double[][] copyAndRotateQuadByYAxis(double[][] quad, int rotation) {
+ double[][] quadOut = new double[4][3];
+ for (int i = 0; i < quad.length * 3; i++) {
+ quadOut[i / 3][i % 3] = quad[i / 3][i % 3];
+ }
+
+ while (rotation-- > 0) {
+ rotateQuadByYAxis(quadOut);
+ }
+ return quadOut;
+ }
+
+ private void addQuad(Tessellator tessellator, double[][] quad, int x, int y, int z, ForgeDirection uvmapping,
+ int[][][] brightness, int subIconId) {
int iu = 0;
int iv = 2;
- if(uvmapping.offsetY == 0)
- {
+ if (uvmapping.offsetY == 0) {
iv = 1;
- if(uvmapping.offsetZ == 0)
- {
+ if (uvmapping.offsetZ == 0) {
iu = 2;
}
}
- float[] normal = IHLMathUtils.get_triangle_normal(triangle);
- tessellator.setNormal(normal[0], normal[1], normal[2]);
- tessellator.setBrightness(this.getBrightness(triangle[0], brightness));
- tessellator.addVertexWithUV(x+triangle[0][0], y+triangle[0][1], z+triangle[0][2], triangle[0][iu], triangle[0][iv]);
- tessellator.setBrightness(this.getBrightness(triangle[1], brightness));
- tessellator.addVertexWithUV(x+triangle[1][0], y+triangle[1][1], z+triangle[1][2], triangle[1][iu], triangle[1][iv]);
- tessellator.setBrightness(this.getBrightness(triangle[2], brightness));
- tessellator.addVertexWithUV(x+triangle[2][0], y+triangle[2][1], z+triangle[2][2], triangle[2][iu], triangle[2][iv]);
+ float[] normal = IHLMathUtils.get_triangle_normal(quad);
+ float minu = pileTileEntityRender.getSubIconMinU(subIconId);
+ float minv = pileTileEntityRender.getSubIconMinV(subIconId);
+ float du = pileTileEntityRender.getSubIconDU(subIconId);
+ float dv = pileTileEntityRender.getSubIconDV(subIconId);
+
+ double u1 = minu + quad[0][iu] * du;
+ double u2 = minu + quad[1][iu] * du;
+ double u3 = minu + quad[2][iu] * du;
+ double u4 = minu + quad[3][iu] * du;
+ double v1 = minv + quad[0][iv] * dv;
+ double v2 = minv + quad[1][iv] * dv;
+ double v3 = minv + quad[2][iv] * dv;
+ double v4 = minv + quad[3][iv] * dv;
+
+ tessellator.setNormal(normal[0], normal[1], normal[2]);
+ tessellator.setBrightness(this.getBrightness(quad[0], brightness));
+ tessellator.addVertexWithUV(x + quad[0][0], y + quad[0][1], z + quad[0][2], u1, v1);
+ tessellator.setBrightness(this.getBrightness(quad[1], brightness));
+ tessellator.addVertexWithUV(x + quad[1][0], y + quad[1][1], z + quad[1][2], u2, v2);
+ tessellator.setBrightness(this.getBrightness(quad[2], brightness));
+ tessellator.addVertexWithUV(x + quad[2][0], y + quad[2][1], z + quad[2][2], u3, v3);
+ tessellator.setBrightness(this.getBrightness(quad[3], brightness));
+ tessellator.addVertexWithUV(x + quad[3][0], y + quad[3][1], z + quad[3][2], u4, v4);
}
-
- public long getItemStackHash(ItemStack stack)
- {
- if(stack==null)
- {
+
+ public long getItemStackHash(ItemStack stack) {
+ if (stack == null) {
return 0;
}
- return ((long)Item.getIdFromItem(stack.getItem())<<31^stack.getItemDamage());
+ return ((long) Item.getIdFromItem(stack.getItem()) << 31 ^ stack.getItemDamage());
}
-
- private void generateBrightnessMatrix(IBlockAccess blockAccess, int x, int y, int z, int[][][] brightness)
- {
- for(int ix = -1; ix <= 1; ix++)
- for(int iy = -1; iy <= 1; iy++)
- for(int iz = -1; iz <= 1; iz++)
- {
- Block block = blockAccess.getBlock(ix+x, iy+y, iz+z);
- if(block!=null && block!=Blocks.air)
- {
- brightness[ix+1][iy+1][iz+1] = block.getMixedBrightnessForBlock(blockAccess, ix+x, iy+y, iz+z);
- }
- else
- {
- brightness[ix+1][iy+1][iz+1] = block.getMixedBrightnessForBlock(blockAccess, x, y, z);
- }
- }
+
+ private void generateBrightnessMatrix(IBlockAccess blockAccess, int x, int y, int z, int[][][] brightness) {
+ for (int ix = -1; ix <= 1; ix++)
+ for (int iy = -1; iy <= 1; iy++)
+ for (int iz = -1; iz <= 1; iz++) {
+ Block block = blockAccess.getBlock(ix + x, iy + y, iz + z);
+ if (block != null && block != Blocks.air) {
+ brightness[ix + 1][iy + 1][iz + 1] = block.getMixedBrightnessForBlock(blockAccess, ix + x,
+ iy + y, iz + z);
+ } else {
+ brightness[ix + 1][iy + 1][iz + 1] = block.getMixedBrightnessForBlock(blockAccess, x, y, z);
+ }
+ }
}
-
- private int getBrightness(double v[], int[][][] brightness)
- {
- int x1 = v[0]<0.5d?0:1;
- int x2 = x1+1;
- int y1 = v[1]<0.5d?0:1;
- int y2 = y1+1;
- int z1 = v[2]<0.5d?0:1;
- int z2 = z1+1;
- float dx = v[0]<0.5d?(float)v[0]*2f:(float)v[0]*2f-1f;
- float dy = v[1]<0.5d?(float)v[1]*2f:(float)v[1]*2f-1f;
- float dz = v[2]<0.5d?(float)v[2]*2f:(float)v[2]*2f-1f;
+
+ private int getBrightness(double v[], int[][][] brightness) {
+ int x1 = v[0] < 0.5d ? 0 : 1;
+ int x2 = x1 + 1;
+ int y1 = v[1] < 0.5d ? 0 : 1;
+ int y2 = y1 + 1;
+ int z1 = v[2] < 0.5d ? 0 : 1;
+ int z2 = z1 + 1;
+ float dx = v[0] < 0.5d ? (float) v[0] * 2f : (float) v[0] * 2f - 1f;
+ float dy = v[1] < 0.5d ? (float) v[1] * 2f : (float) v[1] * 2f - 1f;
+ float dz = v[2] < 0.5d ? (float) v[2] * 2f : (float) v[2] * 2f - 1f;
int brightness1 = brightness[x1][y1][z1];
int brightness2 = brightness[x2][y2][z2];
- float d = IHLMathUtils.sqrt(dx*dx+dy*dy+dz*dz);
- return (int)(brightness1*(1f-d)*0.8f+brightness2*d*0.8f+brightness[1][1][1]*0.2f) & 16711935;
+ float d = IHLMathUtils.sqrt(dx * dx + dy * dy + dz * dz);
+ return (int) (brightness1 * (1f - d) * 0.8f + brightness2 * d * 0.8f + brightness[1][1][1] * 0.2f) & 16711935;
}
-
+
@Override
- public boolean shouldRender3DInInventory(int arg0)
- {
+ public boolean shouldRender3DInInventory(int arg0) {
return true;
}
}
-
\ No newline at end of file diff --git a/ihl/explosion/PileTileEntityRender.java b/ihl/explosion/PileTileEntityRender.java index ea8ab4f..2141e83 100644 --- a/ihl/explosion/PileTileEntityRender.java +++ b/ihl/explosion/PileTileEntityRender.java @@ -1,6 +1,5 @@ package ihl.explosion;
-import java.nio.IntBuffer;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
@@ -17,7 +16,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
-import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL30;
@@ -27,134 +25,164 @@ import ihl.IHLMod; import ihl.utils.IHLItemRenderer;
public class PileTileEntityRender extends TileEntitySpecialRenderer {
-
-private int fb=-1;
-private final int textureWidth=64;
-private final int textureHeight=64;
-private final PileBlockRender pileBlockRender;
-public final Map<Long,Integer> textureIdMap = new HashMap<Long,Integer>();
-private IntBuffer textureIDBuffer;
-private int nextAvailableId = -1;
-private boolean framebufferReady = false;
-private Minecraft mc;
-private final IHLItemRenderer ihlItemRenderer=new IHLItemRenderer(false);
-private final Random random = new Random();
-public PileTileEntityRender(PileBlockRender pileBlockRender1)
-{
- pileBlockRender=pileBlockRender1;
- mc = Minecraft.getMinecraft();
-}
+ private int fb = -1;
+ private final int textureWidth = 64;
+ private final int textureHeight = 64;
+ private final PileBlockRender pileBlockRender;
+ public final Map<Long, Integer> subIconIdMap = new HashMap<Long, Integer>();
+ private int nextAvailableId = -1;
+ private boolean framebufferReady = false;
+ private Minecraft mc;
+ private final IHLItemRenderer ihlItemRenderer = new IHLItemRenderer(false);
+ private final Random random = new Random();
-public void renderAModelAt(PileTileEntity tile, double x, double y, double z, float f)
-{
- ItemStack stack = tile.content;
- if(!framebufferReady)
- {
- this.generateFrameBuffer();
- Minecraft.getMinecraft().entityRenderer.setupCameraTransform(f, 0);
- Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
+ public PileTileEntityRender(PileBlockRender pileBlockRender1) {
+ pileBlockRender = pileBlockRender1;
+ mc = Minecraft.getMinecraft();
}
- else if(stack!=null)
- {
- long hash = this.pileBlockRender.getItemStackHash(stack);
- if(!textureIdMap.containsKey(hash))
- {
- textureIdMap.put(hash,textureIDBuffer.get(++nextAvailableId));
- this.preparetexture(nextAvailableId);
- this.drawTexture(tile);
- Minecraft.getMinecraft().entityRenderer.setupCameraTransform(f, 0);
- Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
- tile.updateBlockRender();
- }
+
+ public void renderAModelAt(PileTileEntity tile, double x, double y, double z, float f) {
+ ItemStack stack = tile.content;
+ if (!framebufferReady) {
+ this.generateFrameBuffer();
+ Minecraft.getMinecraft().entityRenderer.setupCameraTransform(f, 0);
+ Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
+ } else if (stack != null) {
+ long hash = this.pileBlockRender.getItemStackHash(stack);
+ if (!subIconIdMap.containsKey(hash)) {
+
+ subIconIdMap.put(hash, ++nextAvailableId);
+ this.preparetexture();
+ this.drawTexture(tile, nextAvailableId);
+ Minecraft.getMinecraft().entityRenderer.setupCameraTransform(f, 0);
+ Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
+ tile.updateBlockRender();
+ }
+ }
+ }
+
+ private void generateFrameBuffer() {
+ fb = GL30.glGenFramebuffers();
+ this.preparetexture();
+ if (GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) != GL30.GL_FRAMEBUFFER_COMPLETE) {
+ IHLMod.log.error("Something went wrong while creating frame buffer!");
+ IHLMod.log.error(GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER));
+ } else {
+ IHLMod.log.info("FrameBuffer loaded correctly!");
+ }
+ this.framebufferReady = true;
+ }
+
+ private void preparetexture() {
+ GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fb);
+ int texture = Minecraft.getMinecraft().renderEngine.getTexture(TextureMap.locationBlocksTexture)
+ .getGlTextureId();
+ GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
+ GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, texture, 0);
+ }
+
+ private void drawTexture(PileTileEntity tile, int subIconId) {
+ IIcon picon = PileBlock.instance.getIcon(0, 0);
+ float minu = picon.getMinU();
+ float minv = picon.getMinV();
+ float maxu = picon.getMaxU();
+ float maxv = picon.getMaxV();
+ int iconwidth = picon.getIconWidth();
+ int iconheight = picon.getIconHeight();
+ float du = maxu - minu;
+ float dv = maxv - minv;
+ int iconNumU = picon.getIconWidth()/this.textureWidth;
+ int posu = (int) (minu * iconwidth / du) + subIconId % iconNumU * textureWidth;
+ int posv = (int) (minv * iconheight / dv) + subIconId / iconNumU * textureHeight;
+
+ GL11.glViewport(posu, posv, textureWidth, textureHeight);
+ GL11.glMatrixMode(GL11.GL_PROJECTION);
+ GL11.glLoadIdentity();
+ GL11.glOrtho(-1d, 1d, -1d, 1d, 0.05F, this.mc.gameSettings.renderDistanceChunks * 32F);
+ GL11.glMatrixMode(GL11.GL_MODELVIEW);
+ GL11.glLoadIdentity();
+ ItemStack stack = tile.content;
+ GL11.glTranslatef(0, 0, -1f);
+ GLU.gluLookAt(0, 0, 0, -32f/* x reference */, 0f/* y reference */, 0f/* z reference */, 0.0f, 1.0f, 0.0f);
+ GL11.glColor4f(1f, 1f, 1f, 1f);
+ GL11.glRotatef(90f, 0, 1f, 0);
+ GL11.glScalef(2f, 2f, 2f);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 0xf0, 0xf0);
+ if (stack.getItem() instanceof ItemBlock) {
+ Block block = ((ItemBlock) stack.getItem()).field_150939_a;
+ IIcon icon = block.getIcon(0, stack.getItemDamage());
+ double u1 = (double) icon.getInterpolatedU(0D);
+ double u2 = (double) icon.getInterpolatedU(16.0D);
+ double v1 = (double) icon.getInterpolatedV(0D);
+ double v2 = (double) icon.getInterpolatedV(16.0D);
+ Tessellator tessellator = Tessellator.instance;
+ bindTexture(TextureMap.locationBlocksTexture);
+ tessellator.startDrawingQuads();
+ tessellator.setColorOpaque_F(1f, 1f, 1f);
+ tessellator.addVertexWithUV(-0.5, -0.5, 0, u1, v1);
+ tessellator.addVertexWithUV(0.5, -0.5, 0, u1, v2);
+ tessellator.addVertexWithUV(0.5, 0.5, 0, u2, v2);
+ tessellator.addVertexWithUV(-0.5, 0.5, 0, u2, v1);
+ tessellator.draw();
+ }
+ for (int i = 0; i < 128; i++) {
+ GL11.glPushMatrix();
+ float tx = random.nextFloat() - 0.5f;
+ float ty = random.nextFloat() - 0.5f;
+ GL11.glTranslatef(tx, ty, 0);
+ this.ihlItemRenderer.doRender(RenderManager.instance, stack, 0f, 0f, 0f);
+ GL11.glTranslatef(-tx, -ty, 0);
+ GL11.glPopMatrix();
+ }
+ GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());
}
-}
-private void generateFrameBuffer()
-{
- textureIDBuffer = BufferUtils.createIntBuffer(Short.MAX_VALUE);
- GL11.glGenTextures(textureIDBuffer);
- fb=GL30.glGenFramebuffers();
- this.preparetexture(0);
- if (GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) != GL30.GL_FRAMEBUFFER_COMPLETE)
- {
- IHLMod.log.error("Something went wrong while creating frame buffer!");
- IHLMod.log.error(GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER));
- }
- else
- {
- IHLMod.log.info("FrameBuffer loaded correctly!");
- }
- this.framebufferReady=true;
-}
+ public float getSubIconMinU(int index)
+ {
+ IIcon picon = PileBlock.instance.getIcon(0, 0);
+ int iconNumU = picon.getIconWidth()/this.textureWidth;
+ float minu = picon.getMinU();
+ float maxu = picon.getMaxU();
+ float du = (maxu - minu)/iconNumU;
+ return minu + index%iconNumU*du;
+ }
-private void preparetexture(int textureID)
-{
- GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fb);
- int texture = textureIDBuffer.get(textureID);
- GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
- GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, texture, 0);
- GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB8, textureWidth, textureHeight, 0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, (java.nio.ByteBuffer)null);
- GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
- GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
- GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER,GL11.GL_NEAREST);
- GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
-}
-
-private void drawTexture(PileTileEntity tile)
-{
- GL11.glViewport(0, 0, textureWidth, textureHeight);
- GL11.glClearColor(0f, 0f, 0f, 1f);
- GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
- GL11.glMatrixMode(GL11.GL_PROJECTION);
- GL11.glLoadIdentity();
- GL11.glOrtho(-1d, 1d, -1d, 1d, 0.05F, this.mc.gameSettings.renderDistanceChunks * 32F);
- GL11.glMatrixMode(GL11.GL_MODELVIEW);
- GL11.glLoadIdentity();
- ItemStack stack = tile.content;
- GL11.glTranslatef(0, 0, -1f);
- GLU.gluLookAt(0, 0, 0, -32f/*x reference*/, 0f/*y reference*/, 0f/*z reference*/, 0.0f, 1.0f, 0.0f);
- GL11.glColor4f(1f, 1f, 1f, 1f);
- GL11.glRotatef(90f,0,1f,0);
- GL11.glScalef(2f, 2f, 2f);
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 0xf0, 0xf0);
-// Tessellator.instance.setBrightness(16711935);
- if(stack.getItem() instanceof ItemBlock)
+ public float getSubIconMinV(int index)
+ {
+ IIcon picon = PileBlock.instance.getIcon(0, 0);
+ int iconNumU = picon.getIconWidth()/this.textureWidth;
+ int iconNumV = picon.getIconHeight()/this.textureHeight;
+ float minv = picon.getMinV();
+ float maxv = picon.getMaxV();
+ float dv = (maxv - minv)/iconNumV;
+ return minv + index/iconNumU*dv;
+ }
+ public float getSubIconDU(int index)
{
- Block block = ((ItemBlock)stack.getItem()).field_150939_a;
- IIcon icon = block.getIcon(0, stack.getItemDamage());
- double u1 = (double)icon.getInterpolatedU(0D);
- double u2 = (double)icon.getInterpolatedU(16.0D);
- double v1 = (double)icon.getInterpolatedV(0D);
- double v2 = (double)icon.getInterpolatedV(16.0D);
- Tessellator tessellator = Tessellator.instance;
- bindTexture(TextureMap.locationBlocksTexture);
- tessellator.startDrawingQuads();
- tessellator.setColorOpaque_F(1f, 1f, 1f);
- tessellator.addVertexWithUV(-0.5,-0.5, 0,u1,v1);
- tessellator.addVertexWithUV( 0.5,-0.5, 0,u1,v2);
- tessellator.addVertexWithUV( 0.5, 0.5, 0,u2,v2);
- tessellator.addVertexWithUV(-0.5, 0.5, 0,u2,v1);
- tessellator.draw();
+ IIcon picon = PileBlock.instance.getIcon(0, 0);
+ int iconNumU = picon.getIconWidth()/this.textureWidth;
+ float minu = picon.getMinU();
+ float maxu = picon.getMaxU();
+ float du = (maxu - minu)/iconNumU;
+ return du;
}
- for (int i = 0; i < 128; i++)
+
+ public float getSubIconDV(int index)
{
- GL11.glPushMatrix();
- float tx = random.nextFloat()-0.5f;
- float ty = random.nextFloat()-0.5f;
- GL11.glTranslatef(tx, ty, 0);
- this.ihlItemRenderer.doRender(RenderManager.instance,stack, 0f, 0f, 0f);
- GL11.glTranslatef(-tx, -ty, 0);
- GL11.glPopMatrix();
+ IIcon picon = PileBlock.instance.getIcon(0, 0);
+ int iconNumV = picon.getIconHeight()/this.textureHeight;
+ float minv = picon.getMinV();
+ float maxv = picon.getMaxV();
+ float dv = (maxv - minv)/iconNumV;
+ return dv;
}
- GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());
-// IHLRenderUtils.instance.disableAmbientLighting();
-}
-@Override
-public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8)
-{
- this.renderAModelAt((PileTileEntity)par1TileEntity, par2, par4, par6, par8);
-}
+
+
+ @Override
+ public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8) {
+ this.renderAModelAt((PileTileEntity) par1TileEntity, par2, par4, par6, par8);
+ }
}
\ No newline at end of file diff --git a/ihl/flexible_cable/AnchorBlock.java b/ihl/flexible_cable/AnchorBlock.java index 9d9c1dc..90fcf80 100644 --- a/ihl/flexible_cable/AnchorBlock.java +++ b/ihl/flexible_cable/AnchorBlock.java @@ -1,4 +1,5 @@ package ihl.flexible_cable;
+
import ihl.IHLModInfo;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
@@ -9,196 +10,102 @@ import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class AnchorBlock extends Block implements ITileEntityProvider {
- private IIcon blockIconSide;
-
- public AnchorBlock(String unlocalizedName1)
- {
+ public AnchorBlock(String unlocalizedName1) {
super(Material.circuits);
this.setBlockName(unlocalizedName1);
- GameRegistry.registerBlock(this, unlocalizedName1);
+ GameRegistry.registerBlock(this, unlocalizedName1);
}
-
+
@Override
- public boolean hasTileEntity(int metadata)
- {
- return true;
+ public boolean hasTileEntity(int metadata) {
+ return true;
}
-
+
@Override
- public void onBlockPreDestroy(World world, int x, int y, int z, int meta)
- {
- if(!world.isRemote)
- {
+ 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 AnchorTileEntity)
- {
+ if (te != null && te instanceof AnchorTileEntity) {
AnchorTileEntity ate = (AnchorTileEntity) te;
ate.invalidate();
- for(short i=0;i<6;i++)
- {
+ for (short i = 0; i < 6; i++) {
ate.energyNetNodes[i].removeAttachedChains();
}
}
}
super.onBlockPreDestroy(world, x, y, z, meta);
}
-
+
@Override
public TileEntity createNewTileEntity(World arg0, int arg1) {
return new AnchorTileEntity();
}
-
- @Override
- public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float chance, int flag){}
-
- @Override
- public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
- {
- return null;
- }
-
- @Override
- public boolean isOpaqueCube()
- {
- return false;
- }
- @Override
- public boolean renderAsNormalBlock()
- {
- return false;
- }
+ @Override
+ public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float chance, int flag) {
+ }
- @Override
- public int getRenderType()
- {
- return -2;
+ @Override
+ public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_,
+ int p_149668_4_) {
+ return null;
}
@Override
- @SideOnly(Side.CLIENT)
- public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
- {
- int facing=3;
- int mask[] = {
- 0,1,2,3,4,5,
- 1,0,3,2,4,5,
- 3,2,0,1,4,5,
- 2,3,1,0,4,5,
- 2,3,5,4,0,1,
- 2,3,4,5,1,0
- };
- TileEntity te = world.getTileEntity(x, y, z);
- if(te!=null)
- {
- AnchorTileEntity tebh = (AnchorTileEntity) te;
- facing=tebh.getFacing();
- }
+ public boolean isOpaqueCube() {
+ return false;
+ }
- switch (mask[facing*6+side])
- {
- case 0:
- return this.blockIcon;
- case 1:
- return this.blockIconSide;
- case 2:
- return this.blockIconSide;
- case 3:
- return this.blockIconSide;
- case 4:
- return this.blockIconSide;
- case 5:
- return this.blockIconSide;
- default:
- return this.blockIconSide;
- }
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
}
-
+
@Override
- @SideOnly(Side.CLIENT)
- public IIcon getIcon(int side, int meta)
- {
-
- switch(side)
- {
- case 0:
- return this.blockIconSide;
- case 1:
- return this.blockIconSide;
- case 2:
- return this.blockIconSide;
- case 3:
- return this.blockIcon;
- case 4:
- return this.blockIconSide;
- case 5:
- return this.blockIconSide;
- default:
- return this.blockIconSide;
- }
+ public int getRenderType() {
+ return -2;
}
-
+
@Override
@SideOnly(Side.CLIENT)
- public void registerBlockIcons(IIconRegister par1IconRegister)
- {
- this.blockIcon = par1IconRegister.registerIcon(IHLModInfo.MODID + ":junctionBoxFront");
- this.blockIconSide = par1IconRegister.registerIcon(IHLModInfo.MODID + ":junctionBox");
+ public void registerBlockIcons(IIconRegister par1IconRegister) {
+ this.blockIcon = par1IconRegister.registerIcon(IHLModInfo.MODID + ":junctionBox");
}
-
- @Override
- public void setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z)
- {
- TileEntity te = iBlockAccess.getTileEntity(x, y, z);
- if(te!=null && te instanceof AnchorTileEntity)
- {
- AnchorTileEntity ate = (AnchorTileEntity) te;
- float portSize=0.1f;
- float bbMinX = 1f;
- float bbMaxX = 0f;
- float bbMinY = 1f;
- float bbMaxY = 0f;
- float bbMinZ = 1f;
- float bbMaxZ = 0f;
- for(short i=0;i<6;i++)
- {
- if(ate.hasCableOnSide[i])
- {
- float pMinX = (float) (ate.energyNetNodes[i].getPortPos(null)[0]-portSize-x);
- float pMaxX = (float) (ate.energyNetNodes[i].getPortPos(null)[0]+portSize-x);
- float pMinY = (float) (ate.energyNetNodes[i].getPortPos(null)[1]-portSize-y);
- float pMaxY = (float) (ate.energyNetNodes[i].getPortPos(null)[1]+portSize-y);
- float pMinZ = (float) (ate.energyNetNodes[i].getPortPos(null)[2]-portSize-z);
- float pMaxZ = (float) (ate.energyNetNodes[i].getPortPos(null)[2]+portSize-z);
- bbMinX=Math.min(pMinX,bbMinX);
- bbMaxX=Math.max(pMaxX,bbMaxX);
- bbMinY=Math.min(pMinY,bbMinY);
- bbMaxY=Math.max(pMaxY,bbMaxY);
- bbMinZ=Math.min(pMinZ,bbMinZ);
- bbMaxZ=Math.max(pMaxZ,bbMaxZ);
- }
- }
- this.setBlockBounds(bbMinX, bbMinY, bbMinZ, bbMaxX, bbMaxY, bbMaxZ);
- }
- }
- /*
+
@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);
- if(IC2.platform.isSimulating())
- {
+ public void setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z) {
+ TileEntity te = iBlockAccess.getTileEntity(x, y, z);
+ if (te != null && te instanceof AnchorTileEntity) {
AnchorTileEntity ate = (AnchorTileEntity) te;
- short facing = IHLUtils.getFacingFromPlayerView(player, true);
- System.out.println(ate.energyNetNodes[facing].getGridID());
- System.out.println(ate.getOfferedEnergy());
+ float portSize = 0.1f;
+ float bbMinX = 1f;
+ float bbMaxX = 0f;
+ float bbMinY = 1f;
+ float bbMaxY = 0f;
+ float bbMinZ = 1f;
+ float bbMaxZ = 0f;
+ for (short i = 0; i < 6; i++) {
+ if (ate.hasCableOnSide[i]) {
+ float pMinX = (float) (ate.energyNetNodes[i].getPortPos(null)[0] - portSize - x);
+ float pMaxX = (float) (ate.energyNetNodes[i].getPortPos(null)[0] + portSize - x);
+ float pMinY = (float) (ate.energyNetNodes[i].getPortPos(null)[1] - portSize - y);
+ float pMaxY = (float) (ate.energyNetNodes[i].getPortPos(null)[1] + portSize - y);
+ float pMinZ = (float) (ate.energyNetNodes[i].getPortPos(null)[2] - portSize - z);
+ float pMaxZ = (float) (ate.energyNetNodes[i].getPortPos(null)[2] + portSize - z);
+ bbMinX = Math.min(pMinX, bbMinX);
+ bbMaxX = Math.max(pMaxX, bbMaxX);
+ bbMinY = Math.min(pMinY, bbMinY);
+ bbMaxY = Math.max(pMaxY, bbMaxY);
+ bbMinZ = Math.min(pMinZ, bbMinZ);
+ bbMaxZ = Math.max(pMaxZ, bbMaxZ);
+ }
+ }
+ this.setBlockBounds(bbMinX, bbMinY, bbMinZ, bbMaxX, bbMaxY, bbMaxZ);
}
- return false;
- }*/
-
+ }
}
diff --git a/ihl/items_blocks/FlexibleCableItem.java b/ihl/items_blocks/FlexibleCableItem.java index 9944f4c..e7b7986 100644 --- a/ihl/items_blocks/FlexibleCableItem.java +++ b/ihl/items_blocks/FlexibleCableItem.java @@ -17,7 +17,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.IIcon;
+import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import ic2.api.energy.tile.IEnergyTile;
@@ -35,13 +35,8 @@ import ihl.utils.IHLUtils; public class FlexibleCableItem extends Item implements IWire {
- @SideOnly(Side.CLIENT)
- IIcon thickCopper, thinIron, thickIron, insulatedCopperRawruber, insulatedThickCopperRawruber,
- insulatedIronRawruber, insulatedThickIronRawruber, insulatedCopperRuber, insulatedThickCopperRuber,
- insulatedIronRuber, insulatedThickIronRuber;
public static FlexibleCableItem instance;
public final Set<String> yellowColoredWires = new HashSet<String>(3);
- public boolean isDataCable = false;
public FlexibleCableItem() {
super();
@@ -98,8 +93,8 @@ public class FlexibleCableItem extends Item implements IWire { if (world.isRemote)
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, "step.stone", 1.0F, 0.8F);
if (!world.isRemote && t != null
- && ((t instanceof IEnergyNetNode && !isDataCable)
- || (t instanceof IMultiPowerCableHolder && !isDataCable))
+ && ((t instanceof IEnergyNetNode)
+ || (t instanceof IMultiPowerCableHolder))
&& stack.stackTagCompound.getInteger("fullLength") >= 1) {
double ppx, ppy, ppz;
ICableHolder te;
@@ -381,7 +376,7 @@ public class FlexibleCableItem extends Item implements IWire { info.add("Insulation thickness: " + this.getInsulationThickness(itemStack) / 10f + " mm");
info.add("Insulation breakdown voltage: " + this.getVoltageLimit(itemStack) / 1000 + " kV");
}
-
+ info.add(StatCollector.translateToLocal("ihl.powerCableTooltip"));
}
}
@@ -399,35 +394,6 @@ public class FlexibleCableItem extends Item implements IWire { @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) {
this.itemIcon = par1IconRegister.registerIcon(IHLModInfo.MODID + ":copperWire");
- this.thickCopper = par1IconRegister.registerIcon(IHLModInfo.MODID + ":copperWire16x");
- this.thinIron = par1IconRegister.registerIcon(IHLModInfo.MODID + ":steelWire");
- this.thickIron = par1IconRegister.registerIcon(IHLModInfo.MODID + ":steelWire16x");
- this.insulatedIronRawruber = par1IconRegister.registerIcon(IHLModInfo.MODID + ":flexibleCableSteel2");
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public IIcon getIcon(ItemStack stack, int i) {
- if (stack.stackTagCompound != null) {
- if (this.getInsulationMaterial(stack).equals("null")) {
- if (this.getTransverseSection(stack) >= 240) {
- if (yellowColoredWires.contains(this.getMaterial(stack))) {
- return this.thickCopper;
- } else {
- return this.thickIron;
- }
- } else {
- if (yellowColoredWires.contains(this.getMaterial(stack))) {
- return this.itemIcon;
- } else {
- return this.thinIron;
- }
- }
- } else {
- return this.insulatedIronRawruber;
- }
- }
- return this.itemIcon;
}
@Override
diff --git a/ihl/items_blocks/IHLItemBlock.java b/ihl/items_blocks/IHLItemBlock.java index c25450d..499a88b 100644 --- a/ihl/items_blocks/IHLItemBlock.java +++ b/ihl/items_blocks/IHLItemBlock.java @@ -22,226 +22,196 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
-public class IHLItemBlock extends ItemBlock{
+public class IHLItemBlock extends ItemBlock {
public Map<Integer, String> nameMap = new HashMap<Integer, String>();
- public IHLItemBlock(Block block1)
- {
- super(block1);
- this.setFull3D();
+
+ public IHLItemBlock(Block block1) {
+ super(block1);
+ this.setFull3D();
this.setHasSubtypes(true);
- this.setCreativeTab(IHLCreativeTab.tab);
+ this.setCreativeTab(IHLCreativeTab.tab);
}
-
- @Override
- public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10)
- {
- Block block = world.getBlock(x, y, z);
-
- if (block == Blocks.snow_layer && (world.getBlockMetadata(x, y, z) & 7) < 1)
- {
- par7 = 1;
- }
- else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush)
- {
- if (par7 == 0)
- {
- --y;
- }
-
- if (par7 == 1)
- {
- ++y;
- }
-
- if (par7 == 2)
- {
- --z;
- }
-
- if (par7 == 3)
- {
- ++z;
- }
-
- if (par7 == 4)
- {
- --x;
- }
-
- if (par7 == 5)
- {
- ++x;
- }
- }
-
- if (par1ItemStack.stackSize == 0)
- {
- return false;
- }
- else if (!player.canPlayerEdit(x, y, z, par7, par1ItemStack))
- {
- return false;
- }
- else if (y == 255)
- {
- return false;
- }
- else if (world.canPlaceEntityOnSide(this.field_150939_a, x, y, z, false, par7, player, par1ItemStack))
- {
- int metadata = par1ItemStack.getItemDamage();
- int var13 = this.field_150939_a.onBlockPlaced(world, x, y, z, par7, par8, par9, par10, metadata);
-
- if (world.setBlock(x, y, z, this.field_150939_a, var13, 3))
- {
- if (world.getBlock(x, y, z) == this.field_150939_a)
- {
- this.field_150939_a.onBlockPlacedBy(world, x, y, z, player, par1ItemStack);
- this.field_150939_a.onPostBlockPlaced(world, x, y, z, var13);
- TileEntity tile=world.getTileEntity(x, y, z);
- if(tile instanceof IWrenchable && IC2.platform.isSimulating())
- {
- IWrenchable te=(IWrenchable)tile;
- int var6 = MathHelper.floor_double(player.rotationPitch * 4.0F / 360.0F + 0.5D) & 3;
- int l = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
- if(player.isSneaking())
- {
- if(var6==1)
- {
- te.setFacing((short) 0);
- }
- else if(var6==3)
- {
- te.setFacing((short) 1);
- }
- else
- {
-
- switch (l)
- {
- case 0:
- te.setFacing((short)3);
- break;
-
- case 1:
- te.setFacing((short)4);
- break;
-
- case 2:
- te.setFacing((short)2);
- break;
-
- case 3:
- te.setFacing((short)5);
- }
- }
- }
- else
- {
- if(var6==1)
- {
- te.setFacing((short) 1);
- }
- else if(var6==3)
- {
- te.setFacing((short) 0);
- }
- else
- {
-
- switch (l)
- {
- case 0:
- te.setFacing((short)2);
- break;
-
- case 1:
- te.setFacing((short)5);
- break;
-
- case 2:
- te.setFacing((short)3);
- break;
-
- case 3:
- te.setFacing((short)4);
- } }
- }
- }
- }
-
- world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, "step.stone", 1.0F, 0.8F);
- --par1ItemStack.stackSize;
- }
-
- return true;
- }
- else
- {
- return false;
- }
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public void registerIcons(IIconRegister par1IconRegister) {
- this.itemIcon = par1IconRegister.registerIcon(IHLModInfo.MODID + ":driverItem");
+
+ @Override
+ public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer player, World world, int x, int y, int z, int par7,
+ float par8, float par9, float par10) {
+ Block block = world.getBlock(x, y, z);
+
+ if (block == Blocks.snow_layer && (world.getBlockMetadata(x, y, z) & 7) < 1) {
+ par7 = 1;
+ } else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush) {
+ if (par7 == 0) {
+ --y;
+ }
+
+ if (par7 == 1) {
+ ++y;
+ }
+
+ if (par7 == 2) {
+ --z;
+ }
+
+ if (par7 == 3) {
+ ++z;
+ }
+
+ if (par7 == 4) {
+ --x;
+ }
+
+ if (par7 == 5) {
+ ++x;
+ }
}
-
- public Block getBlockContained()
- {
- return this.field_150939_a;
+
+ if (par1ItemStack.stackSize == 0) {
+ return false;
+ } else if (!player.canPlayerEdit(x, y, z, par7, par1ItemStack)) {
+ return false;
+ } else if (y == 255) {
+ return false;
+ } else if (world.canPlaceEntityOnSide(this.field_150939_a, x, y, z, false, par7, player, par1ItemStack)) {
+ int metadata = par1ItemStack.getItemDamage();
+ int var13 = this.field_150939_a.onBlockPlaced(world, x, y, z, par7, par8, par9, par10, metadata);
+
+ if (world.setBlock(x, y, z, this.field_150939_a, var13, 3)) {
+ if (world.getBlock(x, y, z) == this.field_150939_a) {
+ this.field_150939_a.onBlockPlacedBy(world, x, y, z, player, par1ItemStack);
+ this.field_150939_a.onPostBlockPlaced(world, x, y, z, var13);
+ TileEntity tile = world.getTileEntity(x, y, z);
+ if (tile instanceof IWrenchable && IC2.platform.isSimulating()) {
+ IWrenchable te = (IWrenchable) tile;
+ int var6 = MathHelper.floor_double(player.rotationPitch * 4.0F / 360.0F + 0.5D) & 3;
+ int l = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
+ if (player.isSneaking()) {
+ if (var6 == 1) {
+ te.setFacing((short) 0);
+ } else if (var6 == 3) {
+ te.setFacing((short) 1);
+ } else {
+
+ switch (l) {
+ case 0:
+ te.setFacing((short) 3);
+ break;
+
+ case 1:
+ te.setFacing((short) 4);
+ break;
+
+ case 2:
+ te.setFacing((short) 2);
+ break;
+
+ case 3:
+ te.setFacing((short) 5);
+ }
+ }
+ } else {
+ if (var6 == 1) {
+ te.setFacing((short) 1);
+ } else if (var6 == 3) {
+ te.setFacing((short) 0);
+ } else {
+
+ switch (l) {
+ case 0:
+ te.setFacing((short) 2);
+ break;
+
+ case 1:
+ te.setFacing((short) 5);
+ break;
+
+ case 2:
+ te.setFacing((short) 3);
+ break;
+
+ case 3:
+ te.setFacing((short) 4);
+ }
+ }
+ }
+ }
+ }
+
+ world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, "step.stone", 1.0F, 0.8F);
+ --par1ItemStack.stackSize;
+ }
+
+ return true;
+ } else {
+ return false;
}
-
- @Override
- @SideOnly(Side.CLIENT)
- public CreativeTabs getCreativeTab()
- {
- return this.field_150939_a.getCreativeTabToDisplayOn();
- }
-
+ }
+
@Override
- public String getUnlocalizedName(ItemStack stack)
- {
- if(!nameMap.isEmpty() && nameMap.containsKey(stack.getItemDamage()))
- {
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister par1IconRegister) {
+ this.itemIcon = par1IconRegister.registerIcon(IHLModInfo.MODID + ":sackItem");
+ }
+
+ public Block getBlockContained() {
+ return this.field_150939_a;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public CreativeTabs getCreativeTab() {
+ return this.field_150939_a.getCreativeTabToDisplayOn();
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack) {
+ if (!nameMap.isEmpty() && nameMap.containsKey(stack.getItemDamage())) {
return nameMap.get(stack.getItemDamage());
- }
- else
- {
+ } else {
return this.field_150939_a.getUnlocalizedName();
}
}
- @SuppressWarnings({ "rawtypes", "unchecked" })
+ @SuppressWarnings({ "rawtypes", "unchecked" })
@Override
- public void addInformation(ItemStack itemStack, EntityPlayer player, List info, boolean flag)
- {
- if(itemStack.stackTagCompound!=null && itemStack.stackTagCompound.hasKey("resultSuffix"))
- {
- String result_suffix = itemStack.stackTagCompound.getString("resultSuffix");
- if(StatCollector.canTranslate("ihl."+result_suffix))
- {
- result_suffix = StatCollector.translateToLocal("ihl."+result_suffix);
- }
- info.add(StatCollector.translateToLocal("result_of_molding")+result_suffix);
- if(itemStack.stackTagCompound.hasKey("isContainStearin") && itemStack.stackTagCompound.getBoolean("isContainStearin"))
- {
- info.add(StatCollector.translateToLocal("ihl.tooltip.step")+" 1: "+StatCollector.translateToLocal("remove_wax_using_muffle_furnace"));
- info.add(StatCollector.translateToLocal("ihl.tooltip.step")+" 2: "+StatCollector.translateToLocal("fill_from_top_with_molten_metal"));
- info.add(StatCollector.translateToLocal("ihl.tooltip.step")+" 3: "+StatCollector.translateToLocal("wait_for_10_seconds"));
- info.add(StatCollector.translateToLocal("ihl.tooltip.step")+" 4: "+StatCollector.translateToLocal("destroy_mold_to_get_results"));
-
- }
- else
- {
- info.add(StatCollector.translateToLocal("ihl.tooltip.step")+" 1: "+StatCollector.translateToLocal("fill_from_top_with_molten_metal"));
- info.add(StatCollector.translateToLocal("ihl.tooltip.step")+" 2: "+StatCollector.translateToLocal("wait_for_10_seconds"));
- info.add(StatCollector.translateToLocal("ihl.tooltip.step")+" 3: "+StatCollector.translateToLocal("destroy_mold_to_get_results"));
- }
- if(itemStack.stackTagCompound.hasKey("detonator_delay"))
- {
- info.add(StatCollector.translateToLocal("ihl.detonator_delay")+" "+itemStack.stackTagCompound.getInteger("detonator_delay")+StatCollector.translateToLocal("ihl.seconds"));
- }
- }
- }
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List info, boolean flag) {
+ if (itemStack.stackTagCompound != null) {
+ if (itemStack.stackTagCompound.hasKey("resultSuffix")) {
+ String result_suffix = itemStack.stackTagCompound.getString("resultSuffix");
+ if (StatCollector.canTranslate("ihl." + result_suffix)) {
+ result_suffix = StatCollector.translateToLocal("ihl." + result_suffix);
+ }
+ info.add(StatCollector.translateToLocal("result_of_molding") + result_suffix);
+ if (itemStack.stackTagCompound.hasKey("isContainStearin")
+ && itemStack.stackTagCompound.getBoolean("isContainStearin")) {
+ info.add(StatCollector.translateToLocal("ihl.tooltip.step") + " 1: "
+ + StatCollector.translateToLocal("remove_wax_using_muffle_furnace"));
+ info.add(StatCollector.translateToLocal("ihl.tooltip.step") + " 2: "
+ + StatCollector.translateToLocal("fill_from_top_with_molten_metal"));
+ info.add(StatCollector.translateToLocal("ihl.tooltip.step") + " 3: "
+ + StatCollector.translateToLocal("wait_for_10_seconds"));
+ info.add(StatCollector.translateToLocal("ihl.tooltip.step") + " 4: "
+ + StatCollector.translateToLocal("destroy_mold_to_get_results"));
+
+ } else {
+ info.add(StatCollector.translateToLocal("ihl.tooltip.step") + " 1: "
+ + StatCollector.translateToLocal("fill_from_top_with_molten_metal"));
+ info.add(StatCollector.translateToLocal("ihl.tooltip.step") + " 2: "
+ + StatCollector.translateToLocal("wait_for_10_seconds"));
+ info.add(StatCollector.translateToLocal("ihl.tooltip.step") + " 3: "
+ + StatCollector.translateToLocal("destroy_mold_to_get_results"));
+ }
+
+ }
+ if (itemStack.stackTagCompound.hasKey("detonator_delay")) {
+ info.add(StatCollector.translateToLocal("ihl.detonator_delay") + " "
+ + itemStack.stackTagCompound.getInteger("detonator_delay") + " "
+ + StatCollector.translateToLocal("ihl.seconds"));
+ }
+ if (itemStack.stackTagCompound.hasKey("explosionPower")) {
+ info.add(StatCollector.translateToLocal("ihl.explosionPower") + " "
+ + itemStack.stackTagCompound.getInteger("explosionPower") + " "
+ + StatCollector.translateToLocal("ihl.mTNT"));
+ }
+ }
+ }
}
diff --git a/ihl/items_blocks/IHLTool.java b/ihl/items_blocks/IHLTool.java index 4e51b5b..4a4c662 100644 --- a/ihl/items_blocks/IHLTool.java +++ b/ihl/items_blocks/IHLTool.java @@ -33,7 +33,6 @@ import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.reactor.IReactor;
-import ic2.core.Ic2Items;
import ihl.IHLCreativeTab;
import ihl.IHLModInfo;
import ihl.flexible_cable.SetOfDiesMiniGUI;
@@ -119,14 +118,6 @@ public class IHLTool extends Item implements IItemHasMiniGUI{ public static void init()
{
- if(IHLUtils.getFirstOreDictName(Ic2Items.bronzeAxe).equals(""))
- {
- OreDictionary.registerOre("craftingToolAxe", Ic2Items.bronzeAxe.getItem());
- }
- if(IHLUtils.getFirstOreDictName(Ic2Items.bronzePickaxe).equals(""))
- {
- OreDictionary.registerOre("craftingToolPickaxe", Ic2Items.bronzePickaxe.getItem());
- }
IHLTool item = new IHLTool();
GameRegistry.registerItem(item,item.getUnlocalizedName());
Type[] var1 = Type.values();
diff --git a/ihl/items_blocks/ItemSubstance.java b/ihl/items_blocks/ItemSubstance.java index 7404a54..30ef694 100644 --- a/ihl/items_blocks/ItemSubstance.java +++ b/ihl/items_blocks/ItemSubstance.java @@ -271,8 +271,6 @@ public class ItemSubstance extends Item implements IItemHasMiniGUI { CrushedPurifiedCinnabar(109, "crushedPurifiedCinnabar", true, "HgS"),
CrushedCinnabar(108, "crushedCinnabar", true, "HgS"),
OvenRawPorcelain(107, "ovenRawPorcelain"),
- PrecipitatorCondenserRawPorcelain(106, "precipitatorCondenserRawPorcelain"),
- ChimneyKneeRawPorcelain(105, "chimneyKneeRawPorcelain"),
TungstenDust(104, "dustTungsten", true, "W"),
ElectrolysisBathPorcelain(103, "electrolysisBathPorcelain"),
ElectrolysisBathRawPorcelain(102, "electrolysisBathRawPorcelain"),
diff --git a/ihl/items_blocks/MachineBaseBlock.java b/ihl/items_blocks/MachineBaseBlock.java index 80bcd5a..a2d2a98 100644 --- a/ihl/items_blocks/MachineBaseBlock.java +++ b/ihl/items_blocks/MachineBaseBlock.java @@ -20,12 +20,10 @@ import ihl.processing.chemistry.FractionatorBottomTileEntity; import ihl.processing.chemistry.FractionatorCoverTileEntity;
import ihl.processing.chemistry.FractionatorSectionTileEntity;
import ihl.processing.chemistry.GaedesMercuryRotaryPumpTileEntity;
-import ihl.processing.chemistry.GoldChimneyKneeTileEntity;
import ihl.processing.chemistry.LabElectrolyzerTileEntity;
import ihl.processing.chemistry.LeadOvenTileEntity;
import ihl.processing.chemistry.LoomTileEntity;
import ihl.processing.chemistry.PaperMachineTileEntity;
-import ihl.processing.chemistry.PrecipitatorCondenserTileEntity;
import ihl.processing.chemistry.RefluxCondenserTileEntity;
import ihl.processing.metallurgy.AchesonFurnanceTileEntity;
import ihl.processing.metallurgy.CoilerTileEntity;
@@ -93,28 +91,8 @@ public class MachineBaseBlock extends Block implements ITileEntityProvider{ textureFrontMachineCasing,
textureFrontPaperMachine,
textureBackMachineCasing,
- frequencyGeneratorBack,
- frequencyGeneratorBottom,
- frequencyGeneratorFront,
- frequencyGeneratorLeft,
- frequencyGeneratorRight,
- frequencyGeneratorTop,
bronzeTubTop,
bronzeTubSide,
- glassBoxTop,
- glassBoxSide,
- glassBoxBottom,
- glassBoxInnerSide,
- glassBoxInnerBottom,
- vacuumInductionMeltingFurnaceFront,
- vacuumInductionMeltingFurnaceBack,
- vacuumInductionMeltingFurnaceLeft,
- vacuumInductionMeltingFurnaceRight,
- hydrotransportPulpRegeneratorFront,
- hydrotransportPulpRegeneratorBack,
- redstoneSignalConverterEmitterSide,
- redstoneSignalConverterEmptySide,
- redstoneSignalConverterSensorSide,
steel,
redPaint,
greenPaint,
@@ -286,28 +264,8 @@ public class MachineBaseBlock extends Block implements ITileEntityProvider{ this.textureBackCryogenicDistiller = par1IconRegister.registerIcon(IHLModInfo.MODID + ":cryogenicDistillerInputSide");
this.textureFrontChemicalReactor = par1IconRegister.registerIcon(IHLModInfo.MODID + ":chemicalReactorOutputSide");
this.textureFrontPaperMachine = par1IconRegister.registerIcon(IHLModInfo.MODID + ":paperMachineFront");
- this.frequencyGeneratorBack = par1IconRegister.registerIcon(IHLModInfo.MODID + ":frequencyGeneratorBack");
- this.frequencyGeneratorFront = par1IconRegister.registerIcon(IHLModInfo.MODID + ":frequencyGeneratorFront");
- this.frequencyGeneratorTop = par1IconRegister.registerIcon(IHLModInfo.MODID + ":frequencyGeneratorTop");
- this.frequencyGeneratorLeft = par1IconRegister.registerIcon(IHLModInfo.MODID + ":frequencyGeneratorLeft");
- this.frequencyGeneratorRight = par1IconRegister.registerIcon(IHLModInfo.MODID + ":frequencyGeneratorRight");
- this.frequencyGeneratorBottom = par1IconRegister.registerIcon(IHLModInfo.MODID + ":frequencyGeneratorBottom");
this.bronzeTubTop = par1IconRegister.registerIcon(IHLModInfo.MODID + ":tubBronzeTop");
this.bronzeTubSide = par1IconRegister.registerIcon(IHLModInfo.MODID + ":tubBronzeSide");
- this.glassBoxBottom = par1IconRegister.registerIcon(IHLModInfo.MODID + ":glassBoxBottom");
- this.glassBoxInnerBottom = par1IconRegister.registerIcon(IHLModInfo.MODID + ":glassBoxInnerBottom");
- this.glassBoxInnerSide = par1IconRegister.registerIcon(IHLModInfo.MODID + ":glassBoxInnerSide");
- this.glassBoxSide = par1IconRegister.registerIcon(IHLModInfo.MODID + ":glassBoxSide");
- this.glassBoxTop = par1IconRegister.registerIcon(IHLModInfo.MODID + ":glassBoxTop");
- this.vacuumInductionMeltingFurnaceFront = par1IconRegister.registerIcon(IHLModInfo.MODID + ":vacuumInductionMeltingFurnaceFront");
- this.vacuumInductionMeltingFurnaceBack = par1IconRegister.registerIcon(IHLModInfo.MODID + ":vacuumInductionMeltingFurnaceBack");
- this.vacuumInductionMeltingFurnaceLeft = par1IconRegister.registerIcon(IHLModInfo.MODID + ":vacuumInductionMeltingFurnaceLeft");
- this.vacuumInductionMeltingFurnaceRight = par1IconRegister.registerIcon(IHLModInfo.MODID + ":vacuumInductionMeltingFurnaceRight");
- this.hydrotransportPulpRegeneratorFront = par1IconRegister.registerIcon(IHLModInfo.MODID + ":hydrotransportPulpRegeneratorFront");
- this.hydrotransportPulpRegeneratorBack = par1IconRegister.registerIcon(IHLModInfo.MODID + ":hydrotransportPulpRegeneratorBack");
- this.redstoneSignalConverterEmitterSide = par1IconRegister.registerIcon(IHLModInfo.MODID + ":redstoneSignalConverterEmitterSide");
- this.redstoneSignalConverterEmptySide = par1IconRegister.registerIcon(IHLModInfo.MODID + ":redstoneSignalConverterEmptySide");
- this.redstoneSignalConverterSensorSide = par1IconRegister.registerIcon(IHLModInfo.MODID + ":redstoneSignalConverterSensorSide");
this.steel = par1IconRegister.registerIcon(IHLModInfo.MODID + ":steel");
this.redPaint = par1IconRegister.registerIcon(IHLModInfo.MODID + ":redPaint");
this.greenPaint = par1IconRegister.registerIcon(IHLModInfo.MODID + ":greenPaint");
@@ -647,8 +605,6 @@ public class MachineBaseBlock extends Block implements ITileEntityProvider{ Coiler("coiler",CoilerTileEntity.class, false, new ItemStack(Items.stick)),
Lathe1("lathePart1",LathePart1TileEntity.class, false, IHLUtils.getThisModItemStack("stickSteel")),
Lathe2("lathePart2",LathePart2TileEntity.class, false, IHLUtils.getOreDictItemStack("plateSteel")),
- PrecipitatorCondenser("goldPrecipitatorCondenser",PrecipitatorCondenserTileEntity.class, false, IHLUtils.getThisModItemStack("dustPorcelain")),
- GoldChimneyKnee("goldChimneyKnee",GoldChimneyKneeTileEntity.class, false, IHLUtils.getThisModItemStack("dustPorcelain")),
LeadOven("leadOven",LeadOvenTileEntity.class, true, IHLUtils.getThisModItemStack("dustPorcelain")),
DetonationSprayingMachine("cannonBronze",DetonationSprayingMachineTileEntity.class, false, new ItemStack(Items.stick)),
BronzeTub("tubBronze",ImpregnatingMachineTileEntity.class, false, true, null),
diff --git a/ihl/model/FlexibleCableItemRender.java b/ihl/model/FlexibleCableItemRender.java index 02fc5f7..71a8337 100644 --- a/ihl/model/FlexibleCableItemRender.java +++ b/ihl/model/FlexibleCableItemRender.java @@ -109,11 +109,7 @@ public class FlexibleCableItemRender implements IItemRenderer { GL11.glRotatef(360f / this.segmentsAmount, 1f, 0f, 0f);
GL11.glTranslatef(0.004f, 0f, 0f);
GL11.glRotatef(spiralStepAngle, 0f, 0f, 1f);
- if (((FlexibleCableItem) stack.getItem()).isDataCable) {
- GL11.glColor3f(1f, 0.2f, 0f);
- } else {
- GL11.glColor3f(1f, 1f, 1f);
- }
+ GL11.glColor3f(1f, 1f, 1f);
if (i == 0) {
if (isNoInsulation(stack)) {
if (FlexibleCableItem.instance.yellowColoredWires
@@ -163,9 +159,7 @@ public class FlexibleCableItemRender implements IItemRenderer { }
private int getCableType(ItemStack stack) {
- if (((FlexibleCableItem) stack.getItem()).isDataCable) {
- return 3;
- } else if (isNoInsulation(stack)) {
+ if (isNoInsulation(stack)) {
if (FlexibleCableItem.instance.yellowColoredWires.contains(FlexibleCableItem.instance.getMaterial(stack))) {
return 1;
} else {
@@ -176,7 +170,6 @@ public class FlexibleCableItemRender implements IItemRenderer { }
private boolean isNoInsulation(ItemStack stack) {
- return stack.stackTagCompound != null && FlexibleCableItem.instance.getInsulationMaterial(stack).equals("null")
- && !((FlexibleCableItem) stack.getItem()).isDataCable;
+ return stack.stackTagCompound != null && FlexibleCableItem.instance.getInsulationMaterial(stack).equals("null");
}
}
\ No newline at end of file diff --git a/ihl/model/MultiMetaBlockRender.java b/ihl/model/MultiMetaBlockRender.java deleted file mode 100644 index c995989..0000000 --- a/ihl/model/MultiMetaBlockRender.java +++ /dev/null @@ -1,76 +0,0 @@ -package ihl.model;
-
-import org.lwjgl.opengl.GL11;
-
-import net.minecraft.block.Block;
-import net.minecraft.client.renderer.RenderBlocks;
-import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.world.IBlockAccess;
-import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
-import cpw.mods.fml.client.registry.RenderingRegistry;
-
-public class MultiMetaBlockRender implements ISimpleBlockRenderingHandler
-{
- public final static int renderId = RenderingRegistry.getNextAvailableRenderId();
-
- @Override
- public int getRenderId()
- {
- return renderId;
- }
-
- @Override
- public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderblocks)
- {
- Tessellator tessellator = Tessellator.instance;
- block.setBlockBoundsForItemRender();
- renderblocks.setRenderBoundsFromBlock(block);
- GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, -1.0F, 0.0F);
- renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderblocks.getBlockIconFromSideAndMetadata(block, 0, metadata));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 1.0F, 0.0F);
- renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderblocks.getBlockIconFromSideAndMetadata(block, 1, metadata));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F, -1.0F);
- renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderblocks.getBlockIconFromSideAndMetadata(block, 2, metadata));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F, 1.0F);
- renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderblocks.getBlockIconFromSideAndMetadata(block, 3, metadata));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(-1.0F, 0.0F, 0.0F);
- renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderblocks.getBlockIconFromSideAndMetadata(block, 4, metadata));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(1.0F, 0.0F, 0.0F);
- renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderblocks.getBlockIconFromSideAndMetadata(block, 5, metadata));
- tessellator.draw();
- GL11.glTranslatef(0.5F, 0.5F, 0.5F);
- }
-
- @Override
- public boolean renderWorldBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int meta, RenderBlocks blockRenderer)
- {
- blockRenderer.renderStandardBlock(block, x, y, z);
- Tessellator var5 = Tessellator.instance;
- var5.setBrightness(block.getMixedBrightnessForBlock(blockAccess, x, y, z));
- int var6 = block.colorMultiplier(blockAccess, x, y, z);
- float var7 = (var6 >> 16 & 255) / 255.0F;
- float var8 = (var6 >> 8 & 255) / 255.0F;
- float var9 = (var6 & 255) / 255.0F;
- var5.setColorOpaque_F(var7, var8, var9);
- return true;
- }
-
- @Override
- public boolean shouldRender3DInInventory(int arg0)
- {
- return true;
- }
-}
diff --git a/ihl/model/RenderBlocksExt.java b/ihl/model/RenderBlocksExt.java new file mode 100644 index 0000000..6415059 --- /dev/null +++ b/ihl/model/RenderBlocksExt.java @@ -0,0 +1,67 @@ +package ihl.model; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; + +public class RenderBlocksExt extends RenderBlocks { + + public RenderBlocksExt(IBlockAccess blockAccess) { + super(blockAccess); + } + + @Override + public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) + { + this.brightnessTopLeft=16711935; + this.brightnessTopRight=16711935; + super.renderFaceYNeg(block,x,y,z,icon); + } + + public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) + { + if (this.enableAO) + { + System.out.println("AO is on"); + } + else + { + System.out.println("AO is off"); + } + + this.brightnessTopLeft=16711935; + this.brightnessTopRight=16711935; + super.renderFaceYPos(block, x, y, z, icon); + } + + public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) + { + this.brightnessTopLeft=16711935; + this.brightnessTopRight=16711935; + super.renderFaceZNeg(block, x, y, z, icon); + } + + public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) + { + this.brightnessTopLeft=16711935; + this.brightnessTopRight=16711935; + super.renderFaceZPos(block, x, y, z, icon); + } + + public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) + { + this.brightnessTopLeft=16711935; + this.brightnessTopRight=16711935; + super.renderFaceXNeg(block, x, y, z, icon); + } + + public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) + { + this.brightnessTopLeft=16711935; + this.brightnessTopRight=16711935; + super.renderFaceXPos(block, x, y, z, icon); + } + + +} diff --git a/ihl/nei_integration/AchesonFurnaceRecipeHandler.java b/ihl/nei_integration/AchesonFurnaceRecipeHandler.java index 8571f3a..f359c1c 100644 --- a/ihl/nei_integration/AchesonFurnaceRecipeHandler.java +++ b/ihl/nei_integration/AchesonFurnaceRecipeHandler.java @@ -1,17 +1,12 @@ package ihl.nei_integration;
import java.awt.Rectangle;
-import java.util.ArrayList;
-import java.util.List;
import java.util.Map;
-import codechicken.nei.PositionedStack;
import ihl.processing.metallurgy.AchesonFurnaceGui;
import ihl.processing.metallurgy.AchesonFurnanceTileEntity;
-import ihl.recipes.RecipeInputOreDictionaryList;
import ihl.recipes.UniversalRecipeInput;
import ihl.recipes.UniversalRecipeOutput;
-import ihl.utils.IHLUtils;
import net.minecraft.client.gui.inventory.GuiContainer;
@@ -26,25 +21,25 @@ public class AchesonFurnaceRecipeHandler extends MachineRecipeHandler @Override
protected int[] getInputPosX()
{
- return new int[]{34-5,34-5};
+ return new int[]{40-5,40-5};
}
@Override
protected int[] getInputPosY()
{
- return new int[]{41-11,23-11};
+ return new int[]{40-11,22-11};
}
@Override
protected int[] getOutputPosX()
{
- return new int[]{107-5,107-5};
+ return new int[]{98-5};
}
@Override
protected int[] getOutputPosY()
{
- return new int[]{41-11,23-11};
+ return new int[]{32-11};
}
@Override
@@ -62,13 +57,13 @@ public class AchesonFurnaceRecipeHandler extends MachineRecipeHandler @Override
public String getGuiTexture()
{
- return "ihl:textures/gui/GUIAchesonFurnaceNEI.png";
+ return "ihl:textures/gui/GUIAchesonFurnace.png";
}
@Override
public void loadTransferRects()
{
- this.transferRects.add(new RecipeTransferRect(new Rectangle(40-5, 55-11, 90, 30), this.getRecipeId(), new Object[0]));
+ this.transferRects.add(new RecipeTransferRect(new Rectangle(57-5, 29-11, 40, 30), this.getRecipeId(), new Object[0]));
}
@Override
@@ -82,17 +77,4 @@ public class AchesonFurnaceRecipeHandler extends MachineRecipeHandler {
return AchesonFurnanceTileEntity.getRecipes();
}
-
- @Override
- public List<PositionedStack> getAdditionalIngredients()
- {
- List<PositionedStack> ps = new ArrayList<PositionedStack>();
- RecipeInputOreDictionaryList ari = new RecipeInputOreDictionaryList(new String[] {"stickCoal","stickGraphite"});
- ps.add(new PositionedStack(ari.getInputs(),16-5,41-11));
- ps.add(new PositionedStack(ari.getInputs(),52-5,41-11));
- ps.add(new PositionedStack(IHLUtils.getOreDictItemStack("stickGraphite"),89-5,41-11));
- ps.add(new PositionedStack(IHLUtils.getOreDictItemStack("stickGraphite"),125-5,41-11));
- return ps;
- }
-
}
diff --git a/ihl/nei_integration/ChimneyKneeRecipeHandler.java b/ihl/nei_integration/ChimneyKneeRecipeHandler.java deleted file mode 100644 index d60c251..0000000 --- a/ihl/nei_integration/ChimneyKneeRecipeHandler.java +++ /dev/null @@ -1,73 +0,0 @@ -package ihl.nei_integration;
-
-import java.util.Map;
-
-import ihl.processing.chemistry.GoldChimneyKneeTileEntity;
-import ihl.recipes.UniversalRecipeInput;
-import ihl.recipes.UniversalRecipeOutput;
-import net.minecraft.client.gui.inventory.GuiContainer;
-
-
-public class ChimneyKneeRecipeHandler extends MachineRecipeHandler
-{
- @Override
- public Class <? extends GuiContainer > getGuiClass()
- {
- return null;
- }
-
- @Override
- protected int[] getInputPosX()
- {
- return new int[]{6-5,6-5,106-5};
- }
-
- @Override
- protected int[] getInputPosY()
- {
- return new int[]{33-11,53-11};
- }
-
- @Override
- protected int[] getOutputPosX()
- {
- return new int[]{96-5};
- }
-
- @Override
- protected int[] getOutputPosY()
- {
- return new int[]{35-11,31-11};
- }
-
-
- @Override
- public String getRecipeName()
- {
- return "Chimney knee";
- }
-
- @Override
- public String getRecipeId()
- {
- return "ihl.chimneyKnee";
- }
-
- @Override
- public String getGuiTexture()
- {
- return "ihl:textures/gui/GUIChimneyKneeNEI.png";
- }
-
- @Override
- public String getOverlayIdentifier()
- {
- return "chimneyKnee";
- }
-
- @Override
- public Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipeList()
- {
- return GoldChimneyKneeTileEntity.getRecipes();
- }
-}
diff --git a/ihl/nei_integration/LeadOvenRecipeHandler.java b/ihl/nei_integration/LeadOvenRecipeHandler.java index 5c43f9e..5c376fd 100644 --- a/ihl/nei_integration/LeadOvenRecipeHandler.java +++ b/ihl/nei_integration/LeadOvenRecipeHandler.java @@ -3,98 +3,86 @@ package ihl.nei_integration; import java.awt.Rectangle;
import java.util.Map;
-import codechicken.lib.gui.GuiDraw;
import ihl.processing.chemistry.LeadOvenGui;
import ihl.processing.chemistry.LeadOvenTileEntity;
import ihl.recipes.UniversalRecipeInput;
import ihl.recipes.UniversalRecipeOutput;
import net.minecraft.client.gui.inventory.GuiContainer;
+public class LeadOvenRecipeHandler extends MachineRecipeHandler {
+ @Override
+ public Class<? extends GuiContainer> getGuiClass() {
+ return LeadOvenGui.class;
+ }
-public class LeadOvenRecipeHandler extends MachineRecipeHandler
-{
- @Override
- public Class <? extends GuiContainer > getGuiClass()
- {
- return LeadOvenGui.class;
- }
-
- @Override
- protected int[] getInputPosX()
- {
- return new int[]{47-5,65-5};
- }
-
- @Override
- protected int[] getInputPosY()
- {
- return new int[]{17-11};
- }
-
- @Override
- protected int[] getOutputPosX()
- {
- return new int[]{112-5};
- }
-
- @Override
- protected int[] getOutputPosY()
- {
- return new int[]{35-11};
- }
-
- @Override
- protected int[] getFluidOutputPosX()
- {
- return new int[]{112-5};
- }
-
- @Override
- protected int[] getFluidOutputPosY()
- {
- return new int[]{17-11};
- }
-
- @Override
- public String getRecipeName()
- {
- return "Chemically resistant oven";
- }
-
- @Override
- public String getRecipeId()
- {
- return "ihl.leadOven";
- }
-
- @Override
- public String getGuiTexture()
- {
- return "ihl:textures/gui/GUILeadOven.png";
- }
-
- @Override
- public String getOverlayIdentifier()
- {
- return "leadOven";
- }
-
- @Override
- public void drawBackground(int i)
- {
- super.drawBackground(i);
- GuiDraw.drawTexturedModalRect(107-5, 16-11, 199, 0, 26, 18);
- }
-
- @Override
- public void loadTransferRects()
- {
- this.transferRects.add(new RecipeTransferRect(new Rectangle(80-10, 35-10, 22, 15), this.getRecipeId(), new Object[0]));
- }
-
- @Override
- public Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipeList()
- {
- return LeadOvenTileEntity.getRecipes();
- }
+ @Override
+ protected int[] getInputPosX() {
+ return new int[] { 47 - 5, 65 - 5 };
+ }
+
+ @Override
+ protected int[] getInputPosY() {
+ return new int[] { 17 - 11 };
+ }
+
+ @Override
+ protected int[] getOutputPosX() {
+ return new int[] { 112 - 5 };
+ }
+
+ @Override
+ protected int[] getOutputPosY() {
+ return new int[] { 35 - 11 };
+ }
+
+ @Override
+ protected int[] getFluidOutputPosX() {
+ return new int[] { 9 - 5 };
+ }
+
+ @Override
+ protected int[] getFluidOutputPosY() {
+ return new int[] { 53 - 11 };
+ }
+
+ @Override
+ protected int[] getFluidInputPosX() {
+ return new int[] { 9 - 5 };
+ }
+
+ @Override
+ protected int[] getFluidInputPosY() {
+ return new int[] { 17 - 11 };
+ }
+
+ @Override
+ public String getRecipeName() {
+ return "Chemical oven";
+ }
+
+ @Override
+ public String getRecipeId() {
+ return "ihl.leadOven";
+ }
+
+ @Override
+ public String getGuiTexture() {
+ return "ihl:textures/gui/GUILeadOven.png";
+ }
+
+ @Override
+ public String getOverlayIdentifier() {
+ return "leadOven";
+ }
+
+ @Override
+ public void loadTransferRects() {
+ this.transferRects.add(
+ new RecipeTransferRect(new Rectangle(80 - 10, 35 - 10, 22, 15), this.getRecipeId(), new Object[0]));
+ }
+
+ @Override
+ public Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipeList() {
+ return LeadOvenTileEntity.getRecipes();
+ }
}
diff --git a/ihl/nei_integration/MuffleFurnaceRecipeHandler.java b/ihl/nei_integration/MuffleFurnaceRecipeHandler.java index 46ba9a7..bd57d64 100644 --- a/ihl/nei_integration/MuffleFurnaceRecipeHandler.java +++ b/ihl/nei_integration/MuffleFurnaceRecipeHandler.java @@ -22,25 +22,25 @@ public class MuffleFurnaceRecipeHandler extends MachineRecipeHandler @Override
protected int[] getInputPosX()
{
- return new int[]{51-5,69-5};
+ return new int[]{40-5,40-5};
}
@Override
protected int[] getInputPosY()
{
- return new int[]{34-11};
+ return new int[]{40-11,22-11};
}
@Override
protected int[] getOutputPosX()
{
- return new int[]{105-5,123-5};
+ return new int[]{98-5};
}
-
+
@Override
protected int[] getOutputPosY()
{
- return new int[]{34-11};
+ return new int[]{32-11};
}
@Override
@@ -58,7 +58,7 @@ public class MuffleFurnaceRecipeHandler extends MachineRecipeHandler @Override
public String getGuiTexture()
{
- return "ihl:textures/gui/GUIMuffleFurnace.png";
+ return "ihl:textures/gui/GUIAchesonFurnace.png";
}
@Override
@@ -70,7 +70,7 @@ public class MuffleFurnaceRecipeHandler extends MachineRecipeHandler @Override
public void loadTransferRects()
{
- this.transferRects.add(new RecipeTransferRect(new Rectangle(40-5, 55-11, 55, 15), this.getRecipeId(), new Object[0]));
+ this.transferRects.add(new RecipeTransferRect(new Rectangle(57-5, 29-11, 40, 30), this.getRecipeId(), new Object[0]));
}
diff --git a/ihl/nei_integration/NEIIHLConfig.java b/ihl/nei_integration/NEIIHLConfig.java index 288ab24..8047b27 100644 --- a/ihl/nei_integration/NEIIHLConfig.java +++ b/ihl/nei_integration/NEIIHLConfig.java @@ -95,10 +95,6 @@ public class NEIIHLConfig implements IConfigureNEI API.registerUsageHandler(new CrucibleRecipeHandler());
API.registerRecipeHandler(new FractionationColumnRecipeHandler());
API.registerUsageHandler(new FractionationColumnRecipeHandler());
- API.registerRecipeHandler(new ChimneyKneeRecipeHandler());
- API.registerUsageHandler(new ChimneyKneeRecipeHandler());
- API.registerRecipeHandler(new PrecipitatorCondenserRecipeHandler());
- API.registerUsageHandler(new PrecipitatorCondenserRecipeHandler());
API.registerRecipeHandler(new IronWorkbenchRecipeHandler());
API.registerUsageHandler(new IronWorkbenchRecipeHandler());
this.addSubsets();
diff --git a/ihl/nei_integration/PrecipitatorCondenserRecipeHandler.java b/ihl/nei_integration/PrecipitatorCondenserRecipeHandler.java deleted file mode 100644 index 1b771fc..0000000 --- a/ihl/nei_integration/PrecipitatorCondenserRecipeHandler.java +++ /dev/null @@ -1,67 +0,0 @@ -package ihl.nei_integration;
-
-import java.awt.Rectangle;
-import java.util.Map;
-
-import ihl.processing.chemistry.PrecipitatorCondenserTileEntity;
-import ihl.recipes.UniversalRecipeInput;
-import ihl.recipes.UniversalRecipeOutput;
-import net.minecraft.client.gui.inventory.GuiContainer;
-
-public class PrecipitatorCondenserRecipeHandler extends MachineRecipeHandler {
- @Override
- public Class<? extends GuiContainer> getGuiClass() {
- return null;
- }
-
- @Override
- protected int[] getInputPosX() {
- return new int[] { 6 - 5, 6 - 5, 106 - 5 };
- }
-
- @Override
- protected int[] getInputPosY() {
- return new int[] { 33 - 11, 53 - 11 };
- }
-
- @Override
- protected int[] getOutputPosX() {
- return new int[] { 75 - 5 };
- }
-
- @Override
- protected int[] getOutputPosY() {
- return new int[] { 53 - 11, 31 - 11 };
- }
-
- @Override
- public String getRecipeName() {
- return "Precipitator/Condenser";
- }
-
- @Override
- public String getRecipeId() {
- return "ihl.precipitatorCondenser";
- }
-
- @Override
- public String getGuiTexture() {
- return "ihl:textures/gui/GUICondenserNEI.png";
- }
-
- @Override
- public String getOverlayIdentifier() {
- return "condenser";
- }
-
- @Override
- public void loadTransferRects() {
- this.transferRects
- .add(new RecipeTransferRect(new Rectangle(23 - 5, 10 - 10, 50, 58), this.getRecipeId(), new Object[0]));
- }
-
- @Override
- public Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipeList() {
- return PrecipitatorCondenserTileEntity.getRecipes();
- }
-}
diff --git a/ihl/processing/chemistry/AbsorberCoolerModel.java b/ihl/processing/chemistry/AbsorberCoolerModel.java deleted file mode 100644 index 7dac4c9..0000000 --- a/ihl/processing/chemistry/AbsorberCoolerModel.java +++ /dev/null @@ -1,78 +0,0 @@ -package ihl.processing.chemistry; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; - -public class AbsorberCoolerModel extends ModelBase -{ - //fields - ModelRenderer Base; - - public AbsorberCoolerModel() - { - textureWidth = 64; - textureHeight = 32; - setTextureOffset("Base.Shape1", 26, 0); - setTextureOffset("Base.Shape2", 0, 17); - setTextureOffset("Base.Shape4", 30, 16); - setTextureOffset("Base.Shape3", 0, 15); - setTextureOffset("Base.Shape5", 2, 12); - setTextureOffset("Base.Shape6", 0, 2); - setTextureOffset("Base.Shape7", 24, 4); - setTextureOffset("Base.Shape8", 50, 0); - setTextureOffset("Base.Shape9", 0, 0); - setTextureOffset("Base.Shape10", 0, 0); - setTextureOffset("Base.Shape11", 0, 0); - setTextureOffset("Base.Shape12", 0, 0); - setTextureOffset("Base.Shape13", 0, 0); - setTextureOffset("Base.Shape14", 0, 0); - setTextureOffset("Base.Shape15", 0, 0); - setTextureOffset("Base.Shape16", 0, 0); - setTextureOffset("Base.Shape17", 0, 0); - setTextureOffset("Base.Shape18", 0, 0); - setTextureOffset("Base.Shape19", 0, 0); - setTextureOffset("Base.Shape20", 0, 0); - setTextureOffset("Base.Shape21", 0, 0); - setTextureOffset("Base.Shape22", 0, 0); - setTextureOffset("Base.Shape23", 0, 24); - setTextureOffset("Base.Shape24", 7, 12); - setTextureOffset("Base.Shape25", 21, 8); - setTextureOffset("Base.Shape26", 12, 24); - setTextureOffset("Base.Shape27", 0, 0); - setTextureOffset("Base.Shape28", 0, 18); - setTextureOffset("Base.Shape29", 21, 0); - - Base = new ModelRenderer(this, "Base"); - Base.setRotationPoint(0F, 23F, 0F); - Base.mirror = true; - Base.addBox("Shape1", 6F, -14F, -7F, 1, 14, 14); - Base.addBox("Shape2", -7F, -1F, -8F, 14, 1, 1); - Base.addBox("Shape4", 6F, -14F, -8F, 1, 13, 1); - Base.addBox("Shape3", -7F, -1F, 7F, 14, 1, 1); - Base.addBox("Shape5", -7F, -15F, -8F, 6, 1, 16); - Base.addBox("Shape6", -7F, -14F, 7F, 1, 13, 1); - Base.addBox("Shape7", -7F, -14F, -7F, 1, 14, 14); - Base.addBox("Shape8", -7F, -14F, -8F, 1, 13, 1); - Base.addBox("Shape9", 1F, 0F, -8F, 7, 1, 16); - Base.addBox("Shape10", 6F, -14F, 7F, 1, 13, 1); - Base.addBox("Shape11", 3.5F, -13F, -7F, 1, 1, 14); - Base.addBox("Shape12", 1.5F, -13F, -7F, 1, 1, 14); - Base.addBox("Shape13", -2.5F, -13F, -7F, 1, 1, 14); - Base.addBox("Shape14", -4.5F, -13F, -7F, 1, 1, 14); - Base.addBox("Shape15", -0.5F, -13F, -7F, 1, 1, 14); - Base.addBox("Shape16", -6F, -12.5F, -1.5F, 12, 1, 1); - Base.addBox("Shape17", -6F, -12.5F, -3.5F, 12, 1, 1); - Base.addBox("Shape18", -6F, -12.5F, -5.5F, 12, 1, 1); - Base.addBox("Shape19", -6F, -12.5F, 0.5F, 12, 1, 1); - Base.addBox("Shape20", -6F, -12.5F, 2.5F, 12, 1, 1); - Base.addBox("Shape21", -6F, -12.5F, 4.5F, 12, 1, 1); - Base.addBox("Shape22", -6F, 9F, 7F, 12, 2, 1); - Base.addBox("Shape23", -6F, -14F, -8F, 12, 2, 1); - Base.addBox("Shape24", 1F, -15F, -8F, 6, 1, 16); - Base.addBox("Shape25", -1F, -15F, 1F, 2, 1, 7); - Base.addBox("Shape26", -1F, -15F, -8F, 2, 1, 7); - Base.addBox("Shape27", -8F, 0F, -8F, 7, 1, 16); - Base.addBox("Shape28", -1F, 0F, 1F, 2, 1, 7); - Base.addBox("Shape29", -1F, 0F, -8F, 2, 1, 7); - } -} diff --git a/ihl/processing/chemistry/ApparatusProcessableInvSlot.java b/ihl/processing/chemistry/ApparatusProcessableInvSlot.java index 3698160..84a931b 100644 --- a/ihl/processing/chemistry/ApparatusProcessableInvSlot.java +++ b/ihl/processing/chemistry/ApparatusProcessableInvSlot.java @@ -1,5 +1,6 @@ package ihl.processing.chemistry;
+import ic2.api.recipe.IRecipeInput;
import ic2.core.block.TileEntityInventory;
import ic2.core.block.invslot.InvSlot;
import java.util.ArrayList;
@@ -10,57 +11,48 @@ import net.minecraft.item.ItemStack; public class ApparatusProcessableInvSlot extends InvSlot {
- public ApparatusProcessableInvSlot(TileEntityInventory base1, String name1,
- int oldStartIndex1, Access access1, int count, int stackSizeLimit1) {
+ public ApparatusProcessableInvSlot(TileEntityInventory base1, String name1, int oldStartIndex1, Access access1,
+ int count, int stackSizeLimit1) {
super(base1, name1, oldStartIndex1, access1, count);
this.setStackSizeLimit(stackSizeLimit1);
}
-
- public List<ItemStack> getItemStackList()
- {
+
+ public List<ItemStack> getItemStackList() {
List<ItemStack> list = new ArrayList<ItemStack>();
- for(int i=0; i<this.size(); i++)
- {
- if(get(i)!=null)
- {
+ for (int i = 0; i < this.size(); i++) {
+ if (get(i) != null) {
list.add(get(i));
}
}
return list;
}
-
+
public ItemStack getItemStack(Item item) {
- for(int i=0; i<this.size(); i++)
- {
- if(get(i)!=null && get(i).getItem()==item)
- {
+ for (int i = 0; i < this.size(); i++) {
+ if (get(i) != null && get(i).getItem() == item) {
return get(i);
}
}
return null;
}
- public void replaceItemStack(ItemStack stack1)
- {
- for(int i=0; i<this.size(); i++)
- {
- if(this.get(i)!=null && this.get(i).getItem()==stack1.getItem())
- {
- this.put(i,stack1);
+ public void replaceItemStack(ItemStack stack1) {
+ for (int i = 0; i < this.size(); i++) {
+ if (this.get(i) != null && this.get(i).getItem() == stack1.getItem()) {
+ this.put(i, stack1);
}
}
}
- public void consume(int i, int stackSize1)
- {
- if(this.get(i)==null)return;
- if(this.get(i).stackSize==stackSize1)
- {
- this.put(i, null);
- }
- else
- {
- this.get(i).stackSize-=stackSize1;
+ public void consume(IRecipeInput iRecipeInput) {
+ for (int i = 0; i < this.size(); i++) {
+ if (this.get(i) != null && iRecipeInput.matches(this.get(i))) {
+ this.get(i).stackSize -= iRecipeInput.getAmount();
+ if (this.get(i).stackSize <= 0) {
+ this.put(i, null);
+ return;
+ }
+ }
}
}
diff --git a/ihl/processing/chemistry/ChemicalReactorTileEntity.java b/ihl/processing/chemistry/ChemicalReactorTileEntity.java index ea3427c..2dfe31e 100644 --- a/ihl/processing/chemistry/ChemicalReactorTileEntity.java +++ b/ihl/processing/chemistry/ChemicalReactorTileEntity.java @@ -190,7 +190,7 @@ public class ChemicalReactorTileEntity extends BasicElectricMotorTileEntity impl @SuppressWarnings("unchecked")
public UniversalRecipeOutput getOutput()
{
- return ChemicalReactorTileEntity.recipeManager.getOutputFor(this.getInput()[0],this.getInput()[1], false, false);
+ return ChemicalReactorTileEntity.recipeManager.getOutputFor(this.getInput()[0],this.getInput()[1]);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@@ -203,7 +203,7 @@ public class ChemicalReactorTileEntity extends BasicElectricMotorTileEntity impl {
if(i!=i1)
{
- if(ChemicalReactorTileEntity.recipeManager.getOutputFor(Arrays.asList(new FluidStack[]{fluidTank.getFluid(i),fluidTank.getFluid(i1)}), this.input.getItemStackList(), false, false)!=null)
+ if(ChemicalReactorTileEntity.recipeManager.getOutputFor(Arrays.asList(new FluidStack[]{fluidTank.getFluid(i),fluidTank.getFluid(i1)}), this.input.getItemStackList())!=null)
{
return new List[] {Arrays.asList(new FluidStack[]{fluidTank.getFluid(i),fluidTank.getFluid(i1)}), this.input.getItemStackList()};
}
@@ -221,7 +221,7 @@ public class ChemicalReactorTileEntity extends BasicElectricMotorTileEntity impl UniversalRecipeOutput output1 = getOutput();
for(int i=0; i<recipeInput.getItemInputs().size();i++)
{
- this.input.consume(i,recipeInput.getItemInputs().get(i).getAmount());
+ this.input.consume(recipeInput.getItemInputs().get(i));
}
if(output1.specialConditions)
{
diff --git a/ihl/processing/chemistry/CryogenicDistillerTileEntity.java b/ihl/processing/chemistry/CryogenicDistillerTileEntity.java index 1ed4e36..9bd11a3 100644 --- a/ihl/processing/chemistry/CryogenicDistillerTileEntity.java +++ b/ihl/processing/chemistry/CryogenicDistillerTileEntity.java @@ -3,7 +3,6 @@ package ihl.processing.chemistry; import java.util.Arrays;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import ic2.core.ContainerBase;
import ic2.core.block.invslot.InvSlot;
@@ -103,7 +102,7 @@ public class CryogenicDistillerTileEntity extends BasicElectricMotorTileEntity i }
public UniversalRecipeOutput getOutput() {
- return CryogenicDistillerTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return CryogenicDistillerTileEntity.recipeManager.getOutputFor(this.getInput());
}
@Override
diff --git a/ihl/processing/chemistry/ElectrolysisBathTileEntity.java b/ihl/processing/chemistry/ElectrolysisBathTileEntity.java index 5a7a215..f8fae63 100644 --- a/ihl/processing/chemistry/ElectrolysisBathTileEntity.java +++ b/ihl/processing/chemistry/ElectrolysisBathTileEntity.java @@ -194,7 +194,7 @@ public class ElectrolysisBathTileEntity extends FlexibleCableHolderBaseTileEntit public UniversalRecipeOutput getOutput()
{
- return ElectrolysisBathTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return ElectrolysisBathTileEntity.recipeManager.getOutputFor(this.getInput());
}
@SuppressWarnings("rawtypes")
@@ -203,7 +203,7 @@ public class ElectrolysisBathTileEntity extends FlexibleCableHolderBaseTileEntit for(int i=0;i<fluidTank.getNumberOfFluids();i++)
{
List[] rInput = new List[] {Arrays.asList(new FluidStack[]{fluidTank.getFluid(i)}), this.input.getItemStackList()};
- if(ElectrolysisBathTileEntity.recipeManager.getOutputFor(rInput, false, false)!=null)
+ if(ElectrolysisBathTileEntity.recipeManager.getOutputFor(rInput)!=null)
{
return rInput;
}
@@ -217,7 +217,7 @@ public class ElectrolysisBathTileEntity extends FlexibleCableHolderBaseTileEntit UniversalRecipeOutput output1 = getOutput();
for(int i=0; i<recipeInput.getItemInputs().size();i++)
{
- this.input.consume(i,recipeInput.getItemInputs().get(i).getAmount());
+ this.input.consume(recipeInput.getItemInputs().get(i));
}
this.fluidTank.fill(output1.getFluidOutputs(), true);
}
diff --git a/ihl/processing/chemistry/EvaporatorTileEntity.java b/ihl/processing/chemistry/EvaporatorTileEntity.java index 8160d63..dbdf2e1 100644 --- a/ihl/processing/chemistry/EvaporatorTileEntity.java +++ b/ihl/processing/chemistry/EvaporatorTileEntity.java @@ -196,7 +196,7 @@ public class EvaporatorTileEntity extends TileEntityLiquidTankInventory implemen }
else
{
- UniversalRecipeOutput output = recipeManager.getOutputFor(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null, false, false);
+ UniversalRecipeOutput output = recipeManager.getOutputFor(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null);
return output == null ? false : (this.outputSlot.canAdd(output.getItemOutputs()) ? true : false);
}
}
@@ -280,7 +280,7 @@ public class EvaporatorTileEntity extends TileEntityLiquidTankInventory implemen }
else
{
- UniversalRecipeOutput output = recipeManager.getOutputFor(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null, false, false);
+ UniversalRecipeOutput output = recipeManager.getOutputFor(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null);
return output == null ? null : (this.outputSlot.canAdd(output.getItemOutputs()) ? output : null);
}
}
diff --git a/ihl/processing/chemistry/FluidizedBedReactorContainer.java b/ihl/processing/chemistry/FluidizedBedReactorContainer.java index b2c7738..f1bdb3e 100644 --- a/ihl/processing/chemistry/FluidizedBedReactorContainer.java +++ b/ihl/processing/chemistry/FluidizedBedReactorContainer.java @@ -13,8 +13,7 @@ import net.minecraftforge.fluids.FluidStack; public class FluidizedBedReactorContainer extends ContainerBase<FluidizedBedReactorTileEntity> {
protected FluidizedBedReactorTileEntity tileEntity;
- public int lastFluidAmount = -1;
- public int lastNumberOfFluids = -1;
+ public int lastFluidsHash = -1;
public short lastProgress = -1;
public short lastTemperature = -1;
public short lastEnergy = -1;
@@ -53,7 +52,7 @@ public class FluidizedBedReactorContainer extends ContainerBase<FluidizedBedReac 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)
+ if (fluidTankFluidList.hashCode() != this.lastFluidsHash)
{
IC2.network.get().sendContainerField(this, "fluidTankFluidList");
}
@@ -71,8 +70,7 @@ public class FluidizedBedReactorContainer extends ContainerBase<FluidizedBedReac icrafting.sendProgressBarUpdate(this, 2, (short) this.tileEntity.energy);
}
}
- this.lastNumberOfFluids = this.tileEntity.getNumberOfFluidsInTank();
- this.lastFluidAmount = this.tileEntity.getTankAmount();
+ this.lastFluidsHash = fluidTankFluidList.hashCode();
this.lastProgress = this.tileEntity.progress;
this.lastTemperature = this.tileEntity.temperature;
this.lastEnergy = (short) this.tileEntity.energy;
diff --git a/ihl/processing/chemistry/FluidizedBedReactorTileEntity.java b/ihl/processing/chemistry/FluidizedBedReactorTileEntity.java index 0e279b5..2d8c288 100644 --- a/ihl/processing/chemistry/FluidizedBedReactorTileEntity.java +++ b/ihl/processing/chemistry/FluidizedBedReactorTileEntity.java @@ -178,7 +178,7 @@ public class FluidizedBedReactorTileEntity extends BasicElectricMotorTileEntity public UniversalRecipeOutput getOutput()
{
- return FluidizedBedReactorTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return FluidizedBedReactorTileEntity.recipeManager.getOutputFor(this.getInput());
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@@ -192,7 +192,7 @@ public class FluidizedBedReactorTileEntity extends BasicElectricMotorTileEntity if(i!=i1)
{
List[] rInput = new List[] {Arrays.asList(new FluidStack[]{fluidTank.getFluid(i),fluidTank.getFluid(i1)}), this.input.getItemStackList()};
- if(FluidizedBedReactorTileEntity.recipeManager.getOutputFor(rInput, false, false)!=null)
+ if(FluidizedBedReactorTileEntity.recipeManager.getOutputFor(rInput)!=null)
{
return rInput;
}
@@ -208,7 +208,7 @@ public class FluidizedBedReactorTileEntity extends BasicElectricMotorTileEntity UniversalRecipeInput recipeInput = FluidizedBedReactorTileEntity.recipeManager.getRecipeInput(getInput());
UniversalRecipeOutput output1 = getOutput();
this.fluidTank.drain(recipeInput.getFluidInputs(), true);
- this.input.consume(0, recipeInput.getItemInputs().get(0).getAmount());
+ this.input.consume(recipeInput.getItemInputs().get(0));
if(recipeInput.getItemInputs().get(0).getAmount()==0)
{
ItemStack stack = this.input.get();
@@ -219,10 +219,10 @@ public class FluidizedBedReactorTileEntity extends BasicElectricMotorTileEntity stack.stackTagCompound.setInteger("catalyst_uses",stack.stackTagCompound.getInteger("catalyst_uses")+1);
if(stack.stackTagCompound.getInteger("catalyst_uses")>1000)
{
- this.input.consume(0,1);
+ this.input.consume(recipeInput.getItemInputs().get(0));
}
}
- if(recipeInput.getItemInputs().size()>1)this.input.consume(1, recipeInput.getItemInputs().get(1).getAmount());
+ if(recipeInput.getItemInputs().size()>1)this.input.consume(recipeInput.getItemInputs().get(1));
if(output1.getFluidOutputs().size()>0)this.fluidTank.fill(output1.getFluidOutputs().get(0).copy(), true);
if(output1.getFluidOutputs().size()>1)this.fluidTank.fill(output1.getFluidOutputs().get(1).copy(), true);
if(!output1.getItemOutputs().isEmpty() && output1.getItemOutputs().get(0)!=null)this.outputSlot.add(output1.getItemOutputs());
diff --git a/ihl/processing/chemistry/FractionatorBottomTileEntity.java b/ihl/processing/chemistry/FractionatorBottomTileEntity.java index 20132e9..2f3b43f 100644 --- a/ihl/processing/chemistry/FractionatorBottomTileEntity.java +++ b/ihl/processing/chemistry/FractionatorBottomTileEntity.java @@ -113,7 +113,7 @@ public class FractionatorBottomTileEntity extends TileEntityInventory FluidStack fsCurrentInput = this.fluidTank.getFluid();
if(fsCurrentInput!=null && fsCurrentInput.amount>100 && systemHeat>0)
{
- UniversalRecipeOutput rOutput = FractionatorBottomTileEntity.recipeManager.getOutputFor(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null, false, false);
+ UniversalRecipeOutput rOutput = FractionatorBottomTileEntity.recipeManager.getOutputFor(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null);
UniversalRecipeInput rInput = FractionatorBottomTileEntity.recipeManager.getRecipeInput(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null);
if(rOutput!=null)
{
diff --git a/ihl/processing/chemistry/GoldChimneyKneeModel.java b/ihl/processing/chemistry/GoldChimneyKneeModel.java deleted file mode 100644 index f98fe15..0000000 --- a/ihl/processing/chemistry/GoldChimneyKneeModel.java +++ /dev/null @@ -1,45 +0,0 @@ -package ihl.processing.chemistry; - -import ihl.model.IHLModelRenderer; -import net.minecraft.client.model.ModelBase; -import net.minecraftforge.common.util.ForgeDirection; - -public class GoldChimneyKneeModel extends ModelBase -{ - //fields - IHLModelRenderer Base; - - public GoldChimneyKneeModel() - { - textureWidth = 64; - textureHeight = 32; - setTextureOffset("Base.Shape1", 26, 0); - setTextureOffset("Base.Shape2", 0, 17); - setTextureOffset("Base.Shape4", 30, 16); - setTextureOffset("Base.Shape3", 0, 15); - setTextureOffset("Base.Shape5", 11, 12); - setTextureOffset("Base.Shape6", 9, 2); - setTextureOffset("Base.Shape7", 24, 7); - setTextureOffset("Base.Shape8", 50, 0); - setTextureOffset("Base.Shape9", 0, 0); - setTextureOffset("Base.Shape10", 6, 0); - setTextureOffset("Base.Shape11", 18, 0); - setTextureOffset("Base.Pipe", 0, 0); - - Base = new IHLModelRenderer(this, "Base"); - Base.setRotationPoint(0F, 23F, -6F); - Base.mirror = true; - Base.addBox("Shape1", 5F, -14F, 0F, 1, 15, 12, false); - Base.addBox("Shape2", -6F, -1F, 0F, 11, 2, 1, false); - Base.addBox("Shape4", 5F, -14F, -2F, 1, 13, 2, false); - Base.addBox("Shape3", -6F, -2F, -2F, 11, 1, 3, false); - Base.addBox("Shape5", -6F, -14F, -2F, 11, 1, 14, false); - Base.addBox("Shape6", -5F, -13F, 11F, 4, 14, 1, false); - Base.addBox("Shape7", -6F, -13F, 1F, 1, 14, 11, false); - Base.addBox("Shape8", -6F, -13F, -2F, 1, 11, 3, false); - Base.addBox("Shape9", 1F, -13F, 11F, 4, 14, 1, false); - Base.addBox("Shape10", -1F, -13F, 11F, 2, 4, 1, false); - Base.addBox("Shape11", -1F, -7F, 11F, 2, 8, 1, false); - Base.addTube("Pipe", -2F, -10F, 2F, 4, 4, 12, 0.5F, 1F,ForgeDirection.NORTH); - } -} diff --git a/ihl/processing/chemistry/GoldChimneyKneeRender.java b/ihl/processing/chemistry/GoldChimneyKneeRender.java deleted file mode 100644 index d862963..0000000 --- a/ihl/processing/chemistry/GoldChimneyKneeRender.java +++ /dev/null @@ -1,50 +0,0 @@ -package ihl.processing.chemistry;
-import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.ResourceLocation;
-import org.lwjgl.opengl.GL11;
-import ihl.IHLModInfo;
-
-public class GoldChimneyKneeRender extends TileEntitySpecialRenderer{
-private GoldChimneyKneeModel model = new GoldChimneyKneeModel();
-private ResourceLocation tex = new ResourceLocation(IHLModInfo.MODID+":textures/blocks/porcelainBox.png");
-
-public GoldChimneyKneeRender(){}
-
-public void renderAModelAt(GoldChimneyKneeTileEntity tile, double d, double d1, double d2, float f) {
- int rotation = 0;
- if(tile.getWorldObj() != null)
- {
- switch (tile.getFacing())
- {
- case 2:
- rotation = 0;
- break;
- case 5:
- rotation = 1;
- break;
- case 3:
- rotation = 2;
- break;
- case 4:
- rotation = 3;
- break;
- default:
- rotation = 0;
- }
- }
- bindTexture(tex); //texture
- GL11.glPushMatrix();
- GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.5F, (float)d2 + 0.5F);
- GL11.glScalef(1.0F, -1F, -1F);
- GL11.glRotatef(rotation*90, 0.0F, 1.0F, 0.0F);
- model.Base.render(1.0F/16.0F);
- GL11.glPopMatrix(); //end
-}
-
- @Override
- public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8)
- {
- this.renderAModelAt((GoldChimneyKneeTileEntity)par1TileEntity, par2, par4, par6, par8);
- }
-}
\ No newline at end of file diff --git a/ihl/processing/chemistry/GoldChimneyKneeTileEntity.java b/ihl/processing/chemistry/GoldChimneyKneeTileEntity.java deleted file mode 100644 index 34b3de2..0000000 --- a/ihl/processing/chemistry/GoldChimneyKneeTileEntity.java +++ /dev/null @@ -1,293 +0,0 @@ -package ihl.processing.chemistry;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import ic2.api.network.INetworkDataProvider;
-import ic2.api.tile.IWrenchable;
-import ic2.core.IC2;
-import ihl.recipes.UniversalRecipeInput;
-import ihl.recipes.UniversalRecipeManager;
-import ihl.recipes.UniversalRecipeOutput;
-import ihl.utils.IHLFluidTank;
-import ihl.utils.IHLUtils;
-import ihl.worldgen.ores.IHLFluid;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.Fluid;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.FluidTankInfo;
-import net.minecraftforge.fluids.IFluidHandler;
-
-public class GoldChimneyKneeTileEntity extends TileEntity implements IWrenchable, INetworkDataProvider, IFluidHandler {
- private short facing=2;
- private short lastFacing=2;
- private final IHLFluidTank gasBuffer = new IHLFluidTank(10000);
- private final IHLFluidTank fluidTank = new IHLFluidTank(10000);
- private static UniversalRecipeManager recipeManager = new UniversalRecipeManager("chimneyknee");
-
-
- public GoldChimneyKneeTileEntity()
- {
- super();
- }
-
- @Override
- public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
- return this.facing!=side;
- }
-
- @Override
- public short getFacing()
- {
- return facing;
- }
-
- @Override
- public List<String> getNetworkedFields()
- {
- List<String> fields = new ArrayList<String>();
- fields.add("facing");
- return fields;
- }
-
- @Override
- public void updateEntity()
- {
- super.updateEntity();
- if(IC2.platform.isSimulating())
- {
- if(this.facing!=this.lastFacing)
- {
- IC2.network.get().updateTileEntityField(this, "facing");
- this.lastFacing=this.facing;
- }
- if(this.fluidTank.getFluid()!=null && this.gasBuffer.getFluid()!=null)
- {
- if(this.getOutput()!=null)
- {
- List<FluidStack> output = GoldChimneyKneeTileEntity.recipeManager.getOutputFor(getInput(), true, true).getFluidOutputs();
- if(output.size()>0)
- {
- this.fillOutputApparatus(getConnectDirection(),output.get(0), true);
- }
- }
- }
- if(this.fluidTank.getFluid()!=null)
- {
- if(this.fillOutputApparatus(getConnectDirection(),this.fluidTank.drain(this.fluidTank.getCapacity(), false), false)>0)
- {
- this.fillOutputApparatus(getConnectDirection(),this.fluidTank.drain(this.fluidTank.getCapacity(), true), true);
- }
- }
- if(this.gasBuffer.getFluid()!=null)
- {
- if(this.fillOutputApparatus(getConnectDirection(),this.gasBuffer.drain(this.gasBuffer.getCapacity(), false), false)>0)
- {
- this.fillOutputApparatus(getConnectDirection(),this.gasBuffer.drain(this.gasBuffer.getCapacity(), true), true);
- }
- }
-
- }
- }
-
- private int fillOutputApparatus(ForgeDirection direction,FluidStack fluidStack, boolean doFill)
- {
- TileEntity te = worldObj.getTileEntity(xCoord+mX(),yCoord, zCoord+mZ());
- if(te instanceof IFluidHandler)
- {
- return ((IFluidHandler)te).fill(direction, fluidStack, doFill);
- }
- else
- {
- return 0;
- }
- }
-
- @Override
- public void setFacing(short facing1)
- {
- facing=(short) Math.max(2,facing1);
- if(IC2.platform.isSimulating())
- {
- IC2.network.get().updateTileEntityField(this, "facing");
- }
- }
-
- @Override
- public boolean wrenchCanRemove(EntityPlayer entityPlayer)
- {
- return true;
- }
-
- @Override
- public float getWrenchDropRate()
- {
- return 1F;
- }
-
- @Override
- public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
- {
- return IHLUtils.getThisModItemStack("goldChimneyKnee");
- }
-
- @Override
- public void writeToNBT(NBTTagCompound nbttagcompound)
- {
- super.writeToNBT(nbttagcompound);
- nbttagcompound.setShort("facing",facing);
- NBTTagCompound fluidTankTag = new NBTTagCompound();
- this.fluidTank.writeToNBT(fluidTankTag);
- nbttagcompound.setTag("fluidTank", fluidTankTag);
-
- NBTTagCompound gasBufferTag = new NBTTagCompound();
- this.gasBuffer.writeToNBT(gasBufferTag);
- nbttagcompound.setTag("gasBuffer", gasBufferTag);
-
- }
-
- @Override
- public void readFromNBT(NBTTagCompound nbttagcompound)
- {
- super.readFromNBT(nbttagcompound);
- facing=nbttagcompound.getShort("facing");
- this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank"));
- this.gasBuffer.readFromNBT(nbttagcompound.getCompoundTag("gasBuffer"));
- }
-
- protected int mX()
- {
- switch(this.getFacing())
- {
- case 4:
- return 1;
- case 5:
- return -1;
- default:
- return 0;
- }
- }
-
- protected int mZ()
- {
- switch(this.getFacing())
- {
- case 2:
- return 1;
- case 3:
- return -1;
- default:
- return 0;
- }
- }
-
- public TileEntity getConnectedTileEntity()
- {
- return worldObj.getTileEntity(xCoord+mX(), yCoord, zCoord+mZ());
- }
-
- public ForgeDirection getConnectDirection()
- {
- switch(this.getFacing())
- {
- case 2:
- return ForgeDirection.NORTH;
- case 3:
- return ForgeDirection.SOUTH;
- case 4:
- return ForgeDirection.WEST;
- case 5:
- return ForgeDirection.EAST;
- default:
- return ForgeDirection.NORTH;
- }
- }
-
- @Override
- public boolean canDrain(ForgeDirection arg0, Fluid arg1)
- {
- return false;
- }
-
- @Override
- public boolean canFill(ForgeDirection direction, Fluid fluid)
- {
- return fluid.isGaseous() && (direction==ForgeDirection.DOWN || direction==getConnectDirection());
- }
-
- @Override
- public int fill(ForgeDirection direction, FluidStack fluidStack, boolean doFill)
- {
- if(direction==getConnectDirection() && fluidStack!=null && fluidStack.getFluid()!=null)
- {
- if(fluidStack.getFluid().isGaseous() && fluidStack.getFluid().getDensity()<IHLFluid.maxGaseousStateVapoursDensity)
- {
- return gasBuffer.fill(fluidStack, doFill);
- }
- else
- {
- return 0;
- }
- }
- else if(direction==ForgeDirection.DOWN)
- {
- if(fluidStack.getFluid().isGaseous() && fluidStack.getFluid().getDensity()<IHLFluid.maxGaseousStateVapoursDensity)
- {
- return fluidTank.fill(fluidStack, doFill);
- }
- else
- {
- return 0;
- }
- }
- else
- {
- return 0;
- }
- }
-
- @Override
- public FluidStack drain(ForgeDirection arg0, FluidStack arg1, boolean arg2)
- {
- return null;
- }
-
- @Override
- public FluidStack drain(ForgeDirection arg0, int arg1, boolean arg2)
- {
- return null;
- }
-
- @Override
- public FluidTankInfo[] getTankInfo(ForgeDirection arg0)
- {
- return new FluidTankInfo[]{this.fluidTank.getInfo(), this.gasBuffer.getInfo()};
- }
-
- public static void addRecipe(UniversalRecipeInput input, FluidStack fluidStackWithSize)
- {
- recipeManager.addRecipe(input, new UniversalRecipeOutput((new FluidStack[] {fluidStackWithSize}),null,20));
- }
-
- public UniversalRecipeOutput getOutput()
- {
- return GoldChimneyKneeTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
- }
-
- @SuppressWarnings("rawtypes")
- public List[] getInput()
- {
- return new List[] {Arrays.asList(new FluidStack[] {this.gasBuffer.getFluid(),this.fluidTank.getFluid()}),null};
- }
-
- public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes()
- {
- return recipeManager.getRecipes();
- }
-}
diff --git a/ihl/processing/chemistry/LabElectrolyzerTileEntity.java b/ihl/processing/chemistry/LabElectrolyzerTileEntity.java index f8c00ad..11647d6 100644 --- a/ihl/processing/chemistry/LabElectrolyzerTileEntity.java +++ b/ihl/processing/chemistry/LabElectrolyzerTileEntity.java @@ -174,7 +174,7 @@ public class LabElectrolyzerTileEntity extends BasicElectricMotorTileEntity impl }
public UniversalRecipeOutput getOutput() {
- return LabElectrolyzerTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return LabElectrolyzerTileEntity.recipeManager.getOutputFor(this.getInput());
}
@SuppressWarnings({ "unchecked", "rawtypes" })
diff --git a/ihl/processing/chemistry/LeadOvenContainer.java b/ihl/processing/chemistry/LeadOvenContainer.java index c273623..2f0ff8a 100644 --- a/ihl/processing/chemistry/LeadOvenContainer.java +++ b/ihl/processing/chemistry/LeadOvenContainer.java @@ -1,78 +1,93 @@ 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 LeadOvenContainer extends ContainerBase<LeadOvenTileEntity> {
- protected LeadOvenTileEntity tileEntity;
- public int lastFluidAmount = -1;
- public int lastFuel = -1;
- public short lastProgress = -1;
- private final static int height=166;
-
- public LeadOvenContainer(EntityPlayer entityPlayer, LeadOvenTileEntity 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.fuelSlot, 0, 56, 53));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.inputSlot, 0, 47, 17));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.inputSlot, 1, 65, 17));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 112, 35));
- }
+ protected LeadOvenTileEntity tileEntity;
+ public int lastInputFluidAmount = -1;
+ public int lastOutputFluidAmount = -1;
+ public int lastFuel = -1;
+ public short lastProgress = -1;
+ private final static int height = 166;
+ public List<FluidStack> inputTankFluidList;
+ public List<FluidStack> outputTankFluidList;
+
+ public LeadOvenContainer(EntityPlayer entityPlayer, LeadOvenTileEntity tileEntity1) {
+ super(tileEntity1);
+ this.tileEntity = tileEntity1;
+ inputTankFluidList = this.tileEntity.inputTank.getFluidList();
+ outputTankFluidList = this.tileEntity.outputTank.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.fuelSlot, 0, 56, 53));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.inputSlot, 0, 47, 17));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.inputSlot, 1, 65, 17));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 112, 35));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot, 0, 9, 53));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 9, 17));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 9, 35));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot2, 0, 150, 53));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot2, 0, 150, 17));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 1, 150, 35));
+ }
+
+ @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.inputTank.getFluidAmount() != this.lastInputFluidAmount) {
+ IC2.network.get().sendContainerField(this, "inputTankFluidList");
+ }
+ if (this.tileEntity.outputTank.getFluidAmount() != this.lastOutputFluidAmount) {
+ IC2.network.get().sendContainerField(this, "outputTankFluidList");
+ }
+
+ if (this.tileEntity.fuel != this.lastFuel) {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.fuel);
+ }
- @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, 1, this.tileEntity.progress);
+ }
+ }
+ this.lastFuel = this.tileEntity.fuel;
+ this.lastProgress = this.tileEntity.progress;
+ this.lastInputFluidAmount = this.tileEntity.inputTank.getFluidAmount();
+ this.lastOutputFluidAmount = this.tileEntity.outputTank.getFluidAmount();
+ }
- if (this.tileEntity.fuel != this.lastFuel)
- {
- icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.fuel);
- }
-
- if (this.tileEntity.progress != this.lastProgress)
- {
- icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.progress);
- }
- }
- this.lastFuel = this.tileEntity.fuel;
- this.lastProgress = this.tileEntity.progress;
- }
-
- @Override
- public void updateProgressBar(int index, int value)
- {
- super.updateProgressBar(index, value);
+ @Override
+ public void updateProgressBar(int index, int value) {
+ super.updateProgressBar(index, value);
+
+ switch (index) {
+ case 0:
+ this.tileEntity.fuel = value;
+ break;
+ case 1:
+ this.tileEntity.progress = (short) value;
+ break;
+ }
+ }
- switch (index)
- {
- case 0:
- this.tileEntity.fuel=value;
- break;
- case 1:
- this.tileEntity.progress=(short) value;
- break;
- }
- }
-
@Override
public boolean canInteractWith(EntityPlayer var1) {
return tileEntity.isUseableByPlayer(var1);
diff --git a/ihl/processing/chemistry/LeadOvenGui.java b/ihl/processing/chemistry/LeadOvenGui.java index 2d8e785..0c35a21 100644 --- a/ihl/processing/chemistry/LeadOvenGui.java +++ b/ihl/processing/chemistry/LeadOvenGui.java @@ -3,6 +3,7 @@ package ihl.processing.chemistry; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import ihl.utils.IHLRenderUtils;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@@ -12,35 +13,43 @@ public class LeadOvenGui extends GuiContainer { private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUILeadOven.png");
private LeadOvenContainer container;
- public LeadOvenGui (LeadOvenContainer 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) {
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- this.mc.renderEngine.bindTexture(background);
- }
+ public LeadOvenGui(LeadOvenContainer 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);
- int i1;
- if (this.container.tileEntity.fuel > 0)
- {
- i1 = this.container.tileEntity.gaugeFuelScaled(12);
- this.drawTexturedModalRect(x + 56, y + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2);
- }
- i1 = this.container.tileEntity.gaugeProgressScaled(24);
- this.drawTexturedModalRect(x + 79, y + 34, 176, 14, i1 + 1, 16);
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ 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;
+ if (this.container.tileEntity.inputTank.getFluidAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.inputTank, 30, 19, 42, 66, zLevel,
+ par1, par2, x, y);
+ }
+ if (this.container.tileEntity.outputTank.getFluidAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.outputTank, 133, 19, 145, 66, zLevel,
+ par1, par2, x, y);
+ }
+ }
- }
+ @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);
+ int i1;
+ if (this.container.tileEntity.fuel > 0) {
+ i1 = this.container.tileEntity.gaugeFuelScaled(12);
+ this.drawTexturedModalRect(x + 56, y + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2);
+ }
+ i1 = this.container.tileEntity.gaugeProgressScaled(24);
+ this.drawTexturedModalRect(x + 79, y + 34, 176, 14, i1 + 1, 16);
+ }
}
\ No newline at end of file diff --git a/ihl/processing/chemistry/LeadOvenTileEntity.java b/ihl/processing/chemistry/LeadOvenTileEntity.java index 340d848..c2067d8 100644 --- a/ihl/processing/chemistry/LeadOvenTileEntity.java +++ b/ihl/processing/chemistry/LeadOvenTileEntity.java @@ -11,327 +11,277 @@ import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import ic2.api.recipe.IRecipeInput;
import ic2.core.ContainerBase;
import ic2.core.IC2;
import ic2.core.IHasGui;
-import ic2.core.block.TileEntityLiquidTankInventory;
+import ic2.core.block.TileEntityInventory;
+import ic2.core.block.invslot.InvSlot;
import ic2.core.block.invslot.InvSlotConsumableFuel;
+import ic2.core.block.invslot.InvSlotConsumableLiquid;
+import ic2.core.block.invslot.InvSlotOutput;
import ic2.core.block.invslot.InvSlot.Access;
import ihl.processing.invslots.IHLInvSlotOutput;
+import ihl.processing.invslots.InvSlotConsumableLiquidIHL;
import ihl.recipes.RecipeOutputItemStack;
import ihl.recipes.UniversalRecipeInput;
import ihl.recipes.UniversalRecipeManager;
import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLFluidTank;
import ihl.utils.IHLUtils;
-public class LeadOvenTileEntity extends TileEntityLiquidTankInventory implements IHasGui
-{
- public final InvSlotConsumableFuel fuelSlot;
- public final ApparatusProcessableInvSlot inputSlot;
- public final IHLInvSlotOutput outputSlot;
- public short progress = 0;
- public final short maxProgress = 160;
- public int fuel = 0;
- public int maxFuel = 0;
+public class LeadOvenTileEntity extends TileEntityInventory implements IHasGui, IFluidHandler {
+ public final InvSlotConsumableFuel fuelSlot;
+ public final ApparatusProcessableInvSlot inputSlot;
+ public final IHLInvSlotOutput outputSlot;
+ public final IHLFluidTank inputTank = new IHLFluidTank(1000);
+ public final IHLFluidTank outputTank = new IHLFluidTank(1000);
+ public final InvSlotConsumableLiquidIHL drainInputSlot;
+ public final InvSlotConsumableLiquidIHL fillInputSlot;
+ public final InvSlotOutput emptyFluidItemsSlot;
+ public final InvSlotConsumableLiquidIHL drainInputSlot2;
+ public final InvSlotConsumableLiquidIHL fillInputSlot2;
+ public short progress = 0;
+ public final short maxProgress = 160;
+ public int fuel = 0;
+ public int maxFuel = 0;
protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager("chemicaloven");
- private ItemStack burnedFuel;
-
- public LeadOvenTileEntity()
- {
- super(1000);
- this.fuelSlot = new InvSlotConsumableFuel(this, "fuel", 1, 1, true);
- this.inputSlot = new ApparatusProcessableInvSlot(this, "input", 2, Access.IO, 2, 64);
- this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 1);
- }
-
- public static void addRecipe(UniversalRecipeInput input,UniversalRecipeOutput output)
- {
- recipeManager.addRecipe(input, output);
- }
-
- @Override
- public void readFromNBT(NBTTagCompound nbttagcompound)
- {
- super.readFromNBT(nbttagcompound);
-
- try
- {
- this.fuel = nbttagcompound.getInteger("fuel");
- }
- catch (Throwable var4)
- {
- this.fuel = nbttagcompound.getShort("fuel");
- }
-
- try
- {
- this.maxFuel = nbttagcompound.getInteger("maxFuel");
- }
- catch (Throwable var3)
- {
- this.maxFuel = nbttagcompound.getShort("maxFuel");
- }
- this.progress = nbttagcompound.getShort("progress");
- }
-
- @Override
- public void writeToNBT(NBTTagCompound nbttagcompound)
- {
- super.writeToNBT(nbttagcompound);
- nbttagcompound.setInteger("fuel", this.fuel);
- nbttagcompound.setInteger("maxFuel", this.maxFuel);
- nbttagcompound.setShort("progress", this.progress);
- NBTTagCompound gasBufferTag = new NBTTagCompound();
- nbttagcompound.setTag("gasBuffer", gasBufferTag);
- }
-
+
+ public LeadOvenTileEntity() {
+ super();
+ this.fuelSlot = new InvSlotConsumableFuel(this, "fuel", 1, 1, true);
+ this.inputSlot = new ApparatusProcessableInvSlot(this, "input", 2, Access.IO, 2, 64);
+ this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 1);
+ this.drainInputSlot = new InvSlotConsumableLiquidIHL(this, "drainInput", -1, InvSlot.Access.I, 1,
+ InvSlot.InvSide.TOP, InvSlotConsumableLiquid.OpType.Drain);
+ this.fillInputSlot = new InvSlotConsumableLiquidIHL(this, "fillInput", -1, InvSlot.Access.I, 1,
+ InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.drainInputSlot2 = new InvSlotConsumableLiquidIHL(this, "drainInput", -1, InvSlot.Access.I, 1,
+ InvSlot.InvSide.TOP, InvSlotConsumableLiquid.OpType.Drain);
+ this.fillInputSlot2 = new InvSlotConsumableLiquidIHL(this, "fillInput", -1, InvSlot.Access.I, 1,
+ InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.emptyFluidItemsSlot = new InvSlotOutput(this, "fluidCellsOutput", 2, 2);
+ }
+
+ public static void addRecipe(UniversalRecipeInput input, UniversalRecipeOutput output) {
+ recipeManager.addRecipe(input, output);
+ }
+
@Override
- public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side)
- {
- return this.getFacing()!=(short)side && side!=0 && side!=1;
+ public void readFromNBT(NBTTagCompound nbttagcompound) {
+ super.readFromNBT(nbttagcompound);
+ this.fuel = nbttagcompound.getInteger("fuel");
+ this.maxFuel = nbttagcompound.getInteger("maxFuel");
+ this.progress = nbttagcompound.getShort("progress");
+ this.inputTank.readFromNBT(nbttagcompound.getCompoundTag("inputTank"));
+ this.outputTank.readFromNBT(nbttagcompound.getCompoundTag("outputTank"));
}
-
+
@Override
- public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
- {
- return IHLUtils.getThisModItemStack("leadOven");
+ public void writeToNBT(NBTTagCompound nbttagcompound) {
+ super.writeToNBT(nbttagcompound);
+ nbttagcompound.setInteger("fuel", this.fuel);
+ nbttagcompound.setInteger("maxFuel", this.maxFuel);
+ nbttagcompound.setShort("progress", this.progress);
+ NBTTagCompound inputTankTag = new NBTTagCompound();
+ this.inputTank.writeToNBT(inputTankTag);
+ nbttagcompound.setTag("inputTank", inputTankTag);
+ NBTTagCompound outputTankTag = new NBTTagCompound();
+ this.outputTank.writeToNBT(outputTankTag);
+ nbttagcompound.setTag("outputTank", outputTankTag);
}
-
- public int gaugeProgressScaled(int i)
- {
- return this.progress * i / maxProgress;
- }
-
- public int gaugeFuelScaled(int i)
- {
- if (this.maxFuel == 0)
- {
- this.maxFuel = this.fuel;
-
- if (this.maxFuel == 0)
- {
- this.maxFuel = 160;
- }
- }
-
- return this.fuel * i / this.maxFuel;
- }
-
- public boolean enableUpdateEntity()
- {
- return IC2.platform.isSimulating();
- }
-
- @Override
- public void updateEntityServer()
- {
- super.updateEntityServer();
- if(this.getFluidTank().getFluid()!=null)
- {
- FluidStack fs;
- if(this.maxProgress>0 && this.getOutput()!=null && this.getOutput().getFluidOutputs()!=null && this.getOutput().getFluidOutputs().size()>0)
- {
- fs = this.getFluidTank().drain(this.getOutput().getFluidOutputs().get(0).amount/this.maxProgress, true);
- }
- else
- {
- fs = this.getFluidTank().drain(1000, true);
- }
- TileEntity te = worldObj.getTileEntity(xCoord, yCoord+1, zCoord);
- if(te!=null)
- {
- ForgeDirection direction = ForgeDirection.DOWN;
- if(te instanceof IFluidHandler)
- {
- ((IFluidHandler)te).fill(direction, fs, true);
- }
- }
- }
- if (this.fuel <= 0 && this.canOperate())
- {
- if(this.fuelSlot.get()!=null)
- {
- if(burnedFuel!=null && IHLUtils.isItemsHaveSameOreDictionaryEntry(this.fuelSlot.get(), burnedFuel))
- {
- burnedFuel.stackSize++;
- }
- else if(burnedFuel==null)
- {
- burnedFuel=this.fuelSlot.get().copy();
- burnedFuel.stackSize=1;
- }
- }
- this.fuel = this.maxFuel = this.fuelSlot.consumeFuel();
- }
-
- if (this.isBurning() && this.canOperate())
- {
- ++this.progress;
-
- if (this.progress >= maxProgress)
- {
- this.progress = 0;
- this.operate();
- }
- }
- else
- {
- this.progress = 0;
- }
-
- if (this.fuel > 0)
- {
- --this.fuel;
- }
-
- if (this.getActive() != this.isBurning())
- {
- this.setActive(this.isBurning());
- }
- }
-
- public boolean isBurning()
- {
- return this.fuel > 0;
- }
-
- public boolean canOperate()
- {
- return this.getOutput()!=null;
- }
-
- /**
- * Returns the name of the inventory
- */
- @Override
- public String getInventoryName()
- {
- return "goldOven";
- }
-
- @Override
- public ContainerBase<LeadOvenTileEntity> getGuiContainer(EntityPlayer entityPlayer)
- {
- return new LeadOvenContainer(entityPlayer, this);
- }
-
+
@Override
- @SideOnly(Side.CLIENT)
- public GuiScreen getGui(EntityPlayer entityPlayer, boolean isAdmin)
- {
- return new LeadOvenGui(new LeadOvenContainer(entityPlayer, this));
- }
-
- @Override
- public void onGuiClosed(EntityPlayer entityPlayer) {}
-
- public int mX()
- {
- switch(this.getFacing())
- {
- case 4:
- return -1;
- case 5:
- return 1;
- default:
- return 0;
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing() != (short) side && side != 0 && side != 1;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("leadOven");
+ }
+
+ public int gaugeProgressScaled(int i) {
+ return this.progress * i / maxProgress;
+ }
+
+ public int gaugeFuelScaled(int i) {
+ if (this.maxFuel == 0) {
+ this.maxFuel = this.fuel;
+
+ if (this.maxFuel == 0) {
+ this.maxFuel = 160;
+ }
}
+
+ return this.fuel * i / this.maxFuel;
}
-
- public int mZ()
- {
- switch(this.getFacing())
- {
- case 2:
- return -1;
- case 3:
- return 1;
- default:
- return 0;
+
+ public boolean enableUpdateEntity() {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public void updateEntityServer() {
+ super.updateEntityServer();
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlot, drainInputSlot, emptyFluidItemsSlot, inputTank);
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlot2, drainInputSlot2, emptyFluidItemsSlot, outputTank);
+ if (this.fuel <= 0 && this.canOperate()) {
+ this.fuel = this.maxFuel = this.fuelSlot.consumeFuel();
+ }
+
+ if (this.isBurning() && this.canOperate()) {
+ ++this.progress;
+
+ if (this.progress >= maxProgress) {
+ this.progress = 0;
+ this.operate();
+ }
+ } else {
+ this.progress = 0;
}
+
+ if (this.fuel > 0) {
+ --this.fuel;
+ }
+
+ if (this.getActive() != this.isBurning()) {
+ this.setActive(this.isBurning());
+ }
+ }
+
+ public boolean isBurning() {
+ return this.fuel > 0;
+ }
+
+ public boolean canOperate() {
+ return this.getOutput() != null;
+ }
+
+ /**
+ * Returns the name of the inventory
+ */
+ @Override
+ public String getInventoryName() {
+ return "goldOven";
+ }
+
+ @Override
+ public ContainerBase<LeadOvenTileEntity> getGuiContainer(EntityPlayer entityPlayer) {
+ return new LeadOvenContainer(entityPlayer, this);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer entityPlayer, boolean isAdmin) {
+ return new LeadOvenGui(new LeadOvenContainer(entityPlayer, this));
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer entityPlayer) {
+ }
+
+ public UniversalRecipeOutput getOutput() {
+ return LeadOvenTileEntity.recipeManager.getOutputFor(this.getInput());
}
-
- public UniversalRecipeOutput getOutput()
- {
- return LeadOvenTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
- }
@SuppressWarnings("rawtypes")
- public List[] getInput()
- {
- if(this.inputSlot.get(1)!=null)
- {
- return new List[] {null, Arrays.asList(new ItemStack[] {this.inputSlot.get(0),this.inputSlot.get(1)})};
+ public List[] getInput() {
+ if (this.inputSlot.get(1) != null) {
+ return new List[] { this.inputTank.getFluidList(),
+ Arrays.asList(new ItemStack[] { this.inputSlot.get(0), this.inputSlot.get(1) }) };
}
- return new List[] {null, Arrays.asList(new ItemStack[] {this.inputSlot.get()})};
+ return new List[] { this.inputTank.getFluidList(), Arrays.asList(new ItemStack[] { this.inputSlot.get() }) };
}
-
- public void operate()
- {
- List<IRecipeInput> rinput = LeadOvenTileEntity.recipeManager.getRecipeInput(getInput()).getItemInputs();
- UniversalRecipeOutput routput = LeadOvenTileEntity.recipeManager.getOutputFor(getInput(), false, false);
+
+ public void operate() {
+ UniversalRecipeInput rinput = LeadOvenTileEntity.recipeManager.getRecipeInput(getInput());
+ List<IRecipeInput> rinputItems = rinput.getItemInputs();
+ UniversalRecipeOutput routput = LeadOvenTileEntity.recipeManager.getOutputFor(getInput());
List<FluidStack> output2 = routput.getFluidOutputs();
- if(!output2.isEmpty())
- {
- this.getFluidTank().fill(output2.get(0), true);
+ if (!output2.isEmpty()) {
+ this.outputTank.fill(output2.get(0), true);
}
+ this.inputTank.drain(rinput.getFluidInputs(), true);
List<RecipeOutputItemStack> itemOutputs = routput.getItemOutputs();
- if(itemOutputs!=null && !itemOutputs.isEmpty())
- {
+ if (itemOutputs != null && !itemOutputs.isEmpty()) {
this.outputSlot.add(itemOutputs);
}
- for(int i=0; i<rinput.size();i++)
- {
- if(this.burnedFuel!=null && IHLUtils.isItemsHaveSameOreDictionaryEntry(this.fuelSlot.get(), burnedFuel) && this.burnedFuel.stackSize>=rinput.get(i).getAmount())
- {
- this.burnedFuel.stackSize-=rinput.get(i).getAmount();
- if(this.burnedFuel.stackSize<=0)
- {
- this.burnedFuel=null;
- }
- }
- else
- {
- this.inputSlot.consume(i, rinput.get(i).getAmount());
- }
- if(this.inputSlot.get(i)!=null && this.inputSlot.get(i).stackSize<=0)
- {
- this.inputSlot.put(i, null);
- }
+ for (int i = 0; i < rinputItems.size(); i++) {
+ this.inputSlot.consume(rinputItems.get(i));
}
-
+
}
@Override
+ public FluidStack drain(ForgeDirection from, int amount, boolean doDrain) {
+ switch (from) {
+ case UP:
+ return this.outputTank.drainLightest(amount, doDrain);
+ case NORTH:
+ return this.outputTank.drainLightest(amount, doDrain);
+ case SOUTH:
+ return this.outputTank.drainLightest(amount, doDrain);
+ case WEST:
+ return this.outputTank.drainLightest(amount, doDrain);
+ case EAST:
+ return this.outputTank.drainLightest(amount, doDrain);
+ case DOWN:
+ return this.outputTank.drain(amount, doDrain);
+ default:
+ return this.outputTank.drain(amount, doDrain);
+ }
+ }
+
+ // 1.7.10 API
+ @Override
public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
- return false;
+ return true;
}
@Override
- public boolean canFill(ForgeDirection arg0, Fluid arg1) {
- return false;
+ public boolean canFill(ForgeDirection direction, Fluid arg1) {
+ return direction.equals(ForgeDirection.getOrientation(this.getFacing()).getOpposite());
}
- public static void addRecipe(UniversalRecipeInput input, FluidStack fluidStackWithSize)
- {
- recipeManager.addRecipe(input, new UniversalRecipeOutput((new FluidStack[]{fluidStackWithSize}),null,20));
+ public static void addRecipe(UniversalRecipeInput input, FluidStack fluidStackWithSize) {
+ recipeManager.addRecipe(input, new UniversalRecipeOutput((new FluidStack[] { fluidStackWithSize }), null, 20));
}
public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
return recipeManager.getRecipes();
}
- public static void addRecipe(ItemStack input, FluidStack fluidStackOutput, ItemStack output) {
- recipeManager.addRecipe(new UniversalRecipeInput(null, (new ItemStack[] {input})),new UniversalRecipeOutput((new FluidStack[] {fluidStackOutput}),(new ItemStack[] {output}),20));
+ public static void addRecipe(IRecipeInput recipeInputOreDict, FluidStack fluidStackOutput, ItemStack output) {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, (new IRecipeInput[] { recipeInputOreDict })),
+ new UniversalRecipeOutput((new FluidStack[] { fluidStackOutput }), (new ItemStack[] { output }), 20));
+ }
+
+ public static void addRecipe(IRecipeInput input, ItemStack output) {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, (new IRecipeInput[] { input })),
+ new UniversalRecipeOutput(null, (new ItemStack[] { output }), 20));
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection arg0, FluidStack fluidStack, boolean doDrain) {
+ if (outputTank.getFluid() != null && outputTank.getFluid().containsFluid(fluidStack)) {
+ return this.outputTank.drain(fluidStack, doDrain);
+ }
+ return null;
}
- public static void addRecipe(ItemStack input, ItemStack output) {
- recipeManager.addRecipe(new UniversalRecipeInput(null, (new ItemStack[] {input})),new UniversalRecipeOutput(null,(new ItemStack[] {output}),20));
+ @Override
+ public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
+ return this.inputTank.fill(arg1, arg2);
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
+ return new FluidTankInfo[] { this.inputTank.getInfo() };
}
}
\ No newline at end of file diff --git a/ihl/processing/chemistry/LoomTileEntity.java b/ihl/processing/chemistry/LoomTileEntity.java index e81680d..4ff9bc4 100644 --- a/ihl/processing/chemistry/LoomTileEntity.java +++ b/ihl/processing/chemistry/LoomTileEntity.java @@ -105,7 +105,7 @@ public class LoomTileEntity extends TileEntityInventory implements IHasGui, INet public void operate()
{
List<IRecipeInput> input1 = LoomTileEntity.recipeManager.getRecipeInput(getInput()).getItemInputs();
- List<?> output1 = LoomTileEntity.recipeManager.getOutputFor(getInput(), false, false).getItemOutputs();
+ List<?> output1 = LoomTileEntity.recipeManager.getOutputFor(getInput()).getItemOutputs();
this.output.add(output1);
if(input1.get(0) instanceof RecipeInputWire)
{
@@ -118,7 +118,7 @@ public class LoomTileEntity extends TileEntityInventory implements IHasGui, INet }
else
{
- this.input.consume(0, input1.get(0).getAmount());
+ this.input.consume(input1.get(0));
}
}
@@ -130,8 +130,8 @@ public class LoomTileEntity extends TileEntityInventory implements IHasGui, INet public boolean canOperate()
{
- if(LoomTileEntity.recipeManager.getOutputFor(getInput(), false, false)==null) return false;
- List<?> output1 = LoomTileEntity.recipeManager.getOutputFor(getInput(), false, false).getItemOutputs();
+ if(LoomTileEntity.recipeManager.getOutputFor(getInput())==null) return false;
+ List<?> output1 = LoomTileEntity.recipeManager.getOutputFor(getInput()).getItemOutputs();
return this.output.canAdd(output1);
}
diff --git a/ihl/processing/chemistry/PaperMachineTileEntity.java b/ihl/processing/chemistry/PaperMachineTileEntity.java index 4784d38..eb28314 100644 --- a/ihl/processing/chemistry/PaperMachineTileEntity.java +++ b/ihl/processing/chemistry/PaperMachineTileEntity.java @@ -171,7 +171,7 @@ public class PaperMachineTileEntity extends BasicElectricMotorTileEntity impleme public UniversalRecipeOutput getOutput()
{
- return PaperMachineTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return PaperMachineTileEntity.recipeManager.getOutputFor(this.getInput());
}
@Override
diff --git a/ihl/processing/chemistry/PrecipitatorCondenserModel.java b/ihl/processing/chemistry/PrecipitatorCondenserModel.java deleted file mode 100644 index dd6f15a..0000000 --- a/ihl/processing/chemistry/PrecipitatorCondenserModel.java +++ /dev/null @@ -1,110 +0,0 @@ -package ihl.processing.chemistry; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; - -public class PrecipitatorCondenserModel extends ModelBase -{ - //fields - ModelRenderer Base; - - public PrecipitatorCondenserModel() - { - textureWidth = 64; - textureHeight = 32; - setTextureOffset("Base.Shape1", 22, 0); - setTextureOffset("Base.Shape2", 22, 17); - setTextureOffset("Base.Shape4", 30, 16); - setTextureOffset("Base.Shape3", 30, 15); - setTextureOffset("Base.Shape6", 30, 2); - setTextureOffset("Base.Shape7", 20, 0); - setTextureOffset("Base.Shape8", 50, 0); - setTextureOffset("Base.Shape9", 0, 0); - setTextureOffset("Base.Shape10", 24, 0); - setTextureOffset("Base.Shape11", 0, 0); - setTextureOffset("Base.Shape12", 0, 0); - setTextureOffset("Base.Shape13", 0, 0); - setTextureOffset("Base.Shape14", 0, 0); - setTextureOffset("Base.Shape15", 0, 0); - setTextureOffset("Base.Shape16", 0, 0); - setTextureOffset("Base.Shape17", 0, 0); - setTextureOffset("Base.Shape18", 0, 0); - setTextureOffset("Base.Shape19", 0, 0); - setTextureOffset("Base.Shape20", 0, 0); - setTextureOffset("Base.Shape21", 0, 0); - setTextureOffset("Base.Shape25", 0, 1); - setTextureOffset("Base.Shape26", 12, 24); - setTextureOffset("Base.Shape27", 0, 0); - setTextureOffset("Base.Shape28", 0, 18); - setTextureOffset("Base.Shape29", 21, 0); - setTextureOffset("Base.Shape30", 0, 0); - setTextureOffset("Base.Shape31", 0, 0); - setTextureOffset("Base.Shape32", 0, 0); - setTextureOffset("Base.Shape33", 0, 0); - setTextureOffset("Base.Shape34", 0, 0); - setTextureOffset("Base.Shape35", 0, 0); - setTextureOffset("Base.Shape36", 0, 0); - setTextureOffset("Base.Shape37", 0, 0); - setTextureOffset("Base.Shape38", 0, 0); - setTextureOffset("Base.Shape39", 0, 0); - setTextureOffset("Base.Shape40", 0, 0); - setTextureOffset("Base.Shape5", 0, 0); - setTextureOffset("Base.Shape23", 31, 0); - setTextureOffset("Base.Shape24", 10, 0); - setTextureOffset("Base.Shape41", 27, 26); - setTextureOffset("Base.Shape42", 0, 0); - setTextureOffset("Base.Shape43", 0, 0); - setTextureOffset("Base.Shape44", 0, 0); - setTextureOffset("Base.Shape45", 0, 0); - setTextureOffset("Base.Shape46", 0, 0); - - Base = new ModelRenderer(this, "Base"); - Base.setRotationPoint(0F, 23F, 0F); - Base.mirror = true; - Base.addBox("Shape1", 6F, -15F, -7F, 1, 12, 14); - Base.addBox("Shape2", -7F, -3F, -8F, 14, 3, 1); - Base.addBox("Shape4", 6F, -15F, -8F, 1, 12, 1); - Base.addBox("Shape3", -7F, -3F, 7F, 14, 3, 1); - Base.addBox("Shape6", -7F, -15F, 7F, 1, 12, 1); - Base.addBox("Shape7", -7F, -15F, -7F, 1, 15, 14); - Base.addBox("Shape8", -7F, -15F, -8F, 1, 12, 1); - Base.addBox("Shape9", 1F, 0F, -8F, 6, 1, 16); - Base.addBox("Shape10", 6F, -15F, 7F, 1, 12, 1); - Base.addBox("Shape11", -4F, -13F, 3F, 1, 12, 3); - Base.addBox("Shape12", 4F, -2F, -1F, 2, 1, 3); - Base.addBox("Shape13", 3F, -13F, -1F, 1, 12, 3); - Base.addBox("Shape14", -3F, -13F, 5F, 9, 12, 1); - Base.addBox("Shape15", -6F, -2F, -2F, 12, 1, 1); - Base.addBox("Shape16", -4F, -13F, -5F, 1, 12, 3); - Base.addBox("Shape17", -6F, -2F, 6F, 12, 1, 1); - Base.addBox("Shape18", -6F, -2F, -7F, 12, 1, 2); - Base.addBox("Shape19", -6F, -2F, -5F, 2, 1, 3); - Base.addBox("Shape20", -6F, -2F, 2F, 12, 1, 1); - Base.addBox("Shape21", -6F, -2F, 3F, 2, 1, 3); - Base.addBox("Shape25", -6F, -15F, 7F, 12, 3, 1); - Base.addBox("Shape26", -6F, -15F, -8F, 12, 3, 1); - Base.addBox("Shape27", -8F, 0F, -8F, 7, 1, 16); - Base.addBox("Shape28", -1F, 0F, 1F, 2, 1, 7); - Base.addBox("Shape29", -1F, 0F, -8F, 2, 1, 7); - Base.addBox("Shape30", -3F, -13F, 3F, 9, 12, 1); - Base.addBox("Shape31", -6F, -13F, 1F, 9, 12, 1); - Base.addBox("Shape32", -6F, -13F, -1F, 9, 12, 1); - Base.addBox("Shape33", -3F, -13F, -3F, 9, 12, 1); - Base.addBox("Shape34", -3F, -13F, -5F, 9, 12, 1); - Base.addBox("Shape35", -6F, -13F, -7F, 12, 1, 2); - Base.addBox("Shape36", -6F, -13F, -2F, 12, 1, 1); - Base.addBox("Shape37", -6F, -13F, 2F, 12, 1, 1); - Base.addBox("Shape38", -6F, -13F, 6F, 12, 1, 1); - Base.addBox("Shape39", -6F, -13F, -5F, 2, 1, 3); - Base.addBox("Shape40", -6F, -13F, 3F, 2, 1, 3); - Base.addBox("Shape5", 4F, -13F, -1F, 2, 1, 3); - Base.addBox("Shape23", 6F, -2F, -7F, 1, 2, 14); - Base.addBox("Shape24", 6F, -3F, 3F, 1, 1, 4); - Base.addBox("Shape41", 6F, -3F, -7F, 1, 1, 5); - Base.addBox("Shape42", 7F, -4F, -2F, 4, 1, 5); - Base.addBox("Shape43", 8F, 0F, -2F, 1, 1, 5); - Base.addBox("Shape44", 10F, -3F, -2F, 1, 4, 5); - Base.addBox("Shape45", 7F, -4F, 3F, 4, 5, 1); - Base.addBox("Shape46", 7F, -4F, -3F, 4, 5, 1); - } -} diff --git a/ihl/processing/chemistry/PrecipitatorCondenserRender.java b/ihl/processing/chemistry/PrecipitatorCondenserRender.java deleted file mode 100644 index ae68bbf..0000000 --- a/ihl/processing/chemistry/PrecipitatorCondenserRender.java +++ /dev/null @@ -1,50 +0,0 @@ -package ihl.processing.chemistry;
-import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.ResourceLocation;
-import org.lwjgl.opengl.GL11;
-import ihl.IHLModInfo;
-
-public class PrecipitatorCondenserRender extends TileEntitySpecialRenderer{
-private PrecipitatorCondenserModel model = new PrecipitatorCondenserModel();
-private ResourceLocation tex = new ResourceLocation(IHLModInfo.MODID+":textures/blocks/porcelainBox.png");
-
-public PrecipitatorCondenserRender(){}
-
-public void renderAModelAt(PrecipitatorCondenserTileEntity tile, double d, double d1, double d2, float f) {
- int rotation = 0;
- if(tile.getWorldObj() != null)
- {
- switch (tile.getFacing())
- {
- case 2:
- rotation = 0;
- break;
- case 5:
- rotation = 1;
- break;
- case 3:
- rotation = 2;
- break;
- case 4:
- rotation = 3;
- break;
- default:
- rotation = 0;
- }
- }
- bindTexture(tex); //texture
- GL11.glPushMatrix();
- GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.5F, (float)d2 + 0.5F);
- GL11.glScalef(1.0F, -1F, -1F);
- GL11.glRotatef(rotation*90, 0.0F, 1.0F, 0.0F);
- model.Base.render(1.0F/16.0F);
- GL11.glPopMatrix(); //end
-}
-
- @Override
- public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8)
- {
- this.renderAModelAt((PrecipitatorCondenserTileEntity)par1TileEntity, par2, par4, par6, par8);
- }
-}
\ No newline at end of file diff --git a/ihl/processing/chemistry/PrecipitatorCondenserTileEntity.java b/ihl/processing/chemistry/PrecipitatorCondenserTileEntity.java deleted file mode 100644 index 6f3b43f..0000000 --- a/ihl/processing/chemistry/PrecipitatorCondenserTileEntity.java +++ /dev/null @@ -1,379 +0,0 @@ -package ihl.processing.chemistry;
-
-import java.util.Arrays;
-import java.util.Map;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.Fluid;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.FluidTankInfo;
-import net.minecraftforge.fluids.IFluidHandler;
-import ic2.core.IC2;
-import ic2.core.block.TileEntityInventory;
-import ihl.recipes.UniversalRecipeInput;
-import ihl.recipes.UniversalRecipeManager;
-import ihl.recipes.UniversalRecipeOutput;
-import ihl.utils.IHLFluidTank;
-import ihl.utils.IHLUtils;
-import ihl.worldgen.ores.IHLFluid;
-
-public class PrecipitatorCondenserTileEntity extends TileEntityInventory implements IFluidHandler
-{
- private final static UniversalRecipeManager recipeManager = new UniversalRecipeManager("precipitatorcondenser");
- private static float kF = 24000F;
- private static float fluidC = 4F;
- private static float H = 2256F;
- private final IHLFluidTank gasBuffer = new IHLFluidTank(10000);
- private final IHLFluidTank fluidTank = new IHLFluidTank(100);
- private ForgeDirection gasInputDirection = ForgeDirection.WEST;
- private int amountOfGasCondensed=0;
-
- public PrecipitatorCondenserTileEntity()
- {
- super();
- }
-
- @Override
- public void readFromNBT(NBTTagCompound nbttagcompound)
- {
- super.readFromNBT(nbttagcompound);
- this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank"));
- this.gasBuffer.readFromNBT(nbttagcompound.getCompoundTag("gasBuffer"));
- this.amountOfGasCondensed=nbttagcompound.getInteger("amountOfGasCondensed");
- }
-
- public static void addRecipe(String fluidNameIn, String fluidNameOut, int conversionRateToGas)
- {
- recipeManager.addRecipe(new UniversalRecipeInput((new FluidStack[] {IHLUtils.getFluidStackWithSize(fluidNameIn, conversionRateToGas)}), null), new UniversalRecipeOutput((new FluidStack[] {IHLUtils.getFluidStackWithSize(fluidNameOut, 1)}),null,2));
- }
-
- @Override
- public void writeToNBT(NBTTagCompound nbttagcompound)
- {
- super.writeToNBT(nbttagcompound);
- NBTTagCompound fluidTankTag = new NBTTagCompound();
- this.fluidTank.writeToNBT(fluidTankTag);
- nbttagcompound.setTag("fluidTank", fluidTankTag);
-
- NBTTagCompound gasBufferTag = new NBTTagCompound();
- this.gasBuffer.writeToNBT(gasBufferTag);
- nbttagcompound.setTag("gasBuffer", gasBufferTag);
-
- nbttagcompound.setInteger("amountOfGasCondensed",this.amountOfGasCondensed);
- }
-
- @Override
- public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
- return this.getFacing()!=(short)side && side!=0 && side!=1;
- }
-
- @Override
- public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
- return IHLUtils.getThisModItemStack("goldPrecipitatorCondenser");
- }
-
- public boolean enableUpdateEntity()
- {
- return IC2.platform.isSimulating();
- }
-
- @Override
- public void updateEntityServer()
- {
- super.updateEntityServer();
- FluidStack fluidStack = this.fluidTank.getFluid();
- FluidStack gasStack = this.gasBuffer.getFluid();
- if(fluidStack!=null && gasStack!=null && fluidStack.amount>0 && gasStack.amount>0)
- {
- int t1 = this.fluidTank.getTemperature();
- float densityOfCoolant = IHLFluid.getRealDensity(fluidStack.getFluid());
- float densityOfGas = IHLFluid.getRealDensity(gasStack.getFluid());
- int boilingPointOfGas = IHLFluid.getBoilingPoint(gasStack.getFluid());
- amountOfGasCondensed += this.getAmountOfCondensedGas(fluidStack.amount, this.gasBuffer.getFluidAmount(), boilingPointOfGas, t1, densityOfGas, densityOfCoolant);
- }
- if(amountOfGasCondensed>10000)
- {
- UniversalRecipeOutput rOutput = null;
- UniversalRecipeInput rInput = null;
- FluidStack fs = null;
- for(int i=0;i<this.gasBuffer.getNumberOfFluids();i++)
- {
- FluidStack fs1 = this.gasBuffer.getFluid(i);
- //System.out.println("#"+i+":"+fs1.getLocalizedName()+" amount "+fs1.amount);
- UniversalRecipeOutput rOutput1 = PrecipitatorCondenserTileEntity.recipeManager.getOutputFor(Arrays.asList(new FluidStack[]{fs1}),null, false, false);
- if(rOutput1==null)
- {
- this.gasBuffer.getFluidList().remove(i);
- //System.out.println("output is null");
- }
- else
- {
- //System.out.println("output is not null");
- rOutput=rOutput1;
- rInput = PrecipitatorCondenserTileEntity.recipeManager.getRecipeInput(Arrays.asList(new FluidStack[]{fs1}),null);
- fs=fs1;
- }
- }
- if(rOutput!=null)
- {
- this.gasBuffer.drain(fs, true);
- FluidStack outputFluid = rOutput.getFluidOutputs().get(0).copy();
- outputFluid.amount=amountOfGasCondensed/rInput.getFluidInputs().get(0).getAmount();
- this.fillCondensateOutputApparatus(ForgeDirection.UP, outputFluid, true);
- }
- amountOfGasCondensed=0;
- }
- if(this.gasBuffer.getFluidAmount()*3>this.gasBuffer.getCapacity()*2)
- {
- FluidStack passingGas = this.gasBuffer.drainLightest(this.gasBuffer.getCapacity()/2, true);
- this.fillGaseousOutputApparatus(gasInputDirection, passingGas, true);
- }
- if(this.fluidTank.getFluid()!=null)
- {
- FluidStack coolant = this.fluidTank.drain(5, true);
- this.fillHeatTransferAgentOutputApparatus(ForgeDirection.UP, coolant, true);
- }
- }
-
- private int getAmountOfCondensedGas(int amountOfCoolant, int amountOfGas, int boilingPointOfGas, int temperatureOfCoolant, float densityOfGas, float densityOfCoolant)
- {
- if(amountOfCoolant<=0 || amountOfGas<=0 || boilingPointOfGas-20<temperatureOfCoolant)
- {
- return 0;
- }
- int L = amountOfGas;
- int t2 = boilingPointOfGas;
- int t1 = temperatureOfCoolant;
- int dt1=t2-t1;
- float maxQ=H*L*densityOfGas;
- int t1_1 = t1;
- for(int i=0;i<10;i++)
- {
- float Q2=H*L*densityOfGas;
- t1_1 = t1+(int)(Q2/fluidC/amountOfCoolant/densityOfCoolant);
- int dt2=t2-t1_1;
- float deltaT;
- if(dt1>2*dt2)
- {
- deltaT = (float) ((dt1-dt2)/Math.log((double)dt2/(double)dt1));
- }
- else
- {
- deltaT = (dt1+dt2)*0.5F;
- }
- float Q1 = kF*deltaT;
- if(Q1>=maxQ)
- {
- break;
- }
- else
- {
- int next_L = (int)(Q1/H/densityOfGas);
- if(Math.abs(next_L-L)<4)
- {
- L=next_L;
- break;
- }
- L=next_L;
- }
- }
- if(t1_1>t1)
- {
- this.fluidTank.setTemperature(t1_1);
- }
- else
- {
- this.fluidTank.setTemperature(t1+1);
- }
- return L;
- }
-
- @Override
- public String getInventoryName()
- {
- return "precipitatorCondenser";
- }
-
- public void onGuiClosed(EntityPlayer entityPlayer) {}
-
- public int mX()
- {
- switch(this.getFacing())
- {
- case 4:
- return -1;
- case 5:
- return 1;
- default:
- return 0;
- }
- }
-
- public int mZ()
- {
- switch(this.getFacing())
- {
- case 2:
- return -1;
- case 3:
- return 1;
- default:
- return 0;
- }
- }
-
- public int mLZ()
- {
- switch(this.getFacing())
- {
- case 4:
- return -1;
- case 5:
- return 1;
- default:
- return 0;
- }
- }
-
- public int mLX()
- {
- switch(this.getFacing())
- {
- case 2:
- return 1;
- case 3:
- return -1;
- default:
- return 0;
- }
- }
-
- @Override
- public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
- return false;
- }
-
- @Override
- public boolean canFill(ForgeDirection direction, Fluid fluid) {
- return direction==ForgeDirection.UP || (gasCanPass(direction) && fluid.isGaseous());
- }
-
- @Override
- public int fill(ForgeDirection direction, FluidStack fluidStack, boolean doFill)
- {
- if(fluidStack!=null && fluidStack.getFluid()!=null && fluidStack.amount>0)
- {
- if(gasCanPass(direction) && fluidStack!=null && fluidStack.getFluid()!=null && fluidStack.amount>0)
- {
- this.gasInputDirection=direction;
- if(fluidStack.getFluid().isGaseous() && fluidStack.getFluid().getDensity()<IHLFluid.maxGaseousStateVapoursDensity)
- {
- return gasBuffer.fill(fluidStack, doFill);
- }
- else
- {
- return this.fillCondensateOutputApparatus(ForgeDirection.UP, fluidStack, doFill);
- }
- }
- else if(direction==ForgeDirection.UP)
- {
- return fluidTank.fill(fluidStack, doFill);
- }
- }
- return 0;
- }
-
- private int fillCondensateOutputApparatus(ForgeDirection direction,FluidStack fluidStack, boolean doFill)
- {
- TileEntity te = worldObj.getTileEntity(xCoord+mLX(),yCoord-1, zCoord+mLZ());
- if(te instanceof IFluidHandler)
- {
- return ((IFluidHandler)te).fill(direction, fluidStack, doFill);
- }
- else
- {
- return 0;
- }
- }
-
- private int fillHeatTransferAgentOutputApparatus(ForgeDirection direction,FluidStack fluidStack, boolean doFill)
- {
- TileEntity te = worldObj.getTileEntity(xCoord,yCoord-1,zCoord);
- if(te instanceof IFluidHandler)
- {
- return ((IFluidHandler)te).fill(direction, fluidStack, doFill);
- }
- else
- {
- return 0;
- }
- }
-
-
- private int fillGaseousOutputApparatus(ForgeDirection direction,FluidStack fluidStack, boolean doFill)
- {
- TileEntity te = worldObj.getTileEntity(xCoord-direction.offsetX,yCoord, zCoord-direction.offsetZ);
- if(te instanceof IFluidHandler)
- {
- int amountFilled = ((IFluidHandler)te).fill(direction, fluidStack, doFill);
- return amountFilled;
- }
- else
- {
- return 0;
- }
- }
-
- public boolean gasCanPass(ForgeDirection direction)
- {
- switch(this.getFacing())
- {
- case 4:
- return direction == ForgeDirection.WEST || direction == ForgeDirection.EAST;
- case 5:
- return direction == ForgeDirection.WEST || direction == ForgeDirection.EAST;
- case 2:
- return direction == ForgeDirection.NORTH || direction == ForgeDirection.SOUTH;
- case 3:
- return direction == ForgeDirection.NORTH || direction == ForgeDirection.SOUTH;
- default:
- return direction == ForgeDirection.NORTH || direction == ForgeDirection.SOUTH;
- }
- }
-
- @Override
- public void setFacing(short facing1)
- {
- super.setFacing((short) Math.max(facing1, 2));
- }
-
- @Override
- public FluidStack drain(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
- return null;
- }
-
- @Override
- public FluidStack drain(ForgeDirection arg0, int arg1, boolean arg2) {
- return null;
- }
-
- @Override
- public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
- return new FluidTankInfo[]{this.fluidTank.getInfo(), this.gasBuffer.getInfo()};
- }
-
- public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes()
- {
- return recipeManager.getRecipes();
- }
-
- @Override
- public boolean shouldRenderInPass(int pass)
- {
- return pass==0;
- }
-}
\ No newline at end of file diff --git a/ihl/processing/invslots/IHLInvSlotOutput.java b/ihl/processing/invslots/IHLInvSlotOutput.java index 7e10ab3..d683221 100644 --- a/ihl/processing/invslots/IHLInvSlotOutput.java +++ b/ihl/processing/invslots/IHLInvSlotOutput.java @@ -16,114 +16,88 @@ import ic2.core.block.invslot.InvSlotOutput; import ihl.recipes.RecipeOutputItemStack;
import ihl.utils.IHLUtils;
-public class IHLInvSlotOutput extends InvSlotOutput{
+public class IHLInvSlotOutput extends InvSlotOutput {
+
+ private final Map<Long, Float> substanceAmount = new HashMap<Long, Float>();
- private final Map<Long,Float> substanceAmount = new HashMap<Long,Float>();
public IHLInvSlotOutput(TileEntityInventory base1, String name1, int oldStartIndex1, int count) {
super(base1, name1, oldStartIndex1, count);
}
@SuppressWarnings("rawtypes")
@Override
- public boolean canAdd(List itemOutputs)
- {
- if(itemOutputs==null || itemOutputs.isEmpty())
- {
+ public boolean canAdd(List itemOutputs) {
+ if (itemOutputs == null || itemOutputs.isEmpty()) {
return true;
}
Iterator ioi = itemOutputs.iterator();
- if(this.size()>=itemOutputs.size())
- {
+ if (this.size() >= itemOutputs.size()) {
Object rois;
- if(ioi.hasNext())
- {
+ if (ioi.hasNext()) {
rois = ioi.next();
- }
- else
- {
+ } else {
return true;
}
- for(int i=0;i<this.size();i++)
- {
- if(this.get(i)==null || (this.objectMatchesSlot(rois, i) && this.get(i).stackSize+this.getAmoutOfObject(rois)<this.getStackSizeLimit()))
- {
- if(ioi.hasNext())
- {
+ for (int i = 0; i < this.size(); i++) {
+ if (this.get(i) == null || (this.objectMatchesSlot(rois, i)
+ && this.get(i).stackSize + this.getAmoutOfObject(rois) < this.getStackSizeLimit()
+ && this.get(i).stackSize + this.getAmoutOfObject(rois) <= this.get(i).getMaxStackSize())) {
+ if (ioi.hasNext()) {
rois = ioi.next();
- }
- else
- {
+ } else {
return true;
}
- }
- else
- {
- if(i==this.size()-1)
- {
+ } else {
+ if (i == this.size() - 1) {
return false;
}
}
}
-
+
}
return false;
}
private float getAmoutOfObject(Object obj) {
- if(obj instanceof ItemStack)
- {
+ if (obj instanceof ItemStack) {
return ((ItemStack) obj).stackSize;
- }
- else if(obj instanceof RecipeOutputItemStack)
- {
- return ((RecipeOutputItemStack)obj).quantity;
+ } else if (obj instanceof RecipeOutputItemStack) {
+ return ((RecipeOutputItemStack) obj).quantity;
}
return Short.MAX_VALUE;
}
- public boolean objectMatchesSlot(Object obj, int slot)
- {
- if(this.get(slot)==null)
- {
+ public boolean objectMatchesSlot(Object obj, int slot) {
+ if (this.get(slot) == null) {
return true;
- }
- else
- {
- if(obj instanceof ItemStack)
- {
+ } else {
+ if (obj instanceof ItemStack) {
return IHLUtils.isItemStacksIsEqual(this.get(slot), (ItemStack) obj, true);
- }
- else if(obj instanceof RecipeOutputItemStack)
- {
- return ((RecipeOutputItemStack)obj).matches(this.get(slot));
+ } else if (obj instanceof RecipeOutputItemStack) {
+ return ((RecipeOutputItemStack) obj).matches(this.get(slot));
}
}
return false;
}
- public void add(RecipeOutputItemStack rois)
- {
- for(int i=0;i<this.size();i++)
- {
- if(this.get(i)==null || (this.objectMatchesSlot(rois, i) && this.get(i).stackSize+this.getAmoutOfObject(rois)<this.getStackSizeLimit()))
- {
+ public void add(RecipeOutputItemStack rois) {
+ for (int i = 0; i < this.size(); i++) {
+ if (this.get(i) == null || (this.objectMatchesSlot(rois, i)
+ && this.get(i).stackSize + this.getAmoutOfObject(rois) < this.getStackSizeLimit())) {
this.add(i, rois);
break;
}
}
}
- private void add(int i, RecipeOutputItemStack rois)
- {
- long key = (Item.getIdFromItem(rois.itemStack.getItem())<<32)+rois.itemStack.getItemDamage();
- float amount=0f;
- if(this.substanceAmount.containsKey(key))
- {
+ private void add(int i, RecipeOutputItemStack rois) {
+ long key = (Item.getIdFromItem(rois.itemStack.getItem()) << 32) + rois.itemStack.getItemDamage();
+ float amount = 0f;
+ if (this.substanceAmount.containsKey(key)) {
amount = this.substanceAmount.get(key);
}
- amount+=rois.quantity;
- while(amount>=1)
- {
+ amount += rois.quantity;
+ while (amount >= 1) {
amount--;
this.add(rois.itemStack.copy());
}
@@ -132,80 +106,62 @@ public class IHLInvSlotOutput extends InvSlotOutput{ @Override
@SuppressWarnings("rawtypes")
- public int add(List itemOutputs)
- {
- if(itemOutputs==null || itemOutputs.isEmpty())
- {
+ public int add(List itemOutputs) {
+ if (itemOutputs == null || itemOutputs.isEmpty()) {
return 0;
}
Iterator ioi = itemOutputs.iterator();
- if(this.size()>=itemOutputs.size() && ioi.hasNext())
- {
+ if (this.size() >= itemOutputs.size() && ioi.hasNext()) {
Object rois = ioi.next();
- for(int i=0;i<this.size();i++)
- {
- if(this.get(i)==null || (this.objectMatchesSlot(rois, i) && this.get(i).stackSize+this.getAmoutOfObject(rois)<this.getStackSizeLimit()))
- {
- if(rois instanceof ItemStack)
- {
+ for (int i = 0; i < this.size(); i++) {
+ if (this.get(i) == null || (this.objectMatchesSlot(rois, i)
+ && this.get(i).stackSize + this.getAmoutOfObject(rois) < this.getStackSizeLimit())) {
+ if (rois instanceof ItemStack) {
this.add(((ItemStack) rois).copy());
- }
- else if(rois instanceof RecipeOutputItemStack)
- {
+ } else if (rois instanceof RecipeOutputItemStack) {
this.add(i, (RecipeOutputItemStack) rois);
}
- if(ioi.hasNext())
- {
+ if (ioi.hasNext()) {
rois = ioi.next();
- }
- else
- {
+ } else {
return itemOutputs.size();
}
- }
- else
- {
- if(i==this.size()-1)
- {
+ } else {
+ if (i == this.size() - 1) {
return 0;
}
}
}
-
+
}
return 0;
}
-
+
@Override
- public void readFromNbt(NBTTagCompound nbtTagCompound)
- {
+ public void readFromNbt(NBTTagCompound nbtTagCompound) {
super.readFromNbt(nbtTagCompound);
NBTTagList amountTagList = nbtTagCompound.getTagList("substanceAmountMap", 10);
- for(int i=0;i<amountTagList.tagCount();i++)
- {
- if(amountTagList.getCompoundTagAt(i).hasKey("substanceKey"))
- {
- long substanceKey = amountTagList.getCompoundTagAt(i).getLong("substanceKey");
- float substanceAmount = amountTagList.getCompoundTagAt(i).getFloat("substanceAmount");
- this.substanceAmount.put(substanceKey, substanceAmount);
- }
- }
- }
-
+ for (int i = 0; i < amountTagList.tagCount(); i++) {
+ if (amountTagList.getCompoundTagAt(i).hasKey("substanceKey")) {
+ long substanceKey = amountTagList.getCompoundTagAt(i).getLong("substanceKey");
+ float substanceAmount = amountTagList.getCompoundTagAt(i).getFloat("substanceAmount");
+ this.substanceAmount.put(substanceKey, substanceAmount);
+ }
+ }
+ }
+
@Override
- public void writeToNbt(NBTTagCompound nbtTagCompound)
- {
+ public void writeToNbt(NBTTagCompound nbtTagCompound) {
super.writeToNbt(nbtTagCompound);
- NBTTagList sAmountsList = new NBTTagList();
- Iterator<Entry<Long, Float>> entrySetIterator = this.substanceAmount.entrySet().iterator();
- while(entrySetIterator.hasNext())
- {
- Entry<Long, Float> entry = entrySetIterator.next();
- NBTTagCompound tag = new NBTTagCompound();
- tag.setLong("substanceKey", entry.getKey());
- tag.setFloat("substanceAmount", entry.getValue());
- sAmountsList.appendTag(tag);
- }
- nbtTagCompound.setTag("substanceAmountMap", sAmountsList);
- }
+ NBTTagList sAmountsList = new NBTTagList();
+ Iterator<Entry<Long, Float>> entrySetIterator = this.substanceAmount.entrySet().iterator();
+ while (entrySetIterator.hasNext()) {
+ Entry<Long, Float> entry = entrySetIterator.next();
+ NBTTagCompound tag = new NBTTagCompound();
+ tag.setLong("substanceKey", entry.getKey());
+ tag.setFloat("substanceAmount", entry.getValue());
+ sAmountsList.appendTag(tag);
+ }
+ nbtTagCompound.setTag("substanceAmountMap", sAmountsList);
+ }
}
diff --git a/ihl/processing/invslots/SlotRedstoneConverterCableInvSlot.java b/ihl/processing/invslots/SlotRedstoneConverterCableInvSlot.java deleted file mode 100644 index 461c3cc..0000000 --- a/ihl/processing/invslots/SlotRedstoneConverterCableInvSlot.java +++ /dev/null @@ -1,23 +0,0 @@ -package ihl.processing.invslots;
-
-import net.minecraft.entity.player.EntityPlayer;
-import ic2.core.block.invslot.InvSlot;
-import ic2.core.slot.SlotInvSlot;
-
-public class SlotRedstoneConverterCableInvSlot extends SlotInvSlot {
-
- public InvSlot invSlot;
-
- public SlotRedstoneConverterCableInvSlot(InvSlot invSlot1, int index1,
- int xDisplayPosition1, int yDisplayPosition1) {
- super(invSlot1, index1, xDisplayPosition1, yDisplayPosition1);
- this.invSlot=invSlot1;
- }
-
- @Override
- public boolean canTakeStack(EntityPlayer player)
- {
- return false;
- }
-
-}
diff --git a/ihl/processing/metallurgy/AchesonFurnaceGui.java b/ihl/processing/metallurgy/AchesonFurnaceGui.java index 70e9d05..7665635 100644 --- a/ihl/processing/metallurgy/AchesonFurnaceGui.java +++ b/ihl/processing/metallurgy/AchesonFurnaceGui.java @@ -6,11 +6,10 @@ import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11;
public class AchesonFurnaceGui extends GuiContainer {
- protected static final ResourceLocation achesonFurnaceBackground = new ResourceLocation("ihl", "textures/gui/GUIAchesonFurnance.png");
+ protected static final ResourceLocation achesonFurnaceBackground = new ResourceLocation("ihl", "textures/gui/GUIAchesonFurnace.png");
private MachineBaseContainer container;
public AchesonFurnaceGui(MachineBaseContainer machineBaseContainer) {
- //the container is instanciated and passed to the superclass for handling
super(machineBaseContainer);
this.container=machineBaseContainer;
}
@@ -27,8 +26,8 @@ public class AchesonFurnaceGui extends GuiContainer { }
if (this.container.tileEntity.progress > 0)
{
- i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(50),50);
- this.drawTexturedModalRect(64, 63, 197, 0, i1 + 1, 13);
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(17),17);
+ this.drawTexturedModalRect(70,34, 197, 0, i1 + 1, 13);
}
fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("ihl.gui.achesonFurnance"), 40, 12, 16768125);
}
diff --git a/ihl/processing/metallurgy/AchesonFurnanceContainer.java b/ihl/processing/metallurgy/AchesonFurnanceContainer.java index 140ec97..2580c6c 100644 --- a/ihl/processing/metallurgy/AchesonFurnanceContainer.java +++ b/ihl/processing/metallurgy/AchesonFurnanceContainer.java @@ -8,10 +8,9 @@ public class AchesonFurnanceContainer extends MachineBaseContainer { public AchesonFurnanceContainer(EntityPlayer entityPlayer,
AchesonFurnanceTileEntity tileEntity1) {
super(entityPlayer, tileEntity1);
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.inputElectrode, 0, 63, 40));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.inputElectrode, 1, 99, 40));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 81, 40));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 81, 22));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 40, 22));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 40, 40));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 98, 32));
}
}
diff --git a/ihl/processing/metallurgy/AchesonFurnanceTileEntity.java b/ihl/processing/metallurgy/AchesonFurnanceTileEntity.java index 5709cb9..1692e62 100644 --- a/ihl/processing/metallurgy/AchesonFurnanceTileEntity.java +++ b/ihl/processing/metallurgy/AchesonFurnanceTileEntity.java @@ -4,11 +4,9 @@ import java.util.List; import java.util.Map;
import ic2.api.recipe.IRecipeInput;
-import ic2.api.recipe.RecipeInputOreDict;
import ic2.core.ContainerBase;
-import ic2.core.block.invslot.InvSlot.Access;
import ihl.IHLMod;
-import ihl.processing.chemistry.ApparatusProcessableInvSlot;
+import ihl.processing.invslots.IHLInvSlotOutput;
import ihl.recipes.RecipeOutputItemStack;
import ihl.recipes.UniversalRecipeInput;
import ihl.recipes.UniversalRecipeManager;
@@ -22,15 +20,12 @@ import cpw.mods.fml.relauncher.SideOnly; public class AchesonFurnanceTileEntity extends MachineBaseTileEntity {
- public final ApparatusProcessableInvSlot inputElectrode;
- protected static UniversalRecipeManager recipeManager = new UniversalRecipeManager("achesonfurnace");
- private final RecipeInputOreDict[] validElectrodeTypes = new RecipeInputOreDict[] {
- new RecipeInputOreDict("stickCoal"), new RecipeInputOreDict("stickGraphite"),
- new RecipeInputOreDict("plateCoal"), new RecipeInputOreDict("plateGraphite") };
+ protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager("achesonfurnace");
+ public final IHLInvSlotOutput outputSlot;
public AchesonFurnanceTileEntity() {
super(2);
- inputElectrode = new ApparatusProcessableInvSlot(this, "inputElectrode", 1, Access.IO, 2, 1);
+ this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 1);
}
public static void addRecipe(IRecipeInput input1, IRecipeInput input2, String output1) {
@@ -71,36 +66,23 @@ public class AchesonFurnanceTileEntity extends MachineBaseTileEntity { @Override
public void operate() {
- List<RecipeOutputItemStack> output = AchesonFurnanceTileEntity.recipeManager
- .getOutputFor(getInput(), true, true).getItemOutputs();
- for (int i = 0; i < this.inputElectrode.size(); i++) {
- ItemStack electrodeIS = this.inputElectrode.get(i);
- if (this.validElectrodeTypes[0].matches(electrodeIS)) {
- this.inputElectrode.put(i, IHLUtils.getThisModItemStack("stickGraphite"));
- } else if (this.validElectrodeTypes[2].matches(electrodeIS)) {
- this.inputElectrode.put(i, IHLUtils.getThisModItemStack("plateGraphite"));
- }
- }
- for (int i = 0; i < this.input.size(); i++) {
- if (output.size() > i) {
- ItemStack stack = output.get(i).itemStack.copy();
- stack.stackSize = Math.round(output.get(i).quantity);
- this.input.put(i, stack);
- }
- if (this.input.get(i) != null && this.input.get(i).stackSize <= 0) {
- this.input.put(i, null);
- }
- }
ItemStack crucible = input.getItemStack(IHLMod.crucible);
if (crucible != null) {
((Crucible) crucible.getItem()).processContent(crucible, this);
+ return;
+ }
+ List<RecipeOutputItemStack> output = recipeManager
+ .getOutputFor(getInput()).getItemOutputs();
+ List<IRecipeInput> rinput = recipeManager.getRecipeInput(getInput()).getItemInputs();
+ for (int i = 0; i < rinput.size(); i++) {
+ this.input.consume(rinput.get(i));
}
+ this.outputSlot.add(output);
}
@Override
public boolean canOperate() {
- return this.isValidElectrode(this.inputElectrode.get(0)) && this.isValidElectrode(this.inputElectrode.get(1))
- && this.getOutput() != null;
+ return this.getOutput() != null;
}
@Override
@@ -114,17 +96,6 @@ public class AchesonFurnanceTileEntity extends MachineBaseTileEntity { @Override
public UniversalRecipeOutput getOutput() {
- return AchesonFurnanceTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
- }
-
- private boolean isValidElectrode(ItemStack stack) {
- if (stack != null) {
- for (int i = 0; i < this.validElectrodeTypes.length; i++) {
- if (validElectrodeTypes[i].matches(stack)) {
- return true;
- }
- }
- }
- return false;
+ return AchesonFurnanceTileEntity.recipeManager.getOutputFor(this.getInput());
}
}
diff --git a/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java b/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java index a2fa219..7f82532 100644 --- a/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java +++ b/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java @@ -11,6 +11,7 @@ import ic2.core.IC2; import ic2.core.IHasGui;
import ic2.core.block.invslot.InvSlot;
import ic2.core.block.invslot.InvSlot.Access;
+import ihl.IHLMod;
import ihl.flexible_cable.FlexibleCableHolderBaseTileEntity;
import ihl.flexible_cable.NodeEntity;
import ihl.utils.IHLInvSlotDischarge;
@@ -34,6 +35,7 @@ public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBa public BasicElectricMotorTileEntity() {
super();
+ energyConsume = IHLMod.config.machineryEnergyConsume/100d;
dischargeSlot = new IHLInvSlotDischarge(this, 1, Access.IO, 4, InvSlot.InvSide.BOTTOM);
}
diff --git a/ihl/processing/metallurgy/BigMachineFrameTileEntity.java b/ihl/processing/metallurgy/BigMachineFrameTileEntity.java deleted file mode 100644 index 0922355..0000000 --- a/ihl/processing/metallurgy/BigMachineFrameTileEntity.java +++ /dev/null @@ -1,109 +0,0 @@ -package ihl.processing.metallurgy;
-
-import net.minecraft.block.Block;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.ItemStack;
-import net.minecraft.tileentity.TileEntity;
-import ihl.interfaces.IWorkspaceElement;
-import ihl.utils.IHLUtils;
-
-public class BigMachineFrameTileEntity extends TileEntity implements IWorkspaceElement {
-
- @Override
- public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side)
- {
- return false;
- }
-
- @Override
- public short getFacing()
- {
- return 0;
- }
-
- @Override
- public void setFacing(short facing) {}
-
- @Override
- public boolean wrenchCanRemove(EntityPlayer entityPlayer)
- {
- return true;
- }
-
- @Override
- public float getWrenchDropRate()
- {
- return 1.0f;
- }
-
- @Override
- public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
- {
- return IHLUtils.getThisModItemStack("frameSteel");
- }
-
- @Override
- public boolean canBeUsed()
- {
- int ix,iy,iz;
- int x = xCoord;
- int y = yCoord;
- int z = zCoord;
- int x0 = xCoord;
- int y0 = yCoord;
- int z0 = zCoord;
- for(ix=x;ix>x-3;ix--)
- {
- for(iy=y;iy>y-3;iy--)
- {
- for(iz=z;iz>z-3;iz--)
- {
- TileEntity te = worldObj.getTileEntity(ix, iy, iz);
- if(te instanceof BigMachineFrameTileEntity)
- {
- x0=ix+1;
- y0=iy+1;
- z0=iz+1;
- }
- }
- }
- }
- for(ix=x0-1;ix<x0+1;ix++)
- {
- for(iy=y0-1;iy<y0+1;iy++)
- {
- for(iz=z0-1;iz<z0+1;iz++)
- {
- if(ix!=x0 && iy!=y0 && iz!=z0)
- {
- TileEntity te = worldObj.getTileEntity(ix, iy, iz);
- if(!(te instanceof BigMachineFrameTileEntity))
- {
- return false;
- }
- }
- else
- {
- Block block = worldObj.getBlock(ix, iy, iz);
- if(block!=Blocks.air && !block.isAir(worldObj, ix, iy, iz))
- {
- return false;
- }
- }
- }
- }
- }
- return true;
- }
-
- @Override
- public void use() {}
-
- @Override
- public boolean getIsInvalid()
- {
- return this.isInvalid();
- }
-
-}
diff --git a/ihl/processing/metallurgy/Crucible.java b/ihl/processing/metallurgy/Crucible.java index 3f14f48..77f10a4 100644 --- a/ihl/processing/metallurgy/Crucible.java +++ b/ihl/processing/metallurgy/Crucible.java @@ -148,7 +148,7 @@ public class Crucible extends Item implements IHandHeldInventory, IFluidContaine ItemStack content = inventory.getStackInSlot(0);
if(content!=null)
{
- UniversalRecipeOutput routput = recipeManager.getOutputFor(null, Arrays.asList(new ItemStack [] {content}),false, false);
+ UniversalRecipeOutput routput = recipeManager.getOutputFor(null, Arrays.asList(new ItemStack [] {content}));
if(routput!=null && !routput.getFluidOutputs().isEmpty())
{
FluidStack fluidStack = routput.getFluidOutputs().get(0).copy();
diff --git a/ihl/processing/metallurgy/DetonationSprayingMachineTileEntity.java b/ihl/processing/metallurgy/DetonationSprayingMachineTileEntity.java index f9d2cb6..ce594ed 100644 --- a/ihl/processing/metallurgy/DetonationSprayingMachineTileEntity.java +++ b/ihl/processing/metallurgy/DetonationSprayingMachineTileEntity.java @@ -1,7 +1,5 @@ package ihl.processing.metallurgy;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Map;
import cpw.mods.fml.relauncher.Side;
@@ -102,7 +100,7 @@ public class DetonationSprayingMachineTileEntity extends TileEntityInventory imp public UniversalRecipeOutput getOutput()
{
- return DetonationSprayingMachineTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return DetonationSprayingMachineTileEntity.recipeManager.getOutputFor(this.getInput());
}
public List<?>[] getInput()
@@ -126,7 +124,8 @@ public class DetonationSprayingMachineTileEntity extends TileEntityInventory imp //file tags - "GT.ToolStats"->"MaxDamage" & "Damage"
if(this.canOperate())
{
- List<RecipeOutputItemStack> output1 = DetonationSprayingMachineTileEntity.recipeManager.getOutputFor(getInput(), false, false).getItemOutputs();
+ List<IRecipeInput> input1 = DetonationSprayingMachineTileEntity.recipeManager.getRecipeInput(getInput()).getItemInputs();
+ List<RecipeOutputItemStack> output1 = DetonationSprayingMachineTileEntity.recipeManager.getOutputFor(getInput()).getItemOutputs();
ItemStack resultStack = output1.get(0).itemStack.copy();
resultStack.stackSize=this.input.get(0).stackSize;
if(resultStack.stackTagCompound==null)
@@ -162,9 +161,10 @@ public class DetonationSprayingMachineTileEntity extends TileEntityInventory imp }
}
}
+ for(IRecipeInput stack:input1){
+ this.input.consume(stack);
+ }
this.input.put(0,resultStack);
- this.input.consume(1,1);
- this.input.consume(2,1);
ExplosionIC2 explosion = new ExplosionIC2(worldObj, null, this.xCoord+0.5D, this.yCoord+0.5D, this.zCoord+0.5D, 0.5F, 0.3F, ExplosionIC2.Type.Normal, null, 0);
explosion.doExplosion();
IC2.network.get().initiateTileEntityEvent(this, 0, true);
diff --git a/ihl/processing/metallurgy/ElectricEngineInvSlot.java b/ihl/processing/metallurgy/ElectricEngineInvSlot.java deleted file mode 100644 index c89c50f..0000000 --- a/ihl/processing/metallurgy/ElectricEngineInvSlot.java +++ /dev/null @@ -1,54 +0,0 @@ -package ihl.processing.metallurgy;
-
-import ic2.core.Ic2Items;
-import ic2.core.block.TileEntityInventory;
-import ic2.core.block.invslot.InvSlot;
-import net.minecraft.item.ItemStack;
-
-public class ElectricEngineInvSlot extends InvSlot {
-
- public ElectricEngineInvSlot(TileEntityInventory base1, String name1,
- int oldStartIndex1, Access access1, int count, int stackSizeLimit1) {
- super(base1, name1, oldStartIndex1, access1, count);
- this.setStackSizeLimit(stackSizeLimit1);
- }
-
- public float getEfficiency()
- {
- if(this.isEmpty())
- {
- return 0F;
- }
- else if(this.get().getItem() instanceof ElectricEngineItem)
- {
- return ((ElectricEngineItem)this.get().getItem()).type.efficiency;
- }
- else if(this.get().getItem() == Ic2Items.elemotor.getItem() && this.get().getItemDamage() == Ic2Items.elemotor.getItemDamage())
- {
- return 0.2f;
- }
- else
- {
- return 0f;
- }
- }
-
- @Override
- public boolean accepts(ItemStack stack)
- {
- if(stack!=null && stack.getItem() == Ic2Items.elemotor.getItem() && stack.getItemDamage() == Ic2Items.elemotor.getItemDamage())
- {
- return true;
- }
- else
- {
- return stack==null?true:stack.getItem() instanceof ElectricEngineItem;
- }
- }
-
- public boolean correctContent()
- {
- return this.get()==null?false:this.get().stackSize==1 && ((this.get().getItem() instanceof ElectricEngineItem) || (this.get().getItem() == Ic2Items.elemotor.getItem() && this.get().getItemDamage() == Ic2Items.elemotor.getItemDamage()));
- }
-
-}
diff --git a/ihl/processing/metallurgy/ExtruderTileEntity.java b/ihl/processing/metallurgy/ExtruderTileEntity.java index a654bfc..53447b4 100644 --- a/ihl/processing/metallurgy/ExtruderTileEntity.java +++ b/ihl/processing/metallurgy/ExtruderTileEntity.java @@ -89,13 +89,13 @@ public class ExtruderTileEntity extends BasicElectricMotorTileEntity{ {
UniversalRecipeInput ri = ExtruderTileEntity.recipeManager.getRecipeInput(getInput());
this.fluidTank.fill(getOutput().getFluidOutputs().get(0), true);
- this.input.consume(0,ri.getItemInputs().get(0).getAmount());
- this.input2.consume(0,ri.getItemInputs().get(1).getAmount());
+ this.input.consume(ri.getItemInputs().get(0));
+ this.input2.consume(ri.getItemInputs().get(1));
}
public UniversalRecipeOutput getOutput()
{
- return ExtruderTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return ExtruderTileEntity.recipeManager.getOutputFor(this.getInput());
}
@SuppressWarnings({ "unchecked", "rawtypes" })
diff --git a/ihl/processing/metallurgy/GasWeldingStationTileEntity.java b/ihl/processing/metallurgy/GasWeldingStationTileEntity.java index ff15f5a..54f4177 100644 --- a/ihl/processing/metallurgy/GasWeldingStationTileEntity.java +++ b/ihl/processing/metallurgy/GasWeldingStationTileEntity.java @@ -148,7 +148,7 @@ public class GasWeldingStationTileEntity extends TileEntityInventory implements public boolean canProduceGas()
{
- UniversalRecipeOutput rOutput = GasWeldingStationTileEntity.acetyleneRecipeManager.getOutputFor(Arrays.asList(new FluidStack[]{this.flammableGasTank.getFluid()}), Arrays.asList(new ItemStack[]{this.input.get()}), false, false);
+ UniversalRecipeOutput rOutput = GasWeldingStationTileEntity.acetyleneRecipeManager.getOutputFor(Arrays.asList(new FluidStack[]{this.flammableGasTank.getFluid()}), Arrays.asList(new ItemStack[]{this.input.get()}));
return rOutput!=null;
}
@@ -157,7 +157,7 @@ public class GasWeldingStationTileEntity extends TileEntityInventory implements if(canProduceGas())
{
UniversalRecipeInput rInput = GasWeldingStationTileEntity.acetyleneRecipeManager.getRecipeInput(Arrays.asList(new FluidStack[]{this.flammableGasTank.getFluid()}), Arrays.asList(new ItemStack[]{this.input.get()}));
- UniversalRecipeOutput rOutput = GasWeldingStationTileEntity.acetyleneRecipeManager.getOutputFor(Arrays.asList(new FluidStack[]{this.flammableGasTank.getFluid()}), Arrays.asList(new ItemStack[]{this.input.get()}), false, false);
+ UniversalRecipeOutput rOutput = GasWeldingStationTileEntity.acetyleneRecipeManager.getOutputFor(Arrays.asList(new FluidStack[]{this.flammableGasTank.getFluid()}), Arrays.asList(new ItemStack[]{this.input.get()}));
FluidStack output1 = rOutput.getFluidOutputs().get(0).copy();
FluidStack output2 = rOutput.getFluidOutputs().get(1).copy();
this.flammableGasTank.drain(rInput.getFluidInputs().get(0), true);
diff --git a/ihl/processing/metallurgy/ImpregnatingMachineTileEntity.java b/ihl/processing/metallurgy/ImpregnatingMachineTileEntity.java index 2ea5d2e..1a15f06 100644 --- a/ihl/processing/metallurgy/ImpregnatingMachineTileEntity.java +++ b/ihl/processing/metallurgy/ImpregnatingMachineTileEntity.java @@ -216,7 +216,7 @@ public class ImpregnatingMachineTileEntity extends TileEntityInventory implement public UniversalRecipeOutput getOutput()
{
- return ImpregnatingMachineTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return ImpregnatingMachineTileEntity.recipeManager.getOutputFor(this.getInput());
}
@SuppressWarnings("rawtypes")
@@ -229,7 +229,7 @@ public class ImpregnatingMachineTileEntity extends TileEntityInventory implement if(i!=i1)
{
List[] rInput = new List[]{Arrays.asList(new FluidStack[]{fluidTank.getFluid(i),fluidTank.getFluid(i1)}), this.input.getItemStackList()};
- if(ImpregnatingMachineTileEntity.recipeManager.getOutputFor(rInput, false, false)!=null)
+ if(ImpregnatingMachineTileEntity.recipeManager.getOutputFor(rInput)!=null)
{
return rInput;
}
@@ -245,7 +245,7 @@ public class ImpregnatingMachineTileEntity extends TileEntityInventory implement UniversalRecipeOutput output1 = getOutput();
for(int i=0; i<recipeInput.getItemInputs().size();i++)
{
- this.input.consume(i,recipeInput.getItemInputs().get(i).getAmount());
+ this.input.consume(recipeInput.getItemInputs().get(i));
}
this.fluidTank.drain(recipeInput.getFluidInputs(), true);
this.fluidTank.fill(output1.getFluidOutputs(), true);
diff --git a/ihl/processing/metallurgy/InjectionMoldTileEntity.java b/ihl/processing/metallurgy/InjectionMoldTileEntity.java index e87acd8..33689ba 100644 --- a/ihl/processing/metallurgy/InjectionMoldTileEntity.java +++ b/ihl/processing/metallurgy/InjectionMoldTileEntity.java @@ -82,24 +82,17 @@ public class InjectionMoldTileEntity extends TileEntity implements IFluidHandler ArrayList<ItemStack> resultList = OreDictionary.getOres(this.resultSuffix+formattedFluidName);
if(resultList.isEmpty() || fluidAmountPerItem<=0)
{
-// IHLMod.log.info("Injection mold: resultList.isEmpty() || fluidAmountPerItem<=0");
resultList=new ArrayList<ItemStack>();
List<FluidStack> fi = Arrays.asList(new FluidStack[] {this.fluidTank.getFluid()});
List<ItemStack> ii = Arrays.asList(new ItemStack[] {IHLUtils.getThisModItemStackWithDamage("injectionMold", this.resultSuffix.hashCode() & Integer.MAX_VALUE)});
- UniversalRecipeOutput ro = recipeManager.getOutputFor(fi, ii, false, false);
+ UniversalRecipeOutput ro = recipeManager.getOutputFor(fi, ii);
if(ro!=null)
{
- // IHLMod.log.info("Injection mold: ro not null");
ItemStack stack = ro.getItemOutputs().get(0).itemStack.copy();
stack.stackSize=Math.round(ro.getItemOutputs().get(0).quantity);
resultList.add(stack);
UniversalRecipeInput ri = recipeManager.getRecipeInput(fi, ii);
fluidAmountPerItem = ri.getFluidInputs().get(0).getAmount();
- // IHLMod.log.info("fluidAmountPerItem="+fluidAmountPerItem);
- }
- else
- {
- // IHLMod.log.info("Injection mold: ro is null. Input stack: "+ii.get(0).toString());
}
}
int fluidAmountPerItem2 = Details.getMeltingFluidAmount("nugget");
diff --git a/ihl/processing/metallurgy/MuffleFurnaceGui.java b/ihl/processing/metallurgy/MuffleFurnaceGui.java index ffd664d..bf0df24 100644 --- a/ihl/processing/metallurgy/MuffleFurnaceGui.java +++ b/ihl/processing/metallurgy/MuffleFurnaceGui.java @@ -6,7 +6,7 @@ import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11;
public class MuffleFurnaceGui extends GuiContainer {
- protected static final ResourceLocation muffleFurnaceBackground = new ResourceLocation("ihl", "textures/gui/GUIMuffleFurnace.png");
+ protected static final ResourceLocation muffleFurnaceBackground = new ResourceLocation("ihl", "textures/gui/GUIAchesonFurnace.png");
private MachineBaseContainer container;
public MuffleFurnaceGui(MachineBaseContainer machineBaseContainer) {
@@ -17,22 +17,18 @@ public class MuffleFurnaceGui extends GuiContainer { @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(muffleFurnaceBackground);
int i1;
if (this.container.tileEntity.getEnergy() > 0D)
{
i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
- this.drawTexturedModalRect(8, 14 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
+ this.drawTexturedModalRect(8, 6 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
}
if (this.container.tileEntity.progress > 0)
{
- i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(50),50);
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- this.drawTexturedModalRect(44, 57, 197, 0, i1 + 1, 13);
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(17),17);
+ this.drawTexturedModalRect(70,34, 197, 0, i1 + 1, 13);
}
fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("ihl.gui.muffleFurnace"), 40, 12, 16768125);
diff --git a/ihl/processing/metallurgy/MuffleFurnanceContainer.java b/ihl/processing/metallurgy/MuffleFurnanceContainer.java index a36ac3c..1ae7203 100644 --- a/ihl/processing/metallurgy/MuffleFurnanceContainer.java +++ b/ihl/processing/metallurgy/MuffleFurnanceContainer.java @@ -6,10 +6,11 @@ import net.minecraft.entity.player.EntityPlayer; public class MuffleFurnanceContainer extends MachineBaseContainer {
public MuffleFurnanceContainer(EntityPlayer entityPlayer,
- MachineBaseTileEntity tileEntity1) {
+ MuffleFurnanceTileEntity tileEntity1) {
super(entityPlayer, tileEntity1);
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 51, 34));
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 69, 34));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 40, 22));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 40, 40));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 98, 32));
}
}
diff --git a/ihl/processing/metallurgy/MuffleFurnanceTileEntity.java b/ihl/processing/metallurgy/MuffleFurnanceTileEntity.java index 55db3db..3994bd7 100644 --- a/ihl/processing/metallurgy/MuffleFurnanceTileEntity.java +++ b/ihl/processing/metallurgy/MuffleFurnanceTileEntity.java @@ -3,8 +3,11 @@ package ihl.processing.metallurgy; import java.util.List;
import java.util.Map;
+import ic2.api.recipe.IRecipeInput;
+import ic2.api.recipe.RecipeInputOreDict;
import ic2.core.ContainerBase;
import ihl.IHLMod;
+import ihl.processing.invslots.IHLInvSlotOutput;
import ihl.recipes.RecipeOutputItemStack;
import ihl.recipes.UniversalRecipeInput;
import ihl.recipes.UniversalRecipeManager;
@@ -19,10 +22,11 @@ import cpw.mods.fml.relauncher.SideOnly; public class MuffleFurnanceTileEntity extends MachineBaseTileEntity {
protected static UniversalRecipeManager recipeManager = new UniversalRecipeManager("mufflefurnace");
+ public final IHLInvSlotOutput outputSlot;
public MuffleFurnanceTileEntity() {
super(2);
- this.input.setStackSizeLimit(32);
+ this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 1);
}
@Override
@@ -81,27 +85,17 @@ public class MuffleFurnanceTileEntity extends MachineBaseTileEntity { mold.stackTagCompound.setBoolean("isContainStearin", false);
return;
}
- if (this.getOutput() != null) {
- UniversalRecipeOutput routput = recipeManager
- .getOutputFor(null, this.input.getItemStackList(), true, true);
- List<RecipeOutputItemStack> output = routput.getItemOutputs();
- for (int i = 0; i < this.input.size(); i++) {
- if (i < output.size() && output.get(i) != null) {
- ItemStack outStack = output.get(i).itemStack.copy();
- outStack.stackSize = Math.round(output.get(i).quantity);
- if (this.input.get(i) != null) {
- outStack.stackTagCompound = this.input.get(i).stackTagCompound;
- }
- this.input.put(i, outStack);
- }
- if (this.input.get(i) != null && this.input.get(i).stackSize <= 0)
- this.input.put(i, null);
- }
+ List<RecipeOutputItemStack> output = recipeManager
+ .getOutputFor(getInput()).getItemOutputs();
+ List<IRecipeInput> rinput = recipeManager.getRecipeInput(getInput()).getItemInputs();
+ for (int i = 0; i < rinput.size(); i++) {
+ this.input.consume(rinput.get(i));
}
+ this.outputSlot.add(output);
}
- public static void addRecipe(ItemStack input1, ItemStack output) {
- recipeManager.addRecipe(new UniversalRecipeInput(null, (new ItemStack[] { input1 })),
+ public static void addRecipe(IRecipeInput recipeInputOreDict, ItemStack output) {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, (new IRecipeInput[] { recipeInputOreDict })),
new UniversalRecipeOutput(null, (new ItemStack[] { output }), 20));
}
@@ -111,7 +105,7 @@ public class MuffleFurnanceTileEntity extends MachineBaseTileEntity { @Override
public UniversalRecipeOutput getOutput() {
- return MuffleFurnanceTileEntity.recipeManager.getOutputFor(null, this.input.getItemStackList(), false, false);
+ return MuffleFurnanceTileEntity.recipeManager.getOutputFor(null, this.input.getItemStackList());
}
public static void addRecipe(UniversalRecipeInput universalRecipeInput,
@@ -119,8 +113,8 @@ public class MuffleFurnanceTileEntity extends MachineBaseTileEntity { recipeManager.addRecipe(universalRecipeInput, universalRecipeOutput);
}
- public static void addRecipe(ItemStack input1, ItemStack output, float f) {
- recipeManager.addRecipe(new UniversalRecipeInput(null, (new ItemStack[] { input1 })), new UniversalRecipeOutput(
+ public static void addRecipe(IRecipeInput recipeInputOreDict, ItemStack output, float f) {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, (new IRecipeInput[] { recipeInputOreDict })), new UniversalRecipeOutput(
null, (new RecipeOutputItemStack[] { new RecipeOutputItemStack(output, f) }), 20));
}
}
diff --git a/ihl/processing/metallurgy/RollingMachinePart1TileEntity.java b/ihl/processing/metallurgy/RollingMachinePart1TileEntity.java index a3d6ae6..dc2d293 100644 --- a/ihl/processing/metallurgy/RollingMachinePart1TileEntity.java +++ b/ihl/processing/metallurgy/RollingMachinePart1TileEntity.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.List;
import java.util.Map;
+import ic2.api.recipe.IRecipeInput;
import ic2.core.ContainerBase;
import ic2.core.IC2;
import ic2.core.block.invslot.InvSlot.Access;
@@ -38,7 +39,7 @@ public class RollingMachinePart1TileEntity extends BasicElectricMotorTileEntity{ public UniversalRecipeOutput getOutput()
{
- return RollingMachinePart1TileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return RollingMachinePart1TileEntity.recipeManager.getOutputFor(this.getInput());
}
@Override
@@ -101,9 +102,10 @@ public class RollingMachinePart1TileEntity extends BasicElectricMotorTileEntity{ @Override
public void operate()
{
- List<RecipeOutputItemStack> output = RollingMachinePart1TileEntity.recipeManager.getOutputFor(getInput(), false, false).getItemOutputs();
+ List<IRecipeInput> rinput = recipeManager.getRecipeInput(getInput()).getItemInputs();
+ List<RecipeOutputItemStack> output = RollingMachinePart1TileEntity.recipeManager.getOutputFor(getInput()).getItemOutputs();
this.output.add(output);
- this.input.consume(0, 1);
+ this.input.consume(rinput.get(0));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
diff --git a/ihl/processing/metallurgy/VulcanizationExtrudingMoldTileEntity.java b/ihl/processing/metallurgy/VulcanizationExtrudingMoldTileEntity.java index e052ad7..bb51ced 100644 --- a/ihl/processing/metallurgy/VulcanizationExtrudingMoldTileEntity.java +++ b/ihl/processing/metallurgy/VulcanizationExtrudingMoldTileEntity.java @@ -175,8 +175,7 @@ public class VulcanizationExtrudingMoldTileEntity extends TileEntity private ItemStack processWire(ItemStack wire, boolean doProcess) {
UniversalRecipeOutput rOutput = VulcanizationExtrudingMoldTileEntity.recipeManager.getOutputFor(
- Arrays.asList(new FluidStack[] { this.fluidTank.getFluid() }), Arrays.asList(new ItemStack[] { wire }),
- false, false);
+ Arrays.asList(new FluidStack[] { this.fluidTank.getFluid() }), Arrays.asList(new ItemStack[] { wire }));
if (rOutput == null || this.energy < this.energyConsume) {
return wire;
}
diff --git a/ihl/processing/metallurgy/WireMillTileEntity.java b/ihl/processing/metallurgy/WireMillTileEntity.java index 4216960..f69ea9a 100644 --- a/ihl/processing/metallurgy/WireMillTileEntity.java +++ b/ihl/processing/metallurgy/WireMillTileEntity.java @@ -124,7 +124,7 @@ public class WireMillTileEntity extends BasicElectricMotorTileEntity implements }
else
{
- dice.consume(0, 1);
+ dice.consume(rInputDice);
}
}
if(this.drainInputSlot.get()!=null && !rInput.getItemInputs().isEmpty() && rInput.getItemInputs().get(0).matches(this.drainInputSlot.get()))
@@ -157,7 +157,7 @@ public class WireMillTileEntity extends BasicElectricMotorTileEntity implements public UniversalRecipeOutput getOutput()
{
- return WireMillTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return WireMillTileEntity.recipeManager.getOutputFor(this.getInput());
}
public static void addRecipe(FluidStack moltenMetal, IRecipeInput inputDice,ItemStack output1)
diff --git a/ihl/processing/metallurgy/WoodenRollingMachinePart1TileEntity.java b/ihl/processing/metallurgy/WoodenRollingMachinePart1TileEntity.java index 5c786c5..4dd1f1c 100644 --- a/ihl/processing/metallurgy/WoodenRollingMachinePart1TileEntity.java +++ b/ihl/processing/metallurgy/WoodenRollingMachinePart1TileEntity.java @@ -40,7 +40,7 @@ public class WoodenRollingMachinePart1TileEntity extends BasicElectricMotorTileE public UniversalRecipeOutput getOutput()
{
- return WoodenRollingMachinePart1TileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
+ return WoodenRollingMachinePart1TileEntity.recipeManager.getOutputFor(this.getInput());
}
@Override
@@ -104,11 +104,11 @@ public class WoodenRollingMachinePart1TileEntity extends BasicElectricMotorTileE public void operate()
{
List<IRecipeInput> rInput = WoodenRollingMachinePart1TileEntity.recipeManager.getRecipeInput(getInput()).getItemInputs();
- List<RecipeOutputItemStack> rOutput = WoodenRollingMachinePart1TileEntity.recipeManager.getOutputFor(getInput(), false, false).getItemOutputs();
+ List<RecipeOutputItemStack> rOutput = WoodenRollingMachinePart1TileEntity.recipeManager.getOutputFor(getInput()).getItemOutputs();
this.output.add(rOutput);
for(int i=0;i<rInput.size();i++)
{
- this.input.consume(i, rInput.get(i).getAmount());
+ this.input.consume(rInput.get(i));
}
}
diff --git a/ihl/recipes/RecipeOutputItemStack.java b/ihl/recipes/RecipeOutputItemStack.java index c765b1d..480d1f8 100644 --- a/ihl/recipes/RecipeOutputItemStack.java +++ b/ihl/recipes/RecipeOutputItemStack.java @@ -3,63 +3,50 @@ package ihl.recipes; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
-public class RecipeOutputItemStack
-{
+public class RecipeOutputItemStack {
public final ItemStack itemStack;
public final float quantity;
- public RecipeOutputItemStack(ItemStack itemStack1, float quantity1)
- {
- itemStack=itemStack1;
- quantity=quantity1;
- itemStack.stackSize=1;
+
+ public RecipeOutputItemStack(ItemStack itemStack1, float quantity1) {
+ itemStack = itemStack1;
+ quantity = quantity1;
+ itemStack.stackSize = 1;
}
-
- public RecipeOutputItemStack(ItemStack itemStack1)
- {
+
+ public RecipeOutputItemStack(ItemStack itemStack1) {
this(itemStack1, itemStack1.stackSize);
}
-
- public boolean matches(RecipeOutputItemStack is1)
- {
- if(is1==null||(itemStack.getItem()!=is1.itemStack.getItem()))
- {
+
+ public boolean matches(RecipeOutputItemStack is1) {
+ if (is1 == null || (itemStack.getItem() != is1.itemStack.getItem())) {
return false;
- }
- else if(is1.itemStack.getItemDamage()!=OreDictionary.WILDCARD_VALUE &&
- itemStack.getItemDamage()!=is1.itemStack.getItemDamage())
- {
+ } else if (is1.itemStack.getItemDamage() != OreDictionary.WILDCARD_VALUE
+ && itemStack.getItemDamage() != is1.itemStack.getItemDamage()) {
return false;
}
return true;
}
- public RecipeOutputItemStack copy(int mulipier)
- {
- return new RecipeOutputItemStack(itemStack, quantity*mulipier);
+ public RecipeOutputItemStack copy(int mulipier) {
+ return new RecipeOutputItemStack(itemStack, quantity * mulipier);
}
-
- public RecipeOutputItemStack copy()
- {
+
+ public RecipeOutputItemStack copy() {
return new RecipeOutputItemStack(itemStack, quantity);
}
-
+
@Override
- public String toString()
- {
- return this.itemStack.getUnlocalizedName()+":"+this.quantity;
+ public String toString() {
+ return this.itemStack.getUnlocalizedName() + ":" + this.quantity;
}
- public boolean matches(ItemStack is1)
- {
- if(is1==null||(itemStack.getItem()!=is1.getItem()))
- {
+ public boolean matches(ItemStack is1) {
+ if (is1 == null || (itemStack.getItem() != is1.getItem())) {
return false;
- }
- else if(is1.getItemDamage()!=OreDictionary.WILDCARD_VALUE &&
- itemStack.getItemDamage()!=is1.getItemDamage())
- {
+ } else if (is1.getItemDamage() != OreDictionary.WILDCARD_VALUE
+ && itemStack.getItemDamage() != is1.getItemDamage()) {
return false;
}
- return false;
+ return true;
}
}
diff --git a/ihl/recipes/UniversalRecipeInput.java b/ihl/recipes/UniversalRecipeInput.java index a654c2e..d2c25b6 100644 --- a/ihl/recipes/UniversalRecipeInput.java +++ b/ihl/recipes/UniversalRecipeInput.java @@ -17,7 +17,6 @@ public class UniversalRecipeInput { private final List<IRecipeInputFluid> fluidInputs = new ArrayList<IRecipeInputFluid>();
private final List<IRecipeInput> itemInputs = new ArrayList<IRecipeInput>();
- private int multiplier = Integer.MAX_VALUE;
public UniversalRecipeInput(Object[] fluidStacks, Object[] iRecipeInputs) {
if (fluidStacks != null) {
@@ -55,7 +54,7 @@ public class UniversalRecipeInput { }
public boolean matches(List<FluidStack> fluidInputs1, List<ItemStack> itemInputs1) {
- return this.adjustAmounts(fluidInputs1, itemInputs1, false, false);
+ return this.matches(fluidInputs1, itemInputs1, false);
}
public List<IRecipeInputFluid> getFluidInputs() {
@@ -84,9 +83,7 @@ public class UniversalRecipeInput { return this.matches(rInputsFluids, rInputsItems);
}
- public boolean adjustAmounts(List<FluidStack> fluidInputs1, List<ItemStack> itemInputs1, boolean doCheckAmounts,
- boolean doAdjustAmounts) {
- this.multiplier = Integer.MAX_VALUE;
+ public boolean matches(List<FluidStack> fluidInputs1, List<ItemStack> itemInputs1, boolean doCheckAmounts) {
if (incorrectInputAmount(fluidInputs1, itemInputs1)) {
return false;
}
@@ -96,21 +93,9 @@ public class UniversalRecipeInput { IRecipeInputFluid fs = fi.next();
FluidStack fs1 = getMatchedFluidStack(fs, fluidInputs1);
if (fs1 == null || !fs.matches(fs1)) {
- multiplier = 0;
return false;
} else if (doCheckAmounts && fs1.amount < fs.getAmount()) {
- multiplier = 0;
return false;
- } else if (doAdjustAmounts) {
- if (fs.getAmount() > 0) {
- int multiplier1 = fs1.amount / fs.getAmount();
- if (multiplier1 < multiplier) {
- multiplier = multiplier1;
- }
- }
- fs1.amount -= fs.getAmount();
- if (fs1.amount <= 0)
- fs1 = null;
}
}
}
@@ -120,21 +105,9 @@ public class UniversalRecipeInput { IRecipeInput is = ii.next();
ItemStack is1 = getMatchedItemStack(is, itemInputs1);
if (is1 == null || !is.matches(is1)) {
- multiplier = 0;
return false;
} else if (doCheckAmounts && is1.stackSize < is.getAmount()) {
- multiplier = 0;
return false;
- } else if (doAdjustAmounts) {
- if (is.getAmount() > 0) {
- int multiplier1 = is1.stackSize / is.getAmount();
- if (multiplier1 < multiplier) {
- multiplier = multiplier1;
- }
- }
- if (IHLUtils.reduceItemStackAmountUsingIRecipeInput(is, is1, multiplier)) {
- is1 = null;
- }
}
}
}
@@ -161,35 +134,6 @@ public class UniversalRecipeInput { return null;
}
- public boolean adjustAmounts(UniversalRecipeInput input, boolean doAdjustAmounts) {
- List<IRecipeInput> rInputs = input.getItemInputs();
- Iterator<IRecipeInput> ii = rInputs.iterator();
- List<ItemStack> rInputsItems = new ArrayList<ItemStack>();
- while (ii.hasNext()) {
- IRecipeInput is = ii.next();
- rInputsItems.add(is.getInputs().get(0));
- }
- List<FluidStack> rInputsFluids = new ArrayList<FluidStack>();
- List<IRecipeInputFluid> rInputsF = input.getFluidInputs();
- Iterator<IRecipeInputFluid> iiF = rInputsF.iterator();
- while (iiF.hasNext()) {
- IRecipeInputFluid is = iiF.next();
- rInputsFluids.add(is.getInputs().get(0));
- }
- return this.adjustAmounts(rInputsFluids, rInputsItems, true, doAdjustAmounts);
- }
-
- public int getMultiplierAndAdjustAmounts(List<FluidStack> fluidInputs1, List<ItemStack> itemInputs1) {
- if (this.adjustAmounts(fluidInputs1, itemInputs1, true, true)) {
- if (multiplier < Integer.MAX_VALUE) {
- return multiplier;
- } else
- return 1;
- } else {
- return 0;
- }
- }
-
public boolean containItemStack(ItemStack ingredient) {
if (itemInputs == null || itemInputs.isEmpty()) {
return false;
diff --git a/ihl/recipes/UniversalRecipeManager.java b/ihl/recipes/UniversalRecipeManager.java index 169d6f6..6c09bb1 100644 --- a/ihl/recipes/UniversalRecipeManager.java +++ b/ihl/recipes/UniversalRecipeManager.java @@ -78,8 +78,7 @@ public class UniversalRecipeManager { this.keywordMap.put(keyword, input);
}
- public UniversalRecipeOutput getOutputFor(List<FluidStack> fluidInputs, List<ItemStack> itemInputs,
- boolean adjustInput, boolean inputAffectOutput) {
+ public UniversalRecipeOutput getOutputFor(List<FluidStack> fluidInputs, List<ItemStack> itemInputs) {
if (fluidInputs == null && itemInputs == null) {
return null;
} else {
@@ -94,15 +93,8 @@ public class UniversalRecipeManager { continue;
}
- if (recipeInput.adjustAmounts(fluidInputs, itemInputs, true, false)) {
- UniversalRecipeOutput output = entry.getValue();
- if (inputAffectOutput) {
- int multiplier = recipeInput.getMultiplierAndAdjustAmounts(fluidInputs, itemInputs);
- return output.copyWithMultiplier(multiplier);
- } else if (adjustInput) {
- recipeInput.adjustAmounts(fluidInputs, itemInputs, true, true);
- }
- return output;
+ if (recipeInput.matches(fluidInputs, itemInputs, true)) {
+ return entry.getValue();
}
}
@@ -128,7 +120,7 @@ public class UniversalRecipeManager { continue;
}
- if (recipeInput.adjustAmounts(fluidInputs1, itemInputs1, true, false)) {
+ if (recipeInput.matches(fluidInputs1, itemInputs1, true)) {
return recipeInput;
}
}
@@ -139,8 +131,8 @@ public class UniversalRecipeManager { }
@SuppressWarnings({ "unchecked", "rawtypes" })
- public UniversalRecipeOutput getOutputFor(List[] input, boolean adjustInput, boolean inputAffectOutput) {
- return this.getOutputFor(input[0], input[1], adjustInput, inputAffectOutput);
+ public UniversalRecipeOutput getOutputFor(List[] input) {
+ return this.getOutputFor(input[0], input[1]);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
diff --git a/ihl/utils/IHLMathUtils.java b/ihl/utils/IHLMathUtils.java index 1200fd5..47f3913 100644 --- a/ihl/utils/IHLMathUtils.java +++ b/ihl/utils/IHLMathUtils.java @@ -1,152 +1,103 @@ package ihl.utils; -public class IHLMathUtils -{ - private final static int accuracy_level=65536; - private final static float[] sin_table=new float[accuracy_level]; - private final static float[] atan_table=new float[accuracy_level]; - private final static float[] sqrt_table=new float[accuracy_level]; - private final static float PI=(float)Math.PI; - - public static float sin(float angle) - { - float angle1 = angle % (2*PI); - if(angle1<0) - { - angle1+=2*PI; - } - return sin_table[(int)(angle1*accuracy_level/2/PI)]; - } - - public static float sqrt(float value) - { +public class IHLMathUtils { + private final static int accuracy_level = 1024; + private final static float[] sqrt_table = new float[accuracy_level]; + + public static float sqrt(float value) { float value1 = value; int multiplier = 2; - while(value1 >= 1.0f) - { - multiplier*=multiplier; - value1 /=multiplier*multiplier; + while (value1 >= 1.0f) { + multiplier *= multiplier; + value1 /= multiplier * multiplier; } - return ((multiplier>2)?multiplier:1)*sqrt_table[(int)(value1*accuracy_level)]; + return ((multiplier > 2) ? multiplier : 1) * sqrt_table[(int) (value1 * accuracy_level)]; } - - public static float atan(float tan_value) - { - if(tan_value<-32f) - { - return -1.54f; - } - else if(tan_value>32f) - { - return 1.54f; - } - else - { - return atan_table[(int)((tan_value+32f)*accuracy_level/64f)]; - } - } - - public static float[] vector_vector_multiply(float[] v1, float[] v2) - { - float c_x = v1[1]*v2[2] - v2[1]*v1[2]; - float c_y = v2[0]*v1[2] - v1[0]*v2[2]; - float c_z = v1[0]*v2[1] - v2[0]*v1[1]; - return new float[] {c_x,c_y,c_z}; + + public static float[] vector_vector_multiply(float[] v1, float[] v2) { + float c_x = v1[1] * v2[2] - v2[1] * v1[2]; + float c_y = v2[0] * v1[2] - v1[0] * v2[2]; + float c_z = v1[0] * v2[1] - v2[0] * v1[1]; + return new float[] { c_x, c_y, c_z }; } - public static void normalize_vector(float[] v1) - { - float d = (float)Math.sqrt(v1[0]*v1[0]+v1[1]*v1[1]+v1[2]*v1[2]); - if(d == 0) - { // Nothing can we do. Create new vector towards up direction. - v1[0]=0; - v1[1]=1; - v1[2]=0; - } - else - { - v1[0]/=d; - v1[1]/=d; - v1[2]/=d; + public static void normalize_vector(float[] v1) { + float d = (float) Math.sqrt(v1[0] * v1[0] + v1[1] * v1[1] + v1[2] * v1[2]); + if (d == 0) { // Nothing can we do. Create new vector towards up + // direction. + v1[0] = 0; + v1[1] = 1; + v1[2] = 0; + } else { + v1[0] /= d; + v1[1] /= d; + v1[2] /= d; } } - public static void scale_vector_to_value(float[] v1, float v2) - { - float d = (float)Math.sqrt(v1[0]*v1[0]+v1[1]*v1[1]+v1[2]*v1[2]); - if(d == 0) - { // Nothing can we do. Create new vector towards up direction. - v1[0]=0; - v1[1]=v2; - v1[2]=0; - } - else - { - v1[0]=v1[0]*v2/d; - v1[1]=v1[1]*v2/d; - v1[2]=v1[2]*v2/d; + public static void scale_vector_to_value(float[] v1, float v2) { + float d = (float) Math.sqrt(v1[0] * v1[0] + v1[1] * v1[1] + v1[2] * v1[2]); + if (d == 0) { // Nothing can we do. Create new vector towards up + // direction. + v1[0] = 0; + v1[1] = v2; + v1[2] = 0; + } else { + v1[0] = v1[0] * v2 / d; + v1[1] = v1[1] * v2 / d; + v1[2] = v1[2] * v2 / d; } } - + public static void vector_add(float[] fs, float x, float y, float z) { - fs[0]+=x; - fs[1]+=y; - fs[2]+=z; + fs[0] += x; + fs[1] += y; + fs[2] += z; } - - static - { - for(int i=0;i<accuracy_level;i++) - { - sin_table[i]=(float) Math.sin(2d*Math.PI*i/accuracy_level); - } - for(int i=0;i<accuracy_level;i++) - { - atan_table[i]=(float) Math.atan(-32d+64d*i/accuracy_level); - } - for(int i=0;i<accuracy_level;i++) - { - sqrt_table[i]=(float) Math.sqrt((double)i/accuracy_level); + + static { + for (int i = 0; i < accuracy_level; i++) { + sqrt_table[i] = (float) Math.sqrt((double) i / accuracy_level); } } public static float[] vector_return_difference(double[] v1, double[] v2) { - return new float[] { - (float)(v1[0]-v2[0]), - (float)(v1[1]-v2[1]), - (float)(v1[2]-v2[2])}; + return new float[] { (float) (v1[0] - v2[0]), (float) (v1[1] - v2[1]), (float) (v1[2] - v2[2]) }; } public static float[] vector_return_difference(float[] v1, double[] v2) { - return new float[] { - (float)(v1[0]-v2[0]), - (float)(v1[1]-v2[1]), - (float)(v1[2]-v2[2])}; + return new float[] { (float) (v1[0] - v2[0]), (float) (v1[1] - v2[1]), (float) (v1[2] - v2[2]) }; } public static float[] vector_return_difference(int[] v1, double[] v2) { - return new float[] { - (float)(v1[0]-v2[0]), - (float)(v1[1]-v2[1]), - (float)(v1[2]-v2[2])}; + return new float[] { (float) (v1[0] - v2[0]), (float) (v1[1] - v2[1]), (float) (v1[2] - v2[2]) }; } public static void multiply_vector_to_value(float[] v1, float v2) { - v1[0]*=v2; - v1[1]*=v2; - v1[2]*=v2; + v1[0] *= v2; + v1[1] *= v2; + v1[2] *= v2; } public static void vector_add(double[] v1, float[] v2) { - v1[0]+=v2[0]; - v1[1]+=v2[1]; - v1[2]+=v2[2]; + v1[0] += v2[0]; + v1[1] += v2[1]; + v1[2] += v2[2]; } - + public static float[] get_triangle_normal(double[][] triangle1) { - float[] v1 = vector_return_difference(triangle1[1],triangle1[0]); - float[] v2 = vector_return_difference(triangle1[2],triangle1[0]); - return vector_vector_multiply(v1,v2); + float[] v1 = vector_return_difference(triangle1[1], triangle1[0]); + float[] v2 = vector_return_difference(triangle1[2], triangle1[0]); + return vector_vector_multiply(v1, v2); } - + + public static int sign(int value) { + if (value > 0) + return 1; + else if (value < 0) + return -1; + else + return 0; + } + } diff --git a/ihl/utils/IHLUtils.java b/ihl/utils/IHLUtils.java index 84c04a1..f47673c 100644 --- a/ihl/utils/IHLUtils.java +++ b/ihl/utils/IHLUtils.java @@ -15,10 +15,6 @@ import ihl.metallurgy.constants.*; import ihl.processing.invslots.InvSlotConsumableLiquidIHL;
import ihl.recipes.IRecipeInputFluid;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -926,18 +922,10 @@ public class IHLUtils { if (block1 != Blocks.air) {
--ebs.blockRefCount;
-
- if (block1.getTickRandomly()) {
- --ebs.tickRefCount;
- }
}
if (block != Blocks.air) {
++ebs.blockRefCount;
-
- if (block.getTickRandomly()) {
- ++ebs.tickRefCount;
- }
}
int i1 = Block.getIdFromBlock(block);
diff --git a/ihl/worldgen/IHLWorldGenerator.java b/ihl/worldgen/IHLWorldGenerator.java index 7a5c83d..95a91f3 100644 --- a/ihl/worldgen/IHLWorldGenerator.java +++ b/ihl/worldgen/IHLWorldGenerator.java @@ -4,248 +4,98 @@ import ihl.IHLMod; import ihl.utils.IHLUtils;
import ihl.worldgen.ores.IHLFluid;
-import java.util.HashMap;
import java.util.HashSet;
-import java.util.Map;
import java.util.Random;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
-import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.IChunkProvider;
import cpw.mods.fml.common.IWorldGenerator;
public class IHLWorldGenerator implements IWorldGenerator {
-
- private WorldGenMinableMeta
- apatiteGenerator,
- saltpeterGenerator,
- limestoneGenerator,
- gypsumGenerator,
- potassiumFeldsparGenerator,
- tronaGenerator,
- gyubneraGenerator,
- rocksaltGenerator,
- cinnabarGenerator,
- bauxiteGenerator,
- chromiteGenerator,
- muscoviteGenerator,
- oilGenerator,
- datoliteGenerator,
- saltwaterGenerator,
- bischofiteGenerator;
- private WorldGenMinableMeta currentGenerator;
- protected final Map<Long,Set<int[]>> oreCoordinatesToChunkCoordinates = new HashMap<Long,Set<int[]>>();
- protected final Map<Long,WorldGenMinableMeta> blockToOreCoordinates = new HashMap<Long,WorldGenMinableMeta>();
- public final Set<Long> precalculatedChunkChache = new HashSet<Long>();
+
+ private static final Block[] replaceableMinerals = new Block[] { Blocks.stone, Blocks.gravel , Blocks.gold_ore, Blocks.coal_ore, Blocks.iron_ore, Blocks.lapis_ore, Blocks.clay, Blocks.diamond_ore, Blocks.redstone_ore, Blocks.emerald_ore};
+ private static final Block[] replaceableSand = new Block[] { Blocks.sand };
+ private static final Block[] replaceableForOil = new Block[] { Blocks.lava, Blocks.flowing_lava};
public static IHLWorldGenerator instance;
-
-
+ private final Set<WorldGeneratorBase> generators = new HashSet<WorldGeneratorBase>(8);
+
public IHLWorldGenerator()
{
super();
- apatiteGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates, IHLUtils.getOreDictBlock("oreApatite"), 0, 360, new Block[] {Blocks.stone,Blocks.gravel});
- saltpeterGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreSaltpeter"), 0, 140, new Block[] {Blocks.stone,Blocks.gravel});
- limestoneGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreLimestone"), 0, 140, new Block[] {Blocks.stone,Blocks.gravel});
- gypsumGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreGypsum"), 0, 140, new Block[] {Blocks.stone,Blocks.gravel});
- potassiumFeldsparGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("orePotassiumFeldspar"), 0, 140, new Block[] {Blocks.stone,Blocks.gravel});
- tronaGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreTrona"), 0, 700, new Block[] {Blocks.stone,Blocks.gravel});
- gyubneraGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreGyubnera"), 0, 700, new Block[] {Blocks.stone,Blocks.gravel});
- rocksaltGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreRockSalt"), 0, 140, new Block[] {Blocks.stone,Blocks.gravel});
- cinnabarGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreCinnabar"), 0, 700, new Block[] {Blocks.stone,Blocks.gravel});
- bauxiteGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreBauxite"), 0, 700, new Block[] {Blocks.stone,Blocks.gravel});
- chromiteGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreChromite"), 0, 700, new Block[] {Blocks.stone,Blocks.gravel});
- muscoviteGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreMica"), 0, 140, new Block[] {Blocks.stone,Blocks.gravel});
- oilGenerator = new WorldGenLiquidOre(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLFluid.getBlock("oil"),Blocks.clay, 0, 32, 0, 8, new Block[] {Blocks.lava,Blocks.clay});
- datoliteGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreDatolite"), 0, 700, new Block[] {Blocks.stone,Blocks.gravel});
- saltwaterGenerator = new WorldGenLiquidOre(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLFluid.getBlock("saltwater"),Blocks.sandstone, 0, 32, 62, 62, new Block[] {Blocks.sand,Blocks.sandstone});
- bischofiteGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreBischofite"), 0, 1400, new Block[] {Blocks.stone,Blocks.gravel});
- instance=this;
- }
-
- @Override
- public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
- {
- for(int ix=-16+chunkX;ix<=16+chunkX;ix++)
+ if (IHLMod.config.generateApatiteOre)
{
- for(int iz=-16+chunkZ;iz<=16+chunkZ;iz++)
- {
- long chunkKey = (ix<<16)+iz;
- if(!this.precalculatedChunkChache.contains(chunkKey))
- {
- if(!world.getChunkProvider().chunkExists(ix, iz) || (ix==chunkX && iz==chunkZ))
- {
- currentGenerator = switchCurrentOreGenerator(world, random, ix, iz);
- if(currentGenerator!=null)
- {
- if(currentGenerator.generateNewVein(random, ix, iz))
- {
-
- }
- }
- }
- this.precalculatedChunkChache.add(chunkKey);
- }
- }
- }
- long chunkKey = (chunkX<<16)+chunkZ;
- if(this.precalculatedChunkChache.contains(chunkKey))
+ generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreApatite"), replaceableMinerals));
+ }
+ if (IHLMod.config.generateSaltpeterOre)
{
- Set<int[]> oreCoordinatesSet = this.oreCoordinatesToChunkCoordinates.get(chunkKey);
- if(oreCoordinatesSet!=null)
- {
- Object[] oreCoordinatesSetA = oreCoordinatesSet.toArray();
- for(int i=0;i<oreCoordinatesSetA.length;i++)
- {
- int[] oreCoordinate = (int[]) oreCoordinatesSetA[i];
- int x0 = oreCoordinate[0];
- int y0 = oreCoordinate[1];
- int z0 = oreCoordinate[2];
- long oreCoordinatesKey = (x0<<30)+(y0<<15)+z0;
- this.blockToOreCoordinates.get(oreCoordinatesKey).generate(world, random, x0, y0, z0);
- }
- }
+ generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreSaltpeter"), replaceableMinerals));
}
- }
-
- private WorldGenMinableMeta switchCurrentOreGenerator(World world, Random random, int chunkX, int chunkZ)
- {
- switch(random.nextInt(1000))
+ if (IHLMod.config.generateGyubnera)
+ {
+ generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreGyubnera"), replaceableMinerals));
+ }
+ if (IHLMod.config.generateCinnabar)
+ {
+ generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreCinnabar"), replaceableMinerals));
+ }
+ if (IHLMod.config.generateRocksalt)
+ {
+ generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreRockSalt"), replaceableMinerals));
+ }
+ if (IHLMod.config.generateLimestone)
+ {
+ generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreLimestone"), replaceableMinerals));
+ }
+ if (IHLMod.config.generateGypsum)
+ {
+ generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreGypsum"), replaceableMinerals));
+ }
+ if (IHLMod.config.generatePotassiumFeldspar)
+ {
+ generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("orePotassiumFeldspar"), replaceableMinerals));
+ }
+ if (IHLMod.config.generateTrona)
+ {
+ generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreTrona"), replaceableMinerals));
+ }
+ if (IHLMod.config.generateBauxite)
+ {
+ generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreBauxite"), replaceableMinerals));
+ }
+ if (IHLMod.config.generateChromite)
+ {
+ generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreChromite"), replaceableMinerals));
+ }
+ if (IHLMod.config.generateMuscovite)
+ {
+ generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreMica"), replaceableMinerals));
+ }
+ if (IHLMod.config.generateOil)
+ {
+ generators.add(new WorldGeneratorUndergroundLake(IHLFluid.getBlock("oil"), Blocks.clay, replaceableForOil));
+ }
+ if (IHLMod.config.generateSaltwater)
{
- case 0:
- if (IHLMod.config.generateApatiteOre)
- {
- if (random.nextFloat() < 0.25f)
- {
- return apatiteGenerator;
- }
- }
- break;
- case 1:
- if (IHLMod.config.generateSaltpeterOre)
- {
- if (random.nextFloat() < 0.25f)
- {
- return saltpeterGenerator;
- }
- }
- break;
- case 2:
- if (IHLMod.config.generateGyubnera)
- {
- if (random.nextFloat() < 0.25f)
- {
- return gyubneraGenerator;
- }
- }
- break;
- case 3:
- if (IHLMod.config.generateCinnabar)
- {
- if (random.nextFloat() < 0.25f)
- {
- return cinnabarGenerator;
- }
- }
- break;
- case 4:
- if (IHLMod.config.generateRocksalt)
- {
- if (random.nextFloat() < 0.2F)
- {
- return rocksaltGenerator;
- }
- }
- break;
- case 5:
- if (IHLMod.config.generateLimestone)
- {
- return limestoneGenerator;
- }
- break;
- case 6:
- if (IHLMod.config.generateGypsum)
- {
- return gypsumGenerator;
- }
- break;
- case 7:
- if (IHLMod.config.generatePotassiumFeldspar)
- {
- return potassiumFeldsparGenerator;
- }
- break;
- case 8:
- if (IHLMod.config.generateTrona)
- {
- return tronaGenerator;
- }
- break;
- case 9:
- if (IHLMod.config.generateBauxite)
- {
- if (random.nextFloat() < 0.25F)
- {
- return bauxiteGenerator;
- }
- }
- break;
- case 10:
- if (IHLMod.config.generateChromite)
- {
- if (random.nextFloat() < 0.25F)
- {
- return chromiteGenerator;
- }
- }
- break;
- case 11:
- if (IHLMod.config.generateMuscovite)
- {
- return muscoviteGenerator;
- }
- break;
- case 12:
- if (IHLMod.config.generateOil)
- {
- return oilGenerator;
- }
- break;
- case 13:
- case 16:
- case 17:
- case 18:
- case 19:
- case 20:
- case 21:
- if (IHLMod.config.generateSaltwater)
- {
- BiomeGenBase biome = world.getBiomeGenForCoords(chunkX<<4, chunkZ<<4);
- if(biome.temperature > 1.9f && biome.rainfall==0f)
- {
- return saltwaterGenerator;
- }
- }
- break;
- case 14:
- if (IHLMod.config.generateDatolite)
- {
- if (random.nextFloat() < 0.25F)
- {
- return datoliteGenerator;
- }
- }
- break;
- case 15:
- if (IHLMod.config.generateBischofite)
- {
- if (random.nextFloat() < 0.25F)
- {
- return bischofiteGenerator;
- }
- }
- }
- return null;
+ generators.add(new WorldGeneratorSurfaceLake(IHLFluid.getBlock("saltwater"), replaceableSand));
+ }
+ if (IHLMod.config.generateDatolite)
+ {
+ generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreDatolite"), replaceableMinerals));
+ }
+ if (IHLMod.config.generateBischofite)
+ {
+ generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreBischofite"), replaceableMinerals));
+ }
+ instance=this;
+ }
+
+ @Override
+ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator,
+ IChunkProvider chunkProvider) {
+ for (WorldGeneratorBase generator : generators) {
+ generator.generate(world, chunkX, chunkZ);
+ }
}
}
diff --git a/ihl/worldgen/WorldGenLiquidOre.java b/ihl/worldgen/WorldGenLiquidOre.java deleted file mode 100644 index f59fb2e..0000000 --- a/ihl/worldgen/WorldGenLiquidOre.java +++ /dev/null @@ -1,86 +0,0 @@ -package ihl.worldgen;
-
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
-import net.minecraft.init.Blocks;
-import net.minecraft.world.World;
-
-public class WorldGenLiquidOre extends WorldGenMinableMeta {
-
- public WorldGenLiquidOre(Set<Long> precalculatedChunkChache1,Map<Long, WorldGenMinableMeta> blockToOreCoordinates, Map<Long, Set<int[]>> oreCoordinatesToChunkCoordinates, Block block, Block liquidBedBlock1, int meta, int numberOfBlocks1, int veinMinHeightLimit1, int veinMaxHeightLimit1, Block... replacedBlock1)
- {
- super(precalculatedChunkChache1,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,block, liquidBedBlock1, meta, numberOfBlocks1, veinMinHeightLimit1, veinMaxHeightLimit1, replacedBlock1);
- }
-
- @Override
- public boolean generate(World world, Random random, int x, int y, int z)
- {
- if(replaceableBlocks.contains(world.getBlock(x, y, z)))
- {
- if(y<44 || world.getBlock(x, y+1, z).isAir(world, x, y+1, z) || world.getBlock(x, y+1, z).equals(Blocks.air))
- {
- world.setBlock(x, y, z, mineableBlock, mineableBlockMeta, 2);
- int x1,y1,z1;
- int xyz[] = {0,0,1,0,0,-1,0,0};
- Block block;
- for(int i=0;i<=5;i++)
- {
- x1=x+xyz[i];
- y1=y+xyz[i+1];
- z1=z+xyz[i+2];
- block = world.getBlock(x1,y1,z1);
- if(block!=mineableBlock)
- {
- if(block.getMaterial()==Material.lava)
- {
- world.setBlock(x1, y1, z1, Blocks.obsidian, 0, 2);
- }
- else if(!block.isAir(world, x1, y1, z1) || xyz[i+1]<=0)
- {
- world.setBlock(x1, y1, z1, liquidBedBlock, 0, 2);
- }
- }
- }
- return true;
- }
- }
- return false;
- }
-
- @Override
- public boolean generateNewVein(Random random, int chunkX1, int chunkZ1)
- {
- int chunkX = chunkX1;
- int chunkZ = chunkZ1;
- int x0=chunkX << 4;
- int z0=chunkZ << 4;
- long chunkKey = (chunkX<<16)+chunkZ;
- for(int ix=x0-this.numberOfBlocks/2;ix<x0+this.numberOfBlocks/2;ix++)
- {
- for(int iz=z0-this.numberOfBlocks/2;iz<z0+this.numberOfBlocks/2;iz++)
- {
- for(int iy=this.veinMinHeightLimit;iy<=this.veinMaxHeightLimit;iy++)
- {
- if((ix-x0)*(ix-x0)+(iz-z0)*(iz-z0) < this.numberOfBlocks*this.numberOfBlocks/4)
- {
- int[] oreCoordinatesArray = new int[] {ix,iy,iz};
- long oreCoordinatesKey = (ix<<30)+(iy<<15)+iz;
- {
- chunkX=x0>>4;
- chunkZ=z0>>4;
- chunkKey = (chunkX<<16)+chunkZ;
- updateOreCoordinatesToChunkCoordinates(chunkKey, oreCoordinatesArray);
- this.blockToOreCoordinates.put(oreCoordinatesKey, this);
- this.precalculatedChunkChache.add(chunkKey);
- }
- }
- }
- }
- }
- return true;
- }
-}
diff --git a/ihl/worldgen/WorldGenMinableMeta.java b/ihl/worldgen/WorldGenMinableMeta.java deleted file mode 100644 index f80edba..0000000 --- a/ihl/worldgen/WorldGenMinableMeta.java +++ /dev/null @@ -1,126 +0,0 @@ -package ihl.worldgen;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-
-import net.minecraft.block.Block;
-import net.minecraft.init.Blocks;
-import net.minecraft.util.Vec3;
-import net.minecraft.world.World;
-import net.minecraft.world.gen.feature.WorldGenerator;
-import net.minecraftforge.common.util.ForgeDirection;
-
-public class WorldGenMinableMeta extends WorldGenerator {
-
- protected final Block mineableBlock;
- protected final Set<Block> replaceableBlocks=new HashSet<Block>();
- protected final Block liquidBedBlock;
- protected final int mineableBlockMeta;
- protected final int numberOfBlocks;
- protected int blockCounter;
- protected final int veinMaxHeightLimit;
- protected final int veinMinHeightLimit;
-
- public boolean maxBlockReached=false;
- public int lastX=-1;
- public int lastY=64;
- public int lastZ=-1;
- protected ForgeDirection veinDirection = ForgeDirection.SOUTH;//EAST
- protected final Map<Long, Set<int[]>> oreCoordinatesToChunkCoordinates;
- protected final Map<Long,WorldGenMinableMeta> blockToOreCoordinates;
- protected final Set<Long> precalculatedChunkChache;
-
- public WorldGenMinableMeta(Set<Long> precalculatedChunkChache1, Map<Long,WorldGenMinableMeta> blockToOreCoordinates1, Map<Long, Set<int[]>> oreCoordinatesToChunkCoordinates2, Block block, int meta, int numberOfBlocks1, Block... blocks) {
- this(precalculatedChunkChache1 ,blockToOreCoordinates1, oreCoordinatesToChunkCoordinates2, block, Blocks.clay, meta, numberOfBlocks1, 0, 128, blocks);
- }
-
- public WorldGenMinableMeta(Set<Long> precalculatedChunkChache1, Map<Long,WorldGenMinableMeta> blockToOreCoordinates1, Map<Long,Set<int[]>> oreCoordinatesToChunkCoordinates1, Block block, Block liquidBedBlock1, int meta, int numberOfBlocks1, int veinMinHeightLimit1, int veinMaxHeightLimit1, Block... replacedBlock1)
- {
- precalculatedChunkChache=precalculatedChunkChache1;
- blockToOreCoordinates=blockToOreCoordinates1;
- oreCoordinatesToChunkCoordinates=oreCoordinatesToChunkCoordinates1;
- mineableBlock = block;
- replaceableBlocks.addAll(Arrays.asList(replacedBlock1));
- mineableBlockMeta = meta;
- liquidBedBlock=liquidBedBlock1;
- numberOfBlocks = numberOfBlocks1;
- veinMaxHeightLimit=veinMaxHeightLimit1;
- veinMinHeightLimit=veinMinHeightLimit1;
- }
-
- @Override
- public boolean generate(World world, Random random, int x, int y, int z)
- {
- int chunkX = x>>4;
- int chunkZ = z>>4;
- int xyz[] = {0,0,1,0,0,-1,0,0};
- for(int i=0;i<=5;i++)
- {
- int x0 = x+xyz[i];
- int y0 = y+xyz[i+1];
- int z0 = z+xyz[i+2];
- if(x0>>4==chunkX && z0>>4==chunkZ)
- {
- if(replaceableBlocks.contains(world.getBlock(x0, y0, z0)))
- {
- world.setBlock(x0, y0, z0, mineableBlock, mineableBlockMeta, 2);
- }
- }
- }
- return false;
- }
-
- public boolean generateNewVein(Random random, int chunkX1, int chunkZ1)
- {
- Vec3 veinVector = Vec3.createVectorHelper(random.nextFloat()*2-1f, random.nextFloat()-0.5f, random.nextFloat()*2-1f);
- veinVector.normalize();
- int chunkX = chunkX1;
- int chunkZ = chunkZ1;
- int x0=chunkX << 4;
- int z0=chunkZ << 4;
- int y0=random.nextInt(veinMaxHeightLimit);
- //System.out.println("generated new vein with height="+y0);
- float fx=x0;
- float fy=y0;
- float fz=z0;
- long chunkKey = (chunkX<<16)+chunkZ;
- for(int i=0;i<this.numberOfBlocks;i++)
- {
- int[] oreCoordinatesArray = new int[] {x0,y0,z0};
- long oreCoordinatesKey = (x0<<30)+(y0<<15)+z0;
- {
- chunkX=x0>>4;
- chunkZ=z0>>4;
- chunkKey = (chunkX<<16)+chunkZ;
- updateOreCoordinatesToChunkCoordinates(chunkKey, oreCoordinatesArray);
- this.blockToOreCoordinates.put(oreCoordinatesKey, this);
- this.precalculatedChunkChache.add(chunkKey);
- }
- fx+=veinVector.xCoord+random.nextFloat()*0.25f;
- fy+=veinVector.yCoord+random.nextFloat()*0.25f;
- fz+=veinVector.zCoord+random.nextFloat()*0.25f;
- x0=Math.round(fx);
- y0=Math.round(fy);
- z0=Math.round(fz);
- }
- return true;
- }
-
- protected void updateOreCoordinatesToChunkCoordinates(long chunkKey, int[] oreCoordinates)
- {
- if(this.oreCoordinatesToChunkCoordinates.containsKey(chunkKey))
- {
- this.oreCoordinatesToChunkCoordinates.get(chunkKey).add(oreCoordinates);
- }
- else
- {
- Set<int[]> oreCoordinatesS = new HashSet<int[]>();
- oreCoordinatesS.add(oreCoordinates);
- this.oreCoordinatesToChunkCoordinates.put(chunkKey, oreCoordinatesS);
- }
- }
-
-}
diff --git a/ihl/worldgen/WorldGeneratorBase.java b/ihl/worldgen/WorldGeneratorBase.java new file mode 100644 index 0000000..aaaaa66 --- /dev/null +++ b/ihl/worldgen/WorldGeneratorBase.java @@ -0,0 +1,69 @@ +package ihl.worldgen; + +import java.util.HashSet; +import java.util.Random; +import java.util.Set; + +import ihl.utils.IHLUtils; +import net.minecraft.block.Block; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.storage.ExtendedBlockStorage; + +public abstract class WorldGeneratorBase { + private final Random random = new Random(); + protected final Block ore; + private final Set<Block> replaceableBlocks = new HashSet<Block>(2); + + public WorldGeneratorBase(Block oreIn, Block... replaceableBlocksIn) { + ore = oreIn; + for (Block block : replaceableBlocksIn) { + replaceableBlocks.add(block); + } + } + + public void generate(World world, int chunkX, int chunkZ) { + int[] centralPOI = this.getPOI(world, chunkX, chunkZ, 0, 0); + int[] xz = new int[] { 0, 1, 0, -1, 0 }; + for (int i = 0; i < 4; i++) { + int[] surroundPOI = this.getPOI(world, chunkX + xz[i], chunkZ + xz[i + 1], xz[i], xz[i + 1]); + this.replaceBlocks(world, centralPOI, surroundPOI, chunkX << 4, chunkZ << 4); + } + } + + protected abstract void replaceBlocks(World world, final int[] centralPOI, final int[] surroundPOI, + final int startX, final int startZ); + + protected boolean replace(World world, int absX, int absY, int absZ, final Block block) { + if (!world.getChunkProvider().chunkExists(absX >> 4, absZ >> 4)) { + throw new IllegalStateException("quered chunk is not yet generated!"); + } + Chunk chunk = world.getChunkFromBlockCoords(absX, absZ); + ExtendedBlockStorage ebs = chunk.getBlockStorageArray()[absY >> 4]; + if (ebs != null && replaceableBlocks.contains(ebs.getBlockByExtId(absX & 15, absY & 15, absZ & 15))) { + IHLUtils.setBlockRaw(ebs, absX & 15, absY & 15, absZ & 15, block); + return true; + } + return false; + } + + protected boolean replaceAll(World world, int absX, int absY, int absZ, final Block block) { + if (!world.getChunkProvider().chunkExists(absX >> 4, absZ >> 4)) { + throw new IllegalStateException("quered chunk is not yet generated!"); + } + Chunk chunk = world.getChunkFromBlockCoords(absX, absZ); + ExtendedBlockStorage ebs = chunk.getBlockStorageArray()[absY >> 4]; + if (ebs != null) { + IHLUtils.setBlockRaw(ebs, absX & 15, absY & 15, absZ & 15, block); + return true; + } + return false; + } + + private int[] getPOI(World world, int chunkX, int chunkZ, int xOffset, int zOffset) { + long seed = (long) chunkX << 16 ^ chunkZ << 8 ^ Block.getIdFromBlock(ore); + random.setSeed(seed); + return new int[] { random.nextInt(16) + xOffset * 16, random.nextInt(world.getActualHeight()/2), + random.nextInt(16) + zOffset * 16 }; + } +} diff --git a/ihl/worldgen/WorldGeneratorSurfaceLake.java b/ihl/worldgen/WorldGeneratorSurfaceLake.java new file mode 100644 index 0000000..3affdaf --- /dev/null +++ b/ihl/worldgen/WorldGeneratorSurfaceLake.java @@ -0,0 +1,41 @@ +package ihl.worldgen; + +import ihl.utils.IHLMathUtils; +import ihl.utils.IHLUtils; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.storage.ExtendedBlockStorage; + +public class WorldGeneratorSurfaceLake extends WorldGeneratorBase { + + public WorldGeneratorSurfaceLake(Block oreIn, Block[] replaceableBlocksIn) { + super(oreIn, replaceableBlocksIn); + } + + @Override + protected void replaceBlocks(World world, int[] centralPOI, int[] surroundPOI, int startX, int startZ) { + BiomeGenBase biome = world.getBiomeGenForCoords(startX, startZ); + if (biome.temperature < 1.9f || biome.rainfall != 0f) { + return; + } + int x = centralPOI[0], y = centralPOI[1], z = centralPOI[2]; + for (int ix = x; ix < 16 && ix >= 0; ix += IHLMathUtils.sign(surroundPOI[0] - x)) { + int y2 = y += IHLMathUtils.sign(surroundPOI[1] - world.getActualHeight() / 4 - y); + for (int iz = z; iz < 16 && iz >= 0; iz += IHLMathUtils.sign(surroundPOI[2] - z)) { + y2 += IHLMathUtils.sign(surroundPOI[1] - world.getActualHeight() / 4 - y2); + if (y2 > world.getActualHeight() * 3 / 8 + && world.getBlock(ix + startX, 64, iz + startZ) == Blocks.air) { + this.replace(world, ix + startX, 63, iz + startZ, ore); + } + if (surroundPOI[2] == z) { + break; + } + } + if (surroundPOI[0] == x) { + break; + } + } + } +} diff --git a/ihl/worldgen/WorldGeneratorUndergroundLake.java b/ihl/worldgen/WorldGeneratorUndergroundLake.java new file mode 100644 index 0000000..6cd0870 --- /dev/null +++ b/ihl/worldgen/WorldGeneratorUndergroundLake.java @@ -0,0 +1,39 @@ +package ihl.worldgen; + +import ihl.utils.IHLMathUtils; +import net.minecraft.block.Block; +import net.minecraft.world.World; + +public class WorldGeneratorUndergroundLake extends WorldGeneratorBase { + + private final Block clayBlock; + + public WorldGeneratorUndergroundLake(Block oreIn, Block clayIn, Block[] replaceableBlocksIn) { + super(oreIn, replaceableBlocksIn); + clayBlock = clayIn; + } + + @Override + protected void replaceBlocks(World world, int[] centralPOI, int[] surroundPOI, int startX, int startZ) { + int x = centralPOI[0], y = centralPOI[1] - world.getActualHeight() / 4, z = centralPOI[2]; + for (int ix = x; ix < 16 && ix >= 0; ix += IHLMathUtils.sign(surroundPOI[0] - x)) { + int y2 = y += IHLMathUtils.sign(surroundPOI[1] - world.getActualHeight() / 4 - y); + for (int iz = z; iz < 16 && iz >= 0; iz += IHLMathUtils.sign(surroundPOI[2] - z)) { + y2 += IHLMathUtils.sign(surroundPOI[1] - world.getActualHeight() / 4 - y2); + if (y2 > 1) { + this.replace(world, ix + startX, y2 + 1, iz + startZ, clayBlock); + for (int iy = y2; iy > 0; iy--) { + this.replace(world, ix + startX, iy, iz + startZ, ore); + } + } + if (surroundPOI[2] == z) { + break; + } + } + if (surroundPOI[0] == x) { + break; + } + } + } + +} diff --git a/ihl/worldgen/WorldGeneratorVein.java b/ihl/worldgen/WorldGeneratorVein.java new file mode 100644 index 0000000..3be74e0 --- /dev/null +++ b/ihl/worldgen/WorldGeneratorVein.java @@ -0,0 +1,26 @@ +package ihl.worldgen; + +import ihl.utils.IHLMathUtils; +import net.minecraft.block.Block; +import net.minecraft.world.World; + +public class WorldGeneratorVein extends WorldGeneratorBase { + + public WorldGeneratorVein(Block oreIn, Block[] replaceableBlocksIn) { + super(oreIn, replaceableBlocksIn); + } + + @Override + protected void replaceBlocks(World world, int[] centralPOI, int[] surroundPOI, int startX, int startZ) { + int x = centralPOI[0], y = centralPOI[1], z = centralPOI[2]; + while (x < 16 && x >= 0 && y >= 0 && y < world.getActualHeight() && z >= 0 && z < 16) { + this.replace(world, x + startX, y, z + startZ, ore); + x += IHLMathUtils.sign(surroundPOI[0] - x); + y += IHLMathUtils.sign(surroundPOI[1] - y); + z += IHLMathUtils.sign(surroundPOI[2] - z); + if (IHLMathUtils.sign(surroundPOI[0] - x) == 0 && IHLMathUtils.sign(surroundPOI[1] - y) == 0 + && IHLMathUtils.sign(surroundPOI[2] - z) == 0) + break; + } + } +} diff --git a/ihl/worldgen/ores/IHLFluid.java b/ihl/worldgen/ores/IHLFluid.java index ce98b86..51e0999 100644 --- a/ihl/worldgen/ores/IHLFluid.java +++ b/ihl/worldgen/ores/IHLFluid.java @@ -181,7 +181,7 @@ public class IHLFluid extends Fluid { fluidRubberTreeSap("fluidRubberTreeSap", "fluidRubberTreeSap", 10019, 293, 273, 393, 1200f, "fluidrubbertreesap", Material.water, true, true, false, false),
SpruceResin("SpruceResin","fluidSpruceResin", 10018, 293, 273, 533, 1080, "spruceresin", Material.water, true, true, true, false),
CablingColophony("CablingColophony", 10017, 363, 363, 533, 1070, "cablingcolophony", Material.water, true, false, true),
- Glyceryl("Glyceryl", 10016, 293, 291, 583, 1261, "glyceryl", Material.water, true, false, true),
+ Glycerol("Glycerol", 10016, 293, 291, 583, 1261, "glycerol", Material.water, true, false, true),
SeedOil("SeedOil", 10015, 293, 256, 583, 920, "seedoil", Material.water, true, false, true),
AquaRegia("AquaRegia", 10014, 293, 231, 356, 1060),
SodiumPeroxide("SodiumPeroxide", 10013, 950, 950, 2223, 1800),
@@ -202,10 +202,6 @@ public class IHLFluid extends Fluid { MoltenCopper("MoltenCopper", "fluidMolten", 10048, 1356, 1356, 2840, 8920, "molten.copper", Material.lava, false, false, false),
MoltenBronze("MoltenBronze", 10005, 940, 940, 2840, 8000, "molten.bronze", Material.lava, false, false, false),
MoltenGold("MoltenGold", 10005, 1337, 1337, 3129, 17310, "molten.gold", Material.lava, false, false, false),
- VapourSulfuricAcid("VapourSulfuricAcid", 10004, 610, 283, 610, 4.522F, "vapour.sulfuricacid", new MaterialLiquid(
- MapColor.redColor), false, false, false),
- SulfuricAnhydride("SulfuricAnhydride", 10003, 45, 17, 45, 2, "sulfuricanhydride", new MaterialLiquid(
- MapColor.redColor), true, false, false),
SulfuricAcid("SulfuricAcid", 10002, 293, 283, 610, 1836),
NitricAcid("NitricAcid", 10001, 293, 231, 356, 1100);
|
