From b67ac617dc9c5f43b911158a281c3c61ced5ea5a Mon Sep 17 00:00:00 2001 From: Foghrye4 Date: Sat, 22 Apr 2017 14:31:54 +0300 Subject: NEI titles translation --- assets/ihl/lang/en_US.lang | 24 ++ ihl/ClientProxy.java | 47 --- ihl/IHLMod.java | 108 +------ ihl/IHLModInfo.java | 2 +- ihl/enviroment/LightBulbBlock.java | 157 ---------- ihl/enviroment/LightBulbModel.java | 51 ---- ihl/enviroment/LightBulbRender.java | 77 ----- ihl/enviroment/LightBulbTileEntity.java | 273 ----------------- ihl/enviroment/LightHandler.java | 166 ----------- ihl/enviroment/LightSource.java | 183 ------------ ihl/enviroment/SpotlightBlock.java | 147 ---------- ihl/enviroment/SpotlightModel.java | 71 ----- ihl/enviroment/SpotlightRender.java | 110 ------- ihl/enviroment/SpotlightTileEntity.java | 212 -------------- ihl/model/RenderBlocksExt.java | 324 --------------------- ihl/model/TileEntityRendererDispatcherExt.java | 58 ---- .../AchesonFurnaceRecipeHandler.java | 7 +- .../ChemicalReactorRecipeHandler.java | 6 - ihl/nei_integration/CrucibleRecipeHandler.java | 8 +- .../CryogenicDistillerRecipeHandler.java | 7 - .../DetonationSprayingMachineRecipeHandler.java | 7 +- .../ElectricEvaporatorRecipeHandler.java | 7 +- .../ElectrolysisBathRecipeHandler.java | 8 +- ihl/nei_integration/EvaporatorRecipeHandler.java | 7 +- ihl/nei_integration/ExtruderRecipeHandler.java | 6 +- .../FluidizedBedReactorRecipeHandler.java | 7 +- .../FractionationColumnRecipeHandler.java | 8 +- .../GasWeldingStationGasRecipeHandler.java | 10 +- .../ImpregnatingMachineRecipeHandler.java | 7 +- .../InjectionMoldRecipeHandler.java | 6 +- .../IronWorkbenchRecipeHandler.java | 17 +- .../LabElectrolyzerRecipeHandler.java | 6 +- ihl/nei_integration/LeadOvenRecipeHandler.java | 6 +- ihl/nei_integration/LoomRecipeHandler.java | 7 - ihl/nei_integration/MachineRecipeHandler.java | 6 +- .../MuffleFurnaceRecipeHandler.java | 6 - ihl/nei_integration/PaperMachineRecipeHandler.java | 7 - .../RollingMachineRecipeHandler.java | 6 - .../VulcanizationExtrudingMoldRecipeHandler.java | 9 +- ihl/nei_integration/WireMillRecipeHandler.java | 7 - .../WoodenRollingMachineRecipeHandler.java | 6 - ihl/worldgen/WorldGeneratorBase.java | 2 +- ihl/worldgen/WorldGeneratorUndergroundLake.java | 27 +- ihl_coremod/IHLCoremod.java | 48 --- ihl_coremod/IHLCoremodContainer.java | 29 -- ihl_coremod/WorldRendererClassTransformer.java | 22 -- ihl_coremod/WorldRendererClassVisitor.java | 25 -- ...WorldRendererRenderBlocksInitMethodVisitor.java | 34 --- 48 files changed, 75 insertions(+), 2306 deletions(-) delete mode 100644 ihl/enviroment/LightBulbBlock.java delete mode 100644 ihl/enviroment/LightBulbModel.java delete mode 100644 ihl/enviroment/LightBulbRender.java delete mode 100644 ihl/enviroment/LightBulbTileEntity.java delete mode 100644 ihl/enviroment/LightHandler.java delete mode 100644 ihl/enviroment/LightSource.java delete mode 100644 ihl/enviroment/SpotlightBlock.java delete mode 100644 ihl/enviroment/SpotlightModel.java delete mode 100644 ihl/enviroment/SpotlightRender.java delete mode 100644 ihl/enviroment/SpotlightTileEntity.java delete mode 100644 ihl/model/RenderBlocksExt.java delete mode 100644 ihl/model/TileEntityRendererDispatcherExt.java delete mode 100644 ihl_coremod/IHLCoremod.java delete mode 100644 ihl_coremod/IHLCoremodContainer.java delete mode 100644 ihl_coremod/WorldRendererClassTransformer.java delete mode 100644 ihl_coremod/WorldRendererClassVisitor.java delete mode 100644 ihl_coremod/WorldRendererRenderBlocksInitMethodVisitor.java diff --git a/assets/ihl/lang/en_US.lang b/assets/ihl/lang/en_US.lang index 1a5bb4a..641ea06 100644 --- a/assets/ihl/lang/en_US.lang +++ b/assets/ihl/lang/en_US.lang @@ -2,6 +2,30 @@ language.name=HAYO language.region=US language.code=en_US +ihl.achesonFurnace=Acheson furnace +ihl.chemicalReactor=Chemical reactor +ihl.crucible=Crucible +ihl.cryogenicDistiller=Cryogenic distiller +ihl.detonationSprayingMachine=Detonation spraying machine +ihl.electricEvaporator=Electric evaporator +ihl.electrolysisBath=Electrolysis bath +ihl.evaporator=Evaporator +ihl.extruder=Extruder +ihl.fluidizedBedReactor=Fluidized bed reactor +ihl.fractionator=Fractionation column +ihl.gasWeldingStationGas=Gas wielding station +ihl.impregnatingMachine=Bronze tub +ihl.injectionMold=Injection mold +ihl.ironWorkbench=Iron workbench +ihl.labElectrolyzer=Lab electrolyzer +ihl.leadOven=Chemical oven +ihl.loom=Loom +ihl.muffleFurnace=Muffle furnace +ihl.paperMachine=Paper machine +ihl.rollingMachine=Rolling machine +ihl.woodenRollingMachine=Wooden rolling machine +ihl.wireMill=Wire mill +ihl.vulcanizationExtrudingMold=Vulcanization extruding mold ihl.dosingPump.tip=Type desired amount of fluids /n to be injected to fluid tank near /n dosing pump. Use redstone impulse /n signal to perform injection. /n Press [enter] to accept number. ihl.detonatorHint=RMB while crafting this to set detonator delay ihl.setOfDiesHint=RMB while crafting this to set transverse section diff --git a/ihl/ClientProxy.java b/ihl/ClientProxy.java index b257264..2f58e9c 100644 --- a/ihl/ClientProxy.java +++ b/ihl/ClientProxy.java @@ -12,16 +12,8 @@ import ihl.crop_harvestors.BlobEntityFX.FluidType; import ihl.crop_harvestors.BlobRenderFX; import ihl.crop_harvestors.SackRender; import ihl.crop_harvestors.SackTileEntity; -import ihl.enviroment.LightBulbModel; -import ihl.enviroment.LightBulbRender; -import ihl.enviroment.LightBulbTileEntity; -import ihl.enviroment.LightHandler; -import ihl.enviroment.LightSource; import ihl.enviroment.MirrorRender; import ihl.enviroment.MirrorTileEntity; -import ihl.enviroment.SpotlightModel; -import ihl.enviroment.SpotlightRender; -import ihl.enviroment.SpotlightTileEntity; import ihl.explosion.ExplosionEntityFX; import ihl.explosion.ExplosionRenderFX; import ihl.explosion.IHLEntityFallingPile; @@ -132,28 +124,18 @@ public class ClientProxy extends ServerProxy { public IHLRenderUtils renderUtils; public Map sharedBlockRenders = new HashMap(); public Map, ISelectionBoxSpecialRenderer> selectionBoxSpecialRendererRegistry = new HashMap, ISelectionBoxSpecialRenderer>(); - public LightHandler lightHandler; public ClientProxy() { } - public LightHandler getLightHandler() { - - return this.lightHandler; - } - @Override public void load() throws ParserConfigurationException { - if (lightHandler == null) { - lightHandler = new LightHandler(); - } if (channel == null) { channel = NetworkRegistry.INSTANCE.newEventDrivenChannel(IHLModInfo.MODID); channel.register(this); } this.renderUtils = new IHLRenderUtils(); MinecraftForge.EVENT_BUS.register(this.renderUtils); - TileEntityRendererDispatcher.instance = new TileEntityRendererDispatcherExt(); registerBlockHandler(new ImpregnatingMachineBlockRender(), MachineType.BronzeTub); registerBlockHandler(new RefluxCondenserBlockRender(), MachineType.RefluxCondenser); registerBlockHandler(new RectifierTransformerUnitBlockRender(), MachineType.RectifierTransformerUnit); @@ -217,8 +199,6 @@ public class ClientProxy extends ServerProxy { 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()); @@ -291,13 +271,6 @@ public class ClientProxy extends ServerProxy { 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()); @@ -433,26 +406,6 @@ public class ClientProxy extends ServerProxy { float pitch = byteBufInputStream.readFloat(); this.playSound(world, soundId, x, y, z, volume, pitch); break; - case 4: - posX = byteBufInputStream.readInt(); - posY = byteBufInputStream.readInt(); - posZ = byteBufInputStream.readInt(); - for (LightSource lightSource : ((ClientProxy) IHLMod.proxy).getLightHandler().lightSources) { - if (lightSource.isBlockIlluminated(posX, posY, posZ)) { - lightSource.provideLight(world, posX, posY, posZ); - } - } - break; - case 5: - posX = byteBufInputStream.readInt(); - posY = byteBufInputStream.readInt(); - posZ = byteBufInputStream.readInt(); - for (LightSource lightSource : ((ClientProxy) IHLMod.proxy).getLightHandler().lightSources) { - if (lightSource.isBlockIlluminated(posX, posY, posZ)) { - lightSource.castShadow(world, posX, posY, posZ); - } - } - break; } byteBufInputStream.close(); } diff --git a/ihl/IHLMod.java b/ihl/IHLMod.java index cae4657..3c501dd 100644 --- a/ihl/IHLMod.java +++ b/ihl/IHLMod.java @@ -33,7 +33,6 @@ import ic2.api.recipe.Recipes; import ic2.core.Ic2Items; import ic2.core.util.StackUtil; import ihl.enviroment.LaserHitMirrorEventHandler; -import ihl.enviroment.LightBulbBlock; import ihl.enviroment.MirrorBlock; import ihl.explosion.ChunkAndWorldLoadEventHandler; import ihl.explosion.ExplosionVectorBlockV2; @@ -198,7 +197,6 @@ public class IHLMod implements IFuelHandler { BatteryItem.init(); IHLTool.init(); MirrorBlock.init(); - LightBulbBlock.init(); MachineBaseBlock.init();// must be first IHLMod.enet = new IHLENet(); MinecraftForge.EVENT_BUS.register(new EntityDropEventHandler()); @@ -1171,100 +1169,6 @@ public class IHLMod implements IFuelHandler { new RecipeInputItemStack(new ItemStack(Blocks.wool)) }), Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStackWithSize("mirror", 16) }))); } - Map dyeMap = new HashMap(); - dyeMap.put("dyePurple", 0xff00ff); - dyeMap.put("dyeCyan", 0x00ffff); - dyeMap.put("dyeLightGray", 0xaaaaaa); - dyeMap.put("dyeGray", 0x888888); - dyeMap.put("dyePink", 0xff8888); - dyeMap.put("dyeLime", 0x88ff88); - dyeMap.put("dyeLightBlue", 0x8888ff); - dyeMap.put("dyeBlue", 0x0000ff); - dyeMap.put("dyeGreen", 0x00ff00); - dyeMap.put("dyeRed", 0xff0000); - dyeMap.put("dyeBlack", 0x000000); - dyeMap.put("dyeMagenta", 0xff88ff); - dyeMap.put("dyeOrange", 0xff8800); - dyeMap.put("dyeWhite", 0xffffff); - dyeMap.put("dyeBrown", 0x804000); - dyeMap.put("dyeYellow", 0xffff00); - Map paneGlassMap = new HashMap(); - paneGlassMap.put("paneGlassPurple", 0xff00ff); - paneGlassMap.put("paneGlassCyan", 0x00ffff); - paneGlassMap.put("paneGlassLightGray", 0xaaaaaa); - paneGlassMap.put("paneGlassGray", 0x888888); - paneGlassMap.put("paneGlassPink", 0xff8888); - paneGlassMap.put("paneGlassLime", 0x88ff88); - paneGlassMap.put("paneGlassLightBlue", 0x8888ff); - paneGlassMap.put("paneGlassBlue", 0x0000ff); - paneGlassMap.put("paneGlassGreen", 0x00ff00); - paneGlassMap.put("paneGlassRed", 0xff0000); - paneGlassMap.put("paneGlassBlack", 0x000000); - paneGlassMap.put("paneGlassMagenta", 0xff88ff); - paneGlassMap.put("paneGlassOrange", 0xff8800); - paneGlassMap.put("paneGlassWhite", 0xffffff); - paneGlassMap.put("paneGlassBrown", 0x804000); - paneGlassMap.put("paneGlassYellow", 0xffff00); - IronWorkbenchTileEntity.addRecipe( - new IronWorkbenchRecipe( - Arrays.asList( - new ItemStack[] { IHLUtils.getThisModItemStack("tinSnipsSteel"), - IHLUtils.getThisModItemStack("glassBlowingTubeSteel"), - IHLUtils.getThisModItemStack("hackSawSteel") }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("foilTungsten"), - IHLUtils.getThisModItemStack("foilCopper"), - IHLUtils.getThisModItemStackWithSize("lampHolderPorcelain", 16), - IHLUtils.getOreDictItemStack("dustGlass") }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStackWithSize("lightBulb", 16) }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("gasWeldingStation"), - IHLUtils.getThisModItemStack("gaedesMercuryRotaryPump") }))); - for (Map.Entry dyeEntry : dyeMap.entrySet()) { - ItemStack lightBulb = IHLUtils.getThisModItemStackWithSize("lightBulb", 16); - lightBulb.stackTagCompound = new NBTTagCompound(); - lightBulb.stackTagCompound.setInteger("colour", dyeEntry.getValue()); - IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe( - Arrays.asList( - new ItemStack[] { IHLUtils.getThisModItemStack("tinSnipsSteel"), - IHLUtils.getThisModItemStack("glassBlowingTubeSteel"), - IHLUtils.getThisModItemStack("hackSawSteel") }), - Arrays.asList(new IRecipeInput[] { new RecipeInputOreDict("foilTungsten"), - new RecipeInputOreDict("foilCopper"), - new RecipeInputItemStack( - IHLUtils.getThisModItemStackWithSize("lampHolderPorcelain", 16)), - new RecipeInputOreDict("dustGlass"), new RecipeInputOreDict(dyeEntry.getKey()) }), - Arrays.asList(new ItemStack[] { lightBulb }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("gasWeldingStation"), - IHLUtils.getThisModItemStack("gaedesMercuryRotaryPump") }))); - } - - IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe( - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("hammer"), - IHLUtils.getThisModItemStack("tinSnipsSteel"), IHLUtils.getThisModItemStack("hackSawSteel"), - IHLUtils.getThisModItemStack("setOfFilesSteel"), - IHLUtils.getThisModItemStack("viseSteel") }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("lightBulb"), - IHLUtils.getThisModItemStack("foilSteel"), - IHLUtils.getInsulatedWire("Copper", 1, 15, "Rubber", 100), - IHLUtils.getOreDictItemStack("plateSteel"), new ItemStack(Blocks.glass_pane) }), - Arrays.asList(new ItemStack[] { IHLUtils.getThisModItemStack("spotlight") }))); - - for (Map.Entry paneGlassEntry : paneGlassMap.entrySet()) { - ItemStack spotlight = IHLUtils.getThisModItemStack("spotlight"); - spotlight.stackTagCompound = new NBTTagCompound(); - spotlight.stackTagCompound.setInteger("colour", paneGlassEntry.getValue()); - IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(Arrays.asList(new ItemStack[] { - IHLUtils.getThisModItemStack("hammer"), IHLUtils.getThisModItemStack("tinSnipsSteel"), - IHLUtils.getThisModItemStack("hackSawSteel"), IHLUtils.getThisModItemStack("setOfFilesSteel"), - IHLUtils.getThisModItemStack("viseSteel") }), - Arrays.asList(new IRecipeInput[] { - new RecipeInputItemStack(IHLUtils.getThisModItemStack("lightBulb")), - new RecipeInputOreDict("foilSteel"), - new RecipeInputWire(IHLUtils.getInsulatedWire("Copper", 1, 15, "Rubber", 100)), - new RecipeInputOreDict("plateSteel"), - new RecipeInputOreDict(paneGlassEntry.getKey()) }), - Arrays.asList(new ItemStack[] { spotlight }))); - - } IronWorkbenchTileEntity.addRecipe(new IronWorkbenchRecipe(Arrays.asList( new IRecipeInput[] { RecipeInputs.cutter, RecipeInputs.saw, RecipeInputs.vise, RecipeInputs.file }), Arrays.asList(new IRecipeInput[] { new RecipeInputOreDict("plateSteel", 2), @@ -1756,28 +1660,28 @@ public class IHLMod implements IFuelHandler { if (IHLUtils.hasOreDictionaryEntry("dustSilicon")) FluidizedBedReactorTileEntity.addRecipe(IHLUtils.getFluidStackWithSize("hydrogen", 1333), IHLUtils.getOreDictItemStackWithSize("dustSiliconDioxide", 1), - IHLUtils.getFluidStackWithSize("ic2distilledwater", 2000), + IHLUtils.getFluidStackWithSize("water", 2000), IHLUtils.getOreDictItemStackWithSize("dustTinySilicon", 3)); if (IHLUtils.hasOreDictionaryEntry("dustManganese")) FluidizedBedReactorTileEntity.addRecipe(IHLUtils.getFluidStackWithSize("hydrogen", 2000), IHLUtils.getOreDictItemStackWithSize("dustManganeseOxide", 2), - IHLUtils.getFluidStackWithSize("ic2distilledwater", 3000), + IHLUtils.getFluidStackWithSize("water", 3000), IHLUtils.getOreDictItemStack("dustManganese")); FluidizedBedReactorTileEntity.addRecipe(IHLUtils.getFluidStackWithSize("hydrogen", 1200), IHLUtils.getOreDictItemStack("dustIronOxide"), - IHLUtils.getFluidStackWithSize("ic2distilledwater", 1800), + IHLUtils.getFluidStackWithSize("water", 1800), new RecipeOutputItemStack(IHLUtils.getOreDictItemStack("dustTinyIron"), 3.6f)); FluidizedBedReactorTileEntity.addRecipe(IHLUtils.getFluidStackWithSize("hydrogen", 1500), IHLUtils.getOreDictItemStack("dustTungstenOxide"), - IHLUtils.getFluidStackWithSize("ic2distilledwater", 2250), + IHLUtils.getFluidStackWithSize("water", 2250), new RecipeOutputItemStack(IHLUtils.getOreDictItemStack("dustTinyTungsten"), 2.25f)); FluidizedBedReactorTileEntity.addRecipe(IHLUtils.getFluidStackWithSize("hydrogen", 4000), IHLUtils.getOreDictItemStackWithSize("dustSodiumSulfate", 3), - IHLUtils.getFluidStackWithSize("ic2distilledwater", 6000), + IHLUtils.getFluidStackWithSize("water", 6000), IHLUtils.getOreDictItemStack("dustSodiumSulfide")); FluidizedBedReactorTileEntity.addRecipe(IHLUtils.getFluidStackWithSize("hydrogen", 1200), IHLUtils.getOreDictItemStack("dustAntimonyOxide"), - IHLUtils.getFluidStackWithSize("ic2distilledwater", 1800), + IHLUtils.getFluidStackWithSize("water", 1800), new RecipeOutputItemStack(IHLUtils.getOreDictItemStack("dustTinyAntimony"), 3.6f)); FluidizedBedReactorTileEntity.addRecipe(IHLUtils.getFluidStackWithSize("oxygen", 1500), IHLUtils.getOreDictItemStack("dustIron"), null, diff --git a/ihl/IHLModInfo.java b/ihl/IHLModInfo.java index 314e76b..91cff69 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.630"; + public static final String MODVERSION = "0.633"; } diff --git a/ihl/enviroment/LightBulbBlock.java b/ihl/enviroment/LightBulbBlock.java deleted file mode 100644 index 7c95001..0000000 --- a/ihl/enviroment/LightBulbBlock.java +++ /dev/null @@ -1,157 +0,0 @@ -package ihl.enviroment; - -import java.util.List; -import java.util.Random; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import ihl.IHLCreativeTab; -import ihl.flexible_cable.AnchorTileEntity; -import ihl.items_blocks.IHLItemBlock; -import net.minecraft.block.Block; -import net.minecraft.block.ITileEntityProvider; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemDye; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public class LightBulbBlock extends Block implements ITileEntityProvider { - - public 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"); - this.setLightOpacity(0); - } - - @Override - public boolean hasTileEntity(int metadata) { - return true; - } - - public static void init() { - new LightBulbBlock("lightBulb"); - new SpotlightBlock("spotlight"); - GameRegistry.registerTileEntity(LightBulbTileEntity.class, "lightBulb"); - GameRegistry.registerTileEntity(SpotlightTileEntity.class, "spotlight"); - } - - @Override - public void onBlockPreDestroy(World world, int x, int y, int z, int meta) { - if (world.isRemote) { - TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof LightBulbTileEntity) { - LightBulbTileEntity ate = (LightBulbTileEntity) te; - ate.invalidate(); - } - } - super.onBlockPreDestroy(world, x, y, z, meta); - } - - /** - * 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()); - } - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs tab, List itemlist) { - for (int colour : ItemDye.field_150922_c) { - ItemStack stack = new ItemStack(item); - stack.stackTagCompound = new NBTTagCompound(); - stack.stackTagCompound.setInteger("colour", colour); - itemlist.add(stack); - } - } - - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { - super.onBlockPlacedBy(world, x, y, z, player, stack); - if (!world.isRemote) { - TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof LightBulbTileEntity && stack.stackTagCompound != null) - ((LightBulbTileEntity)tile).colour=stack.stackTagCompound.getInteger("colour"); - } - } - - private void setBlockBoundsBasedOnFacing(int facing) { - int var2 = facing & 7; - float var6 = 0.1875F; - 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; - } - - @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 instanceof LightBulbTileEntity && ((LightBulbTileEntity)te).getActive()){ - return 15; - } - return 0; - } -} diff --git a/ihl/enviroment/LightBulbModel.java b/ihl/enviroment/LightBulbModel.java deleted file mode 100644 index bca6305..0000000 --- a/ihl/enviroment/LightBulbModel.java +++ /dev/null @@ -1,51 +0,0 @@ -package ihl.enviroment; - -import ihl.model.IHLModelRenderer; -import net.minecraft.client.model.ModelBase; -import net.minecraftforge.common.util.ForgeDirection; - -public class LightBulbModel extends ModelBase -{ - //fields - IHLModelRenderer Base; - IHLModelRenderer BaseON; - - public LightBulbModel() - { - textureWidth = 32; - textureHeight = 32; - setTextureOffset("Base.Shape1", 0, 19); - setTextureOffset("Base.TubeNorth", 20, 0); - setTextureOffset("Base.CylinderNorth", 0, 0); - setTextureOffset("Base.CylinderNorth2", 0, 0); - setTextureOffset("Base.SpyralNorth", 16, 24); - - setTextureOffset("BaseON.Shape1", 0, 19); - setTextureOffset("BaseON.TubeNorth", 20, 0); - setTextureOffset("BaseON.CylinderNorth", 0, 9); - setTextureOffset("BaseON.CylinderNorth2", 10, 10); - setTextureOffset("BaseON.SpyralNorth", 0, 24); - - Base = new IHLModelRenderer(this, "Base"); - Base.setRotationPoint(0F, 16F, 0F); - Base.mirror = true; - Base.addBox("Shape1", -2F, -2F, 7F, 4, 4, 1); - Base.addTube("TubeNorth", -2F, -2F, 5F, 4, 4, 2, 0.8f, 1f, ForgeDirection.NORTH); - Base.drawFromInside = true; - Base.addTube("CylinderNorth", -1.5F, -1.5F, 0F, 3, 3, 7, 0f, 1f, ForgeDirection.NORTH); - Base.addTube("CylinderNorth2", -1F, -1F, 0.5F, 2, 2, 5, 0f, 1f, ForgeDirection.NORTH); - Base.drawFromInside = false; - Base.addTube("SpyralNorth", -0.5F, -0.5F, 0.5F, 1, 1, 7, 0f, 1f, ForgeDirection.NORTH); - - BaseON = new IHLModelRenderer(this, "BaseON"); - BaseON.setRotationPoint(0F, 16F, 0F); - BaseON.mirror = true; - BaseON.addBox("Shape1", -2F, -2F, 7F, 4, 4, 1); - BaseON.addTube("TubeNorth", -2F, -2F, 5F, 4, 4, 2, 0.8f, 1f, ForgeDirection.NORTH); - BaseON.drawFromInside = true; - BaseON.addTube("CylinderNorth", -1.5F, -1.5F, 0F, 3, 3, 7, 0f, 1f, ForgeDirection.NORTH); - BaseON.addTube("CylinderNorth2", -1F, -1F, 0.5F, 2, 2, 5, 0f, 1f, ForgeDirection.NORTH); - BaseON.drawFromInside = false; - BaseON.addTube("SpyralNorth", -0.5F, -0.5F, 0.5F, 1, 1, 7, 0f, 1f, ForgeDirection.NORTH); - } -} diff --git a/ihl/enviroment/LightBulbRender.java b/ihl/enviroment/LightBulbRender.java deleted file mode 100644 index caa5f65..0000000 --- a/ihl/enviroment/LightBulbRender.java +++ /dev/null @@ -1,77 +0,0 @@ -package ihl.enviroment; -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 LightBulbRender extends TileEntitySpecialRenderer{ -private LightBulbModel model = new LightBulbModel(); -private ResourceLocation tex = new ResourceLocation(IHLModInfo.MODID+":textures/blocks/lightBulb.png"); -private final float scale=1F/16F; - - public LightBulbRender() {} - - - @Override - public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par8) - { - LightBulbTileEntity cte = (LightBulbTileEntity)tile; - int rotation = 0; - int rotationz = 0; - if(tile.getWorldObj() != null) - { - switch (cte.getFacing()) - { - case 0: - rotationz = 1; - break; - case 1: - rotationz = 3; - break; - case 2: - rotation = 2; - break; - case 5: - rotation = 3; - break; - case 3: - rotation = 0; - break; - case 4: - rotation = 1; - break; - default: - rotation = 0; - } - } - else - { - return; - } - model.BaseON.rotateAngleY=(float) (rotation*Math.PI/2); - model.BaseON.rotateAngleX=(float) (rotationz*Math.PI/2); - model.Base.rotateAngleY=(float) (rotation*Math.PI/2); - model.Base.rotateAngleX=(float) (rotationz*Math.PI/2); - GL11.glPushMatrix(); - GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F); - GL11.glScalef(1.0F, -1F, -1F); - bindTexture(tex); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glColor4f((cte.colour>>>16)/255f,((cte.colour>>>8)&255)/255f, (cte.colour&255)/255f,1f); - if(cte.getActive()) - { - GL11.glDisable(GL11.GL_LIGHTING); - model.BaseON.render(scale); - } - else - { - model.Base.render(scale); - } - GL11.glDisable(GL11.GL_BLEND); - GL11.glPopMatrix(); //end - - } -} \ No newline at end of file diff --git a/ihl/enviroment/LightBulbTileEntity.java b/ihl/enviroment/LightBulbTileEntity.java deleted file mode 100644 index 8695bd7..0000000 --- a/ihl/enviroment/LightBulbTileEntity.java +++ /dev/null @@ -1,273 +0,0 @@ -package ihl.enviroment; - -import java.util.List; -import java.util.Vector; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.util.ForgeDirection; -import ic2.api.energy.event.EnergyTileLoadEvent; -import ic2.api.energy.event.EnergyTileUnloadEvent; -import ic2.api.energy.tile.IEnergySink; -import ic2.api.network.INetworkDataProvider; -import ic2.api.network.INetworkTileEntityEventListener; -import ic2.api.tile.IWrenchable; -import ic2.core.IC2; -import ic2.core.ITickCallback; -import ihl.ClientProxy; -import ihl.IHLMod; -import ihl.IHLModInfo; -import ihl.model.RenderBlocksExt; -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 energy; - public boolean addedToEnergyNet = false; - private boolean loaded = false; - private int ticker; - public int colour = 0xffffff; - - @SideOnly(value = Side.CLIENT) - LightSource lightSource; - - @Override - public void readFromNBT(NBTTagCompound nbttagcompound) { - super.readFromNBT(nbttagcompound); - this.energy = nbttagcompound.getDouble("energy"); - this.facing = nbttagcompound.getShort("facing"); - this.colour = nbttagcompound.getInteger("colour"); - } - - @Override - public void writeToNBT(NBTTagCompound nbttagcompound) { - super.writeToNBT(nbttagcompound); - nbttagcompound.setDouble("energy", this.energy); - nbttagcompound.setShort("facing", this.facing); - nbttagcompound.setInteger("colour", this.colour); - } - - /** - * 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(); - } - } - - public void onLoaded() { - if (!this.worldObj.isRemote) { - IC2.network.get().updateTileEntityField(this, "colour"); - } - if (IC2.platform.isSimulating() && !this.addedToEnergyNet) { - MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); - this.addedToEnergyNet = true; - } - 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(); - } - - @Override - public final boolean canUpdate() { - return true; - } - - @Override - public void updateEntity() { - if (this.worldObj.isRemote) { - if(this.prevActive != active){ - updateLightState(); - this.prevActive = active; - } - } - if(!this.loaded){ - this.onLoaded(); - } - if (!this.worldObj.isRemote && ++this.ticker % 4 == 0) { - if (this.prevFacing != facing) { - this.setFacing(facing); - } - if (this.energy > 0) { - this.energy--; - this.setActive(true); - } else { - this.setActive(false); - } - } - } - - protected void updateLightState() { - if (IC2.platform.isSimulating()) { - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } else if (IC2.platform.isRendering()) { - if (this.getActive()) { - if(lightSource != null) - ((ClientProxy) IHLMod.proxy).getLightHandler().removeLightSource(lightSource); - int red = colour >>> 16; - int green = (colour >>> 8) & 255; - int blue = colour & 255; - int max = red; - if (max < green) - max = green; - if (max < blue) - max = blue; - max -= 255; - red -= max;// Normalize colours - blue -= max; - green -= max; - lightSource = this.createLightSource(red, green, blue); - ((ClientProxy) IHLMod.proxy).getLightHandler().addLightSource(lightSource); - } else if (lightSource != null) { - ((ClientProxy) IHLMod.proxy).getLightHandler().removeLightSource(lightSource); - lightSource = null; - } - } - } - - @SideOnly(value = Side.CLIENT) - protected LightSource createLightSource(int red, int green, int blue) { - return ((ClientProxy) IHLMod.proxy).getLightHandler().calculateLightSource(worldObj, xCoord, yCoord, zCoord, - 64, red, green, blue, null); - } - - @Override - public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) { - switch (direction) { - case UP: - return this.getFacing() == 0; - case DOWN: - return this.getFacing() == 1; - case SOUTH: - return this.getFacing() == 2; - case NORTH: - return this.getFacing() == 3; - case EAST: - return this.getFacing() == 4; - case WEST: - return this.getFacing() == 5; - default: - return false; - } - } - - @Override - public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { - return false; - } - - @Override - public short getFacing() { - 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"); - } - } - this.prevFacing = facing; - if (IC2.platform.isSimulating() && !this.addedToEnergyNet) { - MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); - this.addedToEnergyNet = true; - } - } - - @Override - public List getNetworkedFields() { - Vector ret = new Vector(2); - ret.add("active"); - ret.add("facing"); - ret.add("colour"); - return ret; - } - - @Override - public boolean wrenchCanRemove(EntityPlayer entityPlayer) { - return true; - } - - @Override - public float getWrenchDropRate() { - return 1; - } - - @Override - public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { - return IHLUtils.getThisModItemStack("lightBulb"); - } - - @Override - public double getDemandedEnergy() { - if (energy > 10d) { - return 0d; - } - return Integer.MAX_VALUE; - } - - @Override - public int getSinkTier() { - return 1; - } - - @Override - public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) { - this.energy += amount; - return 0.0D; - } - - public boolean getActive() { - return this.active; - } - - 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; - } -} diff --git a/ihl/enviroment/LightHandler.java b/ihl/enviroment/LightHandler.java deleted file mode 100644 index 31a921e..0000000 --- a/ihl/enviroment/LightHandler.java +++ /dev/null @@ -1,166 +0,0 @@ -package ihl.enviroment; - -import java.util.BitSet; -import java.util.HashSet; -import java.util.Set; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import ihl.IHLMod; -import ihl.utils.IHLMathUtils; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; - -@SideOnly(value = Side.CLIENT) -public class LightHandler { - - private int[][] directionMasks; - private int[][] vectors; - private int bits; - private int halfValue; - - private int lightBitsPerDimension = 10; - private int maxLightRadius = (1 << lightBitsPerDimension - 1) - 1; - private int bitmask = (1 << lightBitsPerDimension) - 1; - public final Set lightSources = new HashSet(); - - public LightHandler() { - this.directionMasks = IHLMod.explosionHandler.directionMasks; - this.vectors = IHLMod.explosionHandler.vectors; - this.bits = IHLMod.explosionHandler.bits; - this.halfValue = IHLMod.explosionHandler.halfValue; - } - - public int encodeXYZ(int x, int y, int z) { - return x + maxLightRadius << lightBitsPerDimension * 2 | y + maxLightRadius << lightBitsPerDimension - | z + maxLightRadius; - } - - public int[] decodeXYZ(int l) { - return new int[] { (l >>> lightBitsPerDimension * 2) - maxLightRadius, - ((l >>> lightBitsPerDimension) & bitmask) - maxLightRadius, (l & bitmask) - maxLightRadius }; - } - - public LightSource calculateLightSource(World world, int sourceX, int sourceY, int sourceZ, int power, int red, - int green, int blue, double[] ds) { - LightSource lightSource = new LightSource(sourceX, sourceY, sourceZ, red, green, blue, power); - int[] borders = { sourceX, sourceY, sourceZ, sourceX, sourceY, sourceZ }; - int[] evSource = { sourceX, sourceY, sourceZ }; - int[] lightSourceXYZ = { sourceX, sourceY, sourceZ }; - for (int i = 0; i < directionMasks.length; i++) { - int[] directionMask = directionMasks[i]; - this.litBlocksAndGetDescendants(world, evSource, lightSourceXYZ, lightSource.illuminatedBlocks, 0, power>>1, - directionMask, borders, ds); - } - lightSource.setBorders(borders[0], borders[1], borders[2], borders[3], borders[4], borders[5]); - return lightSource; - } - - private void litBlocksAndGetDescendants(World world, int[] evSource, int[] lightSource, BitSet illuminatedBlocksSet, - int ev, int power, int[] directionMask, int[] borders, double[] ds) { - power = this.getNewPower(world, ev, evSource, lightSource, power, directionMask, illuminatedBlocksSet, borders, - ds); - power--; - if (power > 1) { - if (vectors[ev].length == 0) { - int[] xyz = IHLMod.explosionHandler.decodeXYZ(ev); - int xb = xyz[0] >> bits - 1; - int yb = xyz[1] >> bits - 1; - int zb = xyz[2] >> bits - 1; - int hashb = xb << 2 | yb << 1 | zb; - xyz[0] -= xb * halfValue; - xyz[1] -= yb * halfValue; - xyz[2] -= zb * halfValue; - if (hashb == 0 || xb > 1 || yb > 1 || zb > 1) { - throw new ArithmeticException("End vectors shall be higher than half value"); - } - int ev2 = IHLMod.explosionHandler.encodeXYZ(xyz[0], xyz[1], xyz[2]); - int[] nextEVSource = { evSource[0] + xb * halfValue * directionMask[0], - evSource[1] + yb * halfValue * directionMask[1], - evSource[2] + zb * halfValue * directionMask[2] }; - litBlocksAndGetDescendants(world, nextEVSource, lightSource, illuminatedBlocksSet, ev2, power, - directionMask, borders, ds); - } else { - for (int d1 : this.vectors[ev]) { - litBlocksAndGetDescendants(world, evSource, lightSource, illuminatedBlocksSet, d1, power, - directionMask, borders, ds); - } - } - } - - } - - private int getNewPower(World world, int ev, int[] evSource, int[] lightSource, int power, int[] directionMask, - BitSet illuminatedBlocksSet, int[] borders, double[] ds) { - int power1 = power; - int[] xyz = IHLMod.explosionHandler.decodeXYZ(ev); - int absX = xyz[0] * directionMask[0] + evSource[0]; - int absY = xyz[1] * directionMask[1] + evSource[1]; - int absZ = xyz[2] * directionMask[2] + evSource[2]; - if (absX < borders[0]) { - borders[0] = absX; - } else if (absY < borders[1]) { - borders[1] = absY; - } else if (absZ < borders[2]) { - borders[2] = absZ; - } else if (absX > borders[3]) { - borders[3] = absX; - } else if (absY > borders[4]) { - borders[4] = absY; - } else if (absZ > borders[5]) { - borders[5] = absZ; - } - power1 = power1 * (255 - world.getBlockLightOpacity(absX, absY, absZ)) / 255; - int lightBitAddress = this.encodeXYZ(absX - lightSource[0], absY - lightSource[1], absZ - lightSource[2]); - illuminatedBlocksSet.set(lightBitAddress); - if (ds != null) { - float dx = (float) (absX - ds[0]); - float dy = (float) (absY - ds[1]); - float dz = (float) (absZ - ds[2]); - float sqd = dx * dx + dy * dy + dz * dz; - float d = IHLMathUtils.sqrt(sqd); - float dx1 = (float) (ds[3] * d); - float dy1 = (float) (ds[4] * d); - float dz1 = (float) (ds[5] * d); - float ddx = dx - dx1; - float ddy = dy - dy1; - float ddz = dz - dz1; - float sqr = ddx * ddx + ddy * ddy + ddz * ddz; - float sqrmax = (float) ds[6] * sqd + 4f; - if (sqr > sqrmax) { - return 0; - } - } - return power1; - } - - public void addLightSource(LightSource lightSource) { -/* IHLMod.log.info("Added light source at area from "+lightSource.fromX+";"+lightSource.fromY+";"+lightSource.fromZ+ - " to "+lightSource.toX+";"+lightSource.toY+";"+lightSource.toZ);*/ - this.lightSources.add(lightSource); - Minecraft.getMinecraft().theWorld.markBlockRangeForRenderUpdate( - lightSource.fromX, - lightSource.fromY, - lightSource.fromZ, - lightSource.toX, - lightSource.toY, - lightSource.toZ); - } - - public void removeLightSource(LightSource lightSource) { - if(!this.lightSources.remove(lightSource)){ - throw new IllegalArgumentException("Requested light source is not presented."); - } -/* IHLMod.log.info("Removing light source at area from "+lightSource.fromX+";"+lightSource.fromY+";"+lightSource.fromZ+ - " to "+lightSource.toX+";"+lightSource.toY+";"+lightSource.toZ);*/ - Minecraft.getMinecraft().theWorld.markBlockRangeForRenderUpdate( - lightSource.fromX, - lightSource.fromY, - lightSource.fromZ, - lightSource.toX, - lightSource.toY, - lightSource.toZ); - } -} diff --git a/ihl/enviroment/LightSource.java b/ihl/enviroment/LightSource.java deleted file mode 100644 index 55f7c6c..0000000 --- a/ihl/enviroment/LightSource.java +++ /dev/null @@ -1,183 +0,0 @@ -package ihl.enviroment; - -import java.util.BitSet; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import ihl.ClientProxy; -import ihl.IHLMod; -import ihl.utils.IHLMathUtils; -import net.minecraft.world.World; - -@SideOnly(value = Side.CLIENT) -public class LightSource { - private final int centerX; - private final int centerY; - private final int centerZ; - public int fromX; - public int fromY; - public int fromZ; - public int toX; - public int toY; - public int toZ; - private final int red; - private final int green; - private final int blue; - private final int power; - public final BitSet illuminatedBlocks = new BitSet(); - - public LightSource(int centerX1, int centerY1, int centerZ1, int red1, int green1, int blue1, int power1) { - centerX = centerX1; - centerY = centerY1; - centerZ = centerZ1; - red = red1; - green = green1; - blue = blue1; - power = power1; - } - - public void setBorders(int fromX1, int fromY1, int fromZ1, int toX1, int toY1, int toZ1) { - fromX = fromX1; - fromY = fromY1; - fromZ = fromZ1; - toX = toX1; - toY = toY1; - toZ = toZ1; - } - - public boolean isBlockIlluminated(int x, int y, int z) { - if (x < fromX || x > toX || y < fromY || y > toY || z < fromZ || z > toZ) { - return false; - } else { - int rx = x - centerX; - int ry = y - centerY; - int rz = z - centerZ; - int l = ((ClientProxy) IHLMod.proxy).getLightHandler().encodeXYZ(rx, ry, rz); - return illuminatedBlocks.get(l); - } - } - - public int[] getLightValue(int x, int y, int z, int[] normal) { - int dx = centerX - x; - int dy = centerY - y; - int dz = centerZ - z; - int d = dx * dx + dy * dy + dz * dz; - if (d == 0) { - return new int[] { 0xf0, this.red, this.blue, this.green }; - } - if (normal[0] + normal[1] + normal[2] == 0) { - dx = dx < 0 ? -dx : dx; - dy = dy < 0 ? -dy : dy; - dz = dz < 0 ? -dz : dz; - } else { - dx = normal[0] * dx; - dy = normal[1] * dy; - dz = normal[2] * dz; - dx = dx > 0 ? dx : 0; - dy = dy > 0 ? dy : 0; - dz = dz > 0 ? dz : 0; - } - int r = power * (dx + dy + dz) / d; - r = r<0?0:r; - int brightness = r > 15 ? 15 : r; - return new int[] { brightness << 4, this.red*r, this.green*r, this.blue*r}; - } - - @Override - public boolean equals(Object o) { - if (o instanceof LightSource) { - LightSource otherLS = (LightSource) o; - return this.centerX == otherLS.centerX && this.centerY == otherLS.centerY && this.centerZ == otherLS.centerZ - && this.fromX == otherLS.fromX && this.fromY == otherLS.fromY && this.fromZ == otherLS.fromZ - && this.toX == otherLS.toX && this.toY == otherLS.toY && this.toZ == otherLS.toZ; - } - return false; - } - - public void provideLight(World world, int x, int y, int z) { - int dx = x-centerX;//100 10 20 - int dy = y-centerY; - int dz = z-centerZ; - int sqd = dx*dx+dy*dy+dz*dz; - float d = IHLMathUtils.sqrt(sqd); - float dx1 = dx/d; - float dy1 = dy/d; - float dz1 = dz/d; - float x1 = x+0.5f; - float y1 = y+0.5f; - float z1 = z+0.5f; - for(int i=0;i<64;i++){ - x1+=dx1; - y1+=dy1; - z1+=dz1; - int absX = (int)x1; - int absY = (int)y1; - int absZ = (int)z1; - int ddx = absX-centerX; - int ddy = absY-centerY; - int ddz = absZ-centerZ; - this.illuminatedBlocks.set(((ClientProxy) IHLMod.proxy).getLightHandler().encodeXYZ(ddx, ddy, ddz)); - if (absX < fromX) { - fromX = absX; - } else if (absY < fromY) { - fromY = absY; - } else if (absZ < fromZ) { - fromZ = absZ; - } else if (absX > toX) { - toX = absX; - } else if (absY > toY) { - toY = absY; - } else if (absZ > toZ) { - toZ = absZ; - } - if(world.getBlockLightOpacity(absX, absY, absZ)>192) { - break; - } - } - } - - public void castShadow(World world, int x, int y, int z) { - int dx = x-centerX; - int dy = y-centerY; - int dz = z-centerZ; - int sqd = dx*dx+dy*dy+dz*dz; - float d = IHLMathUtils.sqrt(sqd); - float dx1 = dx/d; - float dy1 = dy/d; - float dz1 = dz/d; - float x1 = x+0.5f; - float y1 = y+0.5f; - float z1 = z+0.5f; - x1+=dx1; - y1+=dy1; - z1+=dz1; - for(int i=0;i<64;i++){ - x1+=dx1; - y1+=dy1; - z1+=dz1; - int absX = (int)x1; - int absY = (int)y1; - int absZ = (int)z1; - int ddx = absX-centerX; - int ddy = absY-centerY; - int ddz = absZ-centerZ; - this.illuminatedBlocks.clear(((ClientProxy) IHLMod.proxy).getLightHandler().encodeXYZ(ddx, ddy, ddz)); - if (absX < fromX) { - fromX = absX; - } else if (absY < fromY) { - fromY = absY; - } else if (absZ < fromZ) { - fromZ = absZ; - } else if (absX > toX) { - toX = absX; - } else if (absY > toY) { - toY = absY; - } else if (absZ > toZ) { - toZ = absZ; - } - if(world.getBlockLightOpacity(absX, absY, absZ)>192) { - break; - } - } - } -} diff --git a/ihl/enviroment/SpotlightBlock.java b/ihl/enviroment/SpotlightBlock.java deleted file mode 100644 index 02cafd1..0000000 --- a/ihl/enviroment/SpotlightBlock.java +++ /dev/null @@ -1,147 +0,0 @@ -package ihl.enviroment; - -import ic2.core.IC2; -import ihl.IHLCreativeTab; -import ihl.items_blocks.IHLItemBlock; - -import java.util.List; -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.block.ITileEntityProvider; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemDye; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class SpotlightBlock extends Block implements ITileEntityProvider -{ - - public SpotlightBlock(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"); - } - - @Override - public boolean hasTileEntity(int metadata) - { - return true; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs tab, List itemlist) { - for (int colour : ItemDye.field_150922_c) { - ItemStack stack = new ItemStack(item); - stack.stackTagCompound = new NBTTagCompound(); - stack.stackTagCompound.setInteger("colour", colour); - itemlist.add(stack); - } - } - - - - /** - * Returns the quantity of items to drop on block destruction. - */ - @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 boolean isOpaqueCube() - { - return false; - } - - @Override - public boolean isNormalCube() - { - return false; - } - - @Override - public TileEntity createNewTileEntity(World arg0, int arg1) - { - return new SpotlightTileEntity(); - } - - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) - { - TileEntity t = world.getTileEntity(x, y, z); - if(IC2.platform.isSimulating() && t instanceof SpotlightTileEntity) - { - SpotlightTileEntity te = (SpotlightTileEntity)t; - te.setDirectionVector(player); - if(stack.stackTagCompound!=null) - te.colour=stack.stackTagCompound.getInteger("colour"); - } - } - - @Override - public void onBlockPreDestroy(World world, int x, int y, int z, int meta) { - if (world.isRemote) { - TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof LightBulbTileEntity) { - LightBulbTileEntity ate = (LightBulbTileEntity) te; - ate.invalidate(); - } - } - super.onBlockPreDestroy(world, x, y, z, meta); - } - - @Override - public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int i,float pos_x,float pos_y,float pos_z) - { - TileEntity te = world.getTileEntity(x,y,z); - if(IC2.platform.isSimulating() && te instanceof SpotlightTileEntity) - { - ((SpotlightTileEntity)te).setDirectionVector(player); - return true; - } - return false; - } - - public int getLightValue(IBlockAccess world, int x, int y, int z) { - TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof LightBulbTileEntity && ((LightBulbTileEntity)te).getActive()){ - return 15; - } - return 0; - } -} \ No newline at end of file diff --git a/ihl/enviroment/SpotlightModel.java b/ihl/enviroment/SpotlightModel.java deleted file mode 100644 index 057bf94..0000000 --- a/ihl/enviroment/SpotlightModel.java +++ /dev/null @@ -1,71 +0,0 @@ -package ihl.enviroment; - -import ihl.model.IHLModelRenderer; -import net.minecraft.client.model.ModelBase; - - -public class SpotlightModel extends ModelBase -{ - //fields - IHLModelRenderer Base; - IHLModelRenderer RotatingPart1; - IHLModelRenderer RotatingPart2; - IHLModelRenderer RotatingPart3Halo; - - public SpotlightModel() - { - textureWidth = 64; - textureHeight = 32; - setTextureOffset("Base.Shape1", 0, 0); - setTextureOffset("RotatingPart1.Shape3", 0, 0); - setTextureOffset("RotatingPart1.Shape2", 0, 0); - setTextureOffset("RotatingPart1.Shape4", 0, 0); - setTextureOffset("RotatingPart2.Shape5", 0, 15); - setTextureOffset("RotatingPart2.Shape6", 13, 14); - setTextureOffset("RotatingPart2.Shape7", 7, 15); - setTextureOffset("RotatingPart2.Shape8", 14, 8); - setTextureOffset("RotatingPart2.Shape9", 6, 8); - setTextureOffset("RotatingPart2.Shape10", 0, 23); - setTextureOffset("RotatingPart2.Shape11", 0, 0); - setTextureOffset("RotatingPart2.Shape12", 0, 0); - setTextureOffset("RotatingPart3Halo.Shape13", 32, 0); - - Base = new IHLModelRenderer(this, "Base"); - Base.setRotationPoint(0F, 16F, 0F); - setRotation(Base, 0F, 0F, 0F); - Base.mirror = false; - Base.addBox("Shape1", -7F, -7F, 7F, 14, 14, 1); - RotatingPart1 = new IHLModelRenderer(this, "RotatingPart1"); - RotatingPart1.setRotationPoint(0F, 16F, 0F); - setRotation(RotatingPart1, 0F, 0F, 0F); - RotatingPart1.mirror = false; - RotatingPart1.addBox("Shape3", 5F, -1F, -1F, 1, 2, 8); - RotatingPart1.addBox("Shape2", -6F, -1F, -1F, 1, 2, 8); - RotatingPart1.addBox("Shape4", -5F, -1F, 6F, 10, 2, 1); - RotatingPart2 = new IHLModelRenderer(this, "RotatingPart2"); - RotatingPart2.setRotationPoint(0F, 16F, 0F); - setRotation(RotatingPart2, 0F, 0F, 0F); - RotatingPart2.mirror = false; - RotatingPart2.addBox("Shape5", -4F, -4F, -6F, 7, 1, 7); - RotatingPart2.addBox("Shape6", -4F, -4F, 1F, 8, 8, 1); - RotatingPart2.addBox("Shape7", -3F, 3F, -6F, 7, 1, 7); - RotatingPart2.addBox("Shape8", 3F, -4F, -6F, 1, 7, 7); - RotatingPart2.addBox("Shape9", -4F, -3F, -6F, 1, 7, 7); - RotatingPart2.addBox("Shape10", -3F, -3F, -5F, 6, 6, 1); - RotatingPart2.addBox("Shape11", 4F, -1F, -1F, 1, 2, 2); - RotatingPart2.addBox("Shape12", -5F, -1F, -1F, 1, 2, 2); - RotatingPart3Halo = new IHLModelRenderer(this, "RotatingPart3Halo"); - RotatingPart3Halo.setRotationPoint(0F, 16F, 0F); - setRotation(RotatingPart3Halo, 0F, 0F, 0F); - RotatingPart3Halo.mirror = false; - RotatingPart3Halo.addBox("Shape13", -8F, -8F, -6.1F, 16, 16, 0); - } - - private void setRotation(IHLModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - -} diff --git a/ihl/enviroment/SpotlightRender.java b/ihl/enviroment/SpotlightRender.java deleted file mode 100644 index 8f48e1a..0000000 --- a/ihl/enviroment/SpotlightRender.java +++ /dev/null @@ -1,110 +0,0 @@ -package ihl.enviroment; -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; -import ihl.utils.IHLRenderUtils; - -public class SpotlightRender extends TileEntitySpecialRenderer{ -private SpotlightModel model = new SpotlightModel(); -private ResourceLocation tex = new ResourceLocation(IHLModInfo.MODID+":textures/blocks/spotlight.png"); -private final float scale=1F/16F; - - public SpotlightRender() {} - - - @Override - public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par8) - { - SpotlightTileEntity cte = (SpotlightTileEntity)tile; - int rotation = 0; - int rotationz = 0; - if(tile.getWorldObj() != null) - { - switch (cte.getFacing()) - { - case 0: - rotationz = 1; - break; - case 1: - rotationz = 3; - break; - case 2: - rotation = 2; - break; - case 5: - rotation = 3; - break; - case 3: - rotation = 0; - break; - case 4: - rotation = 1; - break; - default: - rotation = 0; - } - } - else - { - return; - } - model.Base.rotateAngleY=(float) (rotation*Math.PI/2); - model.Base.rotateAngleX=(float) (rotationz*Math.PI/2); - model.RotatingPart1.rotateAngleY=(float) (rotation*Math.PI/2); - model.RotatingPart1.rotateAngleX=(float) (rotationz*Math.PI/2); - model.RotatingPart2.rotateAngleY=(float) (rotation*Math.PI/2); - model.RotatingPart2.rotateAngleX=(float) (rotationz*Math.PI/2); - model.RotatingPart3Halo.rotateAngleY=(float) (rotation*Math.PI/2); - model.RotatingPart3Halo.rotateAngleX=(float) (rotationz*Math.PI/2); - model.RotatingPart2.rotateAngleX+=cte.rotationPitch; - model.RotatingPart3Halo.rotateAngleX+=cte.rotationPitch; - GL11.glPushMatrix(); - GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F); - GL11.glScalef(1.0F, -1F, -1F); - bindTexture(tex); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glColor4f(1f, 1f, 1f, 1f); - model.Base.render(scale); - GL11.glTranslatef(model.RotatingPart1.rotationPointX*scale, model.RotatingPart1.rotationPointY*scale, model.RotatingPart1.rotationPointZ*scale); - GL11.glColor4f((cte.colour>>>16)/255f,((cte.colour>>>8)&255)/255f, (cte.colour&255)/255f,1f); - switch(cte.getFacing()) - { - case 0: - GL11.glRotatef(cte.rotationYaw * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); - break; - case 1: - GL11.glRotatef(cte.rotationYaw * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); - break; - case 2: - GL11.glRotatef(cte.rotationYaw * (180F / (float)Math.PI), 0.0F, 0.0F, 1.0F); - break; - case 3: - GL11.glRotatef(cte.rotationYaw * (180F / (float)Math.PI), 0.0F, 0.0F, 1.0F); - break; - case 4: - GL11.glRotatef(cte.rotationYaw * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); - break; - case 5: - GL11.glRotatef(cte.rotationYaw * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); - break; - } - GL11.glTranslatef(-model.RotatingPart1.rotationPointX*scale, -model.RotatingPart1.rotationPointY*scale, -model.RotatingPart1.rotationPointZ*scale); - model.RotatingPart1.render(scale); - model.RotatingPart2.render(scale); - if(cte.getActive()) - { - IHLRenderUtils.instance.enableAmbientLighting(); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); - model.RotatingPart3Halo.render(scale); - IHLRenderUtils.instance.disableAmbientLighting(); - } - - GL11.glDisable(GL11.GL_BLEND); - GL11.glPopMatrix(); //end - - } -} \ No newline at end of file diff --git a/ihl/enviroment/SpotlightTileEntity.java b/ihl/enviroment/SpotlightTileEntity.java deleted file mode 100644 index d8e55df..0000000 --- a/ihl/enviroment/SpotlightTileEntity.java +++ /dev/null @@ -1,212 +0,0 @@ -package ihl.enviroment; - -import ic2.api.network.INetworkTileEntityEventListener; -import ic2.core.IC2; -import ihl.ClientProxy; -import ihl.IHLMod; -import ihl.IHLModInfo; -import ihl.handpump.XYZ; -import ihl.utils.IHLUtils; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.Vec3; -import net.minecraftforge.common.util.ForgeDirection; - -public class SpotlightTileEntity extends LightBulbTileEntity implements INetworkTileEntityEventListener { - public float directionX = 0f; - public float directionY = -1f; - public float directionZ = 0f; - public float prevDirectionX = 0f; - public float prevDirectionY = -1f; - public float prevDirectionZ = 0f; - public float rotationPitch = 0f; - public float rotationYaw = 0f; - public float prevRotationPitch = 0f; - public float prevRotationYaw = 0f; - boolean needLightTargetUpdate = false; - - @Override - public void readFromNBT(NBTTagCompound nbttagcompound) { - super.readFromNBT(nbttagcompound); - directionX = nbttagcompound.getFloat("directionX"); - directionY = nbttagcompound.getFloat("directionY"); - directionZ = nbttagcompound.getFloat("directionZ"); - this.rotationPitch = this.getVectorPitchAngle(directionX,directionY,directionZ); - this.rotationYaw = this.getVectorYawAngle(directionX,directionY,directionZ); - needLightTargetUpdate = true; - } - - @Override - public void writeToNBT(NBTTagCompound nbttagcompound) { - super.writeToNBT(nbttagcompound); - nbttagcompound.setDouble("directionX", directionX); - nbttagcompound.setDouble("directionY", directionY); - nbttagcompound.setDouble("directionZ", directionZ); - } - - @Override - public List getNetworkedFields() { - List list = super.getNetworkedFields(); - list.add("needLightTargetUpdate"); - list.add("rotationPitch"); - list.add("rotationYaw"); - list.add("directionX"); - list.add("directionY"); - list.add("directionZ"); - return list; - } - - @Override - public void updateEntity() { - super.updateEntity(); - if (this.worldObj.isRemote) { - if(this.directionX!=this.prevDirectionX || - this.directionY!=this.prevDirectionY || - this.directionZ!=this.prevDirectionZ){ - updateLightState(); - this.prevDirectionX=this.directionX; - this.prevDirectionY=this.directionY; - this.prevDirectionZ=this.directionZ; - } - } else if (needLightTargetUpdate) { - this.updateLightState(); - needLightTargetUpdate = false; - } - if (!this.worldObj.isRemote) { - if (this.prevRotationPitch != this.rotationPitch) { - IC2.network.get().updateTileEntityField(this, "rotationPitch"); - this.prevRotationPitch = this.rotationPitch; - } - if (this.prevRotationYaw != this.rotationYaw) { - IC2.network.get().updateTileEntityField(this, "rotationYaw"); - this.prevRotationYaw = this.rotationYaw; - } - } - } - - @Override - public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { - return IHLUtils.getThisModItemStack("spotlight"); - } - - public void setDirectionVector(EntityLivingBase player) { - ForgeDirection dir = ForgeDirection.getOrientation(this.getFacing()); - Vec3 lookVec = player.getLookVec(); - if (lookVec.xCoord * dir.offsetX + lookVec.yCoord * dir.offsetY + lookVec.zCoord * dir.offsetZ < 0) { - double x = player.posX - this.xCoord - 0.5D; - double y = player.posY + player.getEyeHeight() - this.yCoord - 0.5D; - double z = player.posZ - this.zCoord - 0.5D; - double d = Math.sqrt(x * x + y * y + z * z); - directionX = (float) (x / d); - directionY = (float) (y / d); - directionZ = (float) (z / d); - } else { - Vec3 plook = player.getLookVec(); - directionX = (float) (plook.xCoord); - directionY = (float) (plook.yCoord); - directionZ = (float) (plook.zCoord); - } - IC2.network.get().updateTileEntityField(this, "directionX"); - IC2.network.get().updateTileEntityField(this, "directionY"); - IC2.network.get().updateTileEntityField(this, "directionZ"); - this.rotationPitch = this.getVectorPitchAngle(directionX,directionY,directionZ); - this.rotationYaw = this.getVectorYawAngle(directionX,directionY,directionZ); - this.needLightTargetUpdate = true; - IC2.network.get().initiateTileEntityEvent(this, 0, true); - } - - private float getVectorPitchAngle(float x, float y, float z) { - switch (this.getFacing()) { - case 0: - return (float) -(Math.abs(Math.asin(z)) + Math.abs(Math.asin(x))); - case 1: - return (float) (Math.abs(Math.asin(z)) + Math.abs(Math.asin(x))); - case 2: - return (float) (Math.abs(Math.asin(y)) + Math.abs(Math.asin(x))); - case 3: - return (float) (Math.abs(Math.asin(y)) + Math.abs(Math.asin(x))); - case 4: - return (float) (Math.abs(Math.asin(y)) + Math.abs(Math.asin(z))); - case 5: - return (float) (Math.abs(Math.asin(y)) + Math.abs(Math.asin(z))); - default: - return (float) (-Math.asin(y)); - } - } - - @SideOnly(value = Side.CLIENT) - @Override - protected LightSource createLightSource(int red, int green, int blue) { - return ((ClientProxy) IHLMod.proxy).getLightHandler().calculateLightSource(worldObj, xCoord, yCoord, zCoord, - 256, red, green, blue, new double[] { this.xCoord + 0.5f, this.yCoord + 0.5f, this.zCoord + 0.5f, - this.directionX, this.directionY, this.directionZ, 0.8d }); - } - - private float getVectorYawAngle(float x, float y, float z) { - switch (this.getFacing()) { - case 0: - if (z >= 0) { - return (float) (Math.acos(x / Math.sqrt(x * x + z * z)) - Math.PI / 2); - } else { - return (float) (-Math.acos(x / Math.sqrt(x * x + z * z)) - Math.PI / 2); - } - case 1: - if (z >= 0) { - return (float) (Math.acos(x / Math.sqrt(x * x + z * z)) - Math.PI / 2); - } else { - return (float) (-Math.acos(x / Math.sqrt(x * x + z * z)) - Math.PI / 2); - } - case 2: - if (y >= 0) { - return (float) (-Math.acos(x / Math.sqrt(x * x + y * y)) - Math.PI / 2); - } else { - return (float) (Math.acos(x / Math.sqrt(x * x + y * y)) - Math.PI / 2); - } - case 3: - if (y >= 0) { - return (float) (-Math.acos(x / Math.sqrt(x * x + y * y)) - Math.PI / 2); - } else { - return (float) (Math.acos(x / Math.sqrt(x * x + y * y)) - Math.PI / 2); - } - case 4: - if (y >= 0) { - return (float) (-Math.acos(z / Math.sqrt(z * z + y * y)) - Math.PI / 2); - } else { - return (float) (Math.acos(z / Math.sqrt(z * z + y * y)) - Math.PI / 2); - } - case 5: - if (y >= 0) { - return (float) (-Math.acos(z / Math.sqrt(z * z + y * y)) - Math.PI / 2); - } else { - return (float) (Math.acos(z / Math.sqrt(z * z + y * y)) - Math.PI / 2); - } - default: - return 0f; - } - } - - @Override - public void onNetworkEvent(int event) { - this.worldObj.playSound(xCoord + 0.5d, yCoord + 0.5d, zCoord + 0.5d, IHLModInfo.MODID + ":spotlightRotating", - 10F, 1f, true); - } -} - -/* - * -Y DOWN(0, -1, 0) 0 /* +Y UP(0, 1, 0) 1 /* -Z NORTH(0, 0, -1) 2 /* +Z - * SOUTH(0, 0, 1) 3 /* -X WEST(-1, 0, 0), 4 /* +X EAST(1, 0, 0), 5 - * //VALID_DIRECTIONS = {DOWN, UP, NORTH, SOUTH, WEST, EAST}; - */ diff --git a/ihl/model/RenderBlocksExt.java b/ihl/model/RenderBlocksExt.java deleted file mode 100644 index 5355b13..0000000 --- a/ihl/model/RenderBlocksExt.java +++ /dev/null @@ -1,324 +0,0 @@ -package ihl.model; - -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.init.Blocks; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.util.ForgeDirection; - -import java.util.HashSet; -import java.util.Set; - -import cpw.mods.fml.relauncher.SideOnly; -import cpw.mods.fml.relauncher.Side; -import ihl.ClientProxy; -import ihl.IHLMod; -import ihl.enviroment.LightSource; - -@SideOnly(value = Side.CLIENT) -public class RenderBlocksExt extends RenderBlocks { - - public static RenderBlocksExt instance; - final static int[][] NULL_NORMAL = new int[][] { new int[] { 0, 0, 0 }, - - new int[] { 1, 0, 0 }, // Top left - new int[] { 0, 0, 1 }, new int[] { 1, 0, 1 }, - - new int[] { -1, 0, 0 }, // Top Right - new int[] { 0, 0, 1 }, new int[] { -1, 0, 1 }, - - new int[] { 1, 0, 0 }, // Bottom Left - new int[] { 0, 0, -1 }, new int[] { 1, 0, -1 }, - - new int[] { -1, 0, 0 }, // Bottom Right - new int[] { 0, 0, -1 }, new int[] { -1, 0, -1 }, - - }; - private final static int[][] YNEG = new int[][] { new int[] { 0, -1, 0 }, // 0 - - new int[] { -1, 0, 0 }, // Top left - new int[] { 0, 0, 1 }, new int[] { -1, 0, 1 }, - - new int[] { 1, 0, 0 }, // Top Right - new int[] { 0, 0, 1 }, new int[] { 1, 0, 1 }, - - new int[] { -1, 0, 0 }, // Bottom Left - new int[] { 0, 0, -1 }, new int[] { -1, 0, -1 }, - - new int[] { 1, 0, 0 }, // Bottom Right - new int[] { 0, 0, -1 }, new int[] { 1, 0, -1 }, }; - private final static int[][] YPOS = new int[][] { new int[] { 0, 1, 0 }, - - new int[] { 1, 0, 0 }, // Top left - new int[] { 0, 0, 1 }, new int[] { 1, 0, 1 }, - - new int[] { -1, 0, 0 }, // Top Right - new int[] { 0, 0, 1 }, new int[] { -1, 0, 1 }, - - new int[] { 1, 0, 0 }, // Bottom Left - new int[] { 0, 0, -1 }, new int[] { 1, 0, -1 }, - - new int[] { -1, 0, 0 }, // Bottom Right - new int[] { 0, 0, -1 }, new int[] { -1, 0, -1 }, - - }; - private final static int[][] XNEG = new int[][] { new int[] { -1, 0, 0 }, // 4 - - new int[] { 0, 1, 0 }, // Top left - new int[] { 0, 0, 1 }, new int[] { 0, 1, 1 }, - - new int[] { 0, -1, 0 }, // Top Right - new int[] { 0, 0, 1 }, new int[] { 0, -1, 1 }, - - new int[] { 0, 1, 0 }, // Bottom Left - new int[] { 0, 0, -1 }, new int[] { 0, 1, -1 }, - - new int[] { 0, -1, 0 }, // Bottom Right - new int[] { 0, 0, -1 }, new int[] { 0, -1, -1 }, }; - private final static int[][] XPOS = new int[][] { new int[] { 1, 0, 0 }, // 5 - - new int[] { 0, -1, 0 }, // Top left - new int[] { 0, 0, 1 }, new int[] { 0, -1, 1 }, - - new int[] { 0, 1, 0 }, // Top Right - new int[] { 0, 0, 1 }, new int[] { 0, 1, 1 }, - - new int[] { 0, -1, 0 }, // Bottom Left - new int[] { 0, 0, -1 }, new int[] { 0, -1, -1 }, - - new int[] { 0, 1, 0 }, // Bottom Right - new int[] { 0, 0, -1 }, new int[] { 0, 1, -1 }, }; - private final static int[][] ZNEG = new int[][] { new int[] { 0, 0, -1 }, // 2 - - new int[] { -1, 0, 0 }, // Top left - new int[] { 0, 1, 0 }, new int[] { -1, 1, 0 }, - - new int[] { -1, 0, 0 }, // Top Right - new int[] { 0, -1, 0 }, new int[] { -1, -1, 0 }, - - new int[] { 1, 0, 0 }, // Bottom Left - new int[] { 0, 1, 0 }, new int[] { 1, 1, 0 }, - - new int[] { 1, 0, 0 }, // Bottom Right - new int[] { 0, -1, 0 }, new int[] { 1, -1, 0 }, - - }; - private final static int[][] ZPOS = new int[][] { new int[] { 0, 0, 1 }, // 3 - - new int[] { -1, 0, 0 }, // Top left - new int[] { 0, 1, 0 }, new int[] { -1, 1, 0 }, - - new int[] { 1, 0, 0 }, // Top Right - new int[] { 0, 1, 0 }, new int[] { 1, 1, 0 }, - - new int[] { -1, 0, 0 }, // Bottom Left - new int[] { 0, -1, 0 }, new int[] { -1, -1, 0 }, - - new int[] { 1, 0, 0 }, // Bottom Right - new int[] { 0, -1, 0 }, new int[] { 1, -1, 0 }, }; - private final static int BRIGHT = 0xFF00F7; - final static int MASK = 0xFF0003; - - public RenderBlocksExt(IBlockAccess blockAccess) { - super(blockAccess); - instance = this; - } - - private void transformColour(Block block, int x, int y, int z, int[][] normal) { - int brightnessBase = block.getMixedBrightnessForBlock(this.blockAccess, x + normal[0][0], y + normal[0][1], - z + normal[0][2]); - int brightnessBase1 = brightnessBase; - int l = block.colorMultiplier(this.blockAccess, x, y, z); - float redF = (float) (l >> 16 & 255) / 255f; - float greenF = (float) (l >> 8 & 255) / 255f; - float blueF = (float) (l & 255) / 255f; - int baseColourValue = 255; - int[] baseColour = new int[] { baseColourValue, baseColourValue, baseColourValue }; - int[] topLeft = new int[] { baseColourValue, baseColourValue, baseColourValue }; - int[] topRight = new int[] { baseColourValue, baseColourValue, baseColourValue }; - int[] bottomLeft = new int[] { baseColourValue, baseColourValue, baseColourValue }; - int[] bottomRight = new int[] { baseColourValue, baseColourValue, baseColourValue }; - int brightnessTopLeft1 = this.brightnessTopLeft; - int brightnessTopRight1 = this.brightnessTopRight; - int brightnessBottomLeft1 = this.brightnessBottomLeft; - int brightnessBottomRight1 = this.brightnessBottomRight; - boolean lightAffected = false; - for (LightSource lightSource : ((ClientProxy) IHLMod.proxy).getLightHandler().lightSources) { - if (lightSource.isBlockIlluminated(x, y, z)) { - lightAffected = true; - int[] lightValue = lightSource.getLightValue(x, y, z, normal[0]); - if ((brightnessBase & 240) < lightValue[0]) { - int colourFactor = lightValue[0] - (brightnessBase & 240); - if ((brightnessBase1 & 240) < lightValue[0]) { - brightnessBase1 &= MASK; - brightnessBase1 |= lightValue[0]; - } - baseColour[0] += lightValue[1] * colourFactor / 255; - baseColour[1] += lightValue[2] * colourFactor / 255; - baseColour[2] += lightValue[3] * colourFactor / 255; - } - if (this.enableAO) { - if (lightSource.isBlockIlluminated(x + normal[1][0], y + normal[1][1], z + normal[1][2]) - && lightSource.isBlockIlluminated(x + normal[2][0], y + normal[2][1], z + normal[2][2]) - && lightSource.isBlockIlluminated(x + normal[3][0], y + normal[3][1], z + normal[3][2])) { - lightValue = lightSource.getLightValue(x + normal[3][0], y + normal[3][1], z + normal[3][2], - normal[0]); - if ((this.brightnessTopLeft & 240) < lightValue[0]) { - int colourFactor = lightValue[0] - (this.brightnessTopLeft & 240); - if ((brightnessTopLeft1 & 240) < lightValue[0]) { - brightnessTopLeft1 &= MASK; - brightnessTopLeft1 |= lightValue[0]; - } - topLeft[0] += lightValue[1] * colourFactor / 255; - topLeft[1] += lightValue[2] * colourFactor / 255; - topLeft[2] += lightValue[3] * colourFactor / 255; - } - } - if (lightSource.isBlockIlluminated(x + normal[4][0], y + normal[4][1], z + normal[4][2]) - && lightSource.isBlockIlluminated(x + normal[5][0], y + normal[5][1], z + normal[5][2]) - && lightSource.isBlockIlluminated(x + normal[6][0], y + normal[6][1], z + normal[6][2])) { - lightValue = lightSource.getLightValue(x + normal[6][0], y + normal[6][1], z + normal[6][2], - normal[0]); - if ((this.brightnessTopRight & 240) < lightValue[0]) { - int colourFactor = lightValue[0] - (this.brightnessTopRight & 240); - if ((brightnessTopRight1 & 240) < lightValue[0]) { - brightnessTopRight1 &= MASK; - brightnessTopRight1 |= lightValue[0]; - } - topRight[0] += lightValue[1] * colourFactor / 255; - topRight[1] += lightValue[2] * colourFactor / 255; - topRight[2] += lightValue[3] * colourFactor / 255; - } - } - if (lightSource.isBlockIlluminated(x + normal[7][0], y + normal[7][1], z + normal[7][2]) - && lightSource.isBlockIlluminated(x + normal[8][0], y + normal[8][1], z + normal[8][2]) - && lightSource.isBlockIlluminated(x + normal[9][0], y + normal[9][1], z + normal[9][2])) { - lightValue = lightSource.getLightValue(x + normal[9][0], y + normal[9][1], z + normal[9][2], - normal[0]); - if ((this.brightnessBottomLeft & 240) < lightValue[0]) { - int colourFactor = lightValue[0] - (this.brightnessBottomLeft & 240); - if ((brightnessBottomLeft1 & 240) < lightValue[0]) { - brightnessBottomLeft1 &= MASK; - brightnessBottomLeft1 |= lightValue[0]; - } - bottomLeft[0] += lightValue[1] * colourFactor / 255; - bottomLeft[1] += lightValue[2] * colourFactor / 255; - bottomLeft[2] += lightValue[3] * colourFactor / 255; - } - } - if (lightSource.isBlockIlluminated(x + normal[10][0], y + normal[10][1], z + normal[10][2]) - && lightSource.isBlockIlluminated(x + normal[11][0], y + normal[11][1], z + normal[11][2]) - && lightSource.isBlockIlluminated(x + normal[12][0], y + normal[12][1], - z + normal[12][2])) { - lightValue = lightSource.getLightValue(x + normal[12][0], y + normal[12][1], z + normal[12][2], - normal[0]); - if ((this.brightnessBottomRight & 240) < lightValue[0]) { - int colourFactor = lightValue[0] - (this.brightnessBottomRight & 240); - if ((brightnessBottomRight1 & 240) < lightValue[0]) { - brightnessBottomRight1 &= MASK; - brightnessBottomRight1 |= lightValue[0]; - } - bottomRight[0] += lightValue[1] * colourFactor / 255; - bottomRight[1] += lightValue[2] * colourFactor / 255; - bottomRight[2] += lightValue[3] * colourFactor / 255; - } - } - } - } - } - if (lightAffected) { - normalizeColour(baseColour); - normalizeColour(topLeft); - normalizeColour(topRight); - normalizeColour(bottomLeft); - normalizeColour(bottomRight); - redF = mixLightColour(redF, baseColour[0]); - greenF = mixLightColour(greenF, baseColour[1]); - blueF = mixLightColour(blueF, baseColour[2]); - this.colorRedTopLeft = mixLightColour(colorRedTopLeft, topLeft[0]); - this.colorGreenTopLeft = mixLightColour(colorGreenTopLeft, topLeft[1]); - this.colorBlueTopLeft = mixLightColour(colorBlueTopLeft, topLeft[2]); - this.colorRedTopRight = mixLightColour(colorRedTopRight, topRight[0]); - this.colorGreenTopRight = mixLightColour(colorGreenTopRight, topRight[1]); - this.colorBlueTopRight = mixLightColour(colorBlueTopRight, topRight[2]); - this.colorRedBottomLeft = mixLightColour(colorRedBottomLeft, bottomLeft[0]); - this.colorGreenBottomLeft = mixLightColour(colorGreenBottomLeft, bottomLeft[1]); - this.colorBlueBottomLeft = mixLightColour(colorBlueBottomLeft, bottomLeft[2]); - this.colorRedBottomRight = mixLightColour(colorRedBottomRight, bottomRight[0]); - this.colorGreenBottomRight = mixLightColour(colorGreenBottomRight, bottomRight[1]); - this.colorBlueBottomRight = mixLightColour(colorBlueBottomRight, bottomRight[2]); - this.brightnessTopLeft = brightnessTopLeft1; - this.brightnessTopRight = brightnessTopRight1; - this.brightnessBottomLeft = brightnessBottomLeft1; - this.brightnessBottomRight = brightnessBottomRight1; - Tessellator.instance.setBrightness(brightnessBase1); - Tessellator.instance.setColorOpaque_F(redF, greenF, blueF); - } - } - - static void normalizeColour(int[] colour) { - int max = colour[0]; - if (max < colour[1]) - max = colour[1]; - if (max < colour[2]) - max = colour[2]; - if (max != 0) { - colour[0] = colour[0] * 255 / max; - colour[1] = colour[1] * 255 / max; - colour[2] = colour[2] * 255 / max; - } else { - colour[0] = 255; - colour[1] = 255; - colour[2] = 255; - } - } - - static float mixLightColour(float original, int colour) { - return original * colour / 255f; - } - - @Override - public void drawCrossedSquares(IIcon icon, double x, double y, double z, float f) { - this.transformColour(this.blockAccess.getBlock((int) x, (int) y, (int) z), (int) x, (int) y, (int) z, - NULL_NORMAL); - super.drawCrossedSquares(icon, x, y, z, f); - } - - @Override - public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) { - this.transformColour(block, (int) x, (int) y, (int) z, YNEG); - super.renderFaceYNeg(block, x, y, z, icon); - } - - @Override - public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) { - this.transformColour(block, (int) x, (int) y, (int) z, YPOS); - super.renderFaceYPos(block, x, y, z, icon); - } - - @Override - public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) { - this.transformColour(block, (int) x, (int) y, (int) z, ZNEG); - super.renderFaceZNeg(block, x, y, z, icon); - } - - @Override - public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) { - this.transformColour(block, (int) x, (int) y, (int) z, ZPOS); - super.renderFaceZPos(block, x, y, z, icon); - } - - @Override - public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) { - this.transformColour(block, (int) x, (int) y, (int) z, XNEG); - super.renderFaceXNeg(block, x, y, z, icon); - } - - @Override - public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) { - this.transformColour(block, (int) x, (int) y, (int) z, XPOS); - super.renderFaceXPos(block, x, y, z, icon); - } -} diff --git a/ihl/model/TileEntityRendererDispatcherExt.java b/ihl/model/TileEntityRendererDispatcherExt.java deleted file mode 100644 index d051a3b..0000000 --- a/ihl/model/TileEntityRendererDispatcherExt.java +++ /dev/null @@ -1,58 +0,0 @@ -package ihl.model; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import ihl.ClientProxy; -import ihl.IHLMod; -import ihl.enviroment.LightSource; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.tileentity.TileEntity; - -@SideOnly(Side.CLIENT) -public class TileEntityRendererDispatcherExt extends TileEntityRendererDispatcher { - - @Override - public void renderTileEntity(TileEntity tile, float partialTick) { - if (tile.getDistanceFrom(this.field_147560_j, this.field_147561_k, this.field_147558_l) < tile - .getMaxRenderDistanceSquared()) { - int x = tile.xCoord; - int y = tile.yCoord; - int z = tile.zCoord; - int brightnessBase = this.field_147550_f.getLightBrightnessForSkyBlocks(x, y, z, 0); - float red = 1f; - float green = 1f; - float blue = 1f; - int[] baseColour = new int[3]; - boolean lightAffected = false; - for (LightSource lightSource : ((ClientProxy) IHLMod.proxy).getLightHandler().lightSources) { - if (lightSource.isBlockIlluminated(x, y, z)) { - lightAffected = true; - int[] lightValue = lightSource.getLightValue(x, y, z, RenderBlocksExt.NULL_NORMAL[0]); - if ((brightnessBase & 240) < lightValue[0]) { - int colourFactor = lightValue[0] - (brightnessBase & 240); - brightnessBase &= RenderBlocksExt.MASK; - brightnessBase |= lightValue[0]; - baseColour[0] += lightValue[1] * colourFactor / 255; - baseColour[1] += lightValue[2] * colourFactor / 255; - baseColour[2] += lightValue[3] * colourFactor / 255; - } - } - } - if (lightAffected) { - RenderBlocksExt.normalizeColour(baseColour); - red = RenderBlocksExt.mixLightColour(red, baseColour[0]); - green = RenderBlocksExt.mixLightColour(green, baseColour[1]); - blue = RenderBlocksExt.mixLightColour(blue, baseColour[2]); - } - int j = brightnessBase % 65536; - int k = brightnessBase / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F); - GL11.glColor4f(red, green, blue, 1.0F); - this.renderTileEntityAt(tile, (double) x - staticPlayerX, (double) y - staticPlayerY, - (double) z - staticPlayerZ, partialTick); - } - } -} diff --git a/ihl/nei_integration/AchesonFurnaceRecipeHandler.java b/ihl/nei_integration/AchesonFurnaceRecipeHandler.java index f359c1c..959991e 100644 --- a/ihl/nei_integration/AchesonFurnaceRecipeHandler.java +++ b/ihl/nei_integration/AchesonFurnaceRecipeHandler.java @@ -8,6 +8,7 @@ import ihl.processing.metallurgy.AchesonFurnanceTileEntity; import ihl.recipes.UniversalRecipeInput; import ihl.recipes.UniversalRecipeOutput; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.StatCollector; public class AchesonFurnaceRecipeHandler extends MachineRecipeHandler @@ -42,12 +43,6 @@ public class AchesonFurnaceRecipeHandler extends MachineRecipeHandler return new int[]{32-11}; } - @Override - public String getRecipeName() - { - return "Acheson Furnace"; - } - @Override public String getRecipeId() { diff --git a/ihl/nei_integration/ChemicalReactorRecipeHandler.java b/ihl/nei_integration/ChemicalReactorRecipeHandler.java index 7dd6801..f627314 100644 --- a/ihl/nei_integration/ChemicalReactorRecipeHandler.java +++ b/ihl/nei_integration/ChemicalReactorRecipeHandler.java @@ -70,12 +70,6 @@ public class ChemicalReactorRecipeHandler extends MachineRecipeHandler return new int[]{51-11}; } - @Override - public String getRecipeName() - { - return "Chemical reactor"; - } - @Override public String getRecipeId() { diff --git a/ihl/nei_integration/CrucibleRecipeHandler.java b/ihl/nei_integration/CrucibleRecipeHandler.java index d91b137..acd2849 100644 --- a/ihl/nei_integration/CrucibleRecipeHandler.java +++ b/ihl/nei_integration/CrucibleRecipeHandler.java @@ -10,6 +10,7 @@ import ihl.recipes.UniversalRecipeInput; import ihl.recipes.UniversalRecipeOutput; import ihl.utils.IHLUtils; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.StatCollector; public class CrucibleRecipeHandler extends MachineRecipeHandler @@ -44,13 +45,6 @@ public class CrucibleRecipeHandler extends MachineRecipeHandler return new int[]{51-11}; } - - @Override - public String getRecipeName() - { - return "Crucible"; - } - @Override public String getRecipeId() { diff --git a/ihl/nei_integration/CryogenicDistillerRecipeHandler.java b/ihl/nei_integration/CryogenicDistillerRecipeHandler.java index fe7caea..db7aafc 100644 --- a/ihl/nei_integration/CryogenicDistillerRecipeHandler.java +++ b/ihl/nei_integration/CryogenicDistillerRecipeHandler.java @@ -55,13 +55,6 @@ public class CryogenicDistillerRecipeHandler extends MachineRecipeHandler return new int[]{33-11,51-11}; } - - @Override - public String getRecipeName() - { - return "Cryogenic distiller"; - } - @Override public String getRecipeId() { diff --git a/ihl/nei_integration/DetonationSprayingMachineRecipeHandler.java b/ihl/nei_integration/DetonationSprayingMachineRecipeHandler.java index 07385dd..5280d37 100644 --- a/ihl/nei_integration/DetonationSprayingMachineRecipeHandler.java +++ b/ihl/nei_integration/DetonationSprayingMachineRecipeHandler.java @@ -9,6 +9,7 @@ import ihl.processing.metallurgy.DetonationSprayingMachineTileEntity; import ihl.recipes.UniversalRecipeInput; import ihl.recipes.UniversalRecipeOutput; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.StatCollector; public class DetonationSprayingMachineRecipeHandler extends MachineRecipeHandler @@ -43,12 +44,6 @@ public class DetonationSprayingMachineRecipeHandler extends MachineRecipeHandler return new int[]{53-11}; } - @Override - public String getRecipeName() - { - return "Detonation Spraying Machine"; - } - @Override public String getRecipeId() { diff --git a/ihl/nei_integration/ElectricEvaporatorRecipeHandler.java b/ihl/nei_integration/ElectricEvaporatorRecipeHandler.java index 535646f..6006aa0 100644 --- a/ihl/nei_integration/ElectricEvaporatorRecipeHandler.java +++ b/ihl/nei_integration/ElectricEvaporatorRecipeHandler.java @@ -8,6 +8,7 @@ import ihl.processing.chemistry.EvaporatorTileEntity; import ihl.recipes.UniversalRecipeInput; import ihl.recipes.UniversalRecipeOutput; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.StatCollector; public class ElectricEvaporatorRecipeHandler extends MachineRecipeHandler @@ -42,12 +43,6 @@ public class ElectricEvaporatorRecipeHandler extends MachineRecipeHandler return new int[]{21}; } - @Override - public String getRecipeName() - { - return "Electric Evaporator"; - } - @Override public String getRecipeId() { diff --git a/ihl/nei_integration/ElectrolysisBathRecipeHandler.java b/ihl/nei_integration/ElectrolysisBathRecipeHandler.java index ff07163..381c141 100644 --- a/ihl/nei_integration/ElectrolysisBathRecipeHandler.java +++ b/ihl/nei_integration/ElectrolysisBathRecipeHandler.java @@ -8,6 +8,7 @@ import ihl.processing.chemistry.ElectrolysisBathTileEntity; import ihl.recipes.UniversalRecipeInput; import ihl.recipes.UniversalRecipeOutput; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.StatCollector; public class ElectrolysisBathRecipeHandler extends MachineRecipeHandler @@ -42,13 +43,6 @@ public class ElectrolysisBathRecipeHandler extends MachineRecipeHandler return new int[]{52-11,51-11,15-11}; } - - @Override - public String getRecipeName() - { - return "Electrolysis bath"; - } - @Override public String getRecipeId() { diff --git a/ihl/nei_integration/EvaporatorRecipeHandler.java b/ihl/nei_integration/EvaporatorRecipeHandler.java index bfb697e..8bf9431 100644 --- a/ihl/nei_integration/EvaporatorRecipeHandler.java +++ b/ihl/nei_integration/EvaporatorRecipeHandler.java @@ -8,6 +8,7 @@ import ihl.processing.chemistry.EvaporatorTileEntity; import ihl.recipes.UniversalRecipeInput; import ihl.recipes.UniversalRecipeOutput; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.StatCollector; public class EvaporatorRecipeHandler extends MachineRecipeHandler @@ -42,12 +43,6 @@ public class EvaporatorRecipeHandler extends MachineRecipeHandler return new int[]{21}; } - @Override - public String getRecipeName() - { - return "Evaporator"; - } - @Override public String getRecipeId() { diff --git a/ihl/nei_integration/ExtruderRecipeHandler.java b/ihl/nei_integration/ExtruderRecipeHandler.java index a823ce6..c00c471 100644 --- a/ihl/nei_integration/ExtruderRecipeHandler.java +++ b/ihl/nei_integration/ExtruderRecipeHandler.java @@ -9,6 +9,7 @@ import ihl.processing.metallurgy.ExtruderTileEntity; import ihl.recipes.UniversalRecipeInput; import ihl.recipes.UniversalRecipeOutput; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.StatCollector; public class ExtruderRecipeHandler extends MachineRecipeHandler { @Override @@ -36,11 +37,6 @@ public class ExtruderRecipeHandler extends MachineRecipeHandler { return new int[] { 32 - 11 }; } - @Override - public String getRecipeName() { - return "Extruder"; - } - @Override public String getRecipeId() { return "ihl.extruder"; diff --git a/ihl/nei_integration/FluidizedBedReactorRecipeHandler.java b/ihl/nei_integration/FluidizedBedReactorRecipeHandler.java index e5dba3d..00aef05 100644 --- a/ihl/nei_integration/FluidizedBedReactorRecipeHandler.java +++ b/ihl/nei_integration/FluidizedBedReactorRecipeHandler.java @@ -9,6 +9,7 @@ import ihl.processing.chemistry.FluidizedBedReactorTileEntity; import ihl.recipes.UniversalRecipeInput; import ihl.recipes.UniversalRecipeOutput; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.StatCollector; public class FluidizedBedReactorRecipeHandler extends MachineRecipeHandler @@ -74,12 +75,6 @@ public class FluidizedBedReactorRecipeHandler extends MachineRecipeHandler GuiDraw.drawTexturedModalRect(83-5, 50-11, 101, 14, 18, 18); } - @Override - public String getRecipeName() - { - return "Fluidized bed reactor"; - } - @Override public String getRecipeId() { diff --git a/ihl/nei_integration/FractionationColumnRecipeHandler.java b/ihl/nei_integration/FractionationColumnRecipeHandler.java index eda5896..399adca 100644 --- a/ihl/nei_integration/FractionationColumnRecipeHandler.java +++ b/ihl/nei_integration/FractionationColumnRecipeHandler.java @@ -6,6 +6,7 @@ import ihl.processing.chemistry.FractionatorBottomTileEntity; import ihl.recipes.UniversalRecipeInput; import ihl.recipes.UniversalRecipeOutput; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.StatCollector; public class FractionationColumnRecipeHandler extends MachineRecipeHandler @@ -40,13 +41,6 @@ public class FractionationColumnRecipeHandler extends MachineRecipeHandler return new int[]{51-11,31-11}; } - - @Override - public String getRecipeName() - { - return "Fractionation column"; - } - @Override public String getRecipeId() { diff --git a/ihl/nei_integration/GasWeldingStationGasRecipeHandler.java b/ihl/nei_integration/GasWeldingStationGasRecipeHandler.java index 0f3a85a..8d5a0c4 100644 --- a/ihl/nei_integration/GasWeldingStationGasRecipeHandler.java +++ b/ihl/nei_integration/GasWeldingStationGasRecipeHandler.java @@ -8,6 +8,7 @@ import ihl.processing.metallurgy.GasWeldingStationTileEntity; import ihl.recipes.UniversalRecipeInput; import ihl.recipes.UniversalRecipeOutput; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.StatCollector; public class GasWeldingStationGasRecipeHandler extends MachineRecipeHandler @@ -47,14 +48,7 @@ public class GasWeldingStationGasRecipeHandler extends MachineRecipeHandler { this.transferRects.add(new RecipeTransferRect(new Rectangle(80-5, 15-11, 50, 50), this.getRecipeId(), new Object[0])); } - - - @Override - public String getRecipeName() - { - return "Gas welding station"; - } - + @Override public String getRecipeId() { diff --git a/ihl/nei_integration/ImpregnatingMachineRecipeHandler.java b/ihl/nei_integration/ImpregnatingMachineRecipeHandler.java index d1f172e..e749617 100644 --- a/ihl/nei_integration/ImpregnatingMachineRecipeHandler.java +++ b/ihl/nei_integration/ImpregnatingMachineRecipeHandler.java @@ -9,6 +9,7 @@ import ihl.processing.metallurgy.ImpregnatingMachineTileEntity; import ihl.recipes.UniversalRecipeInput; import ihl.recipes.UniversalRecipeOutput; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.StatCollector; public class ImpregnatingMachineRecipeHandler extends MachineRecipeHandler @@ -67,12 +68,6 @@ public class ImpregnatingMachineRecipeHandler extends MachineRecipeHandler return new int[]{52-11}; } - @Override - public String getRecipeName() - { - return "Bronze tub"; - } - @Override public String getRecipeId() { diff --git a/ihl/nei_integration/InjectionMoldRecipeHandler.java b/ihl/nei_integration/InjectionMoldRecipeHandler.java index 06bf3c1..97d03d2 100644 --- a/ihl/nei_integration/InjectionMoldRecipeHandler.java +++ b/ihl/nei_integration/InjectionMoldRecipeHandler.java @@ -7,6 +7,7 @@ import ihl.processing.metallurgy.InjectionMoldTileEntity; import ihl.recipes.UniversalRecipeInput; import ihl.recipes.UniversalRecipeOutput; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.StatCollector; public class InjectionMoldRecipeHandler extends MachineRecipeHandler { @Override @@ -34,11 +35,6 @@ public class InjectionMoldRecipeHandler extends MachineRecipeHandler { return new int[] { 51 - 11 }; } - @Override - public String getRecipeName() { - return "Injection mold"; - } - @Override public String getRecipeId() { return "ihl.casting"; diff --git a/ihl/nei_integration/IronWorkbenchRecipeHandler.java b/ihl/nei_integration/IronWorkbenchRecipeHandler.java index 980f13a..f0de0c5 100644 --- a/ihl/nei_integration/IronWorkbenchRecipeHandler.java +++ b/ihl/nei_integration/IronWorkbenchRecipeHandler.java @@ -14,6 +14,8 @@ import java.util.Iterator; import java.util.List; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; + import org.lwjgl.opengl.GL11; import ihl.flexible_cable.IronWorkbenchGui; @@ -37,10 +39,10 @@ public class IronWorkbenchRecipeHandler extends TemplateRecipeHandler return IronWorkbenchGui.class; } - @Override + @Override public String getRecipeName() { - return "Iron workbench"; + return StatCollector.translateToLocal(getRecipeId()); } @Override @@ -80,17 +82,6 @@ public class IronWorkbenchRecipeHandler extends TemplateRecipeHandler GuiDraw.drawTexturedModalRect(0, 0, 7, 7, 162, 108); } - @Override - public void drawExtras(int i) - { - /* - float f = this.ticks >= 20 ? (float)((this.ticks - 20) % 20) / 20.0F : 0.0F; - this.drawProgressBar(74, 23, 176, 14, 25, 16, f, 0); - f = this.ticks <= 20 ? (float)this.ticks / 20.0F : 1.0F; - this.drawProgressBar(51, 25, 176, 0, 14, 14, f, 3); - */ - } - @Override public void loadTransferRects() { diff --git a/ihl/nei_integration/LabElectrolyzerRecipeHandler.java b/ihl/nei_integration/LabElectrolyzerRecipeHandler.java index 5e28067..ea705f6 100644 --- a/ihl/nei_integration/LabElectrolyzerRecipeHandler.java +++ b/ihl/nei_integration/LabElectrolyzerRecipeHandler.java @@ -11,6 +11,7 @@ import ihl.processing.chemistry.LabElectrolyzerTileEntity; import ihl.recipes.UniversalRecipeInput; import ihl.recipes.UniversalRecipeOutput; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.StatCollector; public class LabElectrolyzerRecipeHandler extends MachineRecipeHandler { @Override @@ -38,11 +39,6 @@ public class LabElectrolyzerRecipeHandler extends MachineRecipeHandler { return new int[] { 47 - 10 }; } - @Override - public String getRecipeName() { - return "Lab electrolyzer"; - } - @Override public String getRecipeId() { return "ihl.labElectrolyzer"; diff --git a/ihl/nei_integration/LeadOvenRecipeHandler.java b/ihl/nei_integration/LeadOvenRecipeHandler.java index 5c376fd..98861a2 100644 --- a/ihl/nei_integration/LeadOvenRecipeHandler.java +++ b/ihl/nei_integration/LeadOvenRecipeHandler.java @@ -8,6 +8,7 @@ import ihl.processing.chemistry.LeadOvenTileEntity; import ihl.recipes.UniversalRecipeInput; import ihl.recipes.UniversalRecipeOutput; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.StatCollector; public class LeadOvenRecipeHandler extends MachineRecipeHandler { @Override @@ -55,11 +56,6 @@ public class LeadOvenRecipeHandler extends MachineRecipeHandler { return new int[] { 17 - 11 }; } - @Override - public String getRecipeName() { - return "Chemical oven"; - } - @Override public String getRecipeId() { return "ihl.leadOven"; diff --git a/ihl/nei_integration/LoomRecipeHandler.java b/ihl/nei_integration/LoomRecipeHandler.java index b7f6331..d34f505 100644 --- a/ihl/nei_integration/LoomRecipeHandler.java +++ b/ihl/nei_integration/LoomRecipeHandler.java @@ -48,13 +48,6 @@ public class LoomRecipeHandler extends MachineRecipeHandler return new int[]{44-11}; } - - @Override - public String getRecipeName() - { - return "Loom"; - } - @Override public String getRecipeId() { diff --git a/ihl/nei_integration/MachineRecipeHandler.java b/ihl/nei_integration/MachineRecipeHandler.java index 82b541a..9373738 100644 --- a/ihl/nei_integration/MachineRecipeHandler.java +++ b/ihl/nei_integration/MachineRecipeHandler.java @@ -23,6 +23,7 @@ import java.util.Map.Entry; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; import net.minecraftforge.fluids.BlockFluidBase; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; @@ -36,7 +37,10 @@ public abstract class MachineRecipeHandler extends TemplateRecipeHandler protected int ticks; @Override - public abstract String getRecipeName(); + public String getRecipeName() + { + return StatCollector.translateToLocal(getRecipeId()); + } public abstract String getRecipeId(); diff --git a/ihl/nei_integration/MuffleFurnaceRecipeHandler.java b/ihl/nei_integration/MuffleFurnaceRecipeHandler.java index bd57d64..c5ff0c9 100644 --- a/ihl/nei_integration/MuffleFurnaceRecipeHandler.java +++ b/ihl/nei_integration/MuffleFurnaceRecipeHandler.java @@ -43,12 +43,6 @@ public class MuffleFurnaceRecipeHandler extends MachineRecipeHandler return new int[]{32-11}; } - @Override - public String getRecipeName() - { - return "Muffle furnace"; - } - @Override public String getRecipeId() { diff --git a/ihl/nei_integration/PaperMachineRecipeHandler.java b/ihl/nei_integration/PaperMachineRecipeHandler.java index 2357da8..141872b 100644 --- a/ihl/nei_integration/PaperMachineRecipeHandler.java +++ b/ihl/nei_integration/PaperMachineRecipeHandler.java @@ -43,13 +43,6 @@ public class PaperMachineRecipeHandler extends MachineRecipeHandler return new int[]{51-11,51-11,51-11}; } - - @Override - public String getRecipeName() - { - return "Paper machine"; - } - @Override public String getRecipeId() { diff --git a/ihl/nei_integration/RollingMachineRecipeHandler.java b/ihl/nei_integration/RollingMachineRecipeHandler.java index d550ee7..1a8e4ee 100644 --- a/ihl/nei_integration/RollingMachineRecipeHandler.java +++ b/ihl/nei_integration/RollingMachineRecipeHandler.java @@ -41,12 +41,6 @@ public class RollingMachineRecipeHandler extends MachineRecipeHandler return new int[]{25-11}; } - @Override - public String getRecipeName() - { - return "Rolling machine"; - } - @Override public String getRecipeId() { diff --git a/ihl/nei_integration/VulcanizationExtrudingMoldRecipeHandler.java b/ihl/nei_integration/VulcanizationExtrudingMoldRecipeHandler.java index 0da133e..2ca3b46 100644 --- a/ihl/nei_integration/VulcanizationExtrudingMoldRecipeHandler.java +++ b/ihl/nei_integration/VulcanizationExtrudingMoldRecipeHandler.java @@ -40,17 +40,10 @@ public class VulcanizationExtrudingMoldRecipeHandler extends MachineRecipeHandle return new int[]{46-11}; } - - @Override - public String getRecipeName() - { - return "Vulcanization extruding mold"; - } - @Override public String getRecipeId() { - return "ihl.culcanizationExtrudingMold"; + return "ihl.vulcanizationExtrudingMold"; } @Override diff --git a/ihl/nei_integration/WireMillRecipeHandler.java b/ihl/nei_integration/WireMillRecipeHandler.java index 7a0cafe..6d4ca5f 100644 --- a/ihl/nei_integration/WireMillRecipeHandler.java +++ b/ihl/nei_integration/WireMillRecipeHandler.java @@ -59,13 +59,6 @@ public class WireMillRecipeHandler extends MachineRecipeHandler return new int[]{31-11}; } - - @Override - public String getRecipeName() - { - return "Wire mill"; - } - @Override public String getRecipeId() { diff --git a/ihl/nei_integration/WoodenRollingMachineRecipeHandler.java b/ihl/nei_integration/WoodenRollingMachineRecipeHandler.java index ea44298..f8adb4f 100644 --- a/ihl/nei_integration/WoodenRollingMachineRecipeHandler.java +++ b/ihl/nei_integration/WoodenRollingMachineRecipeHandler.java @@ -42,12 +42,6 @@ public class WoodenRollingMachineRecipeHandler extends MachineRecipeHandler return new int[]{25-11}; } - @Override - public String getRecipeName() - { - return "Wooden rolling machine"; - } - @Override public String getRecipeId() { diff --git a/ihl/worldgen/WorldGeneratorBase.java b/ihl/worldgen/WorldGeneratorBase.java index b5468f5..dc68135 100644 --- a/ihl/worldgen/WorldGeneratorBase.java +++ b/ihl/worldgen/WorldGeneratorBase.java @@ -14,7 +14,7 @@ import net.minecraft.world.chunk.storage.ExtendedBlockStorage; public abstract class WorldGeneratorBase { private final Random random = new Random(); protected final Block ore; - private final Set replaceableBlocks = new HashSet(2); + protected final Set replaceableBlocks = new HashSet(2); public WorldGeneratorBase(Block oreIn, Block... replaceableBlocksIn) { ore = oreIn; diff --git a/ihl/worldgen/WorldGeneratorUndergroundLake.java b/ihl/worldgen/WorldGeneratorUndergroundLake.java index b902efa..7abee8e 100644 --- a/ihl/worldgen/WorldGeneratorUndergroundLake.java +++ b/ihl/worldgen/WorldGeneratorUndergroundLake.java @@ -1,8 +1,11 @@ package ihl.worldgen; import ihl.utils.IHLMathUtils; +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 class WorldGeneratorUndergroundLake extends WorldGeneratorBase { @@ -25,17 +28,23 @@ public class WorldGeneratorUndergroundLake extends WorldGeneratorBase { int d = dx * dx + dz * dz; if (y2 > 1 && d < 64) { for (int iy = y2; iy > 0; iy--) { - int[] xyz = new int[] { 0, 0, -1, 0, 0, 1, 0, 0 }; - for (int i = 2; i < xyz.length; i++) { - int absX = ix + startX + xyz[i - 2]; - int absZ = iz + startZ + xyz[i]; - if(!world.getChunkProvider().chunkExists(absX >> 4, absZ >> 4)) { - continue nextZ; + int absX = ix + startX; + int absZ = iz + startZ; + int absY = iy; + 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))) { + int[] xyz = new int[] { 0, 0, -1, 0, 0, 1, 0, 0 }; + for (int i = 2; i < xyz.length; i++) { + int absX2 = absX + xyz[i - 2]; + int absZ2 = absZ + xyz[i]; + if (!world.getChunkProvider().chunkExists(absX2 >> 4, absZ2 >> 4)) { + continue nextZ; + } + this.replaceAllExceptOre(world, absX2, iy + xyz[i - 1], absZ2, clayBlock); } - this.replaceAllExceptOre(world, absX, iy + xyz[i - 1],absZ, - clayBlock); + IHLUtils.setBlockRaw(ebs, absX & 15, absY & 15, absZ & 15, ore); } - this.replace(world, ix + startX, iy, iz + startZ, ore); } } if (surroundPOI[2] == z) { diff --git a/ihl_coremod/IHLCoremod.java b/ihl_coremod/IHLCoremod.java deleted file mode 100644 index 300e27d..0000000 --- a/ihl_coremod/IHLCoremod.java +++ /dev/null @@ -1,48 +0,0 @@ -package ihl_coremod; - -import java.util.Map; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import cpw.mods.fml.relauncher.IFMLLoadingPlugin; - -@IFMLLoadingPlugin.Name(value = "IHL CoreMod") -@IFMLLoadingPlugin.MCVersion(value = "1.7.10") -@IFMLLoadingPlugin.TransformerExclusions(value = "ihl_coremod.") -@IFMLLoadingPlugin.SortingIndex(value = 0) -public class IHLCoremod implements IFMLLoadingPlugin{ - public static Logger log; - - public IHLCoremod() - { - log = LogManager.getLogger("IHLCoremod"); - log.info("IHL coremod logger created."); - } - - @Override - public String[] getASMTransformerClass() { - return new String[] {WorldRendererClassTransformer.class.getName()}; - } - - @Override - public String getModContainerClass() { - return IHLCoremodContainer.class.getName(); - } - - @Override - public String getSetupClass() { - return null; - } - - @Override - public void injectData(Map data) { - - } - - @Override - public String getAccessTransformerClass() { - return null; - } - -} diff --git a/ihl_coremod/IHLCoremodContainer.java b/ihl_coremod/IHLCoremodContainer.java deleted file mode 100644 index c33a58e..0000000 --- a/ihl_coremod/IHLCoremodContainer.java +++ /dev/null @@ -1,29 +0,0 @@ -package ihl_coremod; - -import java.util.Arrays; - -import com.google.common.eventbus.EventBus; - -import cpw.mods.fml.common.DummyModContainer; -import cpw.mods.fml.common.LoadController; -import cpw.mods.fml.common.ModMetadata; - -public class IHLCoremodContainer extends DummyModContainer { - - public IHLCoremodContainer() { - super(new ModMetadata()); - ModMetadata myMeta = super.getMetadata(); - myMeta.authorList = Arrays.asList(new String[] { "Foghrye4" }); - myMeta.description = "Core mod for ASM tweaks"; - myMeta.modId = "ihl_coremod"; - myMeta.version = "1.0"; - myMeta.name = "IHL core mod"; - } - - @Override - public boolean registerBus(EventBus bus, LoadController controller) - { - bus.register(this); - return true; - } -} diff --git a/ihl_coremod/WorldRendererClassTransformer.java b/ihl_coremod/WorldRendererClassTransformer.java deleted file mode 100644 index b82b9a1..0000000 --- a/ihl_coremod/WorldRendererClassTransformer.java +++ /dev/null @@ -1,22 +0,0 @@ -package ihl_coremod; - -import net.minecraft.launchwrapper.IClassTransformer; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Opcodes; - -public class WorldRendererClassTransformer implements IClassTransformer { - - @Override - public byte[] transform(String name, String transformedName, byte[] basicClass) { - if (name.equals("blo")) { - IHLCoremod.log.info("'net.minecraft.client.renderer.WorldRenderer' founded."); - ClassReader cr = new ClassReader(basicClass); - ClassWriter cw = new ClassWriter(cr, 0); - WorldRendererClassVisitor cv = new WorldRendererClassVisitor(Opcodes.ASM4, cw); - cr.accept(cv, 0); - return cw.toByteArray(); - } - return basicClass; - } -} diff --git a/ihl_coremod/WorldRendererClassVisitor.java b/ihl_coremod/WorldRendererClassVisitor.java deleted file mode 100644 index ea76136..0000000 --- a/ihl_coremod/WorldRendererClassVisitor.java +++ /dev/null @@ -1,25 +0,0 @@ -package ihl_coremod; - -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Type; - -import net.minecraft.client.renderer.RenderBlocks; - -public class WorldRendererClassVisitor extends ClassVisitor { - - public WorldRendererClassVisitor(int api, ClassVisitor cv) { - super(api, cv); - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); - if (name.equals("a") && desc.equals("(Lsv;)V")) { - IHLCoremod.log.info("'updateRenderer(Lnet/minecraft/entity/EntityLivingBase;)V' successfully founded."); - IHLCoremod.log.info("Trying to intercept: '"+Type.getInternalName(RenderBlocks.class)+".'"); - return new WorldRendererRenderBlocksInitMethodVisitor(this.api, mv); - } - return mv; - } -} diff --git a/ihl_coremod/WorldRendererRenderBlocksInitMethodVisitor.java b/ihl_coremod/WorldRendererRenderBlocksInitMethodVisitor.java deleted file mode 100644 index 915d0b7..0000000 --- a/ihl_coremod/WorldRendererRenderBlocksInitMethodVisitor.java +++ /dev/null @@ -1,34 +0,0 @@ -package ihl_coremod; - -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; - -public class WorldRendererRenderBlocksInitMethodVisitor extends MethodVisitor { - - private static final String RENDER_BLOCK_EXT_TYPE = "ihl/model/RenderBlocksExt"; - private static final String RENDER_BLOCK_TYPE = "blm"; - - public WorldRendererRenderBlocksInitMethodVisitor(int api, MethodVisitor mv) { - super(api, mv); - } - - @Override - public void visitTypeInsn(int opcode, String type) { - if (opcode == Opcodes.NEW && type.equals(RENDER_BLOCK_TYPE)) { - IHLCoremod.log.info("'new RenderBlocks' instruction successfully intercepted."); - super.visitTypeInsn(opcode, RENDER_BLOCK_EXT_TYPE); - } else { - super.visitTypeInsn(opcode, type); - } - } - - @Override - public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { - if (owner.equals(RENDER_BLOCK_TYPE) && name.equals("")) { - IHLCoremod.log.info("'RenderBlocks.' method successfully intercepted."); - super.visitMethodInsn(opcode, RENDER_BLOCK_EXT_TYPE, name, desc, itf); - } else { - super.visitMethodInsn(opcode, owner, name, desc, itf); - } - } -} -- cgit v1.2.3