From 01c2e58409984f46087c53f8bc538ce5ef66eaf6 Mon Sep 17 00:00:00 2001 From: malte0811 Date: Wed, 10 May 2017 17:56:05 +0200 Subject: [PATCH] Updated to MC 1.11, part 1 Compiles and runs, but probably doesn't really work yet --- .gitignore | 1 + build.gradle | 10 +- .../industrialWires/CommonProxy.java | 2 +- .../industrialWires/IIC2Connector.java | 2 +- .../industrialWires/IndustrialWires.java | 32 ++-- .../industrialWires/blocks/BlockIWBase.java | 37 ++--- .../blocks/BlockJacobsLadder.java | 29 ++-- .../industrialWires/blocks/EnergyAdapter.java | 12 +- .../industrialWires/blocks/ItemBlockIW.java | 7 +- .../blocks/TileEntityIWBase.java | 6 + .../blocks/TileEntityJacobsLadder.java | 72 ++++---- .../blocks/controlpanel/BlockPanel.java | 30 ++-- .../blocks/controlpanel/TileEntityPanel.java | 44 +++-- .../controlpanel/TileEntityPanelCreator.java | 69 +++----- .../controlpanel/TileEntityRSPanelConn.java | 35 ++-- .../converter/BlockMechanicalConverter.java | 23 ++- .../blocks/converter/TileEntityIEMotor.java | 19 ++- .../converter/TileEntityMechICtoIE.java | 17 +- .../converter/TileEntityMechIEtoIC.java | 13 +- .../blocks/wire/BlockIC2Connector.java | 27 +-- .../wire/TileEntityIC2ConnectorTin.java | 56 +++---- .../client/ClientEventHandler.java | 12 +- .../industrialWires/client/ClientProxy.java | 127 +++++++------- .../client/gui/GuiPanelComponent.java | 12 +- .../client/gui/GuiPanelCreator.java | 25 +-- .../client/gui/elements/GuiIntChooser.java | 16 +- .../client/panelmodel/PanelModel.java | 12 +- .../client/panelmodel/PanelModelLoader.java | 3 +- .../panelmodel/RawModelFontRenderer.java | 4 +- .../containers/ContainerPanelComponent.java | 6 +- .../containers/ContainerPanelCreator.java | 156 +++++++++++++++++- .../containers/ContainerRSPanelConn.java | 6 +- .../controlpanel/CoveredToggleSwitch.java | 3 +- .../controlpanel/IndicatorLight.java | 3 +- .../industrialWires/controlpanel/Label.java | 7 +- .../controlpanel/LightedButton.java | 5 +- .../controlpanel/PanelComponent.java | 5 +- .../controlpanel/PanelUtils.java | 25 +++ .../industrialWires/controlpanel/Slider.java | 4 +- .../controlpanel/ToggleSwitch.java | 3 +- .../industrialWires/controlpanel/Variac.java | 6 +- .../crafting/RecipeCoilLength.java | 27 +-- .../industrialWires/items/ItemIC2Coil.java | 46 +++--- .../items/ItemPanelComponent.java | 15 +- .../network/MessageComponentSync.java | 6 +- .../network/MessageGUIInteract.java | 4 +- .../network/MessagePanelInteract.java | 8 +- .../util/DualEnergyStorage.java | 8 +- .../industrialWires/util/MiscUtils.java | 21 --- .../resources/META-INF/IndustrialWires_at.cfg | 1 - .../{ic2Connector.json => ic2_connector.json} | 38 ++--- .../blockstates/mechanical_converter.json | 2 +- .../assets/industrialwires/lang/en_US.lang | 98 +++++------ .../{iwSixSides.json => iw_six_sides.json} | 0 .../models/item/ic2_wire_coil/copper.json | 6 + .../models/item/ic2_wire_coil/glass.json | 6 + .../models/item/ic2_wire_coil/gold.json | 6 + .../models/item/ic2_wire_coil/hv.json | 6 + .../models/item/ic2_wire_coil/tin.json | 6 + .../models/item/ic2wireCoil/copper.json | 6 - .../models/item/ic2wireCoil/glass.json | 6 - .../models/item/ic2wireCoil/gold.json | 6 - .../models/item/ic2wireCoil/hv.json | 6 - .../models/item/ic2wireCoil/tin.json | 6 - ...ic2_connCopper.png => ic2_conn_copper.png} | Bin .../{ic2_connGlass.png => ic2_conn_glass.png} | Bin .../{ic2_connGold.png => ic2_conn_gold.png} | Bin .../{ic2_connHV.png => ic2_conn_hv.png} | Bin .../{ic2_connTin.png => ic2_conn_tin.png} | Bin ...2_relayCopper.png => ic2_relay_copper.png} | Bin ...ic2_relayGlass.png => ic2_relay_glass.png} | Bin .../{ic2_relayGold.png => ic2_relay_gold.png} | Bin .../{ic2_relayTin.png => ic2_relay_tin.png} | Bin ...ic2_wireCopper.png => ic2_wire_copper.png} | Bin .../{ic2_wireGlass.png => ic2_wire_glass.png} | Bin .../{ic2_wireGold.png => ic2_wire_gold.png} | Bin .../items/{ic2_wireHV.png => ic2_wire_hv.png} | Bin .../{ic2_wireTin.png => ic2_wire_tin.png} | Bin src/main/resources/mcmod.info | 2 +- 79 files changed, 749 insertions(+), 570 deletions(-) delete mode 100644 src/main/resources/META-INF/IndustrialWires_at.cfg rename src/main/resources/assets/industrialwires/blockstates/{ic2Connector.json => ic2_connector.json} (85%) rename src/main/resources/assets/industrialwires/models/block/{iwSixSides.json => iw_six_sides.json} (100%) create mode 100644 src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/copper.json create mode 100644 src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/glass.json create mode 100644 src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/gold.json create mode 100644 src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/hv.json create mode 100644 src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/tin.json delete mode 100644 src/main/resources/assets/industrialwires/models/item/ic2wireCoil/copper.json delete mode 100644 src/main/resources/assets/industrialwires/models/item/ic2wireCoil/glass.json delete mode 100644 src/main/resources/assets/industrialwires/models/item/ic2wireCoil/gold.json delete mode 100644 src/main/resources/assets/industrialwires/models/item/ic2wireCoil/hv.json delete mode 100644 src/main/resources/assets/industrialwires/models/item/ic2wireCoil/tin.json rename src/main/resources/assets/industrialwires/textures/blocks/{ic2_connCopper.png => ic2_conn_copper.png} (100%) rename src/main/resources/assets/industrialwires/textures/blocks/{ic2_connGlass.png => ic2_conn_glass.png} (100%) rename src/main/resources/assets/industrialwires/textures/blocks/{ic2_connGold.png => ic2_conn_gold.png} (100%) rename src/main/resources/assets/industrialwires/textures/blocks/{ic2_connHV.png => ic2_conn_hv.png} (100%) rename src/main/resources/assets/industrialwires/textures/blocks/{ic2_connTin.png => ic2_conn_tin.png} (100%) rename src/main/resources/assets/industrialwires/textures/blocks/{ic2_relayCopper.png => ic2_relay_copper.png} (100%) rename src/main/resources/assets/industrialwires/textures/blocks/{ic2_relayGlass.png => ic2_relay_glass.png} (100%) rename src/main/resources/assets/industrialwires/textures/blocks/{ic2_relayGold.png => ic2_relay_gold.png} (100%) rename src/main/resources/assets/industrialwires/textures/blocks/{ic2_relayTin.png => ic2_relay_tin.png} (100%) rename src/main/resources/assets/industrialwires/textures/items/{ic2_wireCopper.png => ic2_wire_copper.png} (100%) rename src/main/resources/assets/industrialwires/textures/items/{ic2_wireGlass.png => ic2_wire_glass.png} (100%) rename src/main/resources/assets/industrialwires/textures/items/{ic2_wireGold.png => ic2_wire_gold.png} (100%) rename src/main/resources/assets/industrialwires/textures/items/{ic2_wireHV.png => ic2_wire_hv.png} (100%) rename src/main/resources/assets/industrialwires/textures/items/{ic2_wireTin.png => ic2_wire_tin.png} (100%) diff --git a/.gitignore b/.gitignore index 45b9159..7c88c14 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ build eclipse run libs +classes \ No newline at end of file diff --git a/build.gradle b/build.gradle index 265873b..7e3a8b5 100644 --- a/build.gradle +++ b/build.gradle @@ -48,13 +48,11 @@ sourceCompatibility = 1.8 targetCompatibility = 1.8 minecraft { - version = "12.18.3.2234" + version = "13.20.0.2282" runDir = "run" replace '${version}', project.version - mappings = "snapshot_20160701" - //"snapshot_20160518" 1.9 - // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. + mappings = "snapshot_20170323" } repositories { @@ -69,8 +67,8 @@ repositories { } dependencies { - deobfCompile "net.industrial-craft:industrialcraft-2:2.6.+" - deobfCompile "blusunrize:ImmersiveEngineering:0.10-+:deobf" + deobfCompile "net.industrial-craft:industrialcraft-2:2.7.+:dev" + deobfCompile "blusunrize:ImmersiveEngineering:0.11-+:deobf" } jar { diff --git a/src/main/java/malte0811/industrialWires/CommonProxy.java b/src/main/java/malte0811/industrialWires/CommonProxy.java index 3d4ba8d..dbdf000 100644 --- a/src/main/java/malte0811/industrialWires/CommonProxy.java +++ b/src/main/java/malte0811/industrialWires/CommonProxy.java @@ -60,7 +60,7 @@ public class CommonProxy implements IGuiHandler { } else if (ID == 1) {//ITEM GUI EnumHand h = z == 1 ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND; ItemStack held = player.getHeldItem(h); - if (held != null && held.getItem() == IndustrialWires.panelComponent) { + if (!held.isEmpty() && held.getItem() == IndustrialWires.panelComponent) { return new ContainerPanelComponent(h); } } diff --git a/src/main/java/malte0811/industrialWires/IIC2Connector.java b/src/main/java/malte0811/industrialWires/IIC2Connector.java index 92ceec2..c5ed997 100644 --- a/src/main/java/malte0811/industrialWires/IIC2Connector.java +++ b/src/main/java/malte0811/industrialWires/IIC2Connector.java @@ -21,5 +21,5 @@ public interface IIC2Connector { /** * @return leftover energy. */ - public double insertEnergy(double eu, boolean simulate); + double insertEnergy(double eu, boolean simulate); } diff --git a/src/main/java/malte0811/industrialWires/IndustrialWires.java b/src/main/java/malte0811/industrialWires/IndustrialWires.java index 2555b92..d06dbda 100644 --- a/src/main/java/malte0811/industrialWires/IndustrialWires.java +++ b/src/main/java/malte0811/industrialWires/IndustrialWires.java @@ -44,8 +44,8 @@ import malte0811.industrialWires.network.MessageTileSyncIW; import malte0811.industrialWires.wires.IC2Wiretype; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.SidedProxy; @@ -64,7 +64,7 @@ import net.minecraftforge.oredict.ShapelessOreRecipe; import java.util.ArrayList; import java.util.List; -@Mod(modid = IndustrialWires.MODID, version = IndustrialWires.VERSION, dependencies="required-after:immersiveengineering@[0.10-58,);required-after:IC2") +@Mod(modid = IndustrialWires.MODID, version = IndustrialWires.VERSION, dependencies = "required-after:immersiveengineering@[0.10-58,);required-after:ic2") public class IndustrialWires { public static final String MODID = "industrialwires"; public static final String VERSION = "${version}"; @@ -80,10 +80,7 @@ public class IndustrialWires { public static CreativeTabs creativeTab = new CreativeTabs(MODID) { @Override - public Item getTabIconItem() { - return null; - } - public ItemStack getIconItemStack() { + public ItemStack getTabIconItem() { return new ItemStack(coil, 1, 2); } }; @@ -100,12 +97,11 @@ public class IndustrialWires { coil = new ItemIC2Coil(); panelComponent = new ItemPanelComponent(); panel = new BlockPanel(); - //TODO change to MODID+ when changing to a new MC version - 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(TileEntityIC2ConnectorTin.class, MODID + "ic2ConnectorTin"); + GameRegistry.registerTileEntity(TileEntityIC2ConnectorCopper.class, MODID + "ic2ConnectorCopper"); + GameRegistry.registerTileEntity(TileEntityIC2ConnectorGold.class, MODID + "ic2ConnectorGold"); + GameRegistry.registerTileEntity(TileEntityIC2ConnectorHV.class, MODID + "ic2ConnectorHV"); + GameRegistry.registerTileEntity(TileEntityIC2ConnectorGlass.class, MODID + "ic2ConnectorGlass"); GameRegistry.registerTileEntity(TileEntityJacobsLadder.class, MODID+":jacobsLadder"); GameRegistry.registerTileEntity(TileEntityPanel.class, MODID+":control_panel"); GameRegistry.registerTileEntity(TileEntityRSPanelConn.class, MODID+":control_panel_rs"); @@ -210,19 +206,19 @@ public class IndustrialWires { } private class CoilLengthAdapter implements IRecipeAdapter { @Override - public RecipeQuery[] getQueriedInputs(RecipeCoilLength recipe, ItemStack[] in) { + public RecipeQuery[] getQueriedInputs(RecipeCoilLength recipe, NonNullList in) { List ret = new ArrayList<>(); - for (int i = 0;i collidingBoxes, @Nullable Entity entityIn) { - AxisAlignedBB axisalignedbb = getBoundingBox(state, worldIn, pos).offset(pos); - if (entityBox.intersectsWith(axisalignedbb)) { - collidingBoxes.add(axisalignedbb); - } - } - + @Nonnull @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { TileEntity te = source.getTileEntity(pos); @@ -152,8 +140,9 @@ public abstract class BlockIWBase extends Block { //mostly copied from IE @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, - EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { + EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { TileEntity te = world.getTileEntity(pos); + ItemStack heldItem = player.getHeldItem(hand); if(te instanceof IEBlockInterfaces.IDirectionalTile && Utils.isHammer(heldItem) && !world.isRemote) { IEBlockInterfaces.IDirectionalTile directionalTe = (IEBlockInterfaces.IDirectionalTile) te; if (directionalTe.canHammerRotate(side, hitX, hitY, hitZ, player)) { @@ -196,10 +185,10 @@ public abstract class BlockIWBase extends Block { } @Override - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, @Nullable ItemStack stack) { + public void harvestBlock(@Nonnull World worldIn, EntityPlayer player, @Nonnull BlockPos pos, @Nonnull IBlockState state, TileEntity te, ItemStack stack) { if (te instanceof IEBlockInterfaces.ITileDrop) { ItemStack drop = ((IEBlockInterfaces.ITileDrop) te).getTileDrop(player, state); - if (drop!=null) { + if (!drop.isEmpty()) { spawnAsEntity(worldIn, pos, drop); return; } @@ -208,7 +197,7 @@ public abstract class BlockIWBase extends Block { } @Override - public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) { + public boolean rotateBlock(World world, @Nonnull BlockPos pos, @Nonnull EnumFacing axis) { return false; } diff --git a/src/main/java/malte0811/industrialWires/blocks/BlockJacobsLadder.java b/src/main/java/malte0811/industrialWires/blocks/BlockJacobsLadder.java index 4765745..3bdaadc 100644 --- a/src/main/java/malte0811/industrialWires/blocks/BlockJacobsLadder.java +++ b/src/main/java/malte0811/industrialWires/blocks/BlockJacobsLadder.java @@ -34,13 +34,13 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing.AxisDirection; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import javax.annotation.Nullable; -import java.util.List; +import javax.annotation.Nonnull; public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacementCheck { private static PropertyEnum size_property = PropertyEnum.create("size", LadderSize.class); @@ -49,8 +49,9 @@ public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacem super(Material.IRON, "jacobs_ladder"); } + @Nonnull @Override - public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { + public IBlockState getActualState(@Nonnull IBlockState state, IBlockAccess worldIn, BlockPos pos) { state = super.getActualState(state, worldIn, pos); TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityJacobsLadder) { @@ -71,13 +72,14 @@ public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacem return state.getValue(size_property).ordinal(); } + @Nonnull @Override public IBlockState getStateFromMeta(int meta) { return super.getStateFromMeta(meta).withProperty(size_property, LadderSize.values()[meta]); } @Override - public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) { + public void getSubBlocks(@Nonnull Item itemIn, CreativeTabs tab, NonNullList list) { for (int i = 0; i < LadderSize.values().length; i++) { list.add(new ItemStack(this, 1, i)); } @@ -94,7 +96,7 @@ public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacem } @Override - public TileEntity createTileEntity(World world, IBlockState state) { + public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) { return new TileEntityJacobsLadder(state.getValue(size_property)); } @@ -118,8 +120,10 @@ public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacem return false; } + @Nonnull @Override - public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, ItemStack stack) { + public IBlockState getStateForPlacement(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing facing, + float hitX, float hitY, float hitZ, int meta, @Nonnull EntityLivingBase placer, EnumHand hand) { EnumFacing f = facing.getOpposite(); if (facing.getAxis() == EnumFacing.Axis.Y) { double dX = hitX - .5; @@ -130,11 +134,12 @@ public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacem f = EnumFacing.getFacingFromAxis(dZ > 0 ? AxisDirection.POSITIVE : AxisDirection.NEGATIVE, EnumFacing.Axis.Z); } } - return super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, stack).withProperty(IEProperties.FACING_HORIZONTAL, f); + return super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand).withProperty(IEProperties.FACING_HORIZONTAL, f); } + @Nonnull @Override - public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { + public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) { return new ItemStack(this, 1, getMetaFromState(state)); } @@ -148,12 +153,12 @@ public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacem } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { TileEntity te = worldIn.getTileEntity(pos); if (te instanceof TileEntityJacobsLadder) { - return ((TileEntityJacobsLadder) te).onActivated(playerIn, hand, heldItem); + return ((TileEntityJacobsLadder) te).onActivated(playerIn, hand); } - return super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ); + return super.onBlockActivated(worldIn, pos, state, playerIn, hand, side, hitX, hitY, hitZ); } @Override @@ -168,7 +173,7 @@ public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacem } @Override - public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) { + public boolean rotateBlock(World world, @Nonnull BlockPos pos, @Nonnull EnumFacing axis) { TileEntity te = world.getTileEntity(pos); return te instanceof TileEntityJacobsLadder && ((TileEntityJacobsLadder) te).rotate(world, pos, axis); } diff --git a/src/main/java/malte0811/industrialWires/blocks/EnergyAdapter.java b/src/main/java/malte0811/industrialWires/blocks/EnergyAdapter.java index 53f066d..9293a00 100644 --- a/src/main/java/malte0811/industrialWires/blocks/EnergyAdapter.java +++ b/src/main/java/malte0811/industrialWires/blocks/EnergyAdapter.java @@ -25,16 +25,14 @@ import net.minecraftforge.energy.IEnergyStorage; public class EnergyAdapter implements IEnergyStorage { /** - * 3 different copies of the same thing, the TE this adapter is mirroring. + * 2 different copies of the same thing, the TE this adapter is mirroring. * rec and prov are null if the TE does not implement them */ - IFluxConnection tile; - IFluxReceiver rec; - IFluxProvider prov; - - EnumFacing dir; + private IFluxReceiver rec; + private IFluxProvider prov; + + private EnumFacing dir; public EnergyAdapter(IFluxConnection te, EnumFacing f) { - tile = te; dir = f; if (te instanceof IFluxReceiver) { rec = (IFluxReceiver) te; diff --git a/src/main/java/malte0811/industrialWires/blocks/ItemBlockIW.java b/src/main/java/malte0811/industrialWires/blocks/ItemBlockIW.java index 8990d62..73bee1c 100644 --- a/src/main/java/malte0811/industrialWires/blocks/ItemBlockIW.java +++ b/src/main/java/malte0811/industrialWires/blocks/ItemBlockIW.java @@ -28,6 +28,8 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import javax.annotation.Nonnull; + public class ItemBlockIW extends ItemBlock { private final Object[] values; public ItemBlockIW(Block b) { @@ -39,6 +41,8 @@ public class ItemBlockIW extends ItemBlock { } hasSubtypes = true; } + + @Nonnull @Override public String getUnlocalizedName(ItemStack stack) { int meta = stack.getMetadata(); @@ -54,7 +58,8 @@ public class ItemBlockIW extends ItemBlock { } @Override - public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) { + public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, World world, @Nonnull BlockPos pos, + EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull IBlockState newState) { if (block instanceof IPlacementCheck&&!((IPlacementCheck) block).canPlaceBlockAt(world, pos, stack)) { return false; } diff --git a/src/main/java/malte0811/industrialWires/blocks/TileEntityIWBase.java b/src/main/java/malte0811/industrialWires/blocks/TileEntityIWBase.java index faf1656..285ff78 100644 --- a/src/main/java/malte0811/industrialWires/blocks/TileEntityIWBase.java +++ b/src/main/java/malte0811/industrialWires/blocks/TileEntityIWBase.java @@ -22,10 +22,14 @@ import net.minecraft.network.NetworkManager; import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; +import javax.annotation.Nonnull; + public abstract class TileEntityIWBase extends TileEntity { protected static final String ENERGY_TAG = "energy"; protected static final String BUFFER_TAG = "buffer"; protected static final String DIR_TAG = "dir"; + + @Nonnull @Override public NBTTagCompound getUpdateTag() { NBTTagCompound nbt = super.getUpdateTag(); @@ -36,6 +40,8 @@ public abstract class TileEntityIWBase extends TileEntity { public SPacketUpdateTileEntity getUpdatePacket() { return new SPacketUpdateTileEntity(pos, getBlockMetadata(), getUpdateTag()); } + + @Nonnull @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { writeNBT(compound, false); diff --git a/src/main/java/malte0811/industrialWires/blocks/TileEntityJacobsLadder.java b/src/main/java/malte0811/industrialWires/blocks/TileEntityJacobsLadder.java index 1b2ae20..90dcab5 100644 --- a/src/main/java/malte0811/industrialWires/blocks/TileEntityJacobsLadder.java +++ b/src/main/java/malte0811/industrialWires/blocks/TileEntityJacobsLadder.java @@ -50,6 +50,7 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; +import javax.annotation.Nonnull; import javax.annotation.Nullable; public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickable, IHasDummyBlocksIW, ISyncReceiver, IEnergySink, IBlockBoundsIW, IDirectionalTile { @@ -96,7 +97,7 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl if (isDummy()) { return; } - if (!worldObj.isRemote) { + if (!world.isRemote) { if (!addedToIC2Net) { MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); addedToIC2Net = true; @@ -106,16 +107,16 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl double y = j * (size.height + size.extraHeight) / (double) (size.movementPoints - 1) + size.innerPointOffset; double width = widthFromHeight(y); for (int i = 0; i < size.arcPoints - 2; i++) { - double z = size.zMax * 2 * (worldObj.rand.nextDouble() - .5); + double z = size.zMax * 2 * (world.rand.nextDouble() - .5); double xMin = width * i / (double) (size.arcPoints - 2) - width / 2 + size.bottomDistance / 2; double xDiff = width / (double) (size.arcPoints - 2); - double x = worldObj.rand.nextDouble() * xDiff + xMin; + double x = world.rand.nextDouble() * xDiff + xMin; controlControls[i][j] = new Vec3d(x, y, z); } } t = 0; timeTillActive = size.delay; - tStep = 1D / (int) (.875 * size.tickToTop + worldObj.rand.nextInt(size.tickToTop / 4)); + tStep = 1D / (int) (.875 * size.tickToTop + world.rand.nextInt(size.tickToTop / 4)); IndustrialWires.packetHandler.sendToAll(new MessageTileSyncIW(this, writeArcStarter())); } else if (timeTillActive == 0 && t < 1) { double extracted = energy.extractEU(consumtionEU, false); @@ -192,7 +193,7 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl } @Override - public void readCustomNBT(NBTTagCompound nbt, boolean descPacket) { + public void readCustomNBT(@Nonnull NBTTagCompound nbt, boolean descPacket) { LadderSize oldSize = size; size = LadderSize.values()[nbt.getInteger("size")]; if (size != oldSize) { @@ -205,7 +206,7 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl } @Override - public void writeCustomNBT(NBTTagCompound nbt, boolean descPacket) { + public void writeCustomNBT(@Nonnull NBTTagCompound nbt, boolean descPacket) { nbt.setInteger("size", size.ordinal()); nbt.setInteger("dummy", dummy); energy.writeToNbt(nbt, "energy"); @@ -275,8 +276,8 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl public void placeDummies(IBlockState state) { for (int i = 1; i <= size.dummyCount; i++) { BlockPos pos2 = pos.offset(EnumFacing.UP, i); - worldObj.setBlockState(pos2, state); - TileEntity te = worldObj.getTileEntity(pos2); + world.setBlockState(pos2, state); + TileEntity te = world.getTileEntity(pos2); if (te instanceof TileEntityJacobsLadder) { ((TileEntityJacobsLadder) te).size = size; ((TileEntityJacobsLadder) te).dummy = i; @@ -288,8 +289,8 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl @Override public void breakDummies() { for (int i = 0; i <= size.dummyCount; i++) { - if (i != dummy && worldObj.getTileEntity(pos.offset(EnumFacing.UP, i - dummy)) instanceof TileEntityJacobsLadder) { - worldObj.setBlockToAir(pos.offset(EnumFacing.UP, i - dummy)); + if (i != dummy && world.getTileEntity(pos.offset(EnumFacing.UP, i - dummy)) instanceof TileEntityJacobsLadder) { + world.setBlockToAir(pos.offset(EnumFacing.UP, i - dummy)); } } } @@ -309,15 +310,15 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl public boolean isActive() { if (isDummy()) { - TileEntity master = worldObj.getTileEntity(pos.down(dummy)); + TileEntity master = world.getTileEntity(pos.down(dummy)); return master instanceof TileEntityJacobsLadder&&((TileEntityJacobsLadder) master).isActive(); } return timeTillActive == 0 && t < 1; } public void onEntityTouch(Entity e) { - if (isDummy() && !worldObj.isRemote) { - TileEntity master = worldObj.getTileEntity(pos.down(dummy)); + if (isDummy() && !world.isRemote) { + TileEntity master = world.getTileEntity(pos.down(dummy)); if (master instanceof TileEntityJacobsLadder && ((TileEntityJacobsLadder) master).isActive()) { hurtEntity(e); } @@ -328,17 +329,18 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl e.attackEntityFrom(new DamageSource("industrialwires.jacobs_ladder"), IWConfig.HVStuff.jacobsBaseDmg * (size.ordinal() + 1)); } - public boolean onActivated(EntityPlayer playerIn, EnumHand hand, ItemStack heldItem) { - TileEntity masterTE = dummy == 0 ? this : worldObj.getTileEntity(pos.down(dummy)); + public boolean onActivated(EntityPlayer player, EnumHand hand) { + ItemStack heldItem = player.getHeldItem(hand); + TileEntity masterTE = dummy == 0 ? this : world.getTileEntity(pos.down(dummy)); if (masterTE instanceof TileEntityJacobsLadder) { TileEntityJacobsLadder master = (TileEntityJacobsLadder) masterTE; if (master.isActive()) { - if (!worldObj.isRemote) { - hurtEntity(playerIn); + if (!world.isRemote) { + hurtEntity(player); } return true; - } else if (heldItem != null && ApiUtils.compareToOreName(heldItem, "itemSalt")) { - return master.salt(playerIn, hand, heldItem); + } else if (!heldItem.isEmpty() && ApiUtils.compareToOreName(heldItem, "itemSalt")) { + return master.salt(player, hand, heldItem); } } return false; @@ -346,12 +348,12 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl private boolean salt(EntityPlayer player, EnumHand hand, ItemStack held) { if (salt < 3) { - if (!worldObj.isRemote) { + if (!world.isRemote) { salt++; if (!player.isCreative()) { - held.stackSize--; - if (held.stackSize <= 0) { - player.setHeldItem(hand, null); + held.shrink(1); + if (held.getCount() <= 0) { + player.setHeldItem(hand, ItemStack.EMPTY); } } NBTTagCompound update = new NBTTagCompound(); @@ -368,7 +370,7 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl if (isActive()) { return false; } - if (!worldObj.isRemote) { + if (!world.isRemote) { EnumFacing targetDir = facing.rotateAround(EnumFacing.Axis.Y); for (int i = -dummy;i capability, @Nullable EnumFacing from) { + public boolean hasCapability(@Nonnull Capability capability, @Nullable EnumFacing from) { return !isDummy() && from == facing && capability == CapabilityEnergy.ENERGY; } @Override @SuppressWarnings("unchecked") - public T getCapability(Capability capability, @Nullable EnumFacing facing) { + public T getCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { if (hasCapability(capability, facing)) { if (capability == CapabilityEnergy.ENERGY) { return (T) new EnergyCap(); @@ -427,7 +429,7 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl @Override public void onChunkUnload() { - if (!worldObj.isRemote && addedToIC2Net) + if (!world.isRemote && addedToIC2Net) MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); addedToIC2Net = false; super.onChunkUnload(); @@ -435,9 +437,9 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl @Override public void invalidate() { - if (!worldObj.isRemote && addedToIC2Net) { + if (!world.isRemote && addedToIC2Net) { MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); - } else if (worldObj.isRemote) { + } else if (world.isRemote) { //stop sound IndustrialWires.proxy.playJacobsLadderSound(this, -1, soundPos); } @@ -445,6 +447,7 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl super.invalidate(); } + @Nonnull @Override public AxisAlignedBB getRenderBoundingBox() { return new AxisAlignedBB(pos, pos.add(1, 2, 1)); @@ -472,13 +475,14 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl } } + @Nonnull @Override public EnumFacing getFacing() { return facing; } @Override - public void setFacing(EnumFacing facing) { + public void setFacing(@Nonnull EnumFacing facing) { this.facing = facing; } @@ -488,17 +492,17 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl } @Override - public boolean mirrorFacingOnPlacement(EntityLivingBase placer) { + public boolean mirrorFacingOnPlacement(@Nonnull EntityLivingBase placer) { return true; } @Override - public boolean canHammerRotate(EnumFacing side, float hitX, float hitY, float hitZ, EntityLivingBase entity) { + public boolean canHammerRotate(@Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull EntityLivingBase entity) { return false; } @Override - public boolean canRotate(EnumFacing axis) { + public boolean canRotate(@Nonnull EnumFacing axis) { return false; } diff --git a/src/main/java/malte0811/industrialWires/blocks/controlpanel/BlockPanel.java b/src/main/java/malte0811/industrialWires/blocks/controlpanel/BlockPanel.java index a5c0d68..1bc9d0b 100644 --- a/src/main/java/malte0811/industrialWires/blocks/controlpanel/BlockPanel.java +++ b/src/main/java/malte0811/industrialWires/blocks/controlpanel/BlockPanel.java @@ -35,6 +35,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; @@ -43,7 +44,7 @@ import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; -import java.util.List; +import javax.annotation.Nonnull; public class BlockPanel extends BlockIWBase implements IMetaEnum { public static final PropertyEnum type = PropertyEnum.create("type", BlockTypes_Panel.class); @@ -65,7 +66,7 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum { } @Override - public TileEntity createTileEntity(World world, IBlockState state) { + public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) { switch(state.getValue(type)) { case TOP: return new TileEntityPanel(); @@ -88,6 +89,7 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum { return new IProperty[]{IEProperties.FACING_ALL, type}; } + @Nonnull @Override protected BlockStateContainer createBlockState() { BlockStateContainer base = super.createBlockState(); @@ -96,8 +98,9 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum { }); } + @Nonnull @Override - public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { + public IBlockState getActualState(@Nonnull IBlockState state, IBlockAccess worldIn, BlockPos pos) { state = super.getActualState(state, worldIn, pos); TileEntity te = worldIn.getTileEntity(pos); if (te instanceof TileEntityPanel) { @@ -109,8 +112,9 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum { return state; } + @Nonnull @Override - public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { + public IBlockState getExtendedState(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) { state = super.getExtendedState(state, world, pos); if (state instanceof IExtendedBlockState) { TileEntity te = world.getTileEntity(pos); @@ -137,7 +141,7 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum { } @Override - public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) { + public void getSubBlocks(@Nonnull Item itemIn, CreativeTabs tab, NonNullList list) { list.add(new ItemStack(itemIn, 1, 0)); list.add(new ItemStack(itemIn, 1, 1)); list.add(new ItemStack(itemIn, 1, 2)); @@ -159,14 +163,15 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum { public boolean isOpaqueCube(IBlockState state) { return false; } - @Override - public boolean isVisuallyOpaque() { - return false; - } + /* @Override TODO do I not need this any more? + public boolean isVisuallyOpaque() { + return false; + } + */ @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { - if (!super.onBlockActivated(world, pos, state, player, hand, heldItem, side, hitX, hitY, hitZ)&&hand==EnumHand.MAIN_HAND) { + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { + if (!super.onBlockActivated(world, pos, state, player, hand, side, hitX, hitY, hitZ) && hand == EnumHand.MAIN_HAND) { TileEntity te = world.getTileEntity(pos); if (te instanceof TileEntityRSPanelConn){ if (!world.isRemote) { @@ -186,7 +191,8 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum { } @Override - public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { + @Nonnull + public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) { if (state.getValue(type)==BlockTypes_Panel.TOP) { TileEntity te = world.getTileEntity(pos); if (te instanceof TileEntityPanel) { diff --git a/src/main/java/malte0811/industrialWires/blocks/controlpanel/TileEntityPanel.java b/src/main/java/malte0811/industrialWires/blocks/controlpanel/TileEntityPanel.java index 494755a..7bcfccd 100644 --- a/src/main/java/malte0811/industrialWires/blocks/controlpanel/TileEntityPanel.java +++ b/src/main/java/malte0811/industrialWires/blocks/controlpanel/TileEntityPanel.java @@ -27,7 +27,6 @@ import malte0811.industrialWires.blocks.IBlockBoundsIW; import malte0811.industrialWires.blocks.TileEntityIWBase; import malte0811.industrialWires.controlpanel.*; import malte0811.industrialWires.network.MessagePanelInteract; -import malte0811.industrialWires.util.MiscUtils; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.entity.EntityLivingBase; @@ -48,6 +47,7 @@ import net.minecraft.util.math.Vec3d; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.HashSet; import java.util.List; @@ -78,11 +78,6 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil components.add(lbl); components.add(btn); } - Slider slid = new Slider(.5F, 0x00ff00, true, 1, (byte) 1); - slid.setX(.4F); - slid.setY(.25F); - slid.setPanelHeight(components.height); - //components.add(slid); } @Override @@ -90,11 +85,11 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil for (PanelComponent pc : components) { pc.update(this); } - if (!worldObj.isRemote) { + if (!world.isRemote) { if (firstTick) { - List parts = MiscUtils.discoverPanelParts(worldObj, pos); + List parts = PanelUtils.discoverPanelParts(world, pos); for (BlockPos bp : parts) { - TileEntity te = worldObj.getTileEntity(bp); + TileEntity te = world.getTileEntity(bp); if (te instanceof TileEntityRSPanelConn&&!rsPorts.contains(te)) { ((TileEntityRSPanelConn) te).registerPanel(this); } @@ -119,7 +114,8 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil } @Override - public ItemStack getTileDrop(EntityPlayer player, IBlockState state) { + @Nonnull + public ItemStack getTileDrop(@Nonnull EntityPlayer player, @Nonnull IBlockState state) { NBTTagCompound ret = new NBTTagCompound(); writeToItemNBT(ret, true); ItemStack retStack = new ItemStack(IndustrialWires.panel, 1, BlockTypes_Panel.TOP.ordinal()); @@ -128,8 +124,8 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil } @Override - public void readOnPlacement(@Nullable EntityLivingBase placer, ItemStack stack) { - if (stack.hasTagCompound()) { + public void readOnPlacement(@Nullable EntityLivingBase placer, @Nonnull ItemStack stack) { + if (!stack.isEmpty() && stack.hasTagCompound()) { readFromItemNBT(stack.getTagCompound()); } } @@ -154,13 +150,14 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil nbt.setFloat("height", components.height); } + @Nonnull @Override public EnumFacing getFacing() { return components.facing; } @Override - public void setFacing(EnumFacing facing) { + public void setFacing(@Nonnull EnumFacing facing) { this.components.facing = facing; } @@ -169,8 +166,9 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil return 0; } + @Nonnull @Override - public EnumFacing getFacingForPlacement(EntityLivingBase placer, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { + public EnumFacing getFacingForPlacement(@Nonnull EntityLivingBase placer, @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ) { switch (side) { case UP: components.top = EnumFacing.UP; @@ -189,17 +187,17 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil } @Override - public boolean mirrorFacingOnPlacement(EntityLivingBase placer) { + public boolean mirrorFacingOnPlacement(@Nonnull EntityLivingBase placer) { return false; } @Override - public boolean canHammerRotate(EnumFacing side, float hitX, float hitY, float hitZ, EntityLivingBase entity) { + public boolean canHammerRotate(@Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull EntityLivingBase entity) { return false; } @Override - public boolean canRotate(EnumFacing axis) { + public boolean canRotate(@Nonnull EnumFacing axis) { return false; } @@ -230,7 +228,7 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil Matrix4 mat = components.getPanelTopTransform(); PanelComponent retPc = null; RayTraceResult retRay = null; - Vec3d playerPos = Minecraft.getMinecraft().thePlayer.getPositionVector().addVector(-pos.getX(), player.getEyeHeight() - pos.getY(), -pos.getZ()); + Vec3d playerPos = Minecraft.getMinecraft().player.getPositionVector().addVector(-pos.getX(), player.getEyeHeight() - pos.getY(), -pos.getZ()); for (PanelComponent pc : components) { AxisAlignedBB box = pc.getBlockRelativeAABB(); if (box.maxY>box.minY) { @@ -257,8 +255,8 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil } @Override - public boolean interact(EnumFacing side, EntityPlayer player, EnumHand hand, ItemStack heldItem, float hitX, float hitY, float hitZ) { - if (worldObj.isRemote) { + public boolean interact(@Nonnull EnumFacing side, @Nonnull EntityPlayer player, @Nonnull EnumHand hand, @Nonnull ItemStack heldItem, float hitX, float hitY, float hitZ) { + if (world.isRemote) { Pair pc = getSelectedComponent(player, new Vec3d(hitX, hitY, hitZ), false); if (pc != null) { Matrix4 inv = components.getPanelTopTransform(); @@ -279,9 +277,9 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil } public void triggerRenderUpdate() { - IBlockState state = worldObj.getBlockState(pos); - worldObj.notifyBlockUpdate(pos, state, state, 3); - worldObj.addBlockEvent(pos, state.getBlock(), 255, 0); + IBlockState state = world.getBlockState(pos); + world.notifyBlockUpdate(pos, state, state, 3); + world.addBlockEvent(pos, state.getBlock(), 255, 0); } public void registerRS(TileEntityRSPanelConn te) { diff --git a/src/main/java/malte0811/industrialWires/blocks/controlpanel/TileEntityPanelCreator.java b/src/main/java/malte0811/industrialWires/blocks/controlpanel/TileEntityPanelCreator.java index 69d4c15..667633b 100644 --- a/src/main/java/malte0811/industrialWires/blocks/controlpanel/TileEntityPanelCreator.java +++ b/src/main/java/malte0811/industrialWires/blocks/controlpanel/TileEntityPanelCreator.java @@ -18,10 +18,7 @@ package malte0811.industrialWires.blocks.controlpanel; -import blusunrize.immersiveengineering.api.ApiUtils; import blusunrize.immersiveengineering.common.util.IELogger; -import blusunrize.immersiveengineering.common.util.Utils; -import blusunrize.immersiveengineering.common.util.inventory.IIEInventory; import malte0811.industrialWires.IndustrialWires; import malte0811.industrialWires.blocks.IBlockBoundsIW; import malte0811.industrialWires.blocks.INetGUI; @@ -37,27 +34,36 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.math.AxisAlignedBB; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -public class TileEntityPanelCreator extends TileEntityIWBase implements IIEInventory, INetGUI, IBlockBoundsIW { +//TODO I no longer implement IEInventory! +public class TileEntityPanelCreator extends TileEntityIWBase implements INetGUI, IBlockBoundsIW { public List components = new ArrayList<>(); public float height = 0.5F; - public ItemStack[] inv = new ItemStack[1]; + @Nonnull + public ItemStack inv = ItemStack.EMPTY; @Override public void readNBT(NBTTagCompound nbt, boolean updatePacket) { NBTTagList l = nbt.getTagList("components", 10); PanelUtils.readListFromNBT(l, components); height = nbt.getFloat("height"); - inv = Utils.readInventory(nbt.getTagList("inventory", 10), inv.length); + NBTTagCompound invTag; + if (nbt.hasKey("inventory", 9)) { + invTag = nbt.getTagList("inventory", 10).getCompoundTagAt(0); + } else { + invTag = nbt.getCompoundTag("inventory"); + } + inv = new ItemStack(invTag); } @Override public void writeNBT(NBTTagCompound nbt, boolean updatePacket) { writeToItemNBT(nbt, false); - nbt.setTag("inventory", Utils.writeInventory(inv)); + nbt.setTag("inventory", inv.serializeNBT()); } public void writeToItemNBT(NBTTagCompound nbt, boolean toItem) { @@ -71,29 +77,6 @@ public class TileEntityPanelCreator extends TileEntityIWBase implements IIEInven nbt.setFloat("height", height); } - @Override - public ItemStack[] getInventory() { - return inv; - } - - @Override - public boolean isStackValid(int slot, ItemStack stack) { - if (slot == 0) { - return ApiUtils.compareToOreName(stack, "plateIron"); - } - return true; - } - - @Override - public int getSlotLimit(int slot) { - return slot == 0 ? 1 : 64; - } - - @Override - public void doGraphicalUpdates(int slot) { - - } - @Override public void onChange(NBTTagCompound nbt, EntityPlayer p) { int type = nbt.getInteger("type"); @@ -106,10 +89,10 @@ public class TileEntityPanelCreator extends TileEntityIWBase implements IIEInven pc.setY(nbt.getFloat("y")); pc.setPanelHeight(height); components.add(pc); - if (curr != null) { - curr.stackSize--; - if (curr.stackSize <= 0) { - p.inventory.setItemStack(null); + if (!curr.isEmpty()) { + curr.shrink(1); + if (curr.getCount() <= 0) { + p.inventory.setItemStack(ItemStack.EMPTY); } p.inventory.markDirty(); } @@ -119,7 +102,7 @@ public class TileEntityPanelCreator extends TileEntityIWBase implements IIEInven break; case REMOVE: int id = nbt.getInteger("id"); - if (id >= 0 && id < components.size() && p.inventory.getItemStack() == null) { + if (id >= 0 && id < components.size() && !p.inventory.getItemStack().isEmpty()) { PanelComponent removed = components.get(id); ItemStack remItem = ItemPanelComponent.stackFromComponent(removed); p.inventory.setItemStack(remItem); @@ -128,12 +111,12 @@ public class TileEntityPanelCreator extends TileEntityIWBase implements IIEInven } break; case CREATE_PANEL: - if (ItemStack.areItemStacksEqual(PanelUtils.getPanelBase(), inv[0])) { + if (ItemStack.areItemStacksEqual(PanelUtils.getPanelBase(), inv)) { NBTTagCompound panelNBT = new NBTTagCompound(); writeToItemNBT(panelNBT, true); ItemStack panel = new ItemStack(IndustrialWires.panel, 1, BlockTypes_Panel.TOP.ordinal()); panel.setTagCompound(panelNBT); - inv[0] = panel; + inv = panel; components.clear(); } break; @@ -142,7 +125,7 @@ public class TileEntityPanelCreator extends TileEntityIWBase implements IIEInven while (it.hasNext()) { PanelComponent next = it.next(); ItemStack nextStack = ItemPanelComponent.stackFromComponent(next); - if (nextStack != null) { + if (!nextStack.isEmpty()) { if (p.inventory.addItemStackToInventory(nextStack)) { it.remove(); } @@ -152,18 +135,18 @@ public class TileEntityPanelCreator extends TileEntityIWBase implements IIEInven } break; case DISASSEMBLE: - if (components.size() == 0 && inv[0] != null && inv[0].getItem() == PanelUtils.PANEL_ITEM) { + if (components.size() == 0 && inv.getItem() == PanelUtils.PANEL_ITEM) { TileEntityPanel te = new TileEntityPanel(); - te.readFromItemNBT(inv[0].getTagCompound()); + te.readFromItemNBT(inv.getTagCompound()); components = new ArrayList<>(te.getComponents()); height = te.getComponents().height; - inv[0] = null; + inv = ItemStack.EMPTY; } break; } markDirty(); - IBlockState state = worldObj.getBlockState(pos); - worldObj.notifyBlockUpdate(pos, state, state, 3); + IBlockState state = world.getBlockState(pos); + world.notifyBlockUpdate(pos, state, state, 3); } private static final AxisAlignedBB aabb = new AxisAlignedBB(0, 0,0, 1, 14/16D, 1); diff --git a/src/main/java/malte0811/industrialWires/blocks/controlpanel/TileEntityRSPanelConn.java b/src/main/java/malte0811/industrialWires/blocks/controlpanel/TileEntityRSPanelConn.java index 5be5886..8894af8 100644 --- a/src/main/java/malte0811/industrialWires/blocks/controlpanel/TileEntityRSPanelConn.java +++ b/src/main/java/malte0811/industrialWires/blocks/controlpanel/TileEntityRSPanelConn.java @@ -29,7 +29,7 @@ import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces; import malte0811.industrialWires.blocks.IBlockBoundsIW; import malte0811.industrialWires.blocks.INetGUI; import malte0811.industrialWires.controlpanel.PanelComponent; -import malte0811.industrialWires.util.MiscUtils; +import malte0811.industrialWires.controlpanel.PanelUtils; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -68,14 +68,14 @@ public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implem @Override public void update() { - if(hasWorldObj() && !worldObj.isRemote) { + if (hasWorld() && !world.isRemote) { if (!loaded) { loaded = true; // completely reload the network network.removeFromNetwork(null); - List parts = MiscUtils.discoverPanelParts(worldObj, pos); + List parts = PanelUtils.discoverPanelParts(world, pos); for (BlockPos bp:parts) { - TileEntity te = worldObj.getTileEntity(bp); + TileEntity te = world.getTileEntity(bp); if (te instanceof TileEntityPanel) { registerPanel(((TileEntityPanel) te)); } @@ -202,9 +202,9 @@ public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implem hasConn = false; network.removeFromNetwork(this); this.markDirty(); - if(worldObj != null) { - IBlockState state = worldObj.getBlockState(pos); - worldObj.notifyBlockUpdate(pos, state,state, 3); + if (world != null) { + IBlockState state = world.getBlockState(pos); + world.notifyBlockUpdate(pos, state, state, 3); } } @@ -240,10 +240,10 @@ public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implem @Override public void onChange(NBTTagCompound nbt, EntityPlayer p) { if (nbt.hasKey("rsId")) { - List parts = MiscUtils.discoverPanelParts(worldObj, pos); + List parts = PanelUtils.discoverPanelParts(world, pos); List tes = new ArrayList<>(parts.size()); for (BlockPos bp:parts) { - TileEntity te = worldObj.getTileEntity(bp); + TileEntity te = world.getTileEntity(bp); if (te instanceof TileEntityPanel) { tes.add((TileEntityPanel) te); unregisterPanel((TileEntityPanel) te, true); @@ -255,28 +255,29 @@ public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implem registerPanel(panel); } network.updateValues(); - IBlockState state = worldObj.getBlockState(pos); - worldObj.notifyBlockUpdate(pos, state, state, 3); - worldObj.addBlockEvent(pos, state.getBlock(), 255, 0); + IBlockState state = world.getBlockState(pos); + world.notifyBlockUpdate(pos, state, state, 3); + world.addBlockEvent(pos, state.getBlock(), 255, 0); } } @Override public World getConnectorWorld() { - return worldObj; + return world; } public int getRsId() { return id; } + @Nonnull @Override public EnumFacing getFacing() { return facing; } @Override - public void setFacing(EnumFacing facing) { + public void setFacing(@Nonnull EnumFacing facing) { this.facing = facing; } @@ -286,17 +287,17 @@ public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implem } @Override - public boolean mirrorFacingOnPlacement(EntityLivingBase placer) { + public boolean mirrorFacingOnPlacement(@Nonnull EntityLivingBase placer) { return true; } @Override - public boolean canHammerRotate(EnumFacing side, float hitX, float hitY, float hitZ, EntityLivingBase entity) { + public boolean canHammerRotate(@Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull EntityLivingBase entity) { return false; } @Override - public boolean canRotate(EnumFacing axis) { + public boolean canRotate(@Nonnull EnumFacing axis) { return false; } diff --git a/src/main/java/malte0811/industrialWires/blocks/converter/BlockMechanicalConverter.java b/src/main/java/malte0811/industrialWires/blocks/converter/BlockMechanicalConverter.java index 65c083e..7dbacfc 100644 --- a/src/main/java/malte0811/industrialWires/blocks/converter/BlockMechanicalConverter.java +++ b/src/main/java/malte0811/industrialWires/blocks/converter/BlockMechanicalConverter.java @@ -31,11 +31,13 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; -import java.util.List; +import javax.annotation.Nonnull; public class BlockMechanicalConverter extends BlockIWBase implements IMetaEnum { private static PropertyEnum type = PropertyEnum.create("type", MechanicalBlockType.class); @@ -44,7 +46,7 @@ public class BlockMechanicalConverter extends BlockIWBase implements IMetaEnum { } @Override - public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) { + public void getSubBlocks(@Nonnull Item itemIn, CreativeTabs tab, NonNullList list) { for (int i = 0;i<3;i++) { list.add(new ItemStack(itemIn, 1, i)); } @@ -55,6 +57,7 @@ public class BlockMechanicalConverter extends BlockIWBase implements IMetaEnum { return new IProperty[]{type, IEProperties.FACING_ALL}; } + @Nonnull @Override public IBlockState getStateFromMeta(int meta) { return getDefaultState().withProperty(type, MechanicalBlockType.values[meta]); @@ -66,7 +69,7 @@ public class BlockMechanicalConverter extends BlockIWBase implements IMetaEnum { } @Override - public TileEntity createTileEntity(World world, IBlockState state) { + public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) { switch (state.getValue(type)) { case IE_MOTOR: return new TileEntityIEMotor(); @@ -88,18 +91,22 @@ public class BlockMechanicalConverter extends BlockIWBase implements IMetaEnum { return state.getValue(type).ordinal(); } @Override - public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, - float hitZ, int meta, EntityLivingBase placer, ItemStack stack) { - IBlockState base = super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, stack); + @Nonnull + public IBlockState getStateForPlacement(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ, int meta, @Nonnull EntityLivingBase placer, EnumHand h) { + IBlockState base = super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, h); return base.withProperty(type, MechanicalBlockType.values[meta]); } + @Override public int damageDropped(IBlockState state) { return state.getValue(type).ordinal(); } + + @Nonnull @Override - public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, - EntityPlayer player) { + public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, + EntityPlayer player) { return new ItemStack(this, 1, damageDropped(state)); } @Override diff --git a/src/main/java/malte0811/industrialWires/blocks/converter/TileEntityIEMotor.java b/src/main/java/malte0811/industrialWires/blocks/converter/TileEntityIEMotor.java index e163aa1..3d61258 100644 --- a/src/main/java/malte0811/industrialWires/blocks/converter/TileEntityIEMotor.java +++ b/src/main/java/malte0811/industrialWires/blocks/converter/TileEntityIEMotor.java @@ -34,6 +34,8 @@ import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.energy.CapabilityEnergy; +import javax.annotation.Nonnull; + public class TileEntityIEMotor extends TileEntityIWBase implements ITickable, IFluxReceiver, IDirectionalTile { public final double bufferMax = 2*MechConversion.maxIfToMech*ConversionUtil.rotPerIf(); @@ -43,7 +45,7 @@ public class TileEntityIEMotor extends TileEntityIWBase implements ITickable, IF private BlockPos receiver; @Override public void update() { - if (!worldObj.isRemote) { + if (!world.isRemote) { if (receiver==null) { receiver = pos.offset(dir); } @@ -54,7 +56,7 @@ public class TileEntityIEMotor extends TileEntityIWBase implements ITickable, IF rotBuffer += extracted*ConversionUtil.rotPerIf()*MechConversion.ifMotorEfficiency; dirty = true; } - TileEntity te = worldObj.getTileEntity(receiver); + TileEntity te = world.getTileEntity(receiver); if (te instanceof IRotationAcceptor) { ((IRotationAcceptor)te).inputRotation(rotBuffer, dir); rotBuffer = 0; @@ -106,12 +108,13 @@ public class TileEntityIEMotor extends TileEntityIWBase implements ITickable, IF } // Directional + @Nonnull @Override public EnumFacing getFacing() { return dir; } @Override - public void setFacing(EnumFacing facing) { + public void setFacing(@Nonnull EnumFacing facing) { dir = facing; receiver = null; markDirty(); @@ -121,15 +124,15 @@ public class TileEntityIEMotor extends TileEntityIWBase implements ITickable, IF return 1; } @Override - public boolean mirrorFacingOnPlacement(EntityLivingBase placer) { + public boolean mirrorFacingOnPlacement(@Nonnull EntityLivingBase placer) { return false; } @Override - public boolean canHammerRotate(EnumFacing side, float hitX, float hitY, float hitZ, EntityLivingBase entity) { + public boolean canHammerRotate(@Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull EntityLivingBase entity) { return true; } @Override - public boolean hasCapability(Capability capability, EnumFacing facing) { + public boolean hasCapability(@Nonnull Capability capability, EnumFacing facing) { if (capability==CapabilityEnergy.ENERGY&&canConnectEnergy(facing)) { return true; } @@ -137,7 +140,7 @@ public class TileEntityIEMotor extends TileEntityIWBase implements ITickable, IF } @Override @SuppressWarnings("unchecked") - public T getCapability(Capability capability, EnumFacing facing) { + public T getCapability(@Nonnull Capability capability, EnumFacing facing) { if (capability==CapabilityEnergy.ENERGY&&canConnectEnergy(facing)) { return (T) new EnergyAdapter(this, facing); } @@ -145,7 +148,7 @@ public class TileEntityIEMotor extends TileEntityIWBase implements ITickable, IF } @Override - public boolean canRotate(EnumFacing axis) { + public boolean canRotate(@Nonnull EnumFacing axis) { return true; } } diff --git a/src/main/java/malte0811/industrialWires/blocks/converter/TileEntityMechICtoIE.java b/src/main/java/malte0811/industrialWires/blocks/converter/TileEntityMechICtoIE.java index 2f54244..e2c7fe0 100644 --- a/src/main/java/malte0811/industrialWires/blocks/converter/TileEntityMechICtoIE.java +++ b/src/main/java/malte0811/industrialWires/blocks/converter/TileEntityMechICtoIE.java @@ -30,6 +30,8 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; import net.minecraft.util.math.BlockPos; +import javax.annotation.Nonnull; + public class TileEntityMechICtoIE extends TileEntityIWBase implements IDirectionalTile, ITickable { EnumFacing dir = EnumFacing.DOWN; int kinBuffer = 0; @@ -39,14 +41,14 @@ public class TileEntityMechICtoIE extends TileEntityIWBase implements IDirection BlockPos from; @Override public void update() { - if (!worldObj.isRemote) { + if (!world.isRemote) { if (to==null) { to = pos.offset(dir); } if (from==null) { from = pos.offset(dir, -1); } - TileEntity teFrom = worldObj.getTileEntity(from); + TileEntity teFrom = world.getTileEntity(from); if (teFrom instanceof IKineticSource) { int sourceMax = ((IKineticSource) teFrom).maxrequestkineticenergyTick(dir); int draw = Math.min(kinBufMax-kinBuffer, sourceMax); @@ -54,7 +56,7 @@ public class TileEntityMechICtoIE extends TileEntityIWBase implements IDirection kinBuffer += ((IKineticSource) teFrom).requestkineticenergy(dir, draw)*MechConversion.kinToRotEfficiency; } } - TileEntity teTo = worldObj.getTileEntity(to); + TileEntity teTo = world.getTileEntity(to); if (kinBuffer>0&&teTo instanceof IRotationAcceptor) { double out = Math.min(maxInsert, ConversionUtil.rotPerKin()*kinBuffer); ((IRotationAcceptor) teTo).inputRotation(out, dir); @@ -77,12 +79,13 @@ public class TileEntityMechICtoIE extends TileEntityIWBase implements IDirection from = null; } // Directional + @Nonnull @Override public EnumFacing getFacing() { return dir; } @Override - public void setFacing(EnumFacing facing) { + public void setFacing(@Nonnull EnumFacing facing) { dir = facing; to = null; from = null; @@ -93,15 +96,15 @@ public class TileEntityMechICtoIE extends TileEntityIWBase implements IDirection return 1; } @Override - public boolean mirrorFacingOnPlacement(EntityLivingBase placer) { + public boolean mirrorFacingOnPlacement(@Nonnull EntityLivingBase placer) { return false; } @Override - public boolean canHammerRotate(EnumFacing side, float hitX, float hitY, float hitZ, EntityLivingBase entity) { + public boolean canHammerRotate(@Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull EntityLivingBase entity) { return true; } @Override - public boolean canRotate(EnumFacing axis) { + public boolean canRotate(@Nonnull EnumFacing axis) { return true; } } diff --git a/src/main/java/malte0811/industrialWires/blocks/converter/TileEntityMechIEtoIC.java b/src/main/java/malte0811/industrialWires/blocks/converter/TileEntityMechIEtoIC.java index 57ff953..ef34003 100644 --- a/src/main/java/malte0811/industrialWires/blocks/converter/TileEntityMechIEtoIC.java +++ b/src/main/java/malte0811/industrialWires/blocks/converter/TileEntityMechIEtoIC.java @@ -27,6 +27,8 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import javax.annotation.Nonnull; + public class TileEntityMechIEtoIC extends TileEntityIWBase implements IDirectionalTile, IRotationAcceptor, IKineticSource { EnumFacing dir = EnumFacing.DOWN; double rotBuffer = 0; @@ -45,12 +47,13 @@ public class TileEntityMechIEtoIC extends TileEntityIWBase implements IDirection rotBuffer = in.getDouble(BUFFER_TAG); } // Directional + @Nonnull @Override public EnumFacing getFacing() { return dir; } @Override - public void setFacing(EnumFacing facing) { + public void setFacing(@Nonnull EnumFacing facing) { dir = facing; markDirty(); } @@ -59,11 +62,11 @@ public class TileEntityMechIEtoIC extends TileEntityIWBase implements IDirection return 1; } @Override - public boolean mirrorFacingOnPlacement(EntityLivingBase placer) { + public boolean mirrorFacingOnPlacement(@Nonnull EntityLivingBase placer) { return false; } @Override - public boolean canHammerRotate(EnumFacing side, float hitX, float hitY, float hitZ, EntityLivingBase entity) { + public boolean canHammerRotate(@Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull EntityLivingBase entity) { return true; } //IC2 kinetic @@ -91,13 +94,13 @@ public class TileEntityMechIEtoIC extends TileEntityIWBase implements IDirection //IE rotation @Override - public void inputRotation(double rotation, EnumFacing side) { + public void inputRotation(double rotation, @Nonnull EnumFacing side) { if (side==dir) { rotBuffer = Math.min(rotBufMax, rotBuffer+rotation); } } @Override - public boolean canRotate(EnumFacing axis) { + public boolean canRotate(@Nonnull EnumFacing axis) { return true; } } diff --git a/src/main/java/malte0811/industrialWires/blocks/wire/BlockIC2Connector.java b/src/main/java/malte0811/industrialWires/blocks/wire/BlockIC2Connector.java index 4058ba3..a9f756b 100644 --- a/src/main/java/malte0811/industrialWires/blocks/wire/BlockIC2Connector.java +++ b/src/main/java/malte0811/industrialWires/blocks/wire/BlockIC2Connector.java @@ -21,7 +21,6 @@ import blusunrize.immersiveengineering.api.IEProperties; import malte0811.industrialWires.IndustrialWires; import malte0811.industrialWires.blocks.BlockIWBase; import malte0811.industrialWires.blocks.IMetaEnum; -import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; @@ -33,26 +32,28 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; +import javax.annotation.Nonnull; import java.util.Arrays; -import java.util.List; public class BlockIC2Connector extends BlockIWBase implements IMetaEnum { private static PropertyEnum type = PropertyEnum.create("type", BlockTypes_IC2_Connector.class); public BlockIC2Connector() { - super(Material.IRON, "ic2Connector"); + super(Material.IRON, "ic2_connector"); setHardness(3.0F); setResistance(15.0F); lightOpacity = 0; this.setCreativeTab(IndustrialWires.creativeTab); } + @Override - public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn) { + public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos posNeighbor) { TileEntity te = world.getTileEntity(pos); if(te instanceof TileEntityIC2ConnectorTin) { TileEntityIC2ConnectorTin connector = (TileEntityIC2ConnectorTin) te; @@ -64,12 +65,13 @@ public class BlockIC2Connector extends BlockIWBase implements IMetaEnum { } @Override - public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) { + public void getSubBlocks(@Nonnull Item itemIn, CreativeTabs tab, NonNullList list) { for (int i = 0;i.1) + if (!world.isRemote && inBuffer > .1) transferPower(); } public void transferPower() { - Set conns = new HashSet<>(ImmersiveNetHandler.INSTANCE.getIndirectEnergyConnections(pos, worldObj)); + Set conns = new HashSet<>(ImmersiveNetHandler.INSTANCE.getIndirectEnergyConnections(pos, world)); Map> maxOutputs = new HashMap<>(); double outputMax = Math.min(inBuffer, maxToNet); double sum = 0; for (AbstractConnection c:conns) { - IImmersiveConnectable iic = ApiUtils.toIIC(c.end, worldObj); + IImmersiveConnectable iic = ApiUtils.toIIC(c.end, world); if (iic instanceof IIC2Connector) { double tmp = inBuffer-((IIC2Connector)iic).insertEnergy(outputMax, true); if (tmp>.00000001) { @@ -97,7 +96,7 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im return; } final double oldInBuf = outputMax; - HashMap transferedPerConn = ImmersiveNetHandler.INSTANCE.getTransferedRates(worldObj.provider.getDimension()); + HashMap transferedPerConn = ImmersiveNetHandler.INSTANCE.getTransferedRates(world.provider.getDimension()); for (AbstractConnection c:maxOutputs.keySet()) { Pair p = maxOutputs.get(c); double out = oldInBuf*p.getRight()/sum; @@ -109,11 +108,11 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im double energyAtConn = inserted+loss; for(Connection sub : c.subConnections) { - int transferredPerCon = transferedPerConn.containsKey(sub)?transferedPerConn.get(sub):0; + int transferredPerCon = transferedPerConn.getOrDefault(sub, 0); energyAtConn-=sub.cableType.getLossRatio()*sub.length; - ImmersiveNetHandler.INSTANCE.getTransferedRates(worldObj.provider.getDimension()).put(sub,(int)(transferredPerCon+energyAtConn)); - IImmersiveConnectable subStart = ApiUtils.toIIC(sub.start,worldObj); - IImmersiveConnectable subEnd = ApiUtils.toIIC(sub.end,worldObj); + ImmersiveNetHandler.INSTANCE.getTransferedRates(world.provider.getDimension()).put(sub, (int) (transferredPerCon + energyAtConn)); + IImmersiveConnectable subStart = ApiUtils.toIIC(sub.start, world); + IImmersiveConnectable subEnd = ApiUtils.toIIC(sub.end, world); if(subStart!=null && passedConnectors.add(subStart)) subStart.onEnergyPassthrough((int)(inserted-inserted*intermediaryLoss)); if(subEnd!=null && passedConnectors.add(subEnd)) @@ -147,7 +146,7 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im } @Override public void invalidate() { - if (!worldObj.isRemote&&!first) + if (!world.isRemote && !first) MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); first = true; super.invalidate(); @@ -155,7 +154,7 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im @Override public void onChunkUnload() { super.onChunkUnload(); - if (!worldObj.isRemote&&!first) + if (!world.isRemote && !first) MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); first = true; } @@ -277,13 +276,14 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im nbt.setDouble("maxToMachine", maxToMachine); } + @Nonnull @Override public EnumFacing getFacing() { return f; } @Override - public void setFacing(EnumFacing facing) { + public void setFacing(@Nonnull EnumFacing facing) { f = facing; } @@ -293,12 +293,12 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im } @Override - public boolean mirrorFacingOnPlacement(EntityLivingBase placer) { + public boolean mirrorFacingOnPlacement(@Nonnull EntityLivingBase placer) { return true; } @Override - public boolean canHammerRotate(EnumFacing side, float hitX, float hitY, float hitZ, EntityLivingBase entity) { + public boolean canHammerRotate(@Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull EntityLivingBase entity) { return false; } @@ -332,7 +332,7 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im */ @Override public int hashCode() { - int ret = worldObj.provider.getDimension(); + int ret = world.provider.getDimension(); ret = 31*ret+pos.hashCode(); return ret; } @@ -351,13 +351,13 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im if (!te.pos.equals(pos)) { return false; } - if (te.worldObj.provider.getDimension()!=worldObj.provider.getDimension()) { + if (te.world.provider.getDimension() != world.provider.getDimension()) { return false; } return true; } @Override - public boolean canRotate(EnumFacing axis) { + public boolean canRotate(@Nonnull EnumFacing axis) { return false; } } diff --git a/src/main/java/malte0811/industrialWires/client/ClientEventHandler.java b/src/main/java/malte0811/industrialWires/client/ClientEventHandler.java index 939a363..3b1fdff 100644 --- a/src/main/java/malte0811/industrialWires/client/ClientEventHandler.java +++ b/src/main/java/malte0811/industrialWires/client/ClientEventHandler.java @@ -45,11 +45,11 @@ import org.apache.commons.lang3.tuple.Pair; public class ClientEventHandler { @SubscribeEvent public void renderOverlayPost(RenderGameOverlayEvent.Post e) { - if(ClientUtils.mc().thePlayer!=null && e.getType() == RenderGameOverlayEvent.ElementType.TEXT) { - EntityPlayer player = ClientUtils.mc().thePlayer; + if (ClientUtils.mc().player != null && e.getType() == RenderGameOverlayEvent.ElementType.TEXT) { + EntityPlayer player = ClientUtils.mc().player; for(EnumHand hand : EnumHand.values()) { - if(player.getHeldItem(hand)!=null) { + if (!player.getHeldItem(hand).isEmpty()) { ItemStack equipped = player.getHeldItem(hand); if(OreDictionary.itemMatches(new ItemStack(IndustrialWires.coil, 1, OreDictionary.WILDCARD_VALUE), equipped, false)) { IC2Wiretype type = IC2Wiretype.IC2_TYPES[equipped.getItemDamage()]; @@ -62,7 +62,7 @@ public class ClientEventHandler { 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) { + if (focussedBlock != null && focussedBlock.typeOfHit == RayTraceResult.Type.BLOCK) { distSquared = focussedBlock.getBlockPos().distanceSq(link[1],link[2],link[3]); } else { distSquared = player.getDistanceSq(link[1],link[2],link[3]); @@ -83,10 +83,10 @@ public class ClientEventHandler { @SubscribeEvent public void renderBoundingBoxes(DrawBlockHighlightEvent event) { if (!event.isCanceled() && event.getSubID() == 0 && event.getTarget().typeOfHit == RayTraceResult.Type.BLOCK) { - TileEntity tile = event.getPlayer().worldObj.getTileEntity(event.getTarget().getBlockPos()); + TileEntity tile = event.getPlayer().world.getTileEntity(event.getTarget().getBlockPos()); if (tile instanceof TileEntityPanel) { TileEntityPanel panel = (TileEntityPanel) tile; - Pair pc = panel.getSelectedComponent(Minecraft.getMinecraft().thePlayer, event.getTarget().hitVec, true); + Pair pc = panel.getSelectedComponent(Minecraft.getMinecraft().player, event.getTarget().hitVec, true); if (pc != null) { pc.getLeft().renderBox(panel); event.setCanceled(true); diff --git a/src/main/java/malte0811/industrialWires/client/ClientProxy.java b/src/main/java/malte0811/industrialWires/client/ClientProxy.java index 5145a25..6dd5ea7 100644 --- a/src/main/java/malte0811/industrialWires/client/ClientProxy.java +++ b/src/main/java/malte0811/industrialWires/client/ClientProxy.java @@ -21,6 +21,7 @@ import blusunrize.immersiveengineering.api.ManualHelper; import blusunrize.immersiveengineering.client.ClientUtils; import blusunrize.immersiveengineering.client.models.smart.ConnLoader; import blusunrize.immersiveengineering.common.Config; +import blusunrize.immersiveengineering.common.util.IELogger; import blusunrize.lib.manual.ManualInstance; import blusunrize.lib.manual.ManualPages; import blusunrize.lib.manual.ManualPages.PositionedItemStack; @@ -73,42 +74,42 @@ public class ClientProxy extends CommonProxy { @Override public void preInit() { super.preInit(); - ConnLoader.baseModels.put("ic2_conn_tin", new ResourceLocation("immersiveengineering:block/connector/connectorLV.obj")); - ConnLoader.textureReplacements.put("ic2_conn_tin", ImmutableMap.of("#immersiveengineering:blocks/connector_connectorLV", - IndustrialWires.MODID + ":blocks/ic2_connTin")); - ConnLoader.baseModels.put("ic2_relay_tin", new ResourceLocation("immersiveengineering:block/connector/connectorLV.obj")); - ConnLoader.textureReplacements.put("ic2_relay_tin", ImmutableMap.of("#immersiveengineering:blocks/connector_connectorLV", - IndustrialWires.MODID + ":blocks/ic2_relayTin")); + ConnLoader.baseModels.put("ic2_conn_tin", new ResourceLocation("immersiveengineering:block/connector/connector_lv.obj")); + ConnLoader.textureReplacements.put("ic2_conn_tin", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv", + IndustrialWires.MODID + ":blocks/ic2_conn_tin")); + ConnLoader.baseModels.put("ic2_relay_tin", new ResourceLocation("immersiveengineering:block/connector/connector_lv.obj")); + ConnLoader.textureReplacements.put("ic2_relay_tin", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv", + IndustrialWires.MODID + ":blocks/ic2_relay_tin")); - ConnLoader.baseModels.put("ic2_conn_copper", new ResourceLocation("immersiveengineering:block/connector/connectorLV.obj")); - ConnLoader.textureReplacements.put("ic2_conn_copper", ImmutableMap.of("#immersiveengineering:blocks/connector_connectorLV", - IndustrialWires.MODID + ":blocks/ic2_connCopper")); - ConnLoader.baseModels.put("ic2_relay_copper", new ResourceLocation("immersiveengineering:block/connector/connectorLV.obj")); - ConnLoader.textureReplacements.put("ic2_relay_copper", ImmutableMap.of("#immersiveengineering:blocks/connector_connectorLV", - IndustrialWires.MODID + ":blocks/ic2_relayCopper")); + ConnLoader.baseModels.put("ic2_conn_copper", new ResourceLocation("immersiveengineering:block/connector/connector_lv.obj")); + ConnLoader.textureReplacements.put("ic2_conn_copper", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv", + IndustrialWires.MODID + ":blocks/ic2_conn_copper")); + ConnLoader.baseModels.put("ic2_relay_copper", new ResourceLocation("immersiveengineering:block/connector/connector_lv.obj")); + ConnLoader.textureReplacements.put("ic2_relay_copper", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv", + IndustrialWires.MODID + ":blocks/ic2_relay_copper")); - ConnLoader.baseModels.put("ic2_conn_gold", new ResourceLocation("immersiveengineering:block/connector/connectorMV.obj")); - ConnLoader.textureReplacements.put("ic2_conn_gold", ImmutableMap.of("#immersiveengineering:blocks/connector_connectorMV", - IndustrialWires.MODID + ":blocks/ic2_connGold")); - ConnLoader.baseModels.put("ic2_relay_gold", new ResourceLocation("immersiveengineering:block/connector/connectorMV.obj")); - ConnLoader.textureReplacements.put("ic2_relay_gold", ImmutableMap.of("#immersiveengineering:blocks/connector_connectorMV", - IndustrialWires.MODID + ":blocks/ic2_relayGold")); + ConnLoader.baseModels.put("ic2_conn_gold", new ResourceLocation("immersiveengineering:block/connector/connector_mv.obj")); + ConnLoader.textureReplacements.put("ic2_conn_gold", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_mv", + IndustrialWires.MODID + ":blocks/ic2_conn_gold")); + ConnLoader.baseModels.put("ic2_relay_gold", new ResourceLocation("immersiveengineering:block/connector/connector_mv.obj")); + ConnLoader.textureReplacements.put("ic2_relay_gold", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_mv", + IndustrialWires.MODID + ":blocks/ic2_relay_gold")); - ConnLoader.baseModels.put("ic2_conn_hv", new ResourceLocation("immersiveengineering:block/connector/connectorHV.obj")); - ConnLoader.textureReplacements.put("ic2_conn_hv", ImmutableMap.of("#immersiveengineering:blocks/connector_connectorHV", - IndustrialWires.MODID + ":blocks/ic2_connHV")); - ConnLoader.baseModels.put("ic2_relay_hv", new ResourceLocation("immersiveengineering:block/connector/relayHV.obj")); + ConnLoader.baseModels.put("ic2_conn_hv", new ResourceLocation("immersiveengineering:block/connector/connector_hv.obj")); + ConnLoader.textureReplacements.put("ic2_conn_hv", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_hv", + IndustrialWires.MODID + ":blocks/ic2_conn_hv")); + ConnLoader.baseModels.put("ic2_relay_hv", new ResourceLocation("immersiveengineering:block/connector/relay_hv.obj")); - ConnLoader.baseModels.put("ic2_conn_glass", new ResourceLocation("immersiveengineering:block/connector/connectorHV.obj")); - ConnLoader.textureReplacements.put("ic2_conn_glass", ImmutableMap.of("#immersiveengineering:blocks/connector_connectorHV", - IndustrialWires.MODID + ":blocks/ic2_connGlass")); - ConnLoader.baseModels.put("ic2_relay_glass", new ResourceLocation("immersiveengineering:block/connector/relayHV.obj")); - ConnLoader.textureReplacements.put("ic2_relay_glass", ImmutableMap.of("#immersiveengineering:blocks/connector_relayHV", - IndustrialWires.MODID + ":blocks/ic2_relayGlass")); + ConnLoader.baseModels.put("ic2_conn_glass", new ResourceLocation("immersiveengineering:block/connector/connector_hv.obj")); + ConnLoader.textureReplacements.put("ic2_conn_glass", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_hv", + IndustrialWires.MODID + ":blocks/ic2_conn_glass")); + ConnLoader.baseModels.put("ic2_relay_glass", new ResourceLocation("immersiveengineering:block/connector/relay_hv.obj")); + ConnLoader.textureReplacements.put("ic2_relay_glass", ImmutableMap.of("#immersiveengineering:blocks/connector_relay_hv", + IndustrialWires.MODID + ":blocks/ic2_relay_glass")); ConnLoader.baseModels.put("rs_panel_conn", new ResourceLocation("industrialwires:block/rs_panel_conn.obj")); for (int meta = 0; meta < ItemIC2Coil.subNames.length; meta++) { - ResourceLocation loc = new ResourceLocation(IndustrialWires.MODID, "ic2wireCoil/" + ItemIC2Coil.subNames[meta]); + ResourceLocation loc = new ResourceLocation(IndustrialWires.MODID, "ic2_wire_coil/" + ItemIC2Coil.subNames[meta]); ModelBakery.registerItemVariants(IndustrialWires.coil, loc); ModelLoader.setCustomModelResourceLocation(IndustrialWires.coil, meta, new ModelResourceLocation(loc, "inventory")); } @@ -123,12 +124,14 @@ public class ClientProxy extends CommonProxy { if (b != null) { Item blockItem = Item.getItemFromBlock(b); final ResourceLocation loc = b.getRegistryName(); + assert loc != null; ModelLoader.setCustomMeshDefinition(blockItem, stack -> 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 { + IELogger.info(location + ", " + prop); ModelLoader.setCustomModelResourceLocation(blockItem, meta, new ModelResourceLocation(location, prop)); } catch (NullPointerException npe) { throw new RuntimeException(b + " lacks an item!", npe); @@ -191,54 +194,54 @@ public class ClientProxy extends CommonProxy { return ~0; }, IndustrialWires.panelComponent); - m.addEntry("industrialWires.wires", "industrialWires", - new ManualPages.CraftingMulti(m, "industrialWires.wires0", new ItemStack(IndustrialWires.ic2conn, 1, 0), new ItemStack(IndustrialWires.ic2conn, 1, 1), new ItemStack(IndustrialWires.ic2conn, 1, 2), new ItemStack(IndustrialWires.ic2conn, 1, 3), + m.addEntry("industrialwires.wires", "industrialwires", + new ManualPages.CraftingMulti(m, "industrialwires.wires0", new ItemStack(IndustrialWires.ic2conn, 1, 0), new ItemStack(IndustrialWires.ic2conn, 1, 1), new ItemStack(IndustrialWires.ic2conn, 1, 2), new ItemStack(IndustrialWires.ic2conn, 1, 3), new ItemStack(IndustrialWires.ic2conn, 1, 4), new ItemStack(IndustrialWires.ic2conn, 1, 5), new ItemStack(IndustrialWires.ic2conn, 1, 6), new ItemStack(IndustrialWires.ic2conn, 1, 7)), - new ManualPages.Text(m, "industrialWires.wires1"), - new ManualPages.CraftingMulti(m, "industrialWires.wires2", (Object[]) wireRecipes) + new ManualPages.Text(m, "industrialwires.wires1"), + new ManualPages.CraftingMulti(m, "industrialwires.wires2", (Object[]) wireRecipes) ); 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)) + 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)) ); } Config.manual_doubleA.put("iwJacobsUsage", IWConfig.HVStuff.jacobsUsageEU); - m.addEntry("industrialWires.jacobs", "industrialWires", - new ManualPages.CraftingMulti(m, "industrialWires.jacobs0", new ItemStack(IndustrialWires.jacobsLadder, 1, 0), new ItemStack(IndustrialWires.jacobsLadder, 1, 1), new ItemStack(IndustrialWires.jacobsLadder, 1, 2)), - new ManualPages.Text(m, "industrialWires.jacobs1")); + m.addEntry("industrialwires.jacobs", "industrialwires", + new ManualPages.CraftingMulti(m, "industrialwires.jacobs0", new ItemStack(IndustrialWires.jacobsLadder, 1, 0), new ItemStack(IndustrialWires.jacobsLadder, 1, 1), new ItemStack(IndustrialWires.jacobsLadder, 1, 2)), + new ManualPages.Text(m, "industrialwires.jacobs1")); - m.addEntry("industrialWires.intro", "control_panels", - new ManualPages.Text(m, "industrialWires.intro0"), - new ManualPages.Text(m, "industrialWires.intro1"), - new ManualPages.Crafting(m, "industrialWires.intro2", new ItemStack(IndustrialWires.panel, 1, BlockTypes_Panel.DUMMY.ordinal())), - new ManualPages.Text(m, "industrialWires.intro3") + m.addEntry("industrialwires.intro", "control_panels", + new ManualPages.Text(m, "industrialwires.intro0"), + new ManualPages.Text(m, "industrialwires.intro1"), + new ManualPages.Crafting(m, "industrialwires.intro2", new ItemStack(IndustrialWires.panel, 1, BlockTypes_Panel.DUMMY.ordinal())), + new ManualPages.Text(m, "industrialwires.intro3") ); - m.addEntry("industrialWires.panel_creator", "control_panels", - new ManualPages.Crafting(m, "industrialWires.panel_creator0", new ItemStack(IndustrialWires.panel, 1, BlockTypes_Panel.CREATOR.ordinal())), - new ManualPages.Text(m, "industrialWires.panel_creator1"), - new ManualPages.Text(m, "industrialWires.panel_creator2") + m.addEntry("industrialwires.panel_creator", "control_panels", + new ManualPages.Crafting(m, "industrialwires.panel_creator0", new ItemStack(IndustrialWires.panel, 1, BlockTypes_Panel.CREATOR.ordinal())), + new ManualPages.Text(m, "industrialwires.panel_creator1"), + new ManualPages.Text(m, "industrialwires.panel_creator2") ); - m.addEntry("industrialWires.redstone", "control_panels", - new ManualPages.Crafting(m, "industrialWires.redstone0", new ItemStack(IndustrialWires.panel, 1, BlockTypes_Panel.RS_WIRE.ordinal())), - new ManualPages.Text(m, "industrialWires.redstone1") + m.addEntry("industrialwires.redstone", "control_panels", + new ManualPages.Crafting(m, "industrialwires.redstone0", new ItemStack(IndustrialWires.panel, 1, BlockTypes_Panel.RS_WIRE.ordinal())), + new ManualPages.Text(m, "industrialwires.redstone1") ); - m.addEntry("industrialWires.components", "control_panels", - new ManualPages.Crafting(m, "industrialWires.button", new ItemStack(IndustrialWires.panelComponent, 1, 0)), - new ManualPages.Crafting(m, "industrialWires.label", new ItemStack(IndustrialWires.panelComponent, 1, 1)), - new ManualPages.Crafting(m, "industrialWires.indicator_light", new ItemStack(IndustrialWires.panelComponent, 1, 2)), - new ManualPages.Crafting(m, "industrialWires.slider", new ItemStack(IndustrialWires.panelComponent, 1, 3)), - new ManualPages.CraftingMulti(m, "industrialWires.toggle_switch", new ItemStack(IndustrialWires.panelComponent, 1, 5), new ItemStack(IndustrialWires.panelComponent, 1, 6)), - new ManualPages.Text(m, "industrialWires.toggle_switch1"), - new ManualPages.Crafting(m, "industrialWires.variac", new ItemStack(IndustrialWires.panelComponent, 1, 4)) + m.addEntry("industrialwires.components", "control_panels", + new ManualPages.Crafting(m, "industrialwires.button", new ItemStack(IndustrialWires.panelComponent, 1, 0)), + new ManualPages.Crafting(m, "industrialwires.label", new ItemStack(IndustrialWires.panelComponent, 1, 1)), + new ManualPages.Crafting(m, "industrialwires.indicator_light", new ItemStack(IndustrialWires.panelComponent, 1, 2)), + new ManualPages.Crafting(m, "industrialwires.slider", new ItemStack(IndustrialWires.panelComponent, 1, 3)), + new ManualPages.CraftingMulti(m, "industrialwires.toggle_switch", new ItemStack(IndustrialWires.panelComponent, 1, 5), new ItemStack(IndustrialWires.panelComponent, 1, 6)), + new ManualPages.Text(m, "industrialwires.toggle_switch1"), + new ManualPages.Crafting(m, "industrialwires.variac", new ItemStack(IndustrialWires.panelComponent, 1, 4)) ); } @Override public World getClientWorld() { - return Minecraft.getMinecraft().theWorld; + return Minecraft.getMinecraft().world; } private WeakHashMap playingSounds = new WeakHashMap<>(); @@ -283,7 +286,7 @@ public class ClientProxy extends CommonProxy { } else if (ID==1) { EnumHand h = z == 1 ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND; ItemStack held = player.getHeldItem(h); - if (held != null && held.getItem() == IndustrialWires.panelComponent) { + if (!held.isEmpty() && held.getItem() == IndustrialWires.panelComponent) { return new GuiPanelComponent(h, ItemPanelComponent.componentFromStack(held)); } } diff --git a/src/main/java/malte0811/industrialWires/client/gui/GuiPanelComponent.java b/src/main/java/malte0811/industrialWires/client/gui/GuiPanelComponent.java index d06a381..fbaafdc 100644 --- a/src/main/java/malte0811/industrialWires/client/gui/GuiPanelComponent.java +++ b/src/main/java/malte0811/industrialWires/client/gui/GuiPanelComponent.java @@ -62,7 +62,7 @@ public class GuiPanelComponent extends GuiContainer { IConfigurableComponent.StringConfig[] strings = confComp.getStringOptions(); stringTexts.clear(); for (IConfigurableComponent.StringConfig sc : strings) { - GuiTextField toAdd = new GuiTextField(0, mc.fontRendererObj, componentLeft + sc.x, componentTop + sc.y, 58, 12); + GuiTextField toAdd = new GuiTextField(0, mc.fontRenderer, componentLeft + sc.x, componentTop + sc.y, 58, 12); toAdd.setText(sc.value); stringTexts.add(toAdd); } @@ -208,14 +208,14 @@ public class GuiPanelComponent extends GuiContainer { GuiChannelPicker pick = rsChannelChoosers.get(i); String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.RS_CHANNEL, i); if (tooltip!=null&&pick.isHovered(mouseX, mouseY)) { - ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRendererObj); + ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRenderer); } } for (int i = 0;i=field.xPosition&&mouseX=field.yPosition&&mouseYxRelFloat&&aabb.minZ<=yRelFloat&&aabb.maxZ>yRelFloat) { PanelComponent removed = components.get(i); ItemStack remItem = ItemPanelComponent.stackFromComponent(removed); - mc.thePlayer.inventory.setItemStack(remItem); + mc.player.inventory.setItemStack(remItem); NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("type", MessageType.REMOVE.ordinal()); nbt.setInteger("id", i); @@ -204,11 +204,12 @@ public class GuiPanelCreator extends GuiContainer { IndustrialWires.packetHandler.sendToServer(new MessageGUIInteract(container.tile, nbt)); } } - private ItemStack lastFloating; + + private ItemStack lastFloating = ItemStack.EMPTY; private PanelComponent lastFloatingPC; private PanelComponent getFloatingPC() { - ItemStack floating = mc.thePlayer.inventory.getItemStack(); - if (floating==null||floating.getItem()!=IndustrialWires.panelComponent) { + ItemStack floating = mc.player.inventory.getItemStack(); + if (floating.isEmpty() || floating.getItem() != IndustrialWires.panelComponent) { return null; } if (ItemStack.areItemStacksEqual(floating, lastFloating)) { diff --git a/src/main/java/malte0811/industrialWires/client/gui/elements/GuiIntChooser.java b/src/main/java/malte0811/industrialWires/client/gui/elements/GuiIntChooser.java index 7078245..31076f2 100644 --- a/src/main/java/malte0811/industrialWires/client/gui/elements/GuiIntChooser.java +++ b/src/main/java/malte0811/industrialWires/client/gui/elements/GuiIntChooser.java @@ -17,7 +17,7 @@ public class GuiIntChooser extends Gui { xPos = x; yPos = y; max = (int) Math.pow(10, digits)-1; - xPlus = x+mc.fontRendererObj.getCharWidth('0')*(digits+(allowNegative?1:0))+mc.fontRendererObj.getCharWidth('-')+2; + xPlus = x + mc.fontRenderer.getCharWidth('0') * (digits + (allowNegative ? 1 : 0)) + mc.fontRenderer.getCharWidth('-') + 2; format = "%"+digits+"s"; } public void drawChooser() { @@ -26,19 +26,19 @@ public class GuiIntChooser extends Gui { if (value>=0&&allowNegative) { val = "+"+val; } - mc.fontRendererObj.drawStringWithShadow(val, xPos+mc.fontRendererObj.getCharWidth('-')+1, yPos, color); - mc.fontRendererObj.drawStringWithShadow("-", xPos, yPos, color); - mc.fontRendererObj.drawStringWithShadow("+", xPlus, yPos, color); + mc.fontRenderer.drawStringWithShadow(val, xPos + mc.fontRenderer.getCharWidth('-') + 1, yPos, color); + mc.fontRenderer.drawStringWithShadow("-", xPos, yPos, color); + mc.fontRenderer.drawStringWithShadow("+", xPlus, yPos, color); } public void click(int x, int y) { - int height = mc.fontRendererObj.FONT_HEIGHT; + int height = mc.fontRenderer.FONT_HEIGHT; if (y >= yPos && y < yPos + height) { - if (x >= xPlus && x < xPlus + mc.fontRendererObj.getCharWidth('+')) { + if (x >= xPlus && x < xPlus + mc.fontRenderer.getCharWidth('+')) { if (value < max) { value++; } - } else if (x >= xPos && x <= xPos + mc.fontRendererObj.getCharWidth('-')) { + } else if (x >= xPos && x <= xPos + mc.fontRenderer.getCharWidth('-')) { if (value > (allowNegative ? -value : 0)) { value--; } @@ -51,6 +51,6 @@ public class GuiIntChooser extends Gui { } public boolean isMouseOver(int mX, int mY) { - return mX>=xPos&&mX< xPlus +mc.fontRendererObj.getCharWidth('V')&&mY>=yPos&&mY= xPos && mX < xPlus + mc.fontRenderer.getCharWidth('V') && mY >= yPos && mY < yPos + mc.fontRenderer.FONT_HEIGHT; } } diff --git a/src/main/java/malte0811/industrialWires/client/panelmodel/PanelModel.java b/src/main/java/malte0811/industrialWires/client/panelmodel/PanelModel.java index 3912edc..5ba81b7 100644 --- a/src/main/java/malte0811/industrialWires/client/panelmodel/PanelModel.java +++ b/src/main/java/malte0811/industrialWires/client/panelmodel/PanelModel.java @@ -53,6 +53,8 @@ public class PanelModel implements IBakedModel { IEApi.renderCacheClearers.add(modelCache::invalidateAll); IEApi.renderCacheClearers.add(PanelItemOverride.ITEM_MODEL_CACHE::invalidateAll); } + + @Nonnull @Override public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { if (side!=null) { @@ -68,7 +70,7 @@ public class PanelModel implements IBakedModel { m = new AssembledBakedModel(cl); modelCache.put(cl.copyOf(), m); } - return m.getQuads(state, side, rand); + return m.getQuads(state, null, rand); } return ImmutableList.of(); } @@ -88,16 +90,19 @@ public class PanelModel implements IBakedModel { return false; } + @Nonnull @Override public TextureAtlasSprite getParticleTexture() { return PanelUtils.PANEL_TEXTURE; } + @Nonnull @Override public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; } + @Nonnull @Override public ItemOverrideList getOverrides() { return INSTANCE; @@ -113,6 +118,7 @@ public class PanelModel implements IBakedModel { components = comp; } + @Nonnull @Override public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { if (quadsDefault == null) { @@ -137,6 +143,7 @@ public class PanelModel implements IBakedModel { return false; } + @Nonnull @Override public TextureAtlasSprite getParticleTexture() { return PanelUtils.PANEL_TEXTURE; @@ -150,11 +157,14 @@ public class PanelModel implements IBakedModel { new ItemTransformVec3f(new Vector3f(30, 45, 0), new Vector3f(0, .125F, 0), new Vector3f(.6F, .6F, .6F)),//GUI new ItemTransformVec3f(new Vector3f(), new Vector3f(0, .1F, 0), new Vector3f(.25F, .25F, .25F)),//Ground new ItemTransformVec3f(new Vector3f(0, 180, 45), new Vector3f(0, 0, -.1875F), new Vector3f(.5F, .5F, .5F)));//Fixed; + + @Nonnull @Override public ItemCameraTransforms getItemCameraTransforms() {//TODO very much cache this! return transform; } + @Nonnull @Override public ItemOverrideList getOverrides() { return INSTANCE; diff --git a/src/main/java/malte0811/industrialWires/client/panelmodel/PanelModelLoader.java b/src/main/java/malte0811/industrialWires/client/panelmodel/PanelModelLoader.java index 06f335b..142c10f 100644 --- a/src/main/java/malte0811/industrialWires/client/panelmodel/PanelModelLoader.java +++ b/src/main/java/malte0811/industrialWires/client/panelmodel/PanelModelLoader.java @@ -32,6 +32,7 @@ import net.minecraftforge.client.model.IModel; import net.minecraftforge.client.model.ModelLoaderRegistry; import net.minecraftforge.common.model.IModelState; +import javax.annotation.Nonnull; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; @@ -42,7 +43,7 @@ public class PanelModelLoader implements ICustomModelLoader { public static final String RESOURCE_LOCATION = "smartmodel/panel"; @Override - public void onResourceManagerReload(IResourceManager resourceManager) { + public void onResourceManagerReload(@Nonnull IResourceManager resourceManager) { PanelModel.modelCache.invalidateAll(); PanelUtils.PANEL_TEXTURE = null; } diff --git a/src/main/java/malte0811/industrialWires/client/panelmodel/RawModelFontRenderer.java b/src/main/java/malte0811/industrialWires/client/panelmodel/RawModelFontRenderer.java index 72d31cc..87bb8fb 100644 --- a/src/main/java/malte0811/industrialWires/client/panelmodel/RawModelFontRenderer.java +++ b/src/main/java/malte0811/industrialWires/client/panelmodel/RawModelFontRenderer.java @@ -30,6 +30,8 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import org.lwjgl.util.vector.Vector3f; +import javax.annotation.Nonnull; + public class RawModelFontRenderer extends FontRenderer { float[] colorA = new float[4]; private ImmutableList.Builder builder = ImmutableList.builder(); @@ -100,7 +102,7 @@ public class RawModelFontRenderer extends FontRenderer { } @Override - protected void bindTexture(ResourceLocation location) { + protected void bindTexture(@Nonnull ResourceLocation location) { //NO-OP } } \ No newline at end of file diff --git a/src/main/java/malte0811/industrialWires/containers/ContainerPanelComponent.java b/src/main/java/malte0811/industrialWires/containers/ContainerPanelComponent.java index ee30ad2..62bb647 100644 --- a/src/main/java/malte0811/industrialWires/containers/ContainerPanelComponent.java +++ b/src/main/java/malte0811/industrialWires/containers/ContainerPanelComponent.java @@ -24,14 +24,16 @@ import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumHand; +import javax.annotation.Nonnull; + public class ContainerPanelComponent extends Container { public EnumHand hand; public ContainerPanelComponent(EnumHand h) { hand = h; } @Override - public boolean canInteractWith(EntityPlayer playerIn) { + public boolean canInteractWith(@Nonnull EntityPlayer playerIn) { ItemStack held = playerIn.getHeldItem(hand); - return held!=null&&held.getItem()== IndustrialWires.panelComponent; + return !held.isEmpty() && held.getItem() == IndustrialWires.panelComponent; } } diff --git a/src/main/java/malte0811/industrialWires/containers/ContainerPanelCreator.java b/src/main/java/malte0811/industrialWires/containers/ContainerPanelCreator.java index 6cda177..ed4cef2 100644 --- a/src/main/java/malte0811/industrialWires/containers/ContainerPanelCreator.java +++ b/src/main/java/malte0811/industrialWires/containers/ContainerPanelCreator.java @@ -18,22 +18,31 @@ package malte0811.industrialWires.containers; -import blusunrize.immersiveengineering.common.gui.ContainerIEBase; import malte0811.industrialWires.blocks.controlpanel.TileEntityPanelCreator; import malte0811.industrialWires.controlpanel.PanelUtils; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; +import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.util.function.Consumer; +import java.util.function.Predicate; +import java.util.function.Supplier; -//TODO remove dependency on core IE -public class ContainerPanelCreator extends ContainerIEBase { +public class ContainerPanelCreator extends Container { + public TileEntityPanelCreator tile; + private IInventory inv; public ContainerPanelCreator(InventoryPlayer inventoryPlayer, TileEntityPanelCreator tile) { - super(inventoryPlayer, tile); int slotH = 150; int slotX = 14; - slotCount = 1; + this.tile = tile; + inv = new SingleSlotInventory((i) -> tile.inv = i, () -> tile.inv, tile::markDirty, this::canInteractWith, "panel_creator"); addSlotToContainer(new Slot(inv, 0, 7, 37) { @Override public int getSlotStackLimit() { @@ -52,4 +61,141 @@ public class ContainerPanelCreator extends ContainerIEBase set; + Supplier get; + Runnable markDirty; + Predicate isUsable; + String name; + + public SingleSlotInventory(Consumer set, Supplier get, Runnable markDirty, Predicate isUsable, + String name) { + this.set = set; + this.get = get; + this.markDirty = markDirty; + this.isUsable = isUsable; + this.name = name; + } + + @Override + public int getSizeInventory() { + return 1; + } + + @Override + public boolean isEmpty() { + return get.get().isEmpty(); + } + + @Nonnull + @Override + public ItemStack getStackInSlot(int index) { + return index == 0 ? get.get() : ItemStack.EMPTY; + } + + @Nonnull + @Override + public ItemStack decrStackSize(int index, int count) { + if (index != 0) { + return ItemStack.EMPTY; + } + ItemStack stack = get.get(); + ItemStack ret = stack.splitStack(count); + if (stack.getCount() <= 0) { + set.accept(ItemStack.EMPTY); + } + return ret; + } + + @Nonnull + @Override + public ItemStack removeStackFromSlot(int index) { + if (index == 0) { + ItemStack ret = get.get(); + set.accept(ItemStack.EMPTY); + return ret; + } + return ItemStack.EMPTY; + } + + @Override + public void setInventorySlotContents(int index, @Nonnull ItemStack stack) { + if (index == 0) { + set.accept(stack); + } + } + + @Override + public int getInventoryStackLimit() { + return 1; + } + + @Override + public void markDirty() { + markDirty.run(); + } + + @Override + public boolean isUsableByPlayer(@Nonnull EntityPlayer player) { + return isUsable.test(player); + } + + @Override + public void openInventory(@Nonnull EntityPlayer player) { + + } + + @Override + public void closeInventory(@Nonnull EntityPlayer player) { + + } + + @Override + public boolean isItemValidForSlot(int index, @Nonnull ItemStack stack) { + return true; + } + + @Override + public int getField(int id) { + return 0; + } + + @Override + public void setField(int id, int value) { + + } + + @Override + public int getFieldCount() { + return 0; + } + + @Override + public void clear() { + set.accept(ItemStack.EMPTY); + } + + @Nonnull + @Override + public String getName() { + return name; + } + + @Override + public boolean hasCustomName() { + return false; + } + + @Nonnull + @Override + public ITextComponent getDisplayName() { + return new TextComponentString(name); + } + } } diff --git a/src/main/java/malte0811/industrialWires/containers/ContainerRSPanelConn.java b/src/main/java/malte0811/industrialWires/containers/ContainerRSPanelConn.java index cc9f059..a2a7f85 100644 --- a/src/main/java/malte0811/industrialWires/containers/ContainerRSPanelConn.java +++ b/src/main/java/malte0811/industrialWires/containers/ContainerRSPanelConn.java @@ -22,13 +22,15 @@ import malte0811.industrialWires.blocks.controlpanel.TileEntityRSPanelConn; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; +import javax.annotation.Nonnull; + public class ContainerRSPanelConn extends Container { - final TileEntityRSPanelConn te; + private final TileEntityRSPanelConn te; public ContainerRSPanelConn(TileEntityRSPanelConn tile) { te = tile; } @Override - public boolean canInteractWith(EntityPlayer playerIn) { + public boolean canInteractWith(@Nonnull EntityPlayer playerIn) { return playerIn.getDistanceSq(te.getPos())<64; } } diff --git a/src/main/java/malte0811/industrialWires/controlpanel/CoveredToggleSwitch.java b/src/main/java/malte0811/industrialWires/controlpanel/CoveredToggleSwitch.java index 7b5dadf..68a5a32 100644 --- a/src/main/java/malte0811/industrialWires/controlpanel/CoveredToggleSwitch.java +++ b/src/main/java/malte0811/industrialWires/controlpanel/CoveredToggleSwitch.java @@ -60,7 +60,7 @@ public class CoveredToggleSwitch extends ToggleSwitch { } @Override - public boolean interactWith(Vec3d hitRel, TileEntityPanel tile, EntityPlayerMP player) { + public void interactWith(Vec3d hitRel, TileEntityPanel tile, EntityPlayerMP player) { if (player.isSneaking()&&state==SwitchState.OPEN) { state = SwitchState.CLOSED; } else { @@ -69,7 +69,6 @@ public class CoveredToggleSwitch extends ToggleSwitch { setOut(state.active, tile); tile.markDirty(); tile.triggerRenderUpdate(); - return true; } @Override diff --git a/src/main/java/malte0811/industrialWires/controlpanel/IndicatorLight.java b/src/main/java/malte0811/industrialWires/controlpanel/IndicatorLight.java index cecff8c..bba5263 100644 --- a/src/main/java/malte0811/industrialWires/controlpanel/IndicatorLight.java +++ b/src/main/java/malte0811/industrialWires/controlpanel/IndicatorLight.java @@ -107,8 +107,7 @@ public class IndicatorLight extends PanelComponent implements IConfigurableCompo } @Override - public boolean interactWith(Vec3d hitRelative, TileEntityPanel tile, EntityPlayerMP player) { - return false; + public void interactWith(Vec3d hitRelative, TileEntityPanel tile, EntityPlayerMP player) { } @Override diff --git a/src/main/java/malte0811/industrialWires/controlpanel/Label.java b/src/main/java/malte0811/industrialWires/controlpanel/Label.java index 43a2596..e5bc36c 100644 --- a/src/main/java/malte0811/industrialWires/controlpanel/Label.java +++ b/src/main/java/malte0811/industrialWires/controlpanel/Label.java @@ -95,8 +95,7 @@ public class Label extends PanelComponent implements IConfigurableComponent { } @Override - public boolean interactWith(Vec3d hitRelative, TileEntityPanel tile, EntityPlayerMP player) { - return false; + public void interactWith(Vec3d hitRelative, TileEntityPanel tile, EntityPlayerMP player) { } @Override @@ -127,10 +126,10 @@ public class Label extends PanelComponent implements IConfigurableComponent { int left = (int) (gui.getX0()+getX()*gui.panelSize); int top = (int) (gui.getY0()+getY()*gui.panelSize); GlStateManager.pushMatrix(); - float scale = gui.mc.fontRendererObj.FONT_HEIGHT*gui.panelSize/(16F*9F*9F); + float scale = gui.mc.fontRenderer.FONT_HEIGHT * gui.panelSize / (16F * 9F * 9F); GlStateManager.translate(left, top, 0); GlStateManager.scale(scale, scale, scale); - gui.mc.fontRendererObj.drawString(text, 0, 0, 0xff000000|color); + gui.mc.fontRenderer.drawString(text, 0, 0, 0xff000000 | color); GlStateManager.popMatrix(); } diff --git a/src/main/java/malte0811/industrialWires/controlpanel/LightedButton.java b/src/main/java/malte0811/industrialWires/controlpanel/LightedButton.java index c58cf3b..add9e18 100644 --- a/src/main/java/malte0811/industrialWires/controlpanel/LightedButton.java +++ b/src/main/java/malte0811/industrialWires/controlpanel/LightedButton.java @@ -109,9 +109,9 @@ public class LightedButton extends PanelComponent implements IConfigurableCompon } @Override - public boolean interactWith(Vec3d hitRel, TileEntityPanel tile, EntityPlayerMP player) { + public void interactWith(Vec3d hitRel, TileEntityPanel tile, EntityPlayerMP player) { if (!latching&&active) { - return false; + return; } setOut(!active, tile); if (!latching) { @@ -119,7 +119,6 @@ public class LightedButton extends PanelComponent implements IConfigurableCompon } tile.markDirty(); tile.triggerRenderUpdate(); - return true; } @Override diff --git a/src/main/java/malte0811/industrialWires/controlpanel/PanelComponent.java b/src/main/java/malte0811/industrialWires/controlpanel/PanelComponent.java index 6faf10d..34d12ce 100644 --- a/src/main/java/malte0811/industrialWires/controlpanel/PanelComponent.java +++ b/src/main/java/malte0811/industrialWires/controlpanel/PanelComponent.java @@ -78,7 +78,7 @@ public abstract class PanelComponent { @Nonnull public abstract AxisAlignedBB getBlockRelativeAABB(); - public abstract boolean interactWith(Vec3d hitRelative, TileEntityPanel tile, EntityPlayerMP player); + public abstract void interactWith(Vec3d hitRelative, TileEntityPanel tile, EntityPlayerMP player); public abstract void update(TileEntityPanel tile); @@ -149,7 +149,8 @@ public abstract class PanelComponent { double px = te.getPos().getX()-TileEntityRendererDispatcher.staticPlayerX; double py = te.getPos().getY()-TileEntityRendererDispatcher.staticPlayerY; double pz = te.getPos().getZ()-TileEntityRendererDispatcher.staticPlayerZ; - RenderGlobal.func_189697_a(te.apply(te.getComponents().getPanelTopTransform(), getBlockRelativeAABB()).expandXyz(0.002).offset(px, py, pz), 0.0F, 0.0F, 0.0F, 0.4F); + RenderGlobal.drawSelectionBoundingBox(te.apply(te.getComponents().getPanelTopTransform(), getBlockRelativeAABB()).expandXyz(0.002).offset(px, py, pz), + 0.0F, 0.0F, 0.0F, 0.4F); GlStateManager.depthMask(true); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); diff --git a/src/main/java/malte0811/industrialWires/controlpanel/PanelUtils.java b/src/main/java/malte0811/industrialWires/controlpanel/PanelUtils.java index 03dc8b0..856e68b 100644 --- a/src/main/java/malte0811/industrialWires/controlpanel/PanelUtils.java +++ b/src/main/java/malte0811/industrialWires/controlpanel/PanelUtils.java @@ -22,8 +22,11 @@ import blusunrize.immersiveengineering.api.Lib; import blusunrize.immersiveengineering.common.util.chickenbones.Matrix4; import ic2.api.item.IC2Items; import malte0811.industrialWires.IndustrialWires; +import malte0811.industrialWires.blocks.controlpanel.BlockPanel; +import malte0811.industrialWires.blocks.controlpanel.BlockTypes_Panel; import malte0811.industrialWires.blocks.controlpanel.PropertyComponents.PanelRenderProperties; import malte0811.industrialWires.client.RawQuad; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -39,7 +42,9 @@ import net.minecraft.nbt.NBTTagFloat; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; +import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.obj.OBJModel; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; @@ -51,8 +56,10 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import java.util.function.BiPredicate; import static malte0811.industrialWires.controlpanel.PanelComponent.*; +import static malte0811.industrialWires.util.MiscUtils.discoverLocal; public final class PanelUtils { public static TextureAtlasSprite PANEL_TEXTURE; @@ -327,4 +334,22 @@ public final class PanelUtils { } return panelBase; } + + public static List discoverPanelParts(World w, BlockPos here) { + BiPredicate isValid = (pos, count) -> { + if (here.distanceSq(pos) > 25 || count > 100 || !w.isBlockLoaded(pos)) { + return false; + } + IBlockState state = w.getBlockState(pos); + return state.getBlock() == IndustrialWires.panel && state.getValue(BlockPanel.type) != BlockTypes_Panel.CREATOR; + }; + List all = discoverLocal(w, here, isValid); + List ret = new ArrayList<>(); + for (BlockPos pos : all) { + if (w.getBlockState(pos).getValue(BlockPanel.type) != BlockTypes_Panel.DUMMY) { + ret.add(pos); + } + } + return ret; + } } \ No newline at end of file diff --git a/src/main/java/malte0811/industrialWires/controlpanel/Slider.java b/src/main/java/malte0811/industrialWires/controlpanel/Slider.java index b9fe11b..dc87997 100644 --- a/src/main/java/malte0811/industrialWires/controlpanel/Slider.java +++ b/src/main/java/malte0811/industrialWires/controlpanel/Slider.java @@ -125,7 +125,7 @@ public class Slider extends PanelComponent implements IConfigurableComponent { } @Override - public boolean interactWith(Vec3d hitRelative, TileEntityPanel tile, EntityPlayerMP player) { + public void interactWith(Vec3d hitRelative, TileEntityPanel tile, EntityPlayerMP player) { double pos = horizontal?hitRelative.xCoord:(length-hitRelative.zCoord); byte newLevel = (byte)(Math.min(pos*16/length, 15)); if (newLevel!=out) { @@ -135,9 +135,7 @@ public class Slider extends PanelComponent implements IConfigurableComponent { out = newLevel; tile.markDirty(); tile.triggerRenderUpdate(); - return true; } - return false; } @Override diff --git a/src/main/java/malte0811/industrialWires/controlpanel/ToggleSwitch.java b/src/main/java/malte0811/industrialWires/controlpanel/ToggleSwitch.java index e47a5a2..55f0fbe 100644 --- a/src/main/java/malte0811/industrialWires/controlpanel/ToggleSwitch.java +++ b/src/main/java/malte0811/industrialWires/controlpanel/ToggleSwitch.java @@ -115,11 +115,10 @@ public class ToggleSwitch extends PanelComponent implements IConfigurableCompone } @Override - public boolean interactWith(Vec3d hitRel, TileEntityPanel tile, EntityPlayerMP player) { + public void interactWith(Vec3d hitRel, TileEntityPanel tile, EntityPlayerMP player) { setOut(!active, tile); tile.markDirty(); tile.triggerRenderUpdate(); - return true; } @Override diff --git a/src/main/java/malte0811/industrialWires/controlpanel/Variac.java b/src/main/java/malte0811/industrialWires/controlpanel/Variac.java index d3b5232..16d0a6a 100644 --- a/src/main/java/malte0811/industrialWires/controlpanel/Variac.java +++ b/src/main/java/malte0811/industrialWires/controlpanel/Variac.java @@ -131,7 +131,7 @@ public class Variac extends PanelComponent implements IConfigurableComponent { } @Override - public boolean interactWith(Vec3d hitRelative, TileEntityPanel tile, EntityPlayerMP player) { + public void interactWith(Vec3d hitRelative, TileEntityPanel tile, EntityPlayerMP player) { double xRel = hitRelative.xCoord - SIZE / 2; double yRel = -(hitRelative.zCoord - SIZE / 2); double angle = 1.5 * Math.PI - Math.atan2(yRel, xRel); @@ -143,7 +143,7 @@ public class Variac extends PanelComponent implements IConfigurableComponent { angle -= .5 * Math.PI / 17; angle /= 2 * Math.PI; if (angle < 0 || angle >= 16 / 17D) { - return true; + return; } byte newLevel = (byte) (angle * 17); if (newLevel > out) { @@ -159,9 +159,7 @@ public class Variac extends PanelComponent implements IConfigurableComponent { out = newLevel; tile.markDirty(); tile.triggerRenderUpdate(); - return true; } - return false; } @Override diff --git a/src/main/java/malte0811/industrialWires/crafting/RecipeCoilLength.java b/src/main/java/malte0811/industrialWires/crafting/RecipeCoilLength.java index 32b4663..5a9d5ff 100644 --- a/src/main/java/malte0811/industrialWires/crafting/RecipeCoilLength.java +++ b/src/main/java/malte0811/industrialWires/crafting/RecipeCoilLength.java @@ -22,13 +22,16 @@ import malte0811.industrialWires.items.ItemIC2Coil; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; +import javax.annotation.Nonnull; + public class RecipeCoilLength implements IRecipe { public final ItemStack coil; public final ItemStack cable; - final int maxLength; + private final int maxLength; public RecipeCoilLength(int meta) { coil = new ItemStack(IndustrialWires.coil, 1, meta); cable = ItemIC2Coil.getUninsulatedCable(coil); @@ -36,13 +39,14 @@ public class RecipeCoilLength implements IRecipe { } @Override - public boolean matches(InventoryCrafting inv, World worldIn) { + public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World worldIn) { int l = getLength(inv); return l>0; } + @Nonnull @Override - public ItemStack getCraftingResult(InventoryCrafting inv) { + public ItemStack getCraftingResult(@Nonnull InventoryCrafting inv) { ItemStack ret = new ItemStack(IndustrialWires.coil, 1, coil.getItemDamage()); ItemIC2Coil.setLength(ret, Math.min(maxLength, getLength(inv))); return ret; @@ -53,22 +57,25 @@ public class RecipeCoilLength implements IRecipe { return 0; } + @Nonnull @Override public ItemStack getRecipeOutput() { - return null; + return ItemStack.EMPTY; } + @Nonnull @Override - public ItemStack[] getRemainingItems(InventoryCrafting inv) { - ItemStack[] ret = new ItemStack[inv.getSizeInventory()]; + public NonNullList getRemainingItems(@Nonnull InventoryCrafting inv) { + NonNullList ret = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY); int length = Math.min(getLength(inv), maxLength); - for (int i = 0;i0;i++) { + for (int i = 0; i < ret.size() && length > 0; i++) { ItemStack curr = inv.getStackInSlot(i); if (OreDictionary.itemMatches(curr, coil, false)) { length-=ItemIC2Coil.getLength(curr); if (length<0) { - ret[i] = new ItemStack(IndustrialWires.coil, 1); - ItemIC2Coil.setLength(ret[i], -length); + ItemStack currStack = new ItemStack(IndustrialWires.coil, 1); + ret.set(i, currStack); + ItemIC2Coil.setLength(currStack, -length); } } else if (OreDictionary.itemMatches(curr, cable, false)) { length--; @@ -84,7 +91,7 @@ public class RecipeCoilLength implements IRecipe { cableLength+=ItemIC2Coil.getLength(curr); } else if (OreDictionary.itemMatches(curr, cable, false)) { cableLength++; - } else if (curr!=null) { + } else if (!curr.isEmpty()) { return -1; } } diff --git a/src/main/java/malte0811/industrialWires/items/ItemIC2Coil.java b/src/main/java/malte0811/industrialWires/items/ItemIC2Coil.java index 2514aa4..97da85c 100644 --- a/src/main/java/malte0811/industrialWires/items/ItemIC2Coil.java +++ b/src/main/java/malte0811/industrialWires/items/ItemIC2Coil.java @@ -17,10 +17,6 @@ */ package malte0811.industrialWires.items; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - import blusunrize.immersiveengineering.ImmersiveEngineering; import blusunrize.immersiveengineering.api.Lib; import blusunrize.immersiveengineering.api.TargetingInfo; @@ -48,30 +44,38 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; +import javax.annotation.Nonnull; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + public class ItemIC2Coil extends Item implements IWireCoil{ public final static String[] subNames = {"tin", "copper", "gold", "hv", "glass"}; public final static String lengthKey = "wireLength"; public ItemIC2Coil() { - setUnlocalizedName(IndustrialWires.MODID+".ic2wireCoil"); + setUnlocalizedName(IndustrialWires.MODID + ".ic2_wire_coil"); setHasSubtypes(true); this.setCreativeTab(IndustrialWires.creativeTab); setMaxStackSize(64); ImmersiveEngineering.registerByFullName(this, IndustrialWires.MODID+":"+"ic2WireCoil"); } @Override - public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) { + public void getSubItems(@Nonnull Item itemIn, CreativeTabs tab, NonNullList subItems) { for (int i = 0;i3) { + if (link.length > 3) { list.add(I18n.format(Lib.DESC_INFO+"attachedToDim", link[1],link[2],link[3],link[0])); } } } //mostly copied from IE + @Nonnull @Override - public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { - if(!world.isRemote) { - if (stack.stackSize>1) { - player.addChatMessage(new TextComponentTranslation(IndustrialWires.MODID+".chat.stackSize")); + public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + ItemStack stack = player.getHeldItem(hand); + if (!world.isRemote && !stack.isEmpty()) { + if (stack.getCount() > 1) { + player.sendMessage(new TextComponentTranslation(IndustrialWires.MODID + ".chat.stackSize")); return EnumActionResult.FAIL; } TileEntity tileEntity = world.getTileEntity(pos); @@ -110,7 +116,7 @@ public class ItemIC2Coil extends Item implements IWireCoil{ } if( !((IImmersiveConnectable)tileEntity).canConnectCable(wire, target)) { - player.addChatMessage(new TextComponentTranslation(Lib.CHAT_WARN+"wrongCable")); + player.sendMessage(new TextComponentTranslation(Lib.CHAT_WARN + "wrongCable")); return EnumActionResult.FAIL; } @@ -124,13 +130,13 @@ public class ItemIC2Coil extends Item implements IWireCoil{ TileEntity tileEntityLinkingPos = world.getTileEntity(linkPos); int distanceSq = (int) Math.ceil( linkPos.distanceSq(masterPos) ); if(array[0]!=world.provider.getDimension()) { - player.addChatMessage(new TextComponentTranslation(Lib.CHAT_WARN+"wrongDimension")); + player.sendMessage(new TextComponentTranslation(Lib.CHAT_WARN + "wrongDimension")); } else if(linkPos.equals(masterPos)) { - player.addChatMessage(new TextComponentTranslation(Lib.CHAT_WARN+"sameConnection")); + player.sendMessage(new TextComponentTranslation(Lib.CHAT_WARN + "sameConnection")); } else if( distanceSq > (type.getMaxLength()*type.getMaxLength())) { - player.addChatMessage(new TextComponentTranslation(Lib.CHAT_WARN+"tooFar")); + player.sendMessage(new TextComponentTranslation(Lib.CHAT_WARN + "tooFar")); } else if(!(tileEntityLinkingPos instanceof IImmersiveConnectable)||!((IImmersiveConnectable) tileEntityLinkingPos).canConnectCable(type, TargetingInfo.readFromNBT(stack.getTagCompound()))) { - player.addChatMessage(new TextComponentTranslation(Lib.CHAT_WARN+"invalidPoint")); + player.sendMessage(new TextComponentTranslation(Lib.CHAT_WARN + "invalidPoint")); } else { IImmersiveConnectable nodeHere = (IImmersiveConnectable)tileEntity; IImmersiveConnectable nodeLink = (IImmersiveConnectable)tileEntityLinkingPos; @@ -144,7 +150,7 @@ public class ItemIC2Coil extends Item implements IWireCoil{ } } if(connectionExists) { - player.addChatMessage(new TextComponentTranslation(Lib.CHAT_WARN+"connectionExists")); + player.sendMessage(new TextComponentTranslation(Lib.CHAT_WARN + "connectionExists")); } else { Vec3d rtOff0 = nodeHere.getRaytraceOffset(nodeLink).addVector(masterPos.getX(), masterPos.getY(), masterPos.getZ()); Vec3d rtOff1 = nodeLink.getRaytraceOffset(nodeHere).addVector(linkPos.getX(), linkPos.getY(), linkPos.getZ()); @@ -168,7 +174,7 @@ public class ItemIC2Coil extends Item implements IWireCoil{ if (length subItems) { + public void getSubItems(@Nonnull Item itemIn, CreativeTabs tab, NonNullList subItems) { for (int i = 0; i < types.length; i++) { subItems.add(new ItemStack(itemIn, 1, i)); } @@ -95,7 +92,7 @@ public class ItemPanelComponent extends Item { return PanelComponent.read(loadFrom); } - @Nullable + @Nonnull public static ItemStack stackFromComponent(PanelComponent pc) { NBTTagCompound inner = new NBTTagCompound(); pc.writeToNBT(inner, true); @@ -108,7 +105,7 @@ public class ItemPanelComponent extends Item { ret.setTagCompound(outer); return ret; } - return null; + return ItemStack.EMPTY; } private static void removeIrrelevantTags(NBTTagCompound inner) { @@ -148,10 +145,10 @@ public class ItemPanelComponent extends Item { @Override @Nonnull - public ActionResult onItemRightClick(@Nonnull ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { + public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, @Nonnull EnumHand hand) { if(!worldIn.isRemote) { playerIn.openGui(IndustrialWires.MODID, 1, worldIn, 0, 0, hand==EnumHand.MAIN_HAND?1:0); } - return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn); + return new ActionResult<>(EnumActionResult.SUCCESS, playerIn.getHeldItem(hand)); } } \ No newline at end of file diff --git a/src/main/java/malte0811/industrialWires/network/MessageComponentSync.java b/src/main/java/malte0811/industrialWires/network/MessageComponentSync.java index 334d071..1e6bcf8 100644 --- a/src/main/java/malte0811/industrialWires/network/MessageComponentSync.java +++ b/src/main/java/malte0811/industrialWires/network/MessageComponentSync.java @@ -63,12 +63,12 @@ public class MessageComponentSync implements IMessage { public static class HandlerServer implements IMessageHandler { @Override public IMessage onMessage(MessageComponentSync message, MessageContext ctx) { - ctx.getServerHandler().playerEntity.getServerWorld().addScheduledTask(()->handle(message, ctx.getServerHandler().playerEntity)); + ctx.getServerHandler().player.getServerWorld().addScheduledTask(() -> handle(message, ctx.getServerHandler().player)); return null; } private void handle(MessageComponentSync msg, EntityPlayerMP player) { ItemStack held = player.getHeldItem(msg.hand); - if (held!=null&&held.getItem()== IndustrialWires.panelComponent) { + if (!held.isEmpty() && held.getItem() == IndustrialWires.panelComponent) { PanelComponent old = ItemPanelComponent.componentFromStack(held); if (old instanceof IConfigurableComponent) { NBTTagList changes = msg.data.getTagList("data", 10); @@ -82,7 +82,7 @@ public class MessageComponentSync implements IMessage { x.printStackTrace(); } } - ItemStack newCmp = ApiUtils.copyStackWithAmount(ItemPanelComponent.stackFromComponent(old), held.stackSize); + ItemStack newCmp = ApiUtils.copyStackWithAmount(ItemPanelComponent.stackFromComponent(old), held.getCount()); player.setHeldItem(msg.hand, newCmp); } } diff --git a/src/main/java/malte0811/industrialWires/network/MessageGUIInteract.java b/src/main/java/malte0811/industrialWires/network/MessageGUIInteract.java index 4cf8a74..035ab90 100644 --- a/src/main/java/malte0811/industrialWires/network/MessageGUIInteract.java +++ b/src/main/java/malte0811/industrialWires/network/MessageGUIInteract.java @@ -57,12 +57,12 @@ public class MessageGUIInteract implements IMessage { public static class HandlerServer implements IMessageHandler { @Override public IMessage onMessage(MessageGUIInteract message, MessageContext ctx) { - ctx.getServerHandler().playerEntity.getServerWorld().addScheduledTask(()->handle(message, ctx.getServerHandler().playerEntity)); + ctx.getServerHandler().player.getServerWorld().addScheduledTask(() -> handle(message, ctx.getServerHandler().player)); return null; } private void handle(MessageGUIInteract msg, EntityPlayerMP player) { if (player.getDistanceSqToCenter(msg.pos)<100) {//closer than 10 blocks - TileEntity te = player.worldObj.getTileEntity(msg.pos); + TileEntity te = player.world.getTileEntity(msg.pos); if (te instanceof INetGUI) { ((INetGUI) te).onChange(msg.data, player); te.markDirty(); diff --git a/src/main/java/malte0811/industrialWires/network/MessagePanelInteract.java b/src/main/java/malte0811/industrialWires/network/MessagePanelInteract.java index 23c397c..05d8ec1 100644 --- a/src/main/java/malte0811/industrialWires/network/MessagePanelInteract.java +++ b/src/main/java/malte0811/industrialWires/network/MessagePanelInteract.java @@ -30,13 +30,11 @@ import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; public class MessagePanelInteract implements IMessage { private BlockPos pos; - //private int dimension; private int pcId; private Vec3d hitRelative; public MessagePanelInteract(TileEntityPanel tile, int id, Vec3d hit) { pos = tile.getPos(); - //dimension = tile.getWorld().provider.getDimension(); pcId = id; hitRelative = hit; } @@ -46,7 +44,6 @@ public class MessagePanelInteract implements IMessage { @Override public void fromBytes(ByteBuf buf) { this.pos = new BlockPos(buf.readInt(), buf.readInt(), buf.readInt()); - //dimension = buf.readInt(); pcId = buf.readInt(); hitRelative = new Vec3d(buf.readDouble(), buf.readDouble(), buf.readDouble()); } @@ -56,7 +53,6 @@ public class MessagePanelInteract implements IMessage { buf.writeInt(this.pos.getX()); buf.writeInt(this.pos.getY()); buf.writeInt(this.pos.getZ()); - //buf.writeInt(dimension); buf.writeInt(pcId); buf.writeDouble(hitRelative.xCoord).writeDouble(hitRelative.yCoord).writeDouble(hitRelative.zCoord); } @@ -64,12 +60,12 @@ public class MessagePanelInteract implements IMessage { public static class HandlerServer implements IMessageHandler { @Override public IMessage onMessage(MessagePanelInteract message, MessageContext ctx) { - ctx.getServerHandler().playerEntity.getServerWorld().addScheduledTask(()->handle(message, ctx.getServerHandler().playerEntity)); + ctx.getServerHandler().player.getServerWorld().addScheduledTask(() -> handle(message, ctx.getServerHandler().player)); return null; } private void handle(MessagePanelInteract msg, EntityPlayerMP player) { if (player.getDistanceSqToCenter(msg.pos)<100) {//closer than 10 blocks - TileEntity te = player.worldObj.getTileEntity(msg.pos); + TileEntity te = player.world.getTileEntity(msg.pos); if (te instanceof TileEntityPanel) { ((TileEntityPanel) te).interactServer(msg.hitRelative, msg.pcId, player); } diff --git a/src/main/java/malte0811/industrialWires/util/DualEnergyStorage.java b/src/main/java/malte0811/industrialWires/util/DualEnergyStorage.java index 291c76c..58909e2 100644 --- a/src/main/java/malte0811/industrialWires/util/DualEnergyStorage.java +++ b/src/main/java/malte0811/industrialWires/util/DualEnergyStorage.java @@ -21,10 +21,10 @@ package malte0811.industrialWires.util; import net.minecraft.nbt.NBTTagCompound; public class DualEnergyStorage { - double storedEU; - double maxEU; - double maxOutEU; - double maxInEU; + private double storedEU; + private double maxEU; + private double maxOutEU; + private double maxInEU; public DualEnergyStorage(double maxEU, double maxInEU, double maxOutEU) { this(0, maxEU, maxInEU, maxOutEU); diff --git a/src/main/java/malte0811/industrialWires/util/MiscUtils.java b/src/main/java/malte0811/industrialWires/util/MiscUtils.java index 548935e..2116585 100644 --- a/src/main/java/malte0811/industrialWires/util/MiscUtils.java +++ b/src/main/java/malte0811/industrialWires/util/MiscUtils.java @@ -22,10 +22,6 @@ import blusunrize.immersiveengineering.api.ApiUtils; import blusunrize.immersiveengineering.api.energy.wires.IImmersiveConnectable; import blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler; import com.google.common.collect.ImmutableSet; -import malte0811.industrialWires.IndustrialWires; -import malte0811.industrialWires.blocks.controlpanel.BlockPanel; -import malte0811.industrialWires.blocks.controlpanel.BlockTypes_Panel; -import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -72,23 +68,6 @@ public final class MiscUtils { return ret; } - public static List discoverPanelParts(World w, BlockPos here) { - BiPredicate isValid = (pos, count)->{ - if (here.distanceSq(pos)>25||count>100||!w.isBlockLoaded(pos)) { - return false; - } - IBlockState state = w.getBlockState(pos); - return state.getBlock() == IndustrialWires.panel && state.getValue(BlockPanel.type) != BlockTypes_Panel.CREATOR; - }; - List all = discoverLocal(w, here, isValid); - List ret = new ArrayList<>(); - for (BlockPos pos:all) { - if (w.getBlockState(pos).getValue(BlockPanel.type)!= BlockTypes_Panel.DUMMY) { - ret.add(pos); - } - } - return ret; - } public static List discoverLocal(World w, BlockPos here, BiPredicate isValid) { List ret = new ArrayList<>(); List open = new ArrayList<>(); diff --git a/src/main/resources/META-INF/IndustrialWires_at.cfg b/src/main/resources/META-INF/IndustrialWires_at.cfg deleted file mode 100644 index cd9ae8f..0000000 --- a/src/main/resources/META-INF/IndustrialWires_at.cfg +++ /dev/null @@ -1 +0,0 @@ -protected net.minecraft.client.gui.inventory.GuiContainer func_146977_a(Lnet/minecraft/inventory/Slot;)V #drawSlot \ No newline at end of file diff --git a/src/main/resources/assets/industrialwires/blockstates/ic2Connector.json b/src/main/resources/assets/industrialwires/blockstates/ic2_connector.json similarity index 85% rename from src/main/resources/assets/industrialwires/blockstates/ic2Connector.json rename to src/main/resources/assets/industrialwires/blockstates/ic2_connector.json index 3bf6105..2756c72 100644 --- a/src/main/resources/assets/industrialwires/blockstates/ic2Connector.json +++ b/src/main/resources/assets/industrialwires/blockstates/ic2_connector.json @@ -12,9 +12,9 @@ "variants": { "inventory,type=tin_conn": [ { - "model": "immersiveengineering:connector/connectorLV.obj", + "model": "immersiveengineering:connector/connector_lv.obj", "textures": { - "#immersiveengineering:blocks/connector_connectorLV": "industrialwires:blocks/ic2_connTin" + "#immersiveengineering:blocks/connector_connector_lv": "industrialwires:blocks/ic2_conn_tin" }, "transform": { "scale": [ 0.5, 0.5, 0.5 ], @@ -29,9 +29,9 @@ ], "inventory,type=tin_relay": [ { - "model": "immersiveengineering:connector/connectorLV.obj", + "model": "immersiveengineering:connector/connector_lv.obj", "textures": { - "#immersiveengineering:blocks/connector_connectorLV": "industrialwires:blocks/ic2_relayTin" + "#immersiveengineering:blocks/connector_connector_lv": "industrialwires:blocks/ic2_relay_tin" }, "transform": { "scale": [ 0.5, 0.5, 0.5 ], @@ -46,9 +46,9 @@ ], "inventory,type=copper_conn": [ { - "model": "immersiveengineering:connector/connectorLV.obj", + "model": "immersiveengineering:connector/connector_lv.obj", "textures": { - "#immersiveengineering:blocks/connector_connectorLV": "industrialwires:blocks/ic2_connCopper" + "#immersiveengineering:blocks/connector_connector_lv": "industrialwires:blocks/ic2_conn_copper" }, "transform": { "scale": [ 0.5, 0.5, 0.5 ], @@ -63,9 +63,9 @@ ], "inventory,type=copper_relay": [ { - "model": "immersiveengineering:connector/connectorLV.obj", + "model": "immersiveengineering:connector/connector_lv.obj", "textures": { - "#immersiveengineering:blocks/connector_connectorLV": "industrialwires:blocks/ic2_relayCopper" + "#immersiveengineering:blocks/connector_connector_lv": "industrialwires:blocks/ic2_relay_copper" }, "transform": { "scale": [ 0.5, 0.5, 0.5 ], @@ -80,9 +80,9 @@ ], "inventory,type=gold_conn": [ { - "model": "immersiveengineering:connector/connectorMV.obj", + "model": "immersiveengineering:connector/connector_mv.obj", "textures": { - "#immersiveengineering:blocks/connector_connectorMV": "industrialwires:blocks/ic2_connGold" + "#immersiveengineering:blocks/connector_connector_mv": "industrialwires:blocks/ic2_conn_gold" }, "transform": { "scale": [ 0.5, 0.5, 0.5 ], @@ -97,9 +97,9 @@ ], "inventory,type=gold_relay": [ { - "model": "immersiveengineering:connector/connectorMV.obj", + "model": "immersiveengineering:connector/connector_mv.obj", "textures": { - "#immersiveengineering:blocks/connector_connectorMV": "industrialwires:blocks/ic2_relayGold" + "#immersiveengineering:blocks/connector_connector_mv": "industrialwires:blocks/ic2_relay_gold" }, "transform": { "scale": [ 0.5, 0.5, 0.5 ], @@ -114,9 +114,9 @@ ], "inventory,type=hv_conn": [ { - "model": "immersiveengineering:connector/connectorHV.obj", + "model": "immersiveengineering:connector/connector_hv.obj", "textures": { - "#immersiveengineering:blocks/connector_connectorHV": "industrialwires:blocks/ic2_connHV" + "#immersiveengineering:blocks/connector_connector_hv": "industrialwires:blocks/ic2_conn_hv" }, "transform": { "scale": [ 0.5, 0.5, 0.5 ], @@ -131,7 +131,7 @@ ], "inventory,type=hv_relay": [ { - "model": "immersiveengineering:connector/relayHV.obj", + "model": "immersiveengineering:connector/relay_hv.obj", "transform": { "scale": [ 0.5, 0.5, 0.5 ], "firstperson_righthand": { "translation": [ 0, 0.25, 0.125 ]}, @@ -145,9 +145,9 @@ ], "inventory,type=glass_conn": [ { - "model": "immersiveengineering:connector/connectorHV.obj", + "model": "immersiveengineering:connector/connector_hv.obj", "textures": { - "#immersiveengineering:blocks/connector_connectorHV": "industrialwires:blocks/ic2_connGlass" + "#immersiveengineering:blocks/connector_connector_hv": "industrialwires:blocks/ic2_conn_glass" }, "transform": { "scale": [ 0.5, 0.5, 0.5 ], @@ -162,9 +162,9 @@ ], "inventory,type=glass_relay": [ { - "model": "immersiveengineering:connector/relayHV.obj", + "model": "immersiveengineering:connector/relay_hv.obj", "textures": { - "#immersiveengineering:blocks/connector_relayHV": "industrialwires:blocks/ic2_relayGlass" + "#immersiveengineering:blocks/connector_relay_hv": "industrialwires:blocks/ic2_relay_glass" }, "transform": { "scale": [ 0.5, 0.5, 0.5 ], diff --git a/src/main/resources/assets/industrialwires/blockstates/mechanical_converter.json b/src/main/resources/assets/industrialwires/blockstates/mechanical_converter.json index 2a7b316..ee9663e 100644 --- a/src/main/resources/assets/industrialwires/blockstates/mechanical_converter.json +++ b/src/main/resources/assets/industrialwires/blockstates/mechanical_converter.json @@ -2,7 +2,7 @@ "forge_marker": 1, "defaults": { "transform": "forge:default-block", - "model": "industrialwires:iwSixSides", + "model": "industrialwires:iw_six_sides", "textures": { }, diff --git a/src/main/resources/assets/industrialwires/lang/en_US.lang b/src/main/resources/assets/industrialwires/lang/en_US.lang index bf5b46d..3374f29 100644 --- a/src/main/resources/assets/industrialwires/lang/en_US.lang +++ b/src/main/resources/assets/industrialwires/lang/en_US.lang @@ -1,13 +1,13 @@ -tile.industrialwires.ic2Connector.tin_conn.name=Tin Wire Connector -tile.industrialwires.ic2Connector.tin_relay.name=Tin Wire Relay -tile.industrialwires.ic2Connector.copper_conn.name=Copper Wire Connector -tile.industrialwires.ic2Connector.copper_relay.name=Copper Wire Relay -tile.industrialwires.ic2Connector.gold_conn.name=Gold Wire Connector -tile.industrialwires.ic2Connector.gold_relay.name=Gold Wire Relay -tile.industrialwires.ic2Connector.hv_conn.name=IC2 HV Wire Connector -tile.industrialwires.ic2Connector.hv_relay.name=IC2 HV Wire Relay -tile.industrialwires.ic2Connector.glass_conn.name=Glass Fiber Wire Connector -tile.industrialwires.ic2Connector.glass_relay.name=Glass Fiber Wire Relay +tile.industrialwires.ic2_connector.tin_conn.name=Tin Wire Connector +tile.industrialwires.ic2_connector.tin_relay.name=Tin Wire Relay +tile.industrialwires.ic2_connector.copper_conn.name=Copper Wire Connector +tile.industrialwires.ic2_connector.copper_relay.name=Copper Wire Relay +tile.industrialwires.ic2_connector.gold_conn.name=Gold Wire Connector +tile.industrialwires.ic2_connector.gold_relay.name=Gold Wire Relay +tile.industrialwires.ic2_connector.hv_conn.name=IC2 HV Wire Connector +tile.industrialwires.ic2_connector.hv_relay.name=IC2 HV Wire Relay +tile.industrialwires.ic2_connector.glass_conn.name=Glass Fiber Wire Connector +tile.industrialwires.ic2_connector.glass_relay.name=Glass Fiber Wire Relay tile.industrialwires.mechanical_converter.ie_motor.name=Rotational Motor tile.industrialwires.mechanical_converter.ie_to_ic2.name=Converter: Rotational To Kinetic @@ -68,52 +68,52 @@ death.attack.industrialwires.jacobs_ladder=%1$s was electrocuted by a Jacob's La itemGroup.industrialwires=Industrial Wires -ie.manual.category.industrialWires.name=Industrial Wires +ie.manual.category.industrialwires.name=Industrial Wires ie.manual.category.control_panels.name=Control Panels -ie.manual.entry.industrialWires.wires.name=Industrial Wires -ie.manual.entry.industrialWires.wires.subtext=No complex impedance! -ie.manual.entry.industrialWires.wires0=Wires from the IndustrialWires company allow you to transfer energy like you can with cables from the IndustrialCraft2 company.
You use them exactly as you would use wires from Immersive Engineering. Each wire transfers as much EU as the corresponding cable would, so -ie.manual.entry.industrialWires.wires1=attaching a connector to a power source that would destroy the cable will destroy the connector.
The wire coils for the IC2 cable are different from the Immersive Engineering wire coils in that longer connections use up more wire: The coils are crafted by placing any combination of uninsulated IC2 cables and the corresponding wire coils in a crafting grid. The next page shows some examples of valid recipes and their outputs. The uninsulated -ie.manual.entry.industrialWires.wires2=tin cables can be replaced by uninsulated copper, gold or HV cables or by glass fiber cable to craft the other coils. +ie.manual.entry.industrialwires.wires.name=Industrial Wires +ie.manual.entry.industrialwires.wires.subtext=No complex impedance! +ie.manual.entry.industrialwires.wires0=Wires from the IndustrialWires company allow you to transfer energy like you can with cables from the IndustrialCraft2 company.
You use them exactly as you would use wires from Immersive Engineering. Each wire transfers as much EU as the corresponding cable would, so +ie.manual.entry.industrialwires.wires1=attaching a connector to a power source that would destroy the cable will destroy the connector.
The wire coils for the IC2 cable are different from the Immersive Engineering wire coils in that longer connections use up more wire: The coils are crafted by placing any combination of uninsulated IC2 cables and the corresponding wire coils in a crafting grid. The next page shows some examples of valid recipes and their outputs. The uninsulated +ie.manual.entry.industrialwires.wires2=tin cables can be replaced by uninsulated copper, gold or HV cables or by glass fiber cable to craft the other coils. -ie.manual.entry.industrialWires.mechConv.name=Mechanical Converters -ie.manual.entry.industrialWires.mechConv.subtext=I made rotational energy for this! -ie.manual.entry.industrialWires.mechConv0=Both the IC2 and IE company produce products that run on kinetic energy of some sort. The new converters from IndustrialWires allow you to convert between these two forms of energy!
To use the "Converter: Rotational To Kinetic" attach a source of IE rotational energy -ie.manual.entry.industrialWires.mechConv1=like a waterwheel or a motor (see page 3) to the side marked with a gear and a consumer of IC2 kinetic energy to the opposite side. The "Converter: Kinetic To Rotational" is used in a similar way (Rotational and kinetic energy have to be swapped).
Unfortunately some energy is -ie.manual.entry.industrialWires.mechConv2=lost with each conversion.
As a little extra the "Mechanical converter" product series also contains a Rotational Motor: It consumes IF to produce IE rotational energy. As with the converters this is not a lossless process. +ie.manual.entry.industrialwires.mechConv.name=Mechanical Converters +ie.manual.entry.industrialwires.mechConv.subtext=I made rotational energy for this! +ie.manual.entry.industrialwires.mechConv0=Both the IC2 and IE company produce products that run on kinetic energy of some sort. The new converters from IndustrialWires allow you to convert between these two forms of energy!
To use the "Converter: Rotational To Kinetic" attach a source of IE rotational energy +ie.manual.entry.industrialwires.mechConv1=like a waterwheel or a motor (see page 3) to the side marked with a gear and a consumer of IC2 kinetic energy to the opposite side. The "Converter: Kinetic To Rotational" is used in a similar way (Rotational and kinetic energy have to be swapped).
Unfortunately some energy is +ie.manual.entry.industrialwires.mechConv2=lost with each conversion.
As a little extra the "Mechanical converter" product series also contains a Rotational Motor: It consumes IF to produce IE rotational energy. As with the converters this is not a lossless process. -ie.manual.entry.industrialWires.jacobs.name=Jacob's Ladders -ie.manual.entry.industrialWires.jacobs.subtext=Probably contain PCB's! -ie.manual.entry.industrialWires.jacobs0=By applying a high voltage between 2 electrodes forming a "V" one can create an arc travelling upwards. They don't serve a particular purpose apart from being a nice-looking waste of power. Power can be supplied using either Flux or EU. The energy usage varies with the size of the ladder. -ie.manual.entry.industrialWires.jacobs1=These are the required power values in EU: . Due to the voltages involved touching the ladder while active is not a good idea. Applying salt to the electrodes will cause the arc to be colored orange for a short time due to the sodium contained in the salt. +ie.manual.entry.industrialwires.jacobs.name=Jacob's Ladders +ie.manual.entry.industrialwires.jacobs.subtext=Probably contain PCB's! +ie.manual.entry.industrialwires.jacobs0=By applying a high voltage between 2 electrodes forming a "V" one can create an arc travelling upwards. They don't serve a particular purpose apart from being a nice-looking waste of power. Power can be supplied using either Flux or EU. The energy usage varies with the size of the ladder. +ie.manual.entry.industrialwires.jacobs1=These are the required power values in EU: . Due to the voltages involved touching the ladder while active is not a good idea. Applying salt to the electrodes will cause the arc to be colored orange for a short time due to the sodium contained in the salt. -ie.manual.entry.industrialWires.intro.name=Introduction -ie.manual.entry.industrialWires.intro.subtext= -ie.manual.entry.industrialWires.intro0=Control Panels allow you to monitor and control a large amount of redstone signals using only a few blocks. Those signals can currently be connected using redstone wires and connectors.
Buttons, switches, indicator lights and other things that can be placed on a control panel are called §l(Panel) Components§r
To create a control panel you will need a Panel Creator, the individual components and a basic machine casing as the enclosure of the panel. Each -ie.manual.entry.industrialWires.intro1=component is described in the entry "Panel Components". Right-clicking with a panel component opens up a GUI in which the properties of the component, like the redstone channel and ID or the color, can be configured. -ie.manual.entry.industrialWires.intro2=A §l(panel) network§r is formed by panel blocks connected to each other, directly or through other panel blocks. Panel blocks include the control panel itself, the panel connector and the Redstone Wire Controller. If multiple components in one network are configured to modify the same -ie.manual.entry.industrialWires.intro3=redstone signal, the resulting behavior is undefined (but won't crash the game). Having multiple components accepting the same signal on a network is valid though. +ie.manual.entry.industrialwires.intro.name=Introduction +ie.manual.entry.industrialwires.intro.subtext= +ie.manual.entry.industrialwires.intro0=Control Panels allow you to monitor and control a large amount of redstone signals using only a few blocks. Those signals can currently be connected using redstone wires and connectors.
Buttons, switches, indicator lights and other things that can be placed on a control panel are called §l(Panel) Components§r
To create a control panel you will need a Panel Creator, the individual components and a basic machine casing as the enclosure of the panel. Each +ie.manual.entry.industrialwires.intro1=component is described in the entry "Panel Components". Right-clicking with a panel component opens up a GUI in which the properties of the component, like the redstone channel and ID or the color, can be configured. +ie.manual.entry.industrialwires.intro2=A §l(panel) network§r is formed by panel blocks connected to each other, directly or through other panel blocks. Panel blocks include the control panel itself, the panel connector and the Redstone Wire Controller. If multiple components in one network are configured to modify the same +ie.manual.entry.industrialwires.intro3=redstone signal, the resulting behavior is undefined (but won't crash the game). Having multiple components accepting the same signal on a network is valid though. -ie.manual.entry.industrialWires.panel_creator.name=Panel Creator -ie.manual.entry.industrialWires.panel_creator.subtext= -ie.manual.entry.industrialWires.panel_creator0=The GUI of the panel creator consists of two major sections: The controls on the left and the panel on the right. Components can be placed on the panel by "placing" the items in the corresponding point in the GUI. If the component is surrounded by a red area, it can not be placed in that -ie.manual.entry.industrialWires.panel_creator1=position on the panel. This usually means that it is either overlapping with an other component or isn't completely on the panel. The top button on the left (D) disassembles an existing control panel when it is placed in the slot beneath the button: The components of that panel are placed in the GUI, allowing them to be repositioned. The machine casing is lost in this process. The next button (C) turns a machine casing in the slot into a control panel with the components as positioned in the right of the GUI. The button -ie.manual.entry.industrialWires.panel_creator2=labeled R removes all components from the GUI panel area and places them in your inventory. Finally the last button (S) changes between being able to place components anywhere on the panel to only being able to place them on a 16x16 grid. +ie.manual.entry.industrialwires.panel_creator.name=Panel Creator +ie.manual.entry.industrialwires.panel_creator.subtext= +ie.manual.entry.industrialwires.panel_creator0=The GUI of the panel creator consists of two major sections: The controls on the left and the panel on the right. Components can be placed on the panel by "placing" the items in the corresponding point in the GUI. If the component is surrounded by a red area, it can not be placed in that +ie.manual.entry.industrialwires.panel_creator1=position on the panel. This usually means that it is either overlapping with an other component or isn't completely on the panel. The top button on the left (D) disassembles an existing control panel when it is placed in the slot beneath the button: The components of that panel are placed in the GUI, allowing them to be repositioned. The machine casing is lost in this process. The next button (C) turns a machine casing in the slot into a control panel with the components as positioned in the right of the GUI. The button +ie.manual.entry.industrialwires.panel_creator2=labeled R removes all components from the GUI panel area and places them in your inventory. Finally the last button (S) changes between being able to place components anywhere on the panel to only being able to place them on a 16x16 grid. -ie.manual.entry.industrialWires.redstone.name=Redstone Connections -ie.manual.entry.industrialWires.redstone.subtext=Could also be blood vessels -ie.manual.entry.industrialWires.redstone0=A panel network can contain any amount of §lRedstone Wire Controllers§r. Each controller should be assigned a different ID in its GUI. Each component that interacts with redstone signals has two settings in its GUI: A redstone channel color and a controller ID. To get the redstone signals out of and into the controller it needs to be connected to redstone -ie.manual.entry.industrialWires.redstone1=connectors from Immersive Engineering. +ie.manual.entry.industrialwires.redstone.name=Redstone Connections +ie.manual.entry.industrialwires.redstone.subtext=Could also be blood vessels +ie.manual.entry.industrialwires.redstone0=A panel network can contain any amount of §lRedstone Wire Controllers§r. Each controller should be assigned a different ID in its GUI. Each component that interacts with redstone signals has two settings in its GUI: A redstone channel color and a controller ID. To get the redstone signals out of and into the controller it needs to be connected to redstone +ie.manual.entry.industrialwires.redstone1=connectors from Immersive Engineering. -ie.manual.entry.industrialWires.components.name=Panel Components -ie.manual.entry.industrialWires.components.subtext=More than just two -ie.manual.entry.industrialWires.button=A simple button that activates a redstone signal when pressed. Its color can be changed. The button either stays on until clicked again (latching) or tuns off after half a second (non-latching). -ie.manual.entry.industrialWires.label=A text that can be placed on the control panel, for example to indicate the purpose of some other component. The color and obviously the text can be edited. -ie.manual.entry.industrialWires.indicator_light=A small indicator that brightens as the input redstone signal is increased. The color can be changed. -ie.manual.entry.industrialWires.slider=A sliding switch that can set an output redstone signal to any desired signal strength. It can be either vertically or horizontally aligned and can have any length between one eighth of a block and one block. The color of the sliding knob can be changed. -ie.manual.entry.industrialWires.toggle_switch=A switch to turn a signal on or off. The covered version includes a cover to prevent accidental activation: When clicked for the first time the cover will open, the signal will be turned on by clicking once again. Another click will close the cover and turn off the output signal. If the cover was opened by accident it can be closed by shift-right-clicking -ie.manual.entry.industrialWires.toggle_switch1=the switch. The color of the cover can be configured. -ie.manual.entry.industrialWires.variac=A Variac® is a variable autotransformer. The output signal of the transformer increases as the knob is turned to the right. The signal strenght can only be increased by one unit per click. \ No newline at end of file +ie.manual.entry.industrialwires.components.name=Panel Components +ie.manual.entry.industrialwires.components.subtext=More than just two +ie.manual.entry.industrialwires.button=A simple button that activates a redstone signal when pressed. Its color can be changed. The button either stays on until clicked again (latching) or tuns off after half a second (non-latching). +ie.manual.entry.industrialwires.label=A text that can be placed on the control panel, for example to indicate the purpose of some other component. The color and obviously the text can be edited. +ie.manual.entry.industrialwires.indicator_light=A small indicator that brightens as the input redstone signal is increased. The color can be changed. +ie.manual.entry.industrialwires.slider=A sliding switch that can set an output redstone signal to any desired signal strength. It can be either vertically or horizontally aligned and can have any length between one eighth of a block and one block. The color of the sliding knob can be changed. +ie.manual.entry.industrialwires.toggle_switch=A switch to turn a signal on or off. The covered version includes a cover to prevent accidental activation: When clicked for the first time the cover will open, the signal will be turned on by clicking once again. Another click will close the cover and turn off the output signal. If the cover was opened by accident it can be closed by shift-right-clicking +ie.manual.entry.industrialwires.toggle_switch1=the switch. The color of the cover can be configured. +ie.manual.entry.industrialwires.variac=A Variac® is a variable autotransformer. The output signal of the transformer increases as the knob is turned to the right. The signal strenght can only be increased by one unit per click. \ No newline at end of file diff --git a/src/main/resources/assets/industrialwires/models/block/iwSixSides.json b/src/main/resources/assets/industrialwires/models/block/iw_six_sides.json similarity index 100% rename from src/main/resources/assets/industrialwires/models/block/iwSixSides.json rename to src/main/resources/assets/industrialwires/models/block/iw_six_sides.json diff --git a/src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/copper.json b/src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/copper.json new file mode 100644 index 0000000..09b426e --- /dev/null +++ b/src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/copper.json @@ -0,0 +1,6 @@ +{ + "parent":"item/generated", + "textures": { + "layer0": "industrialwires:items/ic2_wire_copper" + } +} diff --git a/src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/glass.json b/src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/glass.json new file mode 100644 index 0000000..24d7785 --- /dev/null +++ b/src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/glass.json @@ -0,0 +1,6 @@ +{ + "parent":"item/generated", + "textures": { + "layer0": "industrialwires:items/ic2_wire_glass" + } +} diff --git a/src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/gold.json b/src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/gold.json new file mode 100644 index 0000000..23359b2 --- /dev/null +++ b/src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/gold.json @@ -0,0 +1,6 @@ +{ + "parent":"item/generated", + "textures": { + "layer0": "industrialwires:items/ic2_wire_gold" + } +} diff --git a/src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/hv.json b/src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/hv.json new file mode 100644 index 0000000..c370c2c --- /dev/null +++ b/src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/hv.json @@ -0,0 +1,6 @@ +{ + "parent":"item/generated", + "textures": { + "layer0": "industrialwires:items/ic2_wire_hv" + } +} diff --git a/src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/tin.json b/src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/tin.json new file mode 100644 index 0000000..31be487 --- /dev/null +++ b/src/main/resources/assets/industrialwires/models/item/ic2_wire_coil/tin.json @@ -0,0 +1,6 @@ +{ + "parent":"item/generated", + "textures": { + "layer0": "industrialwires:items/ic2_wire_tin" + } +} diff --git a/src/main/resources/assets/industrialwires/models/item/ic2wireCoil/copper.json b/src/main/resources/assets/industrialwires/models/item/ic2wireCoil/copper.json deleted file mode 100644 index 95b1199..0000000 --- a/src/main/resources/assets/industrialwires/models/item/ic2wireCoil/copper.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent":"item/generated", - "textures": { - "layer0":"industrialwires:items/ic2_wireCopper" - } -} diff --git a/src/main/resources/assets/industrialwires/models/item/ic2wireCoil/glass.json b/src/main/resources/assets/industrialwires/models/item/ic2wireCoil/glass.json deleted file mode 100644 index 1e1c1b3..0000000 --- a/src/main/resources/assets/industrialwires/models/item/ic2wireCoil/glass.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent":"item/generated", - "textures": { - "layer0":"industrialwires:items/ic2_wireGlass" - } -} diff --git a/src/main/resources/assets/industrialwires/models/item/ic2wireCoil/gold.json b/src/main/resources/assets/industrialwires/models/item/ic2wireCoil/gold.json deleted file mode 100644 index 56a31c9..0000000 --- a/src/main/resources/assets/industrialwires/models/item/ic2wireCoil/gold.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent":"item/generated", - "textures": { - "layer0":"industrialwires:items/ic2_wireGold" - } -} diff --git a/src/main/resources/assets/industrialwires/models/item/ic2wireCoil/hv.json b/src/main/resources/assets/industrialwires/models/item/ic2wireCoil/hv.json deleted file mode 100644 index 21df982..0000000 --- a/src/main/resources/assets/industrialwires/models/item/ic2wireCoil/hv.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent":"item/generated", - "textures": { - "layer0":"industrialwires:items/ic2_wireHV" - } -} diff --git a/src/main/resources/assets/industrialwires/models/item/ic2wireCoil/tin.json b/src/main/resources/assets/industrialwires/models/item/ic2wireCoil/tin.json deleted file mode 100644 index 6e00082..0000000 --- a/src/main/resources/assets/industrialwires/models/item/ic2wireCoil/tin.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent":"item/generated", - "textures": { - "layer0":"industrialwires:items/ic2_wireTin" - } -} diff --git a/src/main/resources/assets/industrialwires/textures/blocks/ic2_connCopper.png b/src/main/resources/assets/industrialwires/textures/blocks/ic2_conn_copper.png similarity index 100% rename from src/main/resources/assets/industrialwires/textures/blocks/ic2_connCopper.png rename to src/main/resources/assets/industrialwires/textures/blocks/ic2_conn_copper.png diff --git a/src/main/resources/assets/industrialwires/textures/blocks/ic2_connGlass.png b/src/main/resources/assets/industrialwires/textures/blocks/ic2_conn_glass.png similarity index 100% rename from src/main/resources/assets/industrialwires/textures/blocks/ic2_connGlass.png rename to src/main/resources/assets/industrialwires/textures/blocks/ic2_conn_glass.png diff --git a/src/main/resources/assets/industrialwires/textures/blocks/ic2_connGold.png b/src/main/resources/assets/industrialwires/textures/blocks/ic2_conn_gold.png similarity index 100% rename from src/main/resources/assets/industrialwires/textures/blocks/ic2_connGold.png rename to src/main/resources/assets/industrialwires/textures/blocks/ic2_conn_gold.png diff --git a/src/main/resources/assets/industrialwires/textures/blocks/ic2_connHV.png b/src/main/resources/assets/industrialwires/textures/blocks/ic2_conn_hv.png similarity index 100% rename from src/main/resources/assets/industrialwires/textures/blocks/ic2_connHV.png rename to src/main/resources/assets/industrialwires/textures/blocks/ic2_conn_hv.png diff --git a/src/main/resources/assets/industrialwires/textures/blocks/ic2_connTin.png b/src/main/resources/assets/industrialwires/textures/blocks/ic2_conn_tin.png similarity index 100% rename from src/main/resources/assets/industrialwires/textures/blocks/ic2_connTin.png rename to src/main/resources/assets/industrialwires/textures/blocks/ic2_conn_tin.png diff --git a/src/main/resources/assets/industrialwires/textures/blocks/ic2_relayCopper.png b/src/main/resources/assets/industrialwires/textures/blocks/ic2_relay_copper.png similarity index 100% rename from src/main/resources/assets/industrialwires/textures/blocks/ic2_relayCopper.png rename to src/main/resources/assets/industrialwires/textures/blocks/ic2_relay_copper.png diff --git a/src/main/resources/assets/industrialwires/textures/blocks/ic2_relayGlass.png b/src/main/resources/assets/industrialwires/textures/blocks/ic2_relay_glass.png similarity index 100% rename from src/main/resources/assets/industrialwires/textures/blocks/ic2_relayGlass.png rename to src/main/resources/assets/industrialwires/textures/blocks/ic2_relay_glass.png diff --git a/src/main/resources/assets/industrialwires/textures/blocks/ic2_relayGold.png b/src/main/resources/assets/industrialwires/textures/blocks/ic2_relay_gold.png similarity index 100% rename from src/main/resources/assets/industrialwires/textures/blocks/ic2_relayGold.png rename to src/main/resources/assets/industrialwires/textures/blocks/ic2_relay_gold.png diff --git a/src/main/resources/assets/industrialwires/textures/blocks/ic2_relayTin.png b/src/main/resources/assets/industrialwires/textures/blocks/ic2_relay_tin.png similarity index 100% rename from src/main/resources/assets/industrialwires/textures/blocks/ic2_relayTin.png rename to src/main/resources/assets/industrialwires/textures/blocks/ic2_relay_tin.png diff --git a/src/main/resources/assets/industrialwires/textures/items/ic2_wireCopper.png b/src/main/resources/assets/industrialwires/textures/items/ic2_wire_copper.png similarity index 100% rename from src/main/resources/assets/industrialwires/textures/items/ic2_wireCopper.png rename to src/main/resources/assets/industrialwires/textures/items/ic2_wire_copper.png diff --git a/src/main/resources/assets/industrialwires/textures/items/ic2_wireGlass.png b/src/main/resources/assets/industrialwires/textures/items/ic2_wire_glass.png similarity index 100% rename from src/main/resources/assets/industrialwires/textures/items/ic2_wireGlass.png rename to src/main/resources/assets/industrialwires/textures/items/ic2_wire_glass.png diff --git a/src/main/resources/assets/industrialwires/textures/items/ic2_wireGold.png b/src/main/resources/assets/industrialwires/textures/items/ic2_wire_gold.png similarity index 100% rename from src/main/resources/assets/industrialwires/textures/items/ic2_wireGold.png rename to src/main/resources/assets/industrialwires/textures/items/ic2_wire_gold.png diff --git a/src/main/resources/assets/industrialwires/textures/items/ic2_wireHV.png b/src/main/resources/assets/industrialwires/textures/items/ic2_wire_hv.png similarity index 100% rename from src/main/resources/assets/industrialwires/textures/items/ic2_wireHV.png rename to src/main/resources/assets/industrialwires/textures/items/ic2_wire_hv.png diff --git a/src/main/resources/assets/industrialwires/textures/items/ic2_wireTin.png b/src/main/resources/assets/industrialwires/textures/items/ic2_wire_tin.png similarity index 100% rename from src/main/resources/assets/industrialwires/textures/items/ic2_wireTin.png rename to src/main/resources/assets/industrialwires/textures/items/ic2_wire_tin.png diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index abf84d4..b85a2d8 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -2,7 +2,7 @@ { "modid": "industrialwires", "name": "Industrial Wires", - "description": "Addon for IndustrialCraft2 and Immersive Engineering that adds IE wires to transfer IC2 power", + "description": "An addon for IndustrialCraft2 and Immersive Engineering that adds IE wires to transfer IC2 power and other fun things!", "version": "${version}", "mcversion": "${mcversion}", "url": "",