From f13b944c7a0eb06a037f7ac64b9ca749f412d27d Mon Sep 17 00:00:00 2001 From: malte0811 Date: Tue, 20 Dec 2016 17:05:20 +0100 Subject: [PATCH] Build 5 made the option to disable converters actually do something made wire coils show when they are out of range, mirroring the bahavior of IE coils in the latest dev version --- build.gradle | 4 +- changelog.md | 8 ++++ .../industrialWires/IndustrialWires.java | 46 +++++++++--------- .../industrialWires/blocks/EnergyAdapter.java | 17 +++++++ .../client/ClientEventHandler.java | 15 +++++- .../industrialWires/client/ClientProxy.java | 47 ++++++++++--------- 6 files changed, 91 insertions(+), 46 deletions(-) diff --git a/build.gradle b/build.gradle index 4dd6229..ff7f4ba 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ -def mainVersion = "1.1" -def buildNumber = "4" +def mainVersion = "1.2" +def buildNumber = "5" // For those who want the bleeding edge buildscript { diff --git a/changelog.md b/changelog.md index c1302c6..a87d17b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,11 @@ +#####Version 1.2-5 (10,000 download celebratory release) + - added mechanical converters and the rotational motor + - they convert between IE rotational energy (windmill, dynamo etc) and IC2 kinetic energy + - Rotational motor: produces IE rotational energy from IF + - No lossless conversion + - Can be disabled in the config + - wire coils show when they are out of range (to match the behavior of IE coils in the latest dev version) + #####Version 1.1-4 - fixed an insane amount of log-spam in an edgecase (probably a Vanilla or Forge bug) - added config values for wire length per connection and per coil item diff --git a/src/main/java/malte0811/industrialWires/IndustrialWires.java b/src/main/java/malte0811/industrialWires/IndustrialWires.java index 69cc8b1..befdec7 100644 --- a/src/main/java/malte0811/industrialWires/IndustrialWires.java +++ b/src/main/java/malte0811/industrialWires/IndustrialWires.java @@ -54,7 +54,7 @@ import net.minecraftforge.oredict.RecipeSorter; import net.minecraftforge.oredict.RecipeSorter.Category; import net.minecraftforge.oredict.ShapedOreRecipe; -@Mod(modid = IndustrialWires.MODID, version = IndustrialWires.VERSION, dependencies="required-after:immersiveengineering@[0.10-43,);required-after:IC2") +@Mod(modid = IndustrialWires.MODID, version = IndustrialWires.VERSION, dependencies="required-after:immersiveengineering@[0.10-53,);required-after:IC2") public class IndustrialWires { public static final String MODID = "industrialwires"; public static final String VERSION = "${version}"; @@ -78,16 +78,19 @@ public class IndustrialWires { public void preInit(FMLPreInitializationEvent e) { new IWConfig(); ic2conn = new BlockIC2Connector(); - mechConv = new BlockMechanicalConverter(); + if (IWConfig.enableConversion) + mechConv = new BlockMechanicalConverter(); coil = new ItemIC2Coil(); GameRegistry.registerTileEntity(TileEntityIC2ConnectorTin.class, "ic2ConnectorTin"); GameRegistry.registerTileEntity(TileEntityIC2ConnectorCopper.class, "ic2ConnectorCopper"); GameRegistry.registerTileEntity(TileEntityIC2ConnectorGold.class, "ic2ConnectorGold"); GameRegistry.registerTileEntity(TileEntityIC2ConnectorHV.class, "ic2ConnectorHV"); GameRegistry.registerTileEntity(TileEntityIC2ConnectorGlass.class, "ic2ConnectorGlass"); - GameRegistry.registerTileEntity(TileEntityIEMotor.class, MODID+":ieMotor"); - GameRegistry.registerTileEntity(TileEntityMechICtoIE.class, MODID+":mechIcToIe"); - GameRegistry.registerTileEntity(TileEntityMechIEtoIC.class, MODID+":mechIeToIc"); + if (mechConv!=null) { + GameRegistry.registerTileEntity(TileEntityIEMotor.class, MODID+":ieMotor"); + GameRegistry.registerTileEntity(TileEntityMechICtoIE.class, MODID+":mechIcToIe"); + GameRegistry.registerTileEntity(TileEntityMechIEtoIC.class, MODID+":mechIeToIc"); + } if (IC2Wiretype.IC2_TYPES==null) { throw new IllegalStateException("No IC2 wires registered"); } @@ -116,22 +119,23 @@ public class IndustrialWires { } AssemblerHandler.registerRecipeAdapter(RecipeCoilLength.class, new CoilLengthAdapter()); // MECH CONVERTERS - ItemStack shaftIron = IC2Items.getItem("crafting", "iron_shaft"); - ItemStack shaftSteel = IC2Items.getItem("crafting", "steel_shaft"); - ItemStack ironMechComponent = new ItemStack(IEContent.itemMaterial, 1, 8); - ItemStack steelMechComponent = new ItemStack(IEContent.itemMaterial, 1, 9); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(mechConv, 1, 0), " s ", "ici", "mum", 's', "stickIron", - 'i', "ingotIron", 'c', new ItemStack(IEContent.blockMetalDecoration0, 1, BlockTypes_MetalDecoration0.COIL_LV.getMeta()), - 'u', "ingotCopper", 'm', ironMechComponent)); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(mechConv, 1, 2), "iIi", "sbS", "mrm", 's', "blockSheetmetalIron", - 'i', "plateIron", 'I', shaftIron, - 'b', "ingotBronze", 'm', steelMechComponent, - 'S', "blockSheetmetalSteel", 'r', "stickSteel")); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(mechConv, 1, 1), "mrm", "sbS", "iIi", 's', "blockSheetmetalIron", - 'i', "plateSteel", 'I', shaftSteel, - 'b', "ingotBronze", 'm', ironMechComponent, - 'S', "blockSheetmetalSteel", 'r', "stickIron")); - + if (mechConv!=null) { + ItemStack shaftIron = IC2Items.getItem("crafting", "iron_shaft"); + ItemStack shaftSteel = IC2Items.getItem("crafting", "steel_shaft"); + ItemStack ironMechComponent = new ItemStack(IEContent.itemMaterial, 1, 8); + ItemStack steelMechComponent = new ItemStack(IEContent.itemMaterial, 1, 9); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(mechConv, 1, 0), " s ", "ici", "mum", 's', "stickIron", + 'i', "ingotIron", 'c', new ItemStack(IEContent.blockMetalDecoration0, 1, BlockTypes_MetalDecoration0.COIL_LV.getMeta()), + 'u', "ingotCopper", 'm', ironMechComponent)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(mechConv, 1, 2), "iIi", "sbS", "mrm", 's', "blockSheetmetalIron", + 'i', "plateIron", 'I', shaftIron, + 'b', "ingotBronze", 'm', steelMechComponent, + 'S', "blockSheetmetalSteel", 'r', "stickSteel")); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(mechConv, 1, 1), "mrm", "sbS", "iIi", 's', "blockSheetmetalIron", + 'i', "plateSteel", 'I', shaftSteel, + 'b', "ingotBronze", 'm', ironMechComponent, + 'S', "blockSheetmetalSteel", 'r', "stickIron")); + } } @EventHandler public void postInit(FMLPostInitializationEvent e) { diff --git a/src/main/java/malte0811/industrialWires/blocks/EnergyAdapter.java b/src/main/java/malte0811/industrialWires/blocks/EnergyAdapter.java index f0804db..e7b9565 100644 --- a/src/main/java/malte0811/industrialWires/blocks/EnergyAdapter.java +++ b/src/main/java/malte0811/industrialWires/blocks/EnergyAdapter.java @@ -1,3 +1,20 @@ +/******************************************************************************* + * This file is part of Industrial Wires. + * Copyright (C) 2016 malte0811 + * + * Industrial Wires is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Industrial Wires is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Industrial Wires. If not, see . + *******************************************************************************/ package malte0811.industrialWires.blocks; import blusunrize.immersiveengineering.api.energy.immersiveflux.IFluxConnection; diff --git a/src/main/java/malte0811/industrialWires/client/ClientEventHandler.java b/src/main/java/malte0811/industrialWires/client/ClientEventHandler.java index 26739b5..53ab08e 100644 --- a/src/main/java/malte0811/industrialWires/client/ClientEventHandler.java +++ b/src/main/java/malte0811/industrialWires/client/ClientEventHandler.java @@ -27,6 +27,7 @@ import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumHand; +import net.minecraft.util.math.RayTraceResult; import net.minecraftforge.client.GuiIngameForge; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -42,13 +43,25 @@ public class ClientEventHandler { if(player.getHeldItem(hand)!=null) { ItemStack equipped = player.getHeldItem(hand); if(OreDictionary.itemMatches(new ItemStack(IndustrialWires.coil, 1, OreDictionary.WILDCARD_VALUE), equipped, false)) { - int color = IC2Wiretype.IC2_TYPES[equipped.getItemDamage()].getColour(null); + IC2Wiretype type = IC2Wiretype.IC2_TYPES[equipped.getItemDamage()]; + int color = type.getColour(null); String s = I18n.format(IndustrialWires.MODID+".desc.wireLength", ItemIC2Coil.getLength(equipped)); ClientUtils.font().drawString(s, e.getResolution().getScaledWidth()/2 - ClientUtils.font().getStringWidth(s)/2, e.getResolution().getScaledHeight()-GuiIngameForge.left_height-40, color, true); if(ItemNBTHelper.hasKey(equipped, "linkingPos")) { int[] link = ItemNBTHelper.getIntArray(equipped, "linkingPos"); if(link!=null&&link.length>3) { s = I18n.format(Lib.DESC_INFO+"attachedTo", link[1],link[2],link[3]); + RayTraceResult focussedBlock = ClientUtils.mc().objectMouseOver; + double distSquared; + if (focussedBlock!=null&&focussedBlock.getBlockPos()!=null) { + distSquared = focussedBlock.getBlockPos().distanceSq(link[1],link[2],link[3]); + } else { + distSquared = player.getDistanceSq(link[1],link[2],link[3]); + } + int length = Math.min(ItemIC2Coil.getLength(equipped), type.getMaxLength()); + if (length*length