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
This commit is contained in:
malte0811 2016-12-20 17:05:20 +01:00
parent 04e25e300c
commit f13b944c7a
6 changed files with 91 additions and 46 deletions

View file

@ -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 {

View file

@ -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

View file

@ -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) {

View file

@ -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 <http://www.gnu.org/licenses/>.
*******************************************************************************/
package malte0811.industrialWires.blocks;
import blusunrize.immersiveengineering.api.energy.immersiveflux.IFluxConnection;

View file

@ -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<distSquared) {
color = 0xdd3333;
}
ClientUtils.font().drawString(s, e.getResolution().getScaledWidth()/2 - ClientUtils.font().getStringWidth(s)/2, e.getResolution().getScaledHeight()-GuiIngameForge.left_height-20, color, true);
}
}

View file

@ -86,22 +86,24 @@ public class ClientProxy extends CommonProxy {
}
Block[] blocks = {IndustrialWires.ic2conn, IndustrialWires.mechConv};
for (Block b:blocks) {
Item blockItem = Item.getItemFromBlock(b);
final ResourceLocation loc = b.getRegistryName();
ModelLoader.setCustomMeshDefinition(blockItem, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return new ModelResourceLocation(loc, "inventory");
}
});
Object[] v = ((IMetaEnum)b).getValues();
for(int meta = 0; meta < v.length; meta++) {
String location = loc.toString();
String prop = "inventory,type=" + v[meta].toString().toLowerCase(Locale.US);
try {
ModelLoader.setCustomModelResourceLocation(blockItem, meta, new ModelResourceLocation(location, prop));
} catch(NullPointerException npe) {
throw new RuntimeException(b + " lacks an item!", npe);
if (b!=null) {
Item blockItem = Item.getItemFromBlock(b);
final ResourceLocation loc = b.getRegistryName();
ModelLoader.setCustomMeshDefinition(blockItem, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return new ModelResourceLocation(loc, "inventory");
}
});
Object[] v = ((IMetaEnum)b).getValues();
for(int meta = 0; meta < v.length; meta++) {
String location = loc.toString();
String prop = "inventory,type=" + v[meta].toString().toLowerCase(Locale.US);
try {
ModelLoader.setCustomModelResourceLocation(blockItem, meta, new ModelResourceLocation(location, prop));
} catch(NullPointerException npe) {
throw new RuntimeException(b + " lacks an item!", npe);
}
}
}
}
@ -152,11 +154,12 @@ public class ClientProxy extends CommonProxy {
new ManualPages.Text(m, "industrialWires.wires1"),
new ManualPages.CraftingMulti(m, "industrialWires.wires2", (Object[])wireRecipes)
);
m.addEntry("industrialWires.mechConv", "industrialWires",
new ManualPages.Crafting(m, "industrialWires.mechConv0", new ItemStack(IndustrialWires.mechConv, 1, 1)),
new ManualPages.Crafting(m, "industrialWires.mechConv1", new ItemStack(IndustrialWires.mechConv, 1, 2)),
new ManualPages.Crafting(m, "industrialWires.mechConv2", new ItemStack(IndustrialWires.mechConv, 1, 0))
);
if (IndustrialWires.mechConv!=null) {
m.addEntry("industrialWires.mechConv", "industrialWires",
new ManualPages.Crafting(m, "industrialWires.mechConv0", new ItemStack(IndustrialWires.mechConv, 1, 1)),
new ManualPages.Crafting(m, "industrialWires.mechConv1", new ItemStack(IndustrialWires.mechConv, 1, 2)),
new ManualPages.Crafting(m, "industrialWires.mechConv2", new ItemStack(IndustrialWires.mechConv, 1, 0))
);
}
}
}