Updated to MC 1.11, part 1
Compiles and runs, but probably doesn't really work yet
|
@ -21,3 +21,4 @@ build
|
||||||
eclipse
|
eclipse
|
||||||
run
|
run
|
||||||
libs
|
libs
|
||||||
|
classes
|
10
build.gradle
|
@ -48,13 +48,11 @@ sourceCompatibility = 1.8
|
||||||
targetCompatibility = 1.8
|
targetCompatibility = 1.8
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
version = "12.18.3.2234"
|
version = "13.20.0.2282"
|
||||||
runDir = "run"
|
runDir = "run"
|
||||||
|
|
||||||
replace '${version}', project.version
|
replace '${version}', project.version
|
||||||
mappings = "snapshot_20160701"
|
mappings = "snapshot_20170323"
|
||||||
//"snapshot_20160518" 1.9
|
|
||||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -69,8 +67,8 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
deobfCompile "net.industrial-craft:industrialcraft-2:2.6.+"
|
deobfCompile "net.industrial-craft:industrialcraft-2:2.7.+:dev"
|
||||||
deobfCompile "blusunrize:ImmersiveEngineering:0.10-+:deobf"
|
deobfCompile "blusunrize:ImmersiveEngineering:0.11-+:deobf"
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class CommonProxy implements IGuiHandler {
|
||||||
} else if (ID == 1) {//ITEM GUI
|
} else if (ID == 1) {//ITEM GUI
|
||||||
EnumHand h = z == 1 ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND;
|
EnumHand h = z == 1 ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND;
|
||||||
ItemStack held = player.getHeldItem(h);
|
ItemStack held = player.getHeldItem(h);
|
||||||
if (held != null && held.getItem() == IndustrialWires.panelComponent) {
|
if (!held.isEmpty() && held.getItem() == IndustrialWires.panelComponent) {
|
||||||
return new ContainerPanelComponent(h);
|
return new ContainerPanelComponent(h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@ public interface IIC2Connector {
|
||||||
/**
|
/**
|
||||||
* @return leftover energy.
|
* @return leftover energy.
|
||||||
*/
|
*/
|
||||||
public double insertEnergy(double eu, boolean simulate);
|
double insertEnergy(double eu, boolean simulate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,8 @@ import malte0811.industrialWires.network.MessageTileSyncIW;
|
||||||
import malte0811.industrialWires.wires.IC2Wiretype;
|
import malte0811.industrialWires.wires.IC2Wiretype;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||||
import net.minecraftforge.fml.common.SidedProxy;
|
import net.minecraftforge.fml.common.SidedProxy;
|
||||||
|
@ -64,7 +64,7 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
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 class IndustrialWires {
|
||||||
public static final String MODID = "industrialwires";
|
public static final String MODID = "industrialwires";
|
||||||
public static final String VERSION = "${version}";
|
public static final String VERSION = "${version}";
|
||||||
|
@ -80,10 +80,7 @@ public class IndustrialWires {
|
||||||
public static CreativeTabs creativeTab = new CreativeTabs(MODID) {
|
public static CreativeTabs creativeTab = new CreativeTabs(MODID) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getTabIconItem() {
|
public ItemStack getTabIconItem() {
|
||||||
return null;
|
|
||||||
}
|
|
||||||
public ItemStack getIconItemStack() {
|
|
||||||
return new ItemStack(coil, 1, 2);
|
return new ItemStack(coil, 1, 2);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -100,12 +97,11 @@ public class IndustrialWires {
|
||||||
coil = new ItemIC2Coil();
|
coil = new ItemIC2Coil();
|
||||||
panelComponent = new ItemPanelComponent();
|
panelComponent = new ItemPanelComponent();
|
||||||
panel = new BlockPanel();
|
panel = new BlockPanel();
|
||||||
//TODO change to MODID+ when changing to a new MC version
|
GameRegistry.registerTileEntity(TileEntityIC2ConnectorTin.class, MODID + "ic2ConnectorTin");
|
||||||
GameRegistry.registerTileEntity(TileEntityIC2ConnectorTin.class, "ic2ConnectorTin");
|
GameRegistry.registerTileEntity(TileEntityIC2ConnectorCopper.class, MODID + "ic2ConnectorCopper");
|
||||||
GameRegistry.registerTileEntity(TileEntityIC2ConnectorCopper.class, "ic2ConnectorCopper");
|
GameRegistry.registerTileEntity(TileEntityIC2ConnectorGold.class, MODID + "ic2ConnectorGold");
|
||||||
GameRegistry.registerTileEntity(TileEntityIC2ConnectorGold.class, "ic2ConnectorGold");
|
GameRegistry.registerTileEntity(TileEntityIC2ConnectorHV.class, MODID + "ic2ConnectorHV");
|
||||||
GameRegistry.registerTileEntity(TileEntityIC2ConnectorHV.class, "ic2ConnectorHV");
|
GameRegistry.registerTileEntity(TileEntityIC2ConnectorGlass.class, MODID + "ic2ConnectorGlass");
|
||||||
GameRegistry.registerTileEntity(TileEntityIC2ConnectorGlass.class, "ic2ConnectorGlass");
|
|
||||||
GameRegistry.registerTileEntity(TileEntityJacobsLadder.class, MODID+":jacobsLadder");
|
GameRegistry.registerTileEntity(TileEntityJacobsLadder.class, MODID+":jacobsLadder");
|
||||||
GameRegistry.registerTileEntity(TileEntityPanel.class, MODID+":control_panel");
|
GameRegistry.registerTileEntity(TileEntityPanel.class, MODID+":control_panel");
|
||||||
GameRegistry.registerTileEntity(TileEntityRSPanelConn.class, MODID+":control_panel_rs");
|
GameRegistry.registerTileEntity(TileEntityRSPanelConn.class, MODID+":control_panel_rs");
|
||||||
|
@ -210,19 +206,19 @@ public class IndustrialWires {
|
||||||
}
|
}
|
||||||
private class CoilLengthAdapter implements IRecipeAdapter<RecipeCoilLength> {
|
private class CoilLengthAdapter implements IRecipeAdapter<RecipeCoilLength> {
|
||||||
@Override
|
@Override
|
||||||
public RecipeQuery[] getQueriedInputs(RecipeCoilLength recipe, ItemStack[] in) {
|
public RecipeQuery[] getQueriedInputs(RecipeCoilLength recipe, NonNullList<ItemStack> in) {
|
||||||
List<RecipeQuery> ret = new ArrayList<>();
|
List<RecipeQuery> ret = new ArrayList<>();
|
||||||
for (int i = 0;i<in.length-1;i++) {
|
for (int i = 0; i < in.size() - 1; i++) {
|
||||||
boolean added = false;
|
boolean added = false;
|
||||||
for (int j = 0;j<ret.size();j++) {
|
for (RecipeQuery aRet : ret) {
|
||||||
if (ItemStack.areItemStacksEqual((ItemStack)ret.get(j).query, in[i])) {
|
if (ItemStack.areItemStacksEqual((ItemStack) aRet.query, in.get(i))) {
|
||||||
ret.get(j).querySize++;
|
aRet.querySize++;
|
||||||
added = true;
|
added = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!added) {
|
if (!added) {
|
||||||
ret.add(new RecipeQuery(in[i], 1));
|
ret.add(new RecipeQuery(in.get(i), 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret.toArray(new RecipeQuery[ret.size()]);
|
return ret.toArray(new RecipeQuery[ret.size()]);
|
||||||
|
|
|
@ -31,7 +31,6 @@ import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -45,9 +44,8 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public abstract class BlockIWBase extends Block {
|
public abstract class BlockIWBase extends Block {
|
||||||
|
@ -62,6 +60,7 @@ public abstract class BlockIWBase extends Block {
|
||||||
setCreativeTab(IndustrialWires.creativeTab);
|
setCreativeTab(IndustrialWires.creativeTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState() {
|
protected BlockStateContainer createBlockState() {
|
||||||
if (properties==null) {
|
if (properties==null) {
|
||||||
|
@ -75,8 +74,9 @@ public abstract class BlockIWBase extends Block {
|
||||||
return new BlockStateContainer(this, props);
|
return new BlockStateContainer(this, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@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);
|
state = super.getActualState(state, worldIn, pos);
|
||||||
TileEntity tile = worldIn.getTileEntity(pos);
|
TileEntity tile = worldIn.getTileEntity(pos);
|
||||||
if (tile instanceof IHasDummyBlocksIW) {
|
if (tile instanceof IHasDummyBlocksIW) {
|
||||||
|
@ -92,8 +92,9 @@ public abstract class BlockIWBase extends Block {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@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);
|
state = super.getExtendedState(state, world, pos);
|
||||||
if (state instanceof IExtendedBlockState) {
|
if (state instanceof IExtendedBlockState) {
|
||||||
TileEntity te = world.getTileEntity(pos);
|
TileEntity te = world.getTileEntity(pos);
|
||||||
|
@ -110,7 +111,7 @@ public abstract class BlockIWBase extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
|
public void breakBlock(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
|
||||||
TileEntity te = worldIn.getTileEntity(pos);
|
TileEntity te = worldIn.getTileEntity(pos);
|
||||||
if (te instanceof IHasDummyBlocksIW) {
|
if (te instanceof IHasDummyBlocksIW) {
|
||||||
((IHasDummyBlocksIW) te).breakDummies();
|
((IHasDummyBlocksIW) te).breakDummies();
|
||||||
|
@ -123,20 +124,7 @@ public abstract class BlockIWBase extends Block {
|
||||||
worldIn.removeTileEntity(pos);
|
worldIn.removeTileEntity(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nonnull
|
||||||
@Override
|
|
||||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) {
|
|
||||||
return getBoundingBox(blockState, worldIn, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn) {
|
|
||||||
AxisAlignedBB axisalignedbb = getBoundingBox(state, worldIn, pos).offset(pos);
|
|
||||||
if (entityBox.intersectsWith(axisalignedbb)) {
|
|
||||||
collidingBoxes.add(axisalignedbb);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
TileEntity te = source.getTileEntity(pos);
|
TileEntity te = source.getTileEntity(pos);
|
||||||
|
@ -152,8 +140,9 @@ public abstract class BlockIWBase extends Block {
|
||||||
//mostly copied from IE
|
//mostly copied from IE
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player,
|
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);
|
TileEntity te = world.getTileEntity(pos);
|
||||||
|
ItemStack heldItem = player.getHeldItem(hand);
|
||||||
if(te instanceof IEBlockInterfaces.IDirectionalTile && Utils.isHammer(heldItem) && !world.isRemote) {
|
if(te instanceof IEBlockInterfaces.IDirectionalTile && Utils.isHammer(heldItem) && !world.isRemote) {
|
||||||
IEBlockInterfaces.IDirectionalTile directionalTe = (IEBlockInterfaces.IDirectionalTile) te;
|
IEBlockInterfaces.IDirectionalTile directionalTe = (IEBlockInterfaces.IDirectionalTile) te;
|
||||||
if (directionalTe.canHammerRotate(side, hitX, hitY, hitZ, player)) {
|
if (directionalTe.canHammerRotate(side, hitX, hitY, hitZ, player)) {
|
||||||
|
@ -196,10 +185,10 @@ public abstract class BlockIWBase extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
if (te instanceof IEBlockInterfaces.ITileDrop) {
|
||||||
ItemStack drop = ((IEBlockInterfaces.ITileDrop) te).getTileDrop(player, state);
|
ItemStack drop = ((IEBlockInterfaces.ITileDrop) te).getTileDrop(player, state);
|
||||||
if (drop!=null) {
|
if (!drop.isEmpty()) {
|
||||||
spawnAsEntity(worldIn, pos, drop);
|
spawnAsEntity(worldIn, pos, drop);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +197,7 @@ public abstract class BlockIWBase extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) {
|
public boolean rotateBlock(World world, @Nonnull BlockPos pos, @Nonnull EnumFacing axis) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,13 +34,13 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumFacing.AxisDirection;
|
import net.minecraft.util.EnumFacing.AxisDirection;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacementCheck {
|
public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacementCheck {
|
||||||
private static PropertyEnum<LadderSize> size_property = PropertyEnum.create("size", LadderSize.class);
|
private static PropertyEnum<LadderSize> size_property = PropertyEnum.create("size", LadderSize.class);
|
||||||
|
@ -49,8 +49,9 @@ public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacem
|
||||||
super(Material.IRON, "jacobs_ladder");
|
super(Material.IRON, "jacobs_ladder");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@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);
|
state = super.getActualState(state, worldIn, pos);
|
||||||
TileEntity tile = worldIn.getTileEntity(pos);
|
TileEntity tile = worldIn.getTileEntity(pos);
|
||||||
if (tile instanceof TileEntityJacobsLadder) {
|
if (tile instanceof TileEntityJacobsLadder) {
|
||||||
|
@ -71,13 +72,14 @@ public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacem
|
||||||
return state.getValue(size_property).ordinal();
|
return state.getValue(size_property).ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return super.getStateFromMeta(meta).withProperty(size_property, LadderSize.values()[meta]);
|
return super.getStateFromMeta(meta).withProperty(size_property, LadderSize.values()[meta]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubBlocks(@Nonnull Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
for (int i = 0; i < LadderSize.values().length; i++) {
|
for (int i = 0; i < LadderSize.values().length; i++) {
|
||||||
list.add(new ItemStack(this, 1, i));
|
list.add(new ItemStack(this, 1, i));
|
||||||
}
|
}
|
||||||
|
@ -94,7 +96,7 @@ public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacem
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
|
||||||
return new TileEntityJacobsLadder(state.getValue(size_property));
|
return new TileEntityJacobsLadder(state.getValue(size_property));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,8 +120,10 @@ public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacem
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@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();
|
EnumFacing f = facing.getOpposite();
|
||||||
if (facing.getAxis() == EnumFacing.Axis.Y) {
|
if (facing.getAxis() == EnumFacing.Axis.Y) {
|
||||||
double dX = hitX - .5;
|
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);
|
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
|
@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));
|
return new ItemStack(this, 1, getMetaFromState(state));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,12 +153,12 @@ public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacem
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
TileEntity te = worldIn.getTileEntity(pos);
|
||||||
if (te instanceof TileEntityJacobsLadder) {
|
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
|
@Override
|
||||||
|
@ -168,7 +173,7 @@ public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacem
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
TileEntity te = world.getTileEntity(pos);
|
||||||
return te instanceof TileEntityJacobsLadder && ((TileEntityJacobsLadder) te).rotate(world, pos, axis);
|
return te instanceof TileEntityJacobsLadder && ((TileEntityJacobsLadder) te).rotate(world, pos, axis);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,16 +25,14 @@ import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
|
||||||
public class EnergyAdapter implements 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
|
* rec and prov are null if the TE does not implement them
|
||||||
*/
|
*/
|
||||||
IFluxConnection tile;
|
private IFluxReceiver rec;
|
||||||
IFluxReceiver rec;
|
private IFluxProvider prov;
|
||||||
IFluxProvider prov;
|
|
||||||
|
private EnumFacing dir;
|
||||||
EnumFacing dir;
|
|
||||||
public EnergyAdapter(IFluxConnection te, EnumFacing f) {
|
public EnergyAdapter(IFluxConnection te, EnumFacing f) {
|
||||||
tile = te;
|
|
||||||
dir = f;
|
dir = f;
|
||||||
if (te instanceof IFluxReceiver) {
|
if (te instanceof IFluxReceiver) {
|
||||||
rec = (IFluxReceiver) te;
|
rec = (IFluxReceiver) te;
|
||||||
|
|
|
@ -28,6 +28,8 @@ import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class ItemBlockIW extends ItemBlock {
|
public class ItemBlockIW extends ItemBlock {
|
||||||
private final Object[] values;
|
private final Object[] values;
|
||||||
public ItemBlockIW(Block b) {
|
public ItemBlockIW(Block b) {
|
||||||
|
@ -39,6 +41,8 @@ public class ItemBlockIW extends ItemBlock {
|
||||||
}
|
}
|
||||||
hasSubtypes = true;
|
hasSubtypes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName(ItemStack stack) {
|
public String getUnlocalizedName(ItemStack stack) {
|
||||||
int meta = stack.getMetadata();
|
int meta = stack.getMetadata();
|
||||||
|
@ -54,7 +58,8 @@ public class ItemBlockIW extends ItemBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)) {
|
if (block instanceof IPlacementCheck&&!((IPlacementCheck) block).canPlaceBlockAt(world, pos, stack)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,14 @@ import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public abstract class TileEntityIWBase extends TileEntity {
|
public abstract class TileEntityIWBase extends TileEntity {
|
||||||
protected static final String ENERGY_TAG = "energy";
|
protected static final String ENERGY_TAG = "energy";
|
||||||
protected static final String BUFFER_TAG = "buffer";
|
protected static final String BUFFER_TAG = "buffer";
|
||||||
protected static final String DIR_TAG = "dir";
|
protected static final String DIR_TAG = "dir";
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound getUpdateTag() {
|
public NBTTagCompound getUpdateTag() {
|
||||||
NBTTagCompound nbt = super.getUpdateTag();
|
NBTTagCompound nbt = super.getUpdateTag();
|
||||||
|
@ -36,6 +40,8 @@ public abstract class TileEntityIWBase extends TileEntity {
|
||||||
public SPacketUpdateTileEntity getUpdatePacket() {
|
public SPacketUpdateTileEntity getUpdatePacket() {
|
||||||
return new SPacketUpdateTileEntity(pos, getBlockMetadata(), getUpdateTag());
|
return new SPacketUpdateTileEntity(pos, getBlockMetadata(), getUpdateTag());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||||
writeNBT(compound, false);
|
writeNBT(compound, false);
|
||||||
|
|
|
@ -50,6 +50,7 @@ import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.energy.CapabilityEnergy;
|
import net.minecraftforge.energy.CapabilityEnergy;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickable, IHasDummyBlocksIW, ISyncReceiver, IEnergySink, IBlockBoundsIW, IDirectionalTile {
|
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()) {
|
if (isDummy()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!worldObj.isRemote) {
|
if (!world.isRemote) {
|
||||||
if (!addedToIC2Net) {
|
if (!addedToIC2Net) {
|
||||||
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
|
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
|
||||||
addedToIC2Net = true;
|
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 y = j * (size.height + size.extraHeight) / (double) (size.movementPoints - 1) + size.innerPointOffset;
|
||||||
double width = widthFromHeight(y);
|
double width = widthFromHeight(y);
|
||||||
for (int i = 0; i < size.arcPoints - 2; i++) {
|
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 xMin = width * i / (double) (size.arcPoints - 2) - width / 2 + size.bottomDistance / 2;
|
||||||
double xDiff = width / (double) (size.arcPoints - 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);
|
controlControls[i][j] = new Vec3d(x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t = 0;
|
t = 0;
|
||||||
timeTillActive = size.delay;
|
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()));
|
IndustrialWires.packetHandler.sendToAll(new MessageTileSyncIW(this, writeArcStarter()));
|
||||||
} else if (timeTillActive == 0 && t < 1) {
|
} else if (timeTillActive == 0 && t < 1) {
|
||||||
double extracted = energy.extractEU(consumtionEU, false);
|
double extracted = energy.extractEU(consumtionEU, false);
|
||||||
|
@ -192,7 +193,7 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readCustomNBT(NBTTagCompound nbt, boolean descPacket) {
|
public void readCustomNBT(@Nonnull NBTTagCompound nbt, boolean descPacket) {
|
||||||
LadderSize oldSize = size;
|
LadderSize oldSize = size;
|
||||||
size = LadderSize.values()[nbt.getInteger("size")];
|
size = LadderSize.values()[nbt.getInteger("size")];
|
||||||
if (size != oldSize) {
|
if (size != oldSize) {
|
||||||
|
@ -205,7 +206,7 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeCustomNBT(NBTTagCompound nbt, boolean descPacket) {
|
public void writeCustomNBT(@Nonnull NBTTagCompound nbt, boolean descPacket) {
|
||||||
nbt.setInteger("size", size.ordinal());
|
nbt.setInteger("size", size.ordinal());
|
||||||
nbt.setInteger("dummy", dummy);
|
nbt.setInteger("dummy", dummy);
|
||||||
energy.writeToNbt(nbt, "energy");
|
energy.writeToNbt(nbt, "energy");
|
||||||
|
@ -275,8 +276,8 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
|
||||||
public void placeDummies(IBlockState state) {
|
public void placeDummies(IBlockState state) {
|
||||||
for (int i = 1; i <= size.dummyCount; i++) {
|
for (int i = 1; i <= size.dummyCount; i++) {
|
||||||
BlockPos pos2 = pos.offset(EnumFacing.UP, i);
|
BlockPos pos2 = pos.offset(EnumFacing.UP, i);
|
||||||
worldObj.setBlockState(pos2, state);
|
world.setBlockState(pos2, state);
|
||||||
TileEntity te = worldObj.getTileEntity(pos2);
|
TileEntity te = world.getTileEntity(pos2);
|
||||||
if (te instanceof TileEntityJacobsLadder) {
|
if (te instanceof TileEntityJacobsLadder) {
|
||||||
((TileEntityJacobsLadder) te).size = size;
|
((TileEntityJacobsLadder) te).size = size;
|
||||||
((TileEntityJacobsLadder) te).dummy = i;
|
((TileEntityJacobsLadder) te).dummy = i;
|
||||||
|
@ -288,8 +289,8 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
|
||||||
@Override
|
@Override
|
||||||
public void breakDummies() {
|
public void breakDummies() {
|
||||||
for (int i = 0; i <= size.dummyCount; i++) {
|
for (int i = 0; i <= size.dummyCount; i++) {
|
||||||
if (i != dummy && worldObj.getTileEntity(pos.offset(EnumFacing.UP, i - dummy)) instanceof TileEntityJacobsLadder) {
|
if (i != dummy && world.getTileEntity(pos.offset(EnumFacing.UP, i - dummy)) instanceof TileEntityJacobsLadder) {
|
||||||
worldObj.setBlockToAir(pos.offset(EnumFacing.UP, i - dummy));
|
world.setBlockToAir(pos.offset(EnumFacing.UP, i - dummy));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -309,15 +310,15 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
|
||||||
|
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
if (isDummy()) {
|
if (isDummy()) {
|
||||||
TileEntity master = worldObj.getTileEntity(pos.down(dummy));
|
TileEntity master = world.getTileEntity(pos.down(dummy));
|
||||||
return master instanceof TileEntityJacobsLadder&&((TileEntityJacobsLadder) master).isActive();
|
return master instanceof TileEntityJacobsLadder&&((TileEntityJacobsLadder) master).isActive();
|
||||||
}
|
}
|
||||||
return timeTillActive == 0 && t < 1;
|
return timeTillActive == 0 && t < 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onEntityTouch(Entity e) {
|
public void onEntityTouch(Entity e) {
|
||||||
if (isDummy() && !worldObj.isRemote) {
|
if (isDummy() && !world.isRemote) {
|
||||||
TileEntity master = worldObj.getTileEntity(pos.down(dummy));
|
TileEntity master = world.getTileEntity(pos.down(dummy));
|
||||||
if (master instanceof TileEntityJacobsLadder && ((TileEntityJacobsLadder) master).isActive()) {
|
if (master instanceof TileEntityJacobsLadder && ((TileEntityJacobsLadder) master).isActive()) {
|
||||||
hurtEntity(e);
|
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));
|
e.attackEntityFrom(new DamageSource("industrialwires.jacobs_ladder"), IWConfig.HVStuff.jacobsBaseDmg * (size.ordinal() + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onActivated(EntityPlayer playerIn, EnumHand hand, ItemStack heldItem) {
|
public boolean onActivated(EntityPlayer player, EnumHand hand) {
|
||||||
TileEntity masterTE = dummy == 0 ? this : worldObj.getTileEntity(pos.down(dummy));
|
ItemStack heldItem = player.getHeldItem(hand);
|
||||||
|
TileEntity masterTE = dummy == 0 ? this : world.getTileEntity(pos.down(dummy));
|
||||||
if (masterTE instanceof TileEntityJacobsLadder) {
|
if (masterTE instanceof TileEntityJacobsLadder) {
|
||||||
TileEntityJacobsLadder master = (TileEntityJacobsLadder) masterTE;
|
TileEntityJacobsLadder master = (TileEntityJacobsLadder) masterTE;
|
||||||
if (master.isActive()) {
|
if (master.isActive()) {
|
||||||
if (!worldObj.isRemote) {
|
if (!world.isRemote) {
|
||||||
hurtEntity(playerIn);
|
hurtEntity(player);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (heldItem != null && ApiUtils.compareToOreName(heldItem, "itemSalt")) {
|
} else if (!heldItem.isEmpty() && ApiUtils.compareToOreName(heldItem, "itemSalt")) {
|
||||||
return master.salt(playerIn, hand, heldItem);
|
return master.salt(player, hand, heldItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -346,12 +348,12 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
|
||||||
|
|
||||||
private boolean salt(EntityPlayer player, EnumHand hand, ItemStack held) {
|
private boolean salt(EntityPlayer player, EnumHand hand, ItemStack held) {
|
||||||
if (salt < 3) {
|
if (salt < 3) {
|
||||||
if (!worldObj.isRemote) {
|
if (!world.isRemote) {
|
||||||
salt++;
|
salt++;
|
||||||
if (!player.isCreative()) {
|
if (!player.isCreative()) {
|
||||||
held.stackSize--;
|
held.shrink(1);
|
||||||
if (held.stackSize <= 0) {
|
if (held.getCount() <= 0) {
|
||||||
player.setHeldItem(hand, null);
|
player.setHeldItem(hand, ItemStack.EMPTY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NBTTagCompound update = new NBTTagCompound();
|
NBTTagCompound update = new NBTTagCompound();
|
||||||
|
@ -368,7 +370,7 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
|
||||||
if (isActive()) {
|
if (isActive()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!worldObj.isRemote) {
|
if (!world.isRemote) {
|
||||||
EnumFacing targetDir = facing.rotateAround(EnumFacing.Axis.Y);
|
EnumFacing targetDir = facing.rotateAround(EnumFacing.Axis.Y);
|
||||||
for (int i = -dummy;i<size.dummyCount-dummy+1;i++) {
|
for (int i = -dummy;i<size.dummyCount-dummy+1;i++) {
|
||||||
BlockPos currPos = pos.up(i);
|
BlockPos currPos = pos.up(i);
|
||||||
|
@ -380,7 +382,7 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
|
||||||
IBlockState state = world.getBlockState(currPos).getActualState(world, currPos);
|
IBlockState state = world.getBlockState(currPos).getActualState(world, currPos);
|
||||||
world.notifyBlockUpdate(currPos,state,state,3);
|
world.notifyBlockUpdate(currPos,state,state,3);
|
||||||
world.addBlockEvent(currPos, state.getBlock(), 255, 0);
|
world.addBlockEvent(currPos, state.getBlock(), 255, 0);
|
||||||
world.notifyBlockOfStateChange(currPos, state.getBlock());
|
world.notifyNeighborsOfStateChange(currPos, state.getBlock(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -410,13 +412,13 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing from) {
|
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing from) {
|
||||||
return !isDummy() && from == facing && capability == CapabilityEnergy.ENERGY;
|
return !isDummy() && from == facing && capability == CapabilityEnergy.ENERGY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||||
if (hasCapability(capability, facing)) {
|
if (hasCapability(capability, facing)) {
|
||||||
if (capability == CapabilityEnergy.ENERGY) {
|
if (capability == CapabilityEnergy.ENERGY) {
|
||||||
return (T) new EnergyCap();
|
return (T) new EnergyCap();
|
||||||
|
@ -427,7 +429,7 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChunkUnload() {
|
public void onChunkUnload() {
|
||||||
if (!worldObj.isRemote && addedToIC2Net)
|
if (!world.isRemote && addedToIC2Net)
|
||||||
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
|
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
|
||||||
addedToIC2Net = false;
|
addedToIC2Net = false;
|
||||||
super.onChunkUnload();
|
super.onChunkUnload();
|
||||||
|
@ -435,9 +437,9 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate() {
|
public void invalidate() {
|
||||||
if (!worldObj.isRemote && addedToIC2Net) {
|
if (!world.isRemote && addedToIC2Net) {
|
||||||
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
|
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
|
||||||
} else if (worldObj.isRemote) {
|
} else if (world.isRemote) {
|
||||||
//stop sound
|
//stop sound
|
||||||
IndustrialWires.proxy.playJacobsLadderSound(this, -1, soundPos);
|
IndustrialWires.proxy.playJacobsLadderSound(this, -1, soundPos);
|
||||||
}
|
}
|
||||||
|
@ -445,6 +447,7 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
|
||||||
super.invalidate();
|
super.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getRenderBoundingBox() {
|
public AxisAlignedBB getRenderBoundingBox() {
|
||||||
return new AxisAlignedBB(pos, pos.add(1, 2, 1));
|
return new AxisAlignedBB(pos, pos.add(1, 2, 1));
|
||||||
|
@ -472,13 +475,14 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing() {
|
public EnumFacing getFacing() {
|
||||||
return facing;
|
return facing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFacing(EnumFacing facing) {
|
public void setFacing(@Nonnull EnumFacing facing) {
|
||||||
this.facing = facing;
|
this.facing = facing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,17 +492,17 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mirrorFacingOnPlacement(EntityLivingBase placer) {
|
public boolean mirrorFacingOnPlacement(@Nonnull EntityLivingBase placer) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canRotate(EnumFacing axis) {
|
public boolean canRotate(@Nonnull EnumFacing axis) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.world.IBlockAccess;
|
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.IExtendedBlockState;
|
||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
|
|
||||||
import java.util.List;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class BlockPanel extends BlockIWBase implements IMetaEnum {
|
public class BlockPanel extends BlockIWBase implements IMetaEnum {
|
||||||
public static final PropertyEnum<BlockTypes_Panel> type = PropertyEnum.create("type", BlockTypes_Panel.class);
|
public static final PropertyEnum<BlockTypes_Panel> type = PropertyEnum.create("type", BlockTypes_Panel.class);
|
||||||
|
@ -65,7 +66,7 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
|
||||||
switch(state.getValue(type)) {
|
switch(state.getValue(type)) {
|
||||||
case TOP:
|
case TOP:
|
||||||
return new TileEntityPanel();
|
return new TileEntityPanel();
|
||||||
|
@ -88,6 +89,7 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum {
|
||||||
return new IProperty[]{IEProperties.FACING_ALL, type};
|
return new IProperty[]{IEProperties.FACING_ALL, type};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState() {
|
protected BlockStateContainer createBlockState() {
|
||||||
BlockStateContainer base = super.createBlockState();
|
BlockStateContainer base = super.createBlockState();
|
||||||
|
@ -96,8 +98,9 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@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);
|
state = super.getActualState(state, worldIn, pos);
|
||||||
TileEntity te = worldIn.getTileEntity(pos);
|
TileEntity te = worldIn.getTileEntity(pos);
|
||||||
if (te instanceof TileEntityPanel) {
|
if (te instanceof TileEntityPanel) {
|
||||||
|
@ -109,8 +112,9 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@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);
|
state = super.getExtendedState(state, world, pos);
|
||||||
if (state instanceof IExtendedBlockState) {
|
if (state instanceof IExtendedBlockState) {
|
||||||
TileEntity te = world.getTileEntity(pos);
|
TileEntity te = world.getTileEntity(pos);
|
||||||
|
@ -137,7 +141,7 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubBlocks(@Nonnull Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
list.add(new ItemStack(itemIn, 1, 0));
|
list.add(new ItemStack(itemIn, 1, 0));
|
||||||
list.add(new ItemStack(itemIn, 1, 1));
|
list.add(new ItemStack(itemIn, 1, 1));
|
||||||
list.add(new ItemStack(itemIn, 1, 2));
|
list.add(new ItemStack(itemIn, 1, 2));
|
||||||
|
@ -159,14 +163,15 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum {
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public boolean isVisuallyOpaque() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* @Override TODO do I not need this any more?
|
||||||
|
public boolean isVisuallyOpaque() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
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, heldItem, side, hitX, hitY, hitZ)&&hand==EnumHand.MAIN_HAND) {
|
if (!super.onBlockActivated(world, pos, state, player, hand, side, hitX, hitY, hitZ) && hand == EnumHand.MAIN_HAND) {
|
||||||
TileEntity te = world.getTileEntity(pos);
|
TileEntity te = world.getTileEntity(pos);
|
||||||
if (te instanceof TileEntityRSPanelConn){
|
if (te instanceof TileEntityRSPanelConn){
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
|
@ -186,7 +191,8 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
if (state.getValue(type)==BlockTypes_Panel.TOP) {
|
||||||
TileEntity te = world.getTileEntity(pos);
|
TileEntity te = world.getTileEntity(pos);
|
||||||
if (te instanceof TileEntityPanel) {
|
if (te instanceof TileEntityPanel) {
|
||||||
|
|
|
@ -27,7 +27,6 @@ import malte0811.industrialWires.blocks.IBlockBoundsIW;
|
||||||
import malte0811.industrialWires.blocks.TileEntityIWBase;
|
import malte0811.industrialWires.blocks.TileEntityIWBase;
|
||||||
import malte0811.industrialWires.controlpanel.*;
|
import malte0811.industrialWires.controlpanel.*;
|
||||||
import malte0811.industrialWires.network.MessagePanelInteract;
|
import malte0811.industrialWires.network.MessagePanelInteract;
|
||||||
import malte0811.industrialWires.util.MiscUtils;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
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.ImmutablePair;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -78,11 +78,6 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
|
||||||
components.add(lbl);
|
components.add(lbl);
|
||||||
components.add(btn);
|
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
|
@Override
|
||||||
|
@ -90,11 +85,11 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
|
||||||
for (PanelComponent pc : components) {
|
for (PanelComponent pc : components) {
|
||||||
pc.update(this);
|
pc.update(this);
|
||||||
}
|
}
|
||||||
if (!worldObj.isRemote) {
|
if (!world.isRemote) {
|
||||||
if (firstTick) {
|
if (firstTick) {
|
||||||
List<BlockPos> parts = MiscUtils.discoverPanelParts(worldObj, pos);
|
List<BlockPos> parts = PanelUtils.discoverPanelParts(world, pos);
|
||||||
for (BlockPos bp : parts) {
|
for (BlockPos bp : parts) {
|
||||||
TileEntity te = worldObj.getTileEntity(bp);
|
TileEntity te = world.getTileEntity(bp);
|
||||||
if (te instanceof TileEntityRSPanelConn&&!rsPorts.contains(te)) {
|
if (te instanceof TileEntityRSPanelConn&&!rsPorts.contains(te)) {
|
||||||
((TileEntityRSPanelConn) te).registerPanel(this);
|
((TileEntityRSPanelConn) te).registerPanel(this);
|
||||||
}
|
}
|
||||||
|
@ -119,7 +114,8 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getTileDrop(EntityPlayer player, IBlockState state) {
|
@Nonnull
|
||||||
|
public ItemStack getTileDrop(@Nonnull EntityPlayer player, @Nonnull IBlockState state) {
|
||||||
NBTTagCompound ret = new NBTTagCompound();
|
NBTTagCompound ret = new NBTTagCompound();
|
||||||
writeToItemNBT(ret, true);
|
writeToItemNBT(ret, true);
|
||||||
ItemStack retStack = new ItemStack(IndustrialWires.panel, 1, BlockTypes_Panel.TOP.ordinal());
|
ItemStack retStack = new ItemStack(IndustrialWires.panel, 1, BlockTypes_Panel.TOP.ordinal());
|
||||||
|
@ -128,8 +124,8 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readOnPlacement(@Nullable EntityLivingBase placer, ItemStack stack) {
|
public void readOnPlacement(@Nullable EntityLivingBase placer, @Nonnull ItemStack stack) {
|
||||||
if (stack.hasTagCompound()) {
|
if (!stack.isEmpty() && stack.hasTagCompound()) {
|
||||||
readFromItemNBT(stack.getTagCompound());
|
readFromItemNBT(stack.getTagCompound());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,13 +150,14 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
|
||||||
nbt.setFloat("height", components.height);
|
nbt.setFloat("height", components.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing() {
|
public EnumFacing getFacing() {
|
||||||
return components.facing;
|
return components.facing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFacing(EnumFacing facing) {
|
public void setFacing(@Nonnull EnumFacing facing) {
|
||||||
this.components.facing = facing;
|
this.components.facing = facing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,8 +166,9 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@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) {
|
switch (side) {
|
||||||
case UP:
|
case UP:
|
||||||
components.top = EnumFacing.UP;
|
components.top = EnumFacing.UP;
|
||||||
|
@ -189,17 +187,17 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mirrorFacingOnPlacement(EntityLivingBase placer) {
|
public boolean mirrorFacingOnPlacement(@Nonnull EntityLivingBase placer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canRotate(EnumFacing axis) {
|
public boolean canRotate(@Nonnull EnumFacing axis) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +228,7 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
|
||||||
Matrix4 mat = components.getPanelTopTransform();
|
Matrix4 mat = components.getPanelTopTransform();
|
||||||
PanelComponent retPc = null;
|
PanelComponent retPc = null;
|
||||||
RayTraceResult retRay = 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) {
|
for (PanelComponent pc : components) {
|
||||||
AxisAlignedBB box = pc.getBlockRelativeAABB();
|
AxisAlignedBB box = pc.getBlockRelativeAABB();
|
||||||
if (box.maxY>box.minY) {
|
if (box.maxY>box.minY) {
|
||||||
|
@ -257,8 +255,8 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean interact(EnumFacing side, EntityPlayer player, EnumHand hand, ItemStack heldItem, float hitX, float hitY, float hitZ) {
|
public boolean interact(@Nonnull EnumFacing side, @Nonnull EntityPlayer player, @Nonnull EnumHand hand, @Nonnull ItemStack heldItem, float hitX, float hitY, float hitZ) {
|
||||||
if (worldObj.isRemote) {
|
if (world.isRemote) {
|
||||||
Pair<PanelComponent, RayTraceResult> pc = getSelectedComponent(player, new Vec3d(hitX, hitY, hitZ), false);
|
Pair<PanelComponent, RayTraceResult> pc = getSelectedComponent(player, new Vec3d(hitX, hitY, hitZ), false);
|
||||||
if (pc != null) {
|
if (pc != null) {
|
||||||
Matrix4 inv = components.getPanelTopTransform();
|
Matrix4 inv = components.getPanelTopTransform();
|
||||||
|
@ -279,9 +277,9 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
|
||||||
}
|
}
|
||||||
|
|
||||||
public void triggerRenderUpdate() {
|
public void triggerRenderUpdate() {
|
||||||
IBlockState state = worldObj.getBlockState(pos);
|
IBlockState state = world.getBlockState(pos);
|
||||||
worldObj.notifyBlockUpdate(pos, state, state, 3);
|
world.notifyBlockUpdate(pos, state, state, 3);
|
||||||
worldObj.addBlockEvent(pos, state.getBlock(), 255, 0);
|
world.addBlockEvent(pos, state.getBlock(), 255, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerRS(TileEntityRSPanelConn te) {
|
public void registerRS(TileEntityRSPanelConn te) {
|
||||||
|
|
|
@ -18,10 +18,7 @@
|
||||||
|
|
||||||
package malte0811.industrialWires.blocks.controlpanel;
|
package malte0811.industrialWires.blocks.controlpanel;
|
||||||
|
|
||||||
import blusunrize.immersiveengineering.api.ApiUtils;
|
|
||||||
import blusunrize.immersiveengineering.common.util.IELogger;
|
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.IndustrialWires;
|
||||||
import malte0811.industrialWires.blocks.IBlockBoundsIW;
|
import malte0811.industrialWires.blocks.IBlockBoundsIW;
|
||||||
import malte0811.industrialWires.blocks.INetGUI;
|
import malte0811.industrialWires.blocks.INetGUI;
|
||||||
|
@ -37,27 +34,36 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
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<PanelComponent> components = new ArrayList<>();
|
public List<PanelComponent> components = new ArrayList<>();
|
||||||
public float height = 0.5F;
|
public float height = 0.5F;
|
||||||
public ItemStack[] inv = new ItemStack[1];
|
@Nonnull
|
||||||
|
public ItemStack inv = ItemStack.EMPTY;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readNBT(NBTTagCompound nbt, boolean updatePacket) {
|
public void readNBT(NBTTagCompound nbt, boolean updatePacket) {
|
||||||
NBTTagList l = nbt.getTagList("components", 10);
|
NBTTagList l = nbt.getTagList("components", 10);
|
||||||
PanelUtils.readListFromNBT(l, components);
|
PanelUtils.readListFromNBT(l, components);
|
||||||
height = nbt.getFloat("height");
|
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
|
@Override
|
||||||
public void writeNBT(NBTTagCompound nbt, boolean updatePacket) {
|
public void writeNBT(NBTTagCompound nbt, boolean updatePacket) {
|
||||||
writeToItemNBT(nbt, false);
|
writeToItemNBT(nbt, false);
|
||||||
nbt.setTag("inventory", Utils.writeInventory(inv));
|
nbt.setTag("inventory", inv.serializeNBT());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToItemNBT(NBTTagCompound nbt, boolean toItem) {
|
public void writeToItemNBT(NBTTagCompound nbt, boolean toItem) {
|
||||||
|
@ -71,29 +77,6 @@ public class TileEntityPanelCreator extends TileEntityIWBase implements IIEInven
|
||||||
nbt.setFloat("height", height);
|
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
|
@Override
|
||||||
public void onChange(NBTTagCompound nbt, EntityPlayer p) {
|
public void onChange(NBTTagCompound nbt, EntityPlayer p) {
|
||||||
int type = nbt.getInteger("type");
|
int type = nbt.getInteger("type");
|
||||||
|
@ -106,10 +89,10 @@ public class TileEntityPanelCreator extends TileEntityIWBase implements IIEInven
|
||||||
pc.setY(nbt.getFloat("y"));
|
pc.setY(nbt.getFloat("y"));
|
||||||
pc.setPanelHeight(height);
|
pc.setPanelHeight(height);
|
||||||
components.add(pc);
|
components.add(pc);
|
||||||
if (curr != null) {
|
if (!curr.isEmpty()) {
|
||||||
curr.stackSize--;
|
curr.shrink(1);
|
||||||
if (curr.stackSize <= 0) {
|
if (curr.getCount() <= 0) {
|
||||||
p.inventory.setItemStack(null);
|
p.inventory.setItemStack(ItemStack.EMPTY);
|
||||||
}
|
}
|
||||||
p.inventory.markDirty();
|
p.inventory.markDirty();
|
||||||
}
|
}
|
||||||
|
@ -119,7 +102,7 @@ public class TileEntityPanelCreator extends TileEntityIWBase implements IIEInven
|
||||||
break;
|
break;
|
||||||
case REMOVE:
|
case REMOVE:
|
||||||
int id = nbt.getInteger("id");
|
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);
|
PanelComponent removed = components.get(id);
|
||||||
ItemStack remItem = ItemPanelComponent.stackFromComponent(removed);
|
ItemStack remItem = ItemPanelComponent.stackFromComponent(removed);
|
||||||
p.inventory.setItemStack(remItem);
|
p.inventory.setItemStack(remItem);
|
||||||
|
@ -128,12 +111,12 @@ public class TileEntityPanelCreator extends TileEntityIWBase implements IIEInven
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CREATE_PANEL:
|
case CREATE_PANEL:
|
||||||
if (ItemStack.areItemStacksEqual(PanelUtils.getPanelBase(), inv[0])) {
|
if (ItemStack.areItemStacksEqual(PanelUtils.getPanelBase(), inv)) {
|
||||||
NBTTagCompound panelNBT = new NBTTagCompound();
|
NBTTagCompound panelNBT = new NBTTagCompound();
|
||||||
writeToItemNBT(panelNBT, true);
|
writeToItemNBT(panelNBT, true);
|
||||||
ItemStack panel = new ItemStack(IndustrialWires.panel, 1, BlockTypes_Panel.TOP.ordinal());
|
ItemStack panel = new ItemStack(IndustrialWires.panel, 1, BlockTypes_Panel.TOP.ordinal());
|
||||||
panel.setTagCompound(panelNBT);
|
panel.setTagCompound(panelNBT);
|
||||||
inv[0] = panel;
|
inv = panel;
|
||||||
components.clear();
|
components.clear();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -142,7 +125,7 @@ public class TileEntityPanelCreator extends TileEntityIWBase implements IIEInven
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
PanelComponent next = it.next();
|
PanelComponent next = it.next();
|
||||||
ItemStack nextStack = ItemPanelComponent.stackFromComponent(next);
|
ItemStack nextStack = ItemPanelComponent.stackFromComponent(next);
|
||||||
if (nextStack != null) {
|
if (!nextStack.isEmpty()) {
|
||||||
if (p.inventory.addItemStackToInventory(nextStack)) {
|
if (p.inventory.addItemStackToInventory(nextStack)) {
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
|
@ -152,18 +135,18 @@ public class TileEntityPanelCreator extends TileEntityIWBase implements IIEInven
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DISASSEMBLE:
|
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();
|
TileEntityPanel te = new TileEntityPanel();
|
||||||
te.readFromItemNBT(inv[0].getTagCompound());
|
te.readFromItemNBT(inv.getTagCompound());
|
||||||
components = new ArrayList<>(te.getComponents());
|
components = new ArrayList<>(te.getComponents());
|
||||||
height = te.getComponents().height;
|
height = te.getComponents().height;
|
||||||
inv[0] = null;
|
inv = ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
markDirty();
|
markDirty();
|
||||||
IBlockState state = worldObj.getBlockState(pos);
|
IBlockState state = world.getBlockState(pos);
|
||||||
worldObj.notifyBlockUpdate(pos, state, state, 3);
|
world.notifyBlockUpdate(pos, state, state, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final AxisAlignedBB aabb = new AxisAlignedBB(0, 0,0, 1, 14/16D, 1);
|
private static final AxisAlignedBB aabb = new AxisAlignedBB(0, 0,0, 1, 14/16D, 1);
|
||||||
|
|
|
@ -29,7 +29,7 @@ import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces;
|
||||||
import malte0811.industrialWires.blocks.IBlockBoundsIW;
|
import malte0811.industrialWires.blocks.IBlockBoundsIW;
|
||||||
import malte0811.industrialWires.blocks.INetGUI;
|
import malte0811.industrialWires.blocks.INetGUI;
|
||||||
import malte0811.industrialWires.controlpanel.PanelComponent;
|
import malte0811.industrialWires.controlpanel.PanelComponent;
|
||||||
import malte0811.industrialWires.util.MiscUtils;
|
import malte0811.industrialWires.controlpanel.PanelUtils;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -68,14 +68,14 @@ public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implem
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
if(hasWorldObj() && !worldObj.isRemote) {
|
if (hasWorld() && !world.isRemote) {
|
||||||
if (!loaded) {
|
if (!loaded) {
|
||||||
loaded = true;
|
loaded = true;
|
||||||
// completely reload the network
|
// completely reload the network
|
||||||
network.removeFromNetwork(null);
|
network.removeFromNetwork(null);
|
||||||
List<BlockPos> parts = MiscUtils.discoverPanelParts(worldObj, pos);
|
List<BlockPos> parts = PanelUtils.discoverPanelParts(world, pos);
|
||||||
for (BlockPos bp:parts) {
|
for (BlockPos bp:parts) {
|
||||||
TileEntity te = worldObj.getTileEntity(bp);
|
TileEntity te = world.getTileEntity(bp);
|
||||||
if (te instanceof TileEntityPanel) {
|
if (te instanceof TileEntityPanel) {
|
||||||
registerPanel(((TileEntityPanel) te));
|
registerPanel(((TileEntityPanel) te));
|
||||||
}
|
}
|
||||||
|
@ -202,9 +202,9 @@ public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implem
|
||||||
hasConn = false;
|
hasConn = false;
|
||||||
network.removeFromNetwork(this);
|
network.removeFromNetwork(this);
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
if(worldObj != null) {
|
if (world != null) {
|
||||||
IBlockState state = worldObj.getBlockState(pos);
|
IBlockState state = world.getBlockState(pos);
|
||||||
worldObj.notifyBlockUpdate(pos, state,state, 3);
|
world.notifyBlockUpdate(pos, state, state, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,10 +240,10 @@ public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implem
|
||||||
@Override
|
@Override
|
||||||
public void onChange(NBTTagCompound nbt, EntityPlayer p) {
|
public void onChange(NBTTagCompound nbt, EntityPlayer p) {
|
||||||
if (nbt.hasKey("rsId")) {
|
if (nbt.hasKey("rsId")) {
|
||||||
List<BlockPos> parts = MiscUtils.discoverPanelParts(worldObj, pos);
|
List<BlockPos> parts = PanelUtils.discoverPanelParts(world, pos);
|
||||||
List<TileEntityPanel> tes = new ArrayList<>(parts.size());
|
List<TileEntityPanel> tes = new ArrayList<>(parts.size());
|
||||||
for (BlockPos bp:parts) {
|
for (BlockPos bp:parts) {
|
||||||
TileEntity te = worldObj.getTileEntity(bp);
|
TileEntity te = world.getTileEntity(bp);
|
||||||
if (te instanceof TileEntityPanel) {
|
if (te instanceof TileEntityPanel) {
|
||||||
tes.add((TileEntityPanel) te);
|
tes.add((TileEntityPanel) te);
|
||||||
unregisterPanel((TileEntityPanel) te, true);
|
unregisterPanel((TileEntityPanel) te, true);
|
||||||
|
@ -255,28 +255,29 @@ public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implem
|
||||||
registerPanel(panel);
|
registerPanel(panel);
|
||||||
}
|
}
|
||||||
network.updateValues();
|
network.updateValues();
|
||||||
IBlockState state = worldObj.getBlockState(pos);
|
IBlockState state = world.getBlockState(pos);
|
||||||
worldObj.notifyBlockUpdate(pos, state, state, 3);
|
world.notifyBlockUpdate(pos, state, state, 3);
|
||||||
worldObj.addBlockEvent(pos, state.getBlock(), 255, 0);
|
world.addBlockEvent(pos, state.getBlock(), 255, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public World getConnectorWorld() {
|
public World getConnectorWorld() {
|
||||||
return worldObj;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRsId() {
|
public int getRsId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing() {
|
public EnumFacing getFacing() {
|
||||||
return facing;
|
return facing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFacing(EnumFacing facing) {
|
public void setFacing(@Nonnull EnumFacing facing) {
|
||||||
this.facing = facing;
|
this.facing = facing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,17 +287,17 @@ public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implem
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mirrorFacingOnPlacement(EntityLivingBase placer) {
|
public boolean mirrorFacingOnPlacement(@Nonnull EntityLivingBase placer) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canRotate(EnumFacing axis) {
|
public boolean canRotate(@Nonnull EnumFacing axis) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,13 @@ import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
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.BlockPos;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.List;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class BlockMechanicalConverter extends BlockIWBase implements IMetaEnum {
|
public class BlockMechanicalConverter extends BlockIWBase implements IMetaEnum {
|
||||||
private static PropertyEnum<MechanicalBlockType> type = PropertyEnum.create("type", MechanicalBlockType.class);
|
private static PropertyEnum<MechanicalBlockType> type = PropertyEnum.create("type", MechanicalBlockType.class);
|
||||||
|
@ -44,7 +46,7 @@ public class BlockMechanicalConverter extends BlockIWBase implements IMetaEnum {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubBlocks(@Nonnull Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
for (int i = 0;i<3;i++) {
|
for (int i = 0;i<3;i++) {
|
||||||
list.add(new ItemStack(itemIn, 1, 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};
|
return new IProperty[]{type, IEProperties.FACING_ALL};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return getDefaultState().withProperty(type, MechanicalBlockType.values[meta]);
|
return getDefaultState().withProperty(type, MechanicalBlockType.values[meta]);
|
||||||
|
@ -66,7 +69,7 @@ public class BlockMechanicalConverter extends BlockIWBase implements IMetaEnum {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
|
||||||
switch (state.getValue(type)) {
|
switch (state.getValue(type)) {
|
||||||
case IE_MOTOR:
|
case IE_MOTOR:
|
||||||
return new TileEntityIEMotor();
|
return new TileEntityIEMotor();
|
||||||
|
@ -88,18 +91,22 @@ public class BlockMechanicalConverter extends BlockIWBase implements IMetaEnum {
|
||||||
return state.getValue(type).ordinal();
|
return state.getValue(type).ordinal();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY,
|
@Nonnull
|
||||||
float hitZ, int meta, EntityLivingBase placer, ItemStack stack) {
|
public IBlockState getStateForPlacement(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing facing, float hitX, float hitY,
|
||||||
IBlockState base = super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, stack);
|
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]);
|
return base.withProperty(type, MechanicalBlockType.values[meta]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(IBlockState state) {
|
public int damageDropped(IBlockState state) {
|
||||||
return state.getValue(type).ordinal();
|
return state.getValue(type).ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos,
|
public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos,
|
||||||
EntityPlayer player) {
|
EntityPlayer player) {
|
||||||
return new ItemStack(this, 1, damageDropped(state));
|
return new ItemStack(this, 1, damageDropped(state));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -34,6 +34,8 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.energy.CapabilityEnergy;
|
import net.minecraftforge.energy.CapabilityEnergy;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class TileEntityIEMotor extends TileEntityIWBase implements ITickable, IFluxReceiver, IDirectionalTile {
|
public class TileEntityIEMotor extends TileEntityIWBase implements ITickable, IFluxReceiver, IDirectionalTile {
|
||||||
public final double bufferMax = 2*MechConversion.maxIfToMech*ConversionUtil.rotPerIf();
|
public final double bufferMax = 2*MechConversion.maxIfToMech*ConversionUtil.rotPerIf();
|
||||||
|
|
||||||
|
@ -43,7 +45,7 @@ public class TileEntityIEMotor extends TileEntityIWBase implements ITickable, IF
|
||||||
private BlockPos receiver;
|
private BlockPos receiver;
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
if (!worldObj.isRemote) {
|
if (!world.isRemote) {
|
||||||
if (receiver==null) {
|
if (receiver==null) {
|
||||||
receiver = pos.offset(dir);
|
receiver = pos.offset(dir);
|
||||||
}
|
}
|
||||||
|
@ -54,7 +56,7 @@ public class TileEntityIEMotor extends TileEntityIWBase implements ITickable, IF
|
||||||
rotBuffer += extracted*ConversionUtil.rotPerIf()*MechConversion.ifMotorEfficiency;
|
rotBuffer += extracted*ConversionUtil.rotPerIf()*MechConversion.ifMotorEfficiency;
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
TileEntity te = worldObj.getTileEntity(receiver);
|
TileEntity te = world.getTileEntity(receiver);
|
||||||
if (te instanceof IRotationAcceptor) {
|
if (te instanceof IRotationAcceptor) {
|
||||||
((IRotationAcceptor)te).inputRotation(rotBuffer, dir);
|
((IRotationAcceptor)te).inputRotation(rotBuffer, dir);
|
||||||
rotBuffer = 0;
|
rotBuffer = 0;
|
||||||
|
@ -106,12 +108,13 @@ public class TileEntityIEMotor extends TileEntityIWBase implements ITickable, IF
|
||||||
}
|
}
|
||||||
|
|
||||||
// Directional
|
// Directional
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing() {
|
public EnumFacing getFacing() {
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void setFacing(EnumFacing facing) {
|
public void setFacing(@Nonnull EnumFacing facing) {
|
||||||
dir = facing;
|
dir = facing;
|
||||||
receiver = null;
|
receiver = null;
|
||||||
markDirty();
|
markDirty();
|
||||||
|
@ -121,15 +124,15 @@ public class TileEntityIEMotor extends TileEntityIWBase implements ITickable, IF
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean mirrorFacingOnPlacement(EntityLivingBase placer) {
|
public boolean mirrorFacingOnPlacement(@Nonnull EntityLivingBase placer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@Override
|
@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;
|
return true;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
public boolean hasCapability(@Nonnull Capability<?> capability, EnumFacing facing) {
|
||||||
if (capability==CapabilityEnergy.ENERGY&&canConnectEnergy(facing)) {
|
if (capability==CapabilityEnergy.ENERGY&&canConnectEnergy(facing)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +140,7 @@ public class TileEntityIEMotor extends TileEntityIWBase implements ITickable, IF
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
public <T> T getCapability(@Nonnull Capability<T> capability, EnumFacing facing) {
|
||||||
if (capability==CapabilityEnergy.ENERGY&&canConnectEnergy(facing)) {
|
if (capability==CapabilityEnergy.ENERGY&&canConnectEnergy(facing)) {
|
||||||
return (T) new EnergyAdapter(this, facing);
|
return (T) new EnergyAdapter(this, facing);
|
||||||
}
|
}
|
||||||
|
@ -145,7 +148,7 @@ public class TileEntityIEMotor extends TileEntityIWBase implements ITickable, IF
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canRotate(EnumFacing axis) {
|
public boolean canRotate(@Nonnull EnumFacing axis) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,8 @@ import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class TileEntityMechICtoIE extends TileEntityIWBase implements IDirectionalTile, ITickable {
|
public class TileEntityMechICtoIE extends TileEntityIWBase implements IDirectionalTile, ITickable {
|
||||||
EnumFacing dir = EnumFacing.DOWN;
|
EnumFacing dir = EnumFacing.DOWN;
|
||||||
int kinBuffer = 0;
|
int kinBuffer = 0;
|
||||||
|
@ -39,14 +41,14 @@ public class TileEntityMechICtoIE extends TileEntityIWBase implements IDirection
|
||||||
BlockPos from;
|
BlockPos from;
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
if (!worldObj.isRemote) {
|
if (!world.isRemote) {
|
||||||
if (to==null) {
|
if (to==null) {
|
||||||
to = pos.offset(dir);
|
to = pos.offset(dir);
|
||||||
}
|
}
|
||||||
if (from==null) {
|
if (from==null) {
|
||||||
from = pos.offset(dir, -1);
|
from = pos.offset(dir, -1);
|
||||||
}
|
}
|
||||||
TileEntity teFrom = worldObj.getTileEntity(from);
|
TileEntity teFrom = world.getTileEntity(from);
|
||||||
if (teFrom instanceof IKineticSource) {
|
if (teFrom instanceof IKineticSource) {
|
||||||
int sourceMax = ((IKineticSource) teFrom).maxrequestkineticenergyTick(dir);
|
int sourceMax = ((IKineticSource) teFrom).maxrequestkineticenergyTick(dir);
|
||||||
int draw = Math.min(kinBufMax-kinBuffer, sourceMax);
|
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;
|
kinBuffer += ((IKineticSource) teFrom).requestkineticenergy(dir, draw)*MechConversion.kinToRotEfficiency;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TileEntity teTo = worldObj.getTileEntity(to);
|
TileEntity teTo = world.getTileEntity(to);
|
||||||
if (kinBuffer>0&&teTo instanceof IRotationAcceptor) {
|
if (kinBuffer>0&&teTo instanceof IRotationAcceptor) {
|
||||||
double out = Math.min(maxInsert, ConversionUtil.rotPerKin()*kinBuffer);
|
double out = Math.min(maxInsert, ConversionUtil.rotPerKin()*kinBuffer);
|
||||||
((IRotationAcceptor) teTo).inputRotation(out, dir);
|
((IRotationAcceptor) teTo).inputRotation(out, dir);
|
||||||
|
@ -77,12 +79,13 @@ public class TileEntityMechICtoIE extends TileEntityIWBase implements IDirection
|
||||||
from = null;
|
from = null;
|
||||||
}
|
}
|
||||||
// Directional
|
// Directional
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing() {
|
public EnumFacing getFacing() {
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void setFacing(EnumFacing facing) {
|
public void setFacing(@Nonnull EnumFacing facing) {
|
||||||
dir = facing;
|
dir = facing;
|
||||||
to = null;
|
to = null;
|
||||||
from = null;
|
from = null;
|
||||||
|
@ -93,15 +96,15 @@ public class TileEntityMechICtoIE extends TileEntityIWBase implements IDirection
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean mirrorFacingOnPlacement(EntityLivingBase placer) {
|
public boolean mirrorFacingOnPlacement(@Nonnull EntityLivingBase placer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@Override
|
@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;
|
return true;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean canRotate(EnumFacing axis) {
|
public boolean canRotate(@Nonnull EnumFacing axis) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@ import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class TileEntityMechIEtoIC extends TileEntityIWBase implements IDirectionalTile, IRotationAcceptor, IKineticSource {
|
public class TileEntityMechIEtoIC extends TileEntityIWBase implements IDirectionalTile, IRotationAcceptor, IKineticSource {
|
||||||
EnumFacing dir = EnumFacing.DOWN;
|
EnumFacing dir = EnumFacing.DOWN;
|
||||||
double rotBuffer = 0;
|
double rotBuffer = 0;
|
||||||
|
@ -45,12 +47,13 @@ public class TileEntityMechIEtoIC extends TileEntityIWBase implements IDirection
|
||||||
rotBuffer = in.getDouble(BUFFER_TAG);
|
rotBuffer = in.getDouble(BUFFER_TAG);
|
||||||
}
|
}
|
||||||
// Directional
|
// Directional
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing() {
|
public EnumFacing getFacing() {
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void setFacing(EnumFacing facing) {
|
public void setFacing(@Nonnull EnumFacing facing) {
|
||||||
dir = facing;
|
dir = facing;
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
|
@ -59,11 +62,11 @@ public class TileEntityMechIEtoIC extends TileEntityIWBase implements IDirection
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean mirrorFacingOnPlacement(EntityLivingBase placer) {
|
public boolean mirrorFacingOnPlacement(@Nonnull EntityLivingBase placer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@Override
|
@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;
|
return true;
|
||||||
}
|
}
|
||||||
//IC2 kinetic
|
//IC2 kinetic
|
||||||
|
@ -91,13 +94,13 @@ public class TileEntityMechIEtoIC extends TileEntityIWBase implements IDirection
|
||||||
|
|
||||||
//IE rotation
|
//IE rotation
|
||||||
@Override
|
@Override
|
||||||
public void inputRotation(double rotation, EnumFacing side) {
|
public void inputRotation(double rotation, @Nonnull EnumFacing side) {
|
||||||
if (side==dir) {
|
if (side==dir) {
|
||||||
rotBuffer = Math.min(rotBufMax, rotBuffer+rotation);
|
rotBuffer = Math.min(rotBufMax, rotBuffer+rotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean canRotate(EnumFacing axis) {
|
public boolean canRotate(@Nonnull EnumFacing axis) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ import blusunrize.immersiveengineering.api.IEProperties;
|
||||||
import malte0811.industrialWires.IndustrialWires;
|
import malte0811.industrialWires.IndustrialWires;
|
||||||
import malte0811.industrialWires.blocks.BlockIWBase;
|
import malte0811.industrialWires.blocks.BlockIWBase;
|
||||||
import malte0811.industrialWires.blocks.IMetaEnum;
|
import malte0811.industrialWires.blocks.IMetaEnum;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
|
@ -33,26 +32,28 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class BlockIC2Connector extends BlockIWBase implements IMetaEnum {
|
public class BlockIC2Connector extends BlockIWBase implements IMetaEnum {
|
||||||
private static PropertyEnum<BlockTypes_IC2_Connector> type = PropertyEnum.create("type", BlockTypes_IC2_Connector.class);
|
private static PropertyEnum<BlockTypes_IC2_Connector> type = PropertyEnum.create("type", BlockTypes_IC2_Connector.class);
|
||||||
public BlockIC2Connector() {
|
public BlockIC2Connector() {
|
||||||
super(Material.IRON, "ic2Connector");
|
super(Material.IRON, "ic2_connector");
|
||||||
setHardness(3.0F);
|
setHardness(3.0F);
|
||||||
setResistance(15.0F);
|
setResistance(15.0F);
|
||||||
lightOpacity = 0;
|
lightOpacity = 0;
|
||||||
this.setCreativeTab(IndustrialWires.creativeTab);
|
this.setCreativeTab(IndustrialWires.creativeTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
TileEntity te = world.getTileEntity(pos);
|
||||||
if(te instanceof TileEntityIC2ConnectorTin) {
|
if(te instanceof TileEntityIC2ConnectorTin) {
|
||||||
TileEntityIC2ConnectorTin connector = (TileEntityIC2ConnectorTin) te;
|
TileEntityIC2ConnectorTin connector = (TileEntityIC2ConnectorTin) te;
|
||||||
|
@ -64,12 +65,13 @@ public class BlockIC2Connector extends BlockIWBase implements IMetaEnum {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubBlocks(@Nonnull Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
for (int i = 0;i<type.getAllowedValues().size();i++) {
|
for (int i = 0;i<type.getAllowedValues().size();i++) {
|
||||||
list.add(new ItemStack(itemIn, 1, i));
|
list.add(new ItemStack(itemIn, 1, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState() {
|
protected BlockStateContainer createBlockState() {
|
||||||
BlockStateContainer base = super.createBlockState();
|
BlockStateContainer base = super.createBlockState();
|
||||||
|
@ -84,8 +86,9 @@ public class BlockIC2Connector extends BlockIWBase implements IMetaEnum {
|
||||||
return new IProperty[]{type, IEProperties.FACING_ALL};
|
return new IProperty[]{type, IEProperties.FACING_ALL};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@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);
|
state = super.getActualState(state, worldIn, pos);
|
||||||
TileEntity te = worldIn.getTileEntity(pos);
|
TileEntity te = worldIn.getTileEntity(pos);
|
||||||
if (te instanceof TileEntityIC2ConnectorTin) {
|
if (te instanceof TileEntityIC2ConnectorTin) {
|
||||||
|
@ -94,13 +97,14 @@ public class BlockIC2Connector extends BlockIWBase implements IMetaEnum {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return super.getStateFromMeta(meta).withProperty(type, BlockTypes_IC2_Connector.values()[meta]);
|
return super.getStateFromMeta(meta).withProperty(type, BlockTypes_IC2_Connector.values()[meta]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSideSolid(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
public boolean isSideSolid(IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, EnumFacing side) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +114,7 @@ public class BlockIC2Connector extends BlockIWBase implements IMetaEnum {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
|
||||||
switch (state.getValue(type)) {
|
switch (state.getValue(type)) {
|
||||||
case TIN_CONN:
|
case TIN_CONN:
|
||||||
return new TileEntityIC2ConnectorTin(false);
|
return new TileEntityIC2ConnectorTin(false);
|
||||||
|
@ -136,7 +140,7 @@ public class BlockIC2Connector extends BlockIWBase implements IMetaEnum {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean canRenderInLayer(BlockRenderLayer layer) {
|
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) {
|
||||||
return layer==BlockRenderLayer.TRANSLUCENT||layer==BlockRenderLayer.SOLID;
|
return layer==BlockRenderLayer.TRANSLUCENT||layer==BlockRenderLayer.SOLID;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
@ -155,10 +159,11 @@ public class BlockIC2Connector extends BlockIWBase implements IMetaEnum {
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
|
/*@Override
|
||||||
public boolean isVisuallyOpaque() {
|
public boolean isVisuallyOpaque() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}*/
|
||||||
@Override
|
@Override
|
||||||
public Object[] getValues() {
|
public Object[] getValues() {
|
||||||
return BlockTypes_IC2_Connector.values();
|
return BlockTypes_IC2_Connector.values();
|
||||||
|
|
|
@ -17,16 +17,6 @@
|
||||||
*/
|
*/
|
||||||
package malte0811.industrialWires.blocks.wire;
|
package malte0811.industrialWires.blocks.wire;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import malte0811.industrialWires.blocks.IBlockBoundsIW;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
|
||||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
|
|
||||||
import blusunrize.immersiveengineering.api.ApiUtils;
|
import blusunrize.immersiveengineering.api.ApiUtils;
|
||||||
import blusunrize.immersiveengineering.api.TargetingInfo;
|
import blusunrize.immersiveengineering.api.TargetingInfo;
|
||||||
import blusunrize.immersiveengineering.api.energy.wires.IImmersiveConnectable;
|
import blusunrize.immersiveengineering.api.energy.wires.IImmersiveConnectable;
|
||||||
|
@ -35,7 +25,6 @@ import blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler.Abst
|
||||||
import blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler.Connection;
|
import blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler.Connection;
|
||||||
import blusunrize.immersiveengineering.api.energy.wires.TileEntityImmersiveConnectable;
|
import blusunrize.immersiveengineering.api.energy.wires.TileEntityImmersiveConnectable;
|
||||||
import blusunrize.immersiveengineering.api.energy.wires.WireType;
|
import blusunrize.immersiveengineering.api.energy.wires.WireType;
|
||||||
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IBlockBounds;
|
|
||||||
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IDirectionalTile;
|
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IDirectionalTile;
|
||||||
import ic2.api.energy.event.EnergyTileLoadEvent;
|
import ic2.api.energy.event.EnergyTileLoadEvent;
|
||||||
import ic2.api.energy.event.EnergyTileUnloadEvent;
|
import ic2.api.energy.event.EnergyTileUnloadEvent;
|
||||||
|
@ -44,13 +33,23 @@ import ic2.api.energy.tile.IEnergyEmitter;
|
||||||
import ic2.api.energy.tile.IEnergySink;
|
import ic2.api.energy.tile.IEnergySink;
|
||||||
import ic2.api.energy.tile.IEnergySource;
|
import ic2.api.energy.tile.IEnergySource;
|
||||||
import malte0811.industrialWires.IIC2Connector;
|
import malte0811.industrialWires.IIC2Connector;
|
||||||
|
import malte0811.industrialWires.blocks.IBlockBoundsIW;
|
||||||
import malte0811.industrialWires.wires.IC2Wiretype;
|
import malte0811.industrialWires.wires.IC2Wiretype;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable implements IEnergySource, IEnergySink, IDirectionalTile, ITickable, IIC2Connector, IBlockBoundsIW {
|
public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable implements IEnergySource, IEnergySink, IDirectionalTile, ITickable, IIC2Connector, IBlockBoundsIW {
|
||||||
EnumFacing f = EnumFacing.NORTH;
|
EnumFacing f = EnumFacing.NORTH;
|
||||||
|
@ -71,20 +70,20 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
if (first) {
|
if (first) {
|
||||||
if (!worldObj.isRemote)
|
if (!world.isRemote)
|
||||||
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
|
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
if (!worldObj.isRemote&&inBuffer>.1)
|
if (!world.isRemote && inBuffer > .1)
|
||||||
transferPower();
|
transferPower();
|
||||||
}
|
}
|
||||||
public void transferPower() {
|
public void transferPower() {
|
||||||
Set<AbstractConnection> conns = new HashSet<>(ImmersiveNetHandler.INSTANCE.getIndirectEnergyConnections(pos, worldObj));
|
Set<AbstractConnection> conns = new HashSet<>(ImmersiveNetHandler.INSTANCE.getIndirectEnergyConnections(pos, world));
|
||||||
Map<AbstractConnection, Pair<IIC2Connector, Double>> maxOutputs = new HashMap<>();
|
Map<AbstractConnection, Pair<IIC2Connector, Double>> maxOutputs = new HashMap<>();
|
||||||
double outputMax = Math.min(inBuffer, maxToNet);
|
double outputMax = Math.min(inBuffer, maxToNet);
|
||||||
double sum = 0;
|
double sum = 0;
|
||||||
for (AbstractConnection c:conns) {
|
for (AbstractConnection c:conns) {
|
||||||
IImmersiveConnectable iic = ApiUtils.toIIC(c.end, worldObj);
|
IImmersiveConnectable iic = ApiUtils.toIIC(c.end, world);
|
||||||
if (iic instanceof IIC2Connector) {
|
if (iic instanceof IIC2Connector) {
|
||||||
double tmp = inBuffer-((IIC2Connector)iic).insertEnergy(outputMax, true);
|
double tmp = inBuffer-((IIC2Connector)iic).insertEnergy(outputMax, true);
|
||||||
if (tmp>.00000001) {
|
if (tmp>.00000001) {
|
||||||
|
@ -97,7 +96,7 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final double oldInBuf = outputMax;
|
final double oldInBuf = outputMax;
|
||||||
HashMap<Connection, Integer> transferedPerConn = ImmersiveNetHandler.INSTANCE.getTransferedRates(worldObj.provider.getDimension());
|
HashMap<Connection, Integer> transferedPerConn = ImmersiveNetHandler.INSTANCE.getTransferedRates(world.provider.getDimension());
|
||||||
for (AbstractConnection c:maxOutputs.keySet()) {
|
for (AbstractConnection c:maxOutputs.keySet()) {
|
||||||
Pair<IIC2Connector, Double> p = maxOutputs.get(c);
|
Pair<IIC2Connector, Double> p = maxOutputs.get(c);
|
||||||
double out = oldInBuf*p.getRight()/sum;
|
double out = oldInBuf*p.getRight()/sum;
|
||||||
|
@ -109,11 +108,11 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
|
||||||
double energyAtConn = inserted+loss;
|
double energyAtConn = inserted+loss;
|
||||||
for(Connection sub : c.subConnections)
|
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;
|
energyAtConn-=sub.cableType.getLossRatio()*sub.length;
|
||||||
ImmersiveNetHandler.INSTANCE.getTransferedRates(worldObj.provider.getDimension()).put(sub,(int)(transferredPerCon+energyAtConn));
|
ImmersiveNetHandler.INSTANCE.getTransferedRates(world.provider.getDimension()).put(sub, (int) (transferredPerCon + energyAtConn));
|
||||||
IImmersiveConnectable subStart = ApiUtils.toIIC(sub.start,worldObj);
|
IImmersiveConnectable subStart = ApiUtils.toIIC(sub.start, world);
|
||||||
IImmersiveConnectable subEnd = ApiUtils.toIIC(sub.end,worldObj);
|
IImmersiveConnectable subEnd = ApiUtils.toIIC(sub.end, world);
|
||||||
if(subStart!=null && passedConnectors.add(subStart))
|
if(subStart!=null && passedConnectors.add(subStart))
|
||||||
subStart.onEnergyPassthrough((int)(inserted-inserted*intermediaryLoss));
|
subStart.onEnergyPassthrough((int)(inserted-inserted*intermediaryLoss));
|
||||||
if(subEnd!=null && passedConnectors.add(subEnd))
|
if(subEnd!=null && passedConnectors.add(subEnd))
|
||||||
|
@ -147,7 +146,7 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void invalidate() {
|
public void invalidate() {
|
||||||
if (!worldObj.isRemote&&!first)
|
if (!world.isRemote && !first)
|
||||||
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
|
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
|
||||||
first = true;
|
first = true;
|
||||||
super.invalidate();
|
super.invalidate();
|
||||||
|
@ -155,7 +154,7 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
|
||||||
@Override
|
@Override
|
||||||
public void onChunkUnload() {
|
public void onChunkUnload() {
|
||||||
super.onChunkUnload();
|
super.onChunkUnload();
|
||||||
if (!worldObj.isRemote&&!first)
|
if (!world.isRemote && !first)
|
||||||
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
|
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
|
||||||
first = true;
|
first = true;
|
||||||
}
|
}
|
||||||
|
@ -277,13 +276,14 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
|
||||||
nbt.setDouble("maxToMachine", maxToMachine);
|
nbt.setDouble("maxToMachine", maxToMachine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing() {
|
public EnumFacing getFacing() {
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFacing(EnumFacing facing) {
|
public void setFacing(@Nonnull EnumFacing facing) {
|
||||||
f = facing;
|
f = facing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,12 +293,12 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mirrorFacingOnPlacement(EntityLivingBase placer) {
|
public boolean mirrorFacingOnPlacement(@Nonnull EntityLivingBase placer) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int ret = worldObj.provider.getDimension();
|
int ret = world.provider.getDimension();
|
||||||
ret = 31*ret+pos.hashCode();
|
ret = 31*ret+pos.hashCode();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -351,13 +351,13 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
|
||||||
if (!te.pos.equals(pos)) {
|
if (!te.pos.equals(pos)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (te.worldObj.provider.getDimension()!=worldObj.provider.getDimension()) {
|
if (te.world.provider.getDimension() != world.provider.getDimension()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean canRotate(EnumFacing axis) {
|
public boolean canRotate(@Nonnull EnumFacing axis) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,11 +45,11 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||||
public class ClientEventHandler {
|
public class ClientEventHandler {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void renderOverlayPost(RenderGameOverlayEvent.Post e) {
|
public void renderOverlayPost(RenderGameOverlayEvent.Post e) {
|
||||||
if(ClientUtils.mc().thePlayer!=null && e.getType() == RenderGameOverlayEvent.ElementType.TEXT) {
|
if (ClientUtils.mc().player != null && e.getType() == RenderGameOverlayEvent.ElementType.TEXT) {
|
||||||
EntityPlayer player = ClientUtils.mc().thePlayer;
|
EntityPlayer player = ClientUtils.mc().player;
|
||||||
|
|
||||||
for(EnumHand hand : EnumHand.values()) {
|
for(EnumHand hand : EnumHand.values()) {
|
||||||
if(player.getHeldItem(hand)!=null) {
|
if (!player.getHeldItem(hand).isEmpty()) {
|
||||||
ItemStack equipped = player.getHeldItem(hand);
|
ItemStack equipped = player.getHeldItem(hand);
|
||||||
if(OreDictionary.itemMatches(new ItemStack(IndustrialWires.coil, 1, OreDictionary.WILDCARD_VALUE), equipped, false)) {
|
if(OreDictionary.itemMatches(new ItemStack(IndustrialWires.coil, 1, OreDictionary.WILDCARD_VALUE), equipped, false)) {
|
||||||
IC2Wiretype type = IC2Wiretype.IC2_TYPES[equipped.getItemDamage()];
|
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]);
|
s = I18n.format(Lib.DESC_INFO+"attachedTo", link[1],link[2],link[3]);
|
||||||
RayTraceResult focussedBlock = ClientUtils.mc().objectMouseOver;
|
RayTraceResult focussedBlock = ClientUtils.mc().objectMouseOver;
|
||||||
double distSquared;
|
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]);
|
distSquared = focussedBlock.getBlockPos().distanceSq(link[1],link[2],link[3]);
|
||||||
} else {
|
} else {
|
||||||
distSquared = player.getDistanceSq(link[1],link[2],link[3]);
|
distSquared = player.getDistanceSq(link[1],link[2],link[3]);
|
||||||
|
@ -83,10 +83,10 @@ public class ClientEventHandler {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void renderBoundingBoxes(DrawBlockHighlightEvent event) {
|
public void renderBoundingBoxes(DrawBlockHighlightEvent event) {
|
||||||
if (!event.isCanceled() && event.getSubID() == 0 && event.getTarget().typeOfHit == RayTraceResult.Type.BLOCK) {
|
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) {
|
if (tile instanceof TileEntityPanel) {
|
||||||
TileEntityPanel panel = (TileEntityPanel) tile;
|
TileEntityPanel panel = (TileEntityPanel) tile;
|
||||||
Pair<PanelComponent, RayTraceResult> pc = panel.getSelectedComponent(Minecraft.getMinecraft().thePlayer, event.getTarget().hitVec, true);
|
Pair<PanelComponent, RayTraceResult> pc = panel.getSelectedComponent(Minecraft.getMinecraft().player, event.getTarget().hitVec, true);
|
||||||
if (pc != null) {
|
if (pc != null) {
|
||||||
pc.getLeft().renderBox(panel);
|
pc.getLeft().renderBox(panel);
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
|
|
|
@ -21,6 +21,7 @@ import blusunrize.immersiveengineering.api.ManualHelper;
|
||||||
import blusunrize.immersiveengineering.client.ClientUtils;
|
import blusunrize.immersiveengineering.client.ClientUtils;
|
||||||
import blusunrize.immersiveengineering.client.models.smart.ConnLoader;
|
import blusunrize.immersiveengineering.client.models.smart.ConnLoader;
|
||||||
import blusunrize.immersiveengineering.common.Config;
|
import blusunrize.immersiveengineering.common.Config;
|
||||||
|
import blusunrize.immersiveengineering.common.util.IELogger;
|
||||||
import blusunrize.lib.manual.ManualInstance;
|
import blusunrize.lib.manual.ManualInstance;
|
||||||
import blusunrize.lib.manual.ManualPages;
|
import blusunrize.lib.manual.ManualPages;
|
||||||
import blusunrize.lib.manual.ManualPages.PositionedItemStack;
|
import blusunrize.lib.manual.ManualPages.PositionedItemStack;
|
||||||
|
@ -73,42 +74,42 @@ public class ClientProxy extends CommonProxy {
|
||||||
@Override
|
@Override
|
||||||
public void preInit() {
|
public void preInit() {
|
||||||
super.preInit();
|
super.preInit();
|
||||||
ConnLoader.baseModels.put("ic2_conn_tin", new ResourceLocation("immersiveengineering:block/connector/connectorLV.obj"));
|
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_connectorLV",
|
ConnLoader.textureReplacements.put("ic2_conn_tin", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv",
|
||||||
IndustrialWires.MODID + ":blocks/ic2_connTin"));
|
IndustrialWires.MODID + ":blocks/ic2_conn_tin"));
|
||||||
ConnLoader.baseModels.put("ic2_relay_tin", new ResourceLocation("immersiveengineering:block/connector/connectorLV.obj"));
|
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_connectorLV",
|
ConnLoader.textureReplacements.put("ic2_relay_tin", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv",
|
||||||
IndustrialWires.MODID + ":blocks/ic2_relayTin"));
|
IndustrialWires.MODID + ":blocks/ic2_relay_tin"));
|
||||||
|
|
||||||
ConnLoader.baseModels.put("ic2_conn_copper", new ResourceLocation("immersiveengineering:block/connector/connectorLV.obj"));
|
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_connectorLV",
|
ConnLoader.textureReplacements.put("ic2_conn_copper", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv",
|
||||||
IndustrialWires.MODID + ":blocks/ic2_connCopper"));
|
IndustrialWires.MODID + ":blocks/ic2_conn_copper"));
|
||||||
ConnLoader.baseModels.put("ic2_relay_copper", new ResourceLocation("immersiveengineering:block/connector/connectorLV.obj"));
|
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_connectorLV",
|
ConnLoader.textureReplacements.put("ic2_relay_copper", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv",
|
||||||
IndustrialWires.MODID + ":blocks/ic2_relayCopper"));
|
IndustrialWires.MODID + ":blocks/ic2_relay_copper"));
|
||||||
|
|
||||||
ConnLoader.baseModels.put("ic2_conn_gold", new ResourceLocation("immersiveengineering:block/connector/connectorMV.obj"));
|
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_connectorMV",
|
ConnLoader.textureReplacements.put("ic2_conn_gold", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_mv",
|
||||||
IndustrialWires.MODID + ":blocks/ic2_connGold"));
|
IndustrialWires.MODID + ":blocks/ic2_conn_gold"));
|
||||||
ConnLoader.baseModels.put("ic2_relay_gold", new ResourceLocation("immersiveengineering:block/connector/connectorMV.obj"));
|
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_connectorMV",
|
ConnLoader.textureReplacements.put("ic2_relay_gold", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_mv",
|
||||||
IndustrialWires.MODID + ":blocks/ic2_relayGold"));
|
IndustrialWires.MODID + ":blocks/ic2_relay_gold"));
|
||||||
|
|
||||||
ConnLoader.baseModels.put("ic2_conn_hv", new ResourceLocation("immersiveengineering:block/connector/connectorHV.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_connectorHV",
|
ConnLoader.textureReplacements.put("ic2_conn_hv", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_hv",
|
||||||
IndustrialWires.MODID + ":blocks/ic2_connHV"));
|
IndustrialWires.MODID + ":blocks/ic2_conn_hv"));
|
||||||
ConnLoader.baseModels.put("ic2_relay_hv", new ResourceLocation("immersiveengineering:block/connector/relayHV.obj"));
|
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.baseModels.put("ic2_conn_glass", new ResourceLocation("immersiveengineering:block/connector/connector_hv.obj"));
|
||||||
ConnLoader.textureReplacements.put("ic2_conn_glass", ImmutableMap.of("#immersiveengineering:blocks/connector_connectorHV",
|
ConnLoader.textureReplacements.put("ic2_conn_glass", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_hv",
|
||||||
IndustrialWires.MODID + ":blocks/ic2_connGlass"));
|
IndustrialWires.MODID + ":blocks/ic2_conn_glass"));
|
||||||
ConnLoader.baseModels.put("ic2_relay_glass", new ResourceLocation("immersiveengineering:block/connector/relayHV.obj"));
|
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_relayHV",
|
ConnLoader.textureReplacements.put("ic2_relay_glass", ImmutableMap.of("#immersiveengineering:blocks/connector_relay_hv",
|
||||||
IndustrialWires.MODID + ":blocks/ic2_relayGlass"));
|
IndustrialWires.MODID + ":blocks/ic2_relay_glass"));
|
||||||
|
|
||||||
ConnLoader.baseModels.put("rs_panel_conn", new ResourceLocation("industrialwires:block/rs_panel_conn.obj"));
|
ConnLoader.baseModels.put("rs_panel_conn", new ResourceLocation("industrialwires:block/rs_panel_conn.obj"));
|
||||||
for (int meta = 0; meta < ItemIC2Coil.subNames.length; meta++) {
|
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);
|
ModelBakery.registerItemVariants(IndustrialWires.coil, loc);
|
||||||
ModelLoader.setCustomModelResourceLocation(IndustrialWires.coil, meta, new ModelResourceLocation(loc, "inventory"));
|
ModelLoader.setCustomModelResourceLocation(IndustrialWires.coil, meta, new ModelResourceLocation(loc, "inventory"));
|
||||||
}
|
}
|
||||||
|
@ -123,12 +124,14 @@ public class ClientProxy extends CommonProxy {
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
Item blockItem = Item.getItemFromBlock(b);
|
Item blockItem = Item.getItemFromBlock(b);
|
||||||
final ResourceLocation loc = b.getRegistryName();
|
final ResourceLocation loc = b.getRegistryName();
|
||||||
|
assert loc != null;
|
||||||
ModelLoader.setCustomMeshDefinition(blockItem, stack -> new ModelResourceLocation(loc, "inventory"));
|
ModelLoader.setCustomMeshDefinition(blockItem, stack -> new ModelResourceLocation(loc, "inventory"));
|
||||||
Object[] v = ((IMetaEnum) b).getValues();
|
Object[] v = ((IMetaEnum) b).getValues();
|
||||||
for (int meta = 0; meta < v.length; meta++) {
|
for (int meta = 0; meta < v.length; meta++) {
|
||||||
String location = loc.toString();
|
String location = loc.toString();
|
||||||
String prop = "inventory,type=" + v[meta].toString().toLowerCase(Locale.US);
|
String prop = "inventory,type=" + v[meta].toString().toLowerCase(Locale.US);
|
||||||
try {
|
try {
|
||||||
|
IELogger.info(location + ", " + prop);
|
||||||
ModelLoader.setCustomModelResourceLocation(blockItem, meta, new ModelResourceLocation(location, prop));
|
ModelLoader.setCustomModelResourceLocation(blockItem, meta, new ModelResourceLocation(location, prop));
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException npe) {
|
||||||
throw new RuntimeException(b + " lacks an item!", npe);
|
throw new RuntimeException(b + " lacks an item!", npe);
|
||||||
|
@ -191,54 +194,54 @@ public class ClientProxy extends CommonProxy {
|
||||||
return ~0;
|
return ~0;
|
||||||
}, IndustrialWires.panelComponent);
|
}, IndustrialWires.panelComponent);
|
||||||
|
|
||||||
m.addEntry("industrialWires.wires", "industrialWires",
|
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 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 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.Text(m, "industrialwires.wires1"),
|
||||||
new ManualPages.CraftingMulti(m, "industrialWires.wires2", (Object[]) wireRecipes)
|
new ManualPages.CraftingMulti(m, "industrialwires.wires2", (Object[]) wireRecipes)
|
||||||
);
|
);
|
||||||
if (IndustrialWires.mechConv != null) {
|
if (IndustrialWires.mechConv != null) {
|
||||||
m.addEntry("industrialWires.mechConv", "industrialWires",
|
m.addEntry("industrialwires.mechConv", "industrialwires",
|
||||||
new ManualPages.Crafting(m, "industrialWires.mechConv0", new ItemStack(IndustrialWires.mechConv, 1, 1)),
|
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.mechConv1", new ItemStack(IndustrialWires.mechConv, 1, 2)),
|
||||||
new ManualPages.Crafting(m, "industrialWires.mechConv2", new ItemStack(IndustrialWires.mechConv, 1, 0))
|
new ManualPages.Crafting(m, "industrialwires.mechConv2", new ItemStack(IndustrialWires.mechConv, 1, 0))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Config.manual_doubleA.put("iwJacobsUsage", IWConfig.HVStuff.jacobsUsageEU);
|
Config.manual_doubleA.put("iwJacobsUsage", IWConfig.HVStuff.jacobsUsageEU);
|
||||||
m.addEntry("industrialWires.jacobs", "industrialWires",
|
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.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"));
|
new ManualPages.Text(m, "industrialwires.jacobs1"));
|
||||||
|
|
||||||
|
|
||||||
m.addEntry("industrialWires.intro", "control_panels",
|
m.addEntry("industrialwires.intro", "control_panels",
|
||||||
new ManualPages.Text(m, "industrialWires.intro0"),
|
new ManualPages.Text(m, "industrialwires.intro0"),
|
||||||
new ManualPages.Text(m, "industrialWires.intro1"),
|
new ManualPages.Text(m, "industrialwires.intro1"),
|
||||||
new ManualPages.Crafting(m, "industrialWires.intro2", new ItemStack(IndustrialWires.panel, 1, BlockTypes_Panel.DUMMY.ordinal())),
|
new ManualPages.Crafting(m, "industrialwires.intro2", new ItemStack(IndustrialWires.panel, 1, BlockTypes_Panel.DUMMY.ordinal())),
|
||||||
new ManualPages.Text(m, "industrialWires.intro3")
|
new ManualPages.Text(m, "industrialwires.intro3")
|
||||||
);
|
);
|
||||||
m.addEntry("industrialWires.panel_creator", "control_panels",
|
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.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_creator1"),
|
||||||
new ManualPages.Text(m, "industrialWires.panel_creator2")
|
new ManualPages.Text(m, "industrialwires.panel_creator2")
|
||||||
);
|
);
|
||||||
m.addEntry("industrialWires.redstone", "control_panels",
|
m.addEntry("industrialwires.redstone", "control_panels",
|
||||||
new ManualPages.Crafting(m, "industrialWires.redstone0", new ItemStack(IndustrialWires.panel, 1, BlockTypes_Panel.RS_WIRE.ordinal())),
|
new ManualPages.Crafting(m, "industrialwires.redstone0", new ItemStack(IndustrialWires.panel, 1, BlockTypes_Panel.RS_WIRE.ordinal())),
|
||||||
new ManualPages.Text(m, "industrialWires.redstone1")
|
new ManualPages.Text(m, "industrialwires.redstone1")
|
||||||
);
|
);
|
||||||
m.addEntry("industrialWires.components", "control_panels",
|
m.addEntry("industrialwires.components", "control_panels",
|
||||||
new ManualPages.Crafting(m, "industrialWires.button", new ItemStack(IndustrialWires.panelComponent, 1, 0)),
|
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.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.indicator_light", new ItemStack(IndustrialWires.panelComponent, 1, 2)),
|
||||||
new ManualPages.Crafting(m, "industrialWires.slider", new ItemStack(IndustrialWires.panelComponent, 1, 3)),
|
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.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.Text(m, "industrialwires.toggle_switch1"),
|
||||||
new ManualPages.Crafting(m, "industrialWires.variac", new ItemStack(IndustrialWires.panelComponent, 1, 4))
|
new ManualPages.Crafting(m, "industrialwires.variac", new ItemStack(IndustrialWires.panelComponent, 1, 4))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public World getClientWorld() {
|
public World getClientWorld() {
|
||||||
return Minecraft.getMinecraft().theWorld;
|
return Minecraft.getMinecraft().world;
|
||||||
}
|
}
|
||||||
|
|
||||||
private WeakHashMap<BlockPos, ISound> playingSounds = new WeakHashMap<>();
|
private WeakHashMap<BlockPos, ISound> playingSounds = new WeakHashMap<>();
|
||||||
|
@ -283,7 +286,7 @@ public class ClientProxy extends CommonProxy {
|
||||||
} else if (ID==1) {
|
} else if (ID==1) {
|
||||||
EnumHand h = z == 1 ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND;
|
EnumHand h = z == 1 ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND;
|
||||||
ItemStack held = player.getHeldItem(h);
|
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));
|
return new GuiPanelComponent(h, ItemPanelComponent.componentFromStack(held));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class GuiPanelComponent extends GuiContainer {
|
||||||
IConfigurableComponent.StringConfig[] strings = confComp.getStringOptions();
|
IConfigurableComponent.StringConfig[] strings = confComp.getStringOptions();
|
||||||
stringTexts.clear();
|
stringTexts.clear();
|
||||||
for (IConfigurableComponent.StringConfig sc : strings) {
|
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);
|
toAdd.setText(sc.value);
|
||||||
stringTexts.add(toAdd);
|
stringTexts.add(toAdd);
|
||||||
}
|
}
|
||||||
|
@ -208,14 +208,14 @@ public class GuiPanelComponent extends GuiContainer {
|
||||||
GuiChannelPicker pick = rsChannelChoosers.get(i);
|
GuiChannelPicker pick = rsChannelChoosers.get(i);
|
||||||
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.RS_CHANNEL, i);
|
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.RS_CHANNEL, i);
|
||||||
if (tooltip!=null&&pick.isHovered(mouseX, mouseY)) {
|
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<boolButtons.size();i++) {
|
for (int i = 0;i<boolButtons.size();i++) {
|
||||||
GuiButtonCheckbox box = boolButtons.get(i);
|
GuiButtonCheckbox box = boolButtons.get(i);
|
||||||
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.BOOL, i);
|
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.BOOL, i);
|
||||||
if (tooltip!=null&&box.isMouseOver()) {
|
if (tooltip!=null&&box.isMouseOver()) {
|
||||||
ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRendererObj);
|
ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRenderer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0;i<stringTexts.size();i++) {
|
for (int i = 0;i<stringTexts.size();i++) {
|
||||||
|
@ -223,21 +223,21 @@ public class GuiPanelComponent extends GuiContainer {
|
||||||
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.STRING, i);
|
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.STRING, i);
|
||||||
if (tooltip!=null&&mouseX>=field.xPosition&&mouseX<field.xPosition+field.width&&
|
if (tooltip!=null&&mouseX>=field.xPosition&&mouseX<field.xPosition+field.width&&
|
||||||
mouseY>=field.yPosition&&mouseY<field.yPosition+field.height) {
|
mouseY>=field.yPosition&&mouseY<field.yPosition+field.height) {
|
||||||
ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRendererObj);
|
ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRenderer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0;i<intChoosers.size();i++) {
|
for (int i = 0;i<intChoosers.size();i++) {
|
||||||
GuiIntChooser choose = intChoosers.get(i);
|
GuiIntChooser choose = intChoosers.get(i);
|
||||||
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.INT, i);
|
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.INT, i);
|
||||||
if (tooltip!=null&&choose.isMouseOver(mouseX, mouseY)) {
|
if (tooltip!=null&&choose.isMouseOver(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<floatSliders.size();i++) {
|
for (int i = 0;i<floatSliders.size();i++) {
|
||||||
GuiSliderIE choose = floatSliders.get(i);
|
GuiSliderIE choose = floatSliders.get(i);
|
||||||
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.FLOAT, i);
|
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.FLOAT, i);
|
||||||
if (tooltip!=null&&choose.isMouseOver()) {
|
if (tooltip!=null&&choose.isMouseOver()) {
|
||||||
ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRendererObj);
|
ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRenderer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class GuiPanelCreator extends GuiContainer {
|
||||||
String tooltip = null;
|
String tooltip = null;
|
||||||
if (buttonList.get(0).isMouseOver()) {
|
if (buttonList.get(0).isMouseOver()) {
|
||||||
tooltip = I18n.format(IndustrialWires.MODID+".desc.create_panel");
|
tooltip = I18n.format(IndustrialWires.MODID+".desc.create_panel");
|
||||||
ClientUtils.drawHoveringText(ImmutableList.of("Create a new panel"), mouseX, mouseY, mc.fontRendererObj);
|
ClientUtils.drawHoveringText(ImmutableList.of("Create a new panel"), mouseX, mouseY, mc.fontRenderer);
|
||||||
} else if (buttonList.get(1).isMouseOver()) {
|
} else if (buttonList.get(1).isMouseOver()) {
|
||||||
tooltip = I18n.format(IndustrialWires.MODID+".desc.remove_all");
|
tooltip = I18n.format(IndustrialWires.MODID+".desc.remove_all");
|
||||||
} else if (buttonList.get(2).isMouseOver()) {
|
} else if (buttonList.get(2).isMouseOver()) {
|
||||||
|
@ -94,7 +94,7 @@ public class GuiPanelCreator extends GuiContainer {
|
||||||
tooltip = I18n.format(IndustrialWires.MODID+".desc.disassemble");
|
tooltip = I18n.format(IndustrialWires.MODID+".desc.disassemble");
|
||||||
}
|
}
|
||||||
if (tooltip!=null) {
|
if (tooltip!=null) {
|
||||||
ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRendererObj);
|
ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRenderer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,16 +144,16 @@ public class GuiPanelCreator extends GuiContainer {
|
||||||
nbt.setInteger("type", MessageType.ADD.ordinal());
|
nbt.setInteger("type", MessageType.ADD.ordinal());
|
||||||
IndustrialWires.packetHandler.sendToServer(new MessageGUIInteract(container.tile, nbt));
|
IndustrialWires.packetHandler.sendToServer(new MessageGUIInteract(container.tile, nbt));
|
||||||
components.add(curr.copyOf());
|
components.add(curr.copyOf());
|
||||||
ItemStack currStack = mc.thePlayer.inventory.getItemStack();
|
ItemStack currStack = mc.player.inventory.getItemStack();
|
||||||
if (currStack != null) {
|
if (!currStack.isEmpty()) {
|
||||||
currStack.stackSize--;
|
currStack.shrink(1);
|
||||||
if (currStack.stackSize <= 0) {
|
if (currStack.getCount() <= 0) {
|
||||||
mc.thePlayer.inventory.setItemStack(null);
|
mc.player.inventory.setItemStack(ItemStack.EMPTY);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mc.thePlayer.inventory.getItemStack()==null) {
|
} else if (mc.player.inventory.getItemStack().isEmpty()) {
|
||||||
float xRelFloat = xRel/(float) panelSize;
|
float xRelFloat = xRel/(float) panelSize;
|
||||||
float yRelFloat = yRel/(float) panelSize;
|
float yRelFloat = yRel/(float) panelSize;
|
||||||
for (int i = 0;i<components.size();i++) {
|
for (int i = 0;i<components.size();i++) {
|
||||||
|
@ -162,7 +162,7 @@ public class GuiPanelCreator extends GuiContainer {
|
||||||
if (aabb.minX<=xRelFloat&&aabb.maxX>xRelFloat&&aabb.minZ<=yRelFloat&&aabb.maxZ>yRelFloat) {
|
if (aabb.minX<=xRelFloat&&aabb.maxX>xRelFloat&&aabb.minZ<=yRelFloat&&aabb.maxZ>yRelFloat) {
|
||||||
PanelComponent removed = components.get(i);
|
PanelComponent removed = components.get(i);
|
||||||
ItemStack remItem = ItemPanelComponent.stackFromComponent(removed);
|
ItemStack remItem = ItemPanelComponent.stackFromComponent(removed);
|
||||||
mc.thePlayer.inventory.setItemStack(remItem);
|
mc.player.inventory.setItemStack(remItem);
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
nbt.setInteger("type", MessageType.REMOVE.ordinal());
|
nbt.setInteger("type", MessageType.REMOVE.ordinal());
|
||||||
nbt.setInteger("id", i);
|
nbt.setInteger("id", i);
|
||||||
|
@ -204,11 +204,12 @@ public class GuiPanelCreator extends GuiContainer {
|
||||||
IndustrialWires.packetHandler.sendToServer(new MessageGUIInteract(container.tile, nbt));
|
IndustrialWires.packetHandler.sendToServer(new MessageGUIInteract(container.tile, nbt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private ItemStack lastFloating;
|
|
||||||
|
private ItemStack lastFloating = ItemStack.EMPTY;
|
||||||
private PanelComponent lastFloatingPC;
|
private PanelComponent lastFloatingPC;
|
||||||
private PanelComponent getFloatingPC() {
|
private PanelComponent getFloatingPC() {
|
||||||
ItemStack floating = mc.thePlayer.inventory.getItemStack();
|
ItemStack floating = mc.player.inventory.getItemStack();
|
||||||
if (floating==null||floating.getItem()!=IndustrialWires.panelComponent) {
|
if (floating.isEmpty() || floating.getItem() != IndustrialWires.panelComponent) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (ItemStack.areItemStacksEqual(floating, lastFloating)) {
|
if (ItemStack.areItemStacksEqual(floating, lastFloating)) {
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class GuiIntChooser extends Gui {
|
||||||
xPos = x;
|
xPos = x;
|
||||||
yPos = y;
|
yPos = y;
|
||||||
max = (int) Math.pow(10, digits)-1;
|
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";
|
format = "%"+digits+"s";
|
||||||
}
|
}
|
||||||
public void drawChooser() {
|
public void drawChooser() {
|
||||||
|
@ -26,19 +26,19 @@ public class GuiIntChooser extends Gui {
|
||||||
if (value>=0&&allowNegative) {
|
if (value>=0&&allowNegative) {
|
||||||
val = "+"+val;
|
val = "+"+val;
|
||||||
}
|
}
|
||||||
mc.fontRendererObj.drawStringWithShadow(val, xPos+mc.fontRendererObj.getCharWidth('-')+1, yPos, color);
|
mc.fontRenderer.drawStringWithShadow(val, xPos + mc.fontRenderer.getCharWidth('-') + 1, yPos, color);
|
||||||
mc.fontRendererObj.drawStringWithShadow("-", xPos, yPos, color);
|
mc.fontRenderer.drawStringWithShadow("-", xPos, yPos, color);
|
||||||
mc.fontRendererObj.drawStringWithShadow("+", xPlus, yPos, color);
|
mc.fontRenderer.drawStringWithShadow("+", xPlus, yPos, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void click(int x, int y) {
|
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 (y >= yPos && y < yPos + height) {
|
||||||
if (x >= xPlus && x < xPlus + mc.fontRendererObj.getCharWidth('+')) {
|
if (x >= xPlus && x < xPlus + mc.fontRenderer.getCharWidth('+')) {
|
||||||
if (value < max) {
|
if (value < max) {
|
||||||
value++;
|
value++;
|
||||||
}
|
}
|
||||||
} else if (x >= xPos && x <= xPos + mc.fontRendererObj.getCharWidth('-')) {
|
} else if (x >= xPos && x <= xPos + mc.fontRenderer.getCharWidth('-')) {
|
||||||
if (value > (allowNegative ? -value : 0)) {
|
if (value > (allowNegative ? -value : 0)) {
|
||||||
value--;
|
value--;
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,6 @@ public class GuiIntChooser extends Gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMouseOver(int mX, int mY) {
|
public boolean isMouseOver(int mX, int mY) {
|
||||||
return mX>=xPos&&mX< xPlus +mc.fontRendererObj.getCharWidth('V')&&mY>=yPos&&mY<yPos+mc.fontRendererObj.FONT_HEIGHT;
|
return mX >= xPos && mX < xPlus + mc.fontRenderer.getCharWidth('V') && mY >= yPos && mY < yPos + mc.fontRenderer.FONT_HEIGHT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,8 @@ public class PanelModel implements IBakedModel {
|
||||||
IEApi.renderCacheClearers.add(modelCache::invalidateAll);
|
IEApi.renderCacheClearers.add(modelCache::invalidateAll);
|
||||||
IEApi.renderCacheClearers.add(PanelItemOverride.ITEM_MODEL_CACHE::invalidateAll);
|
IEApi.renderCacheClearers.add(PanelItemOverride.ITEM_MODEL_CACHE::invalidateAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
|
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
|
||||||
if (side!=null) {
|
if (side!=null) {
|
||||||
|
@ -68,7 +70,7 @@ public class PanelModel implements IBakedModel {
|
||||||
m = new AssembledBakedModel(cl);
|
m = new AssembledBakedModel(cl);
|
||||||
modelCache.put(cl.copyOf(), m);
|
modelCache.put(cl.copyOf(), m);
|
||||||
}
|
}
|
||||||
return m.getQuads(state, side, rand);
|
return m.getQuads(state, null, rand);
|
||||||
}
|
}
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
@ -88,16 +90,19 @@ public class PanelModel implements IBakedModel {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public TextureAtlasSprite getParticleTexture() {
|
public TextureAtlasSprite getParticleTexture() {
|
||||||
return PanelUtils.PANEL_TEXTURE;
|
return PanelUtils.PANEL_TEXTURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public ItemCameraTransforms getItemCameraTransforms() {
|
public ItemCameraTransforms getItemCameraTransforms() {
|
||||||
return ItemCameraTransforms.DEFAULT;
|
return ItemCameraTransforms.DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public ItemOverrideList getOverrides() {
|
public ItemOverrideList getOverrides() {
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
|
@ -113,6 +118,7 @@ public class PanelModel implements IBakedModel {
|
||||||
components = comp;
|
components = comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
|
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
|
||||||
if (quadsDefault == null) {
|
if (quadsDefault == null) {
|
||||||
|
@ -137,6 +143,7 @@ public class PanelModel implements IBakedModel {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public TextureAtlasSprite getParticleTexture() {
|
public TextureAtlasSprite getParticleTexture() {
|
||||||
return PanelUtils.PANEL_TEXTURE;
|
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(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(), 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;
|
new ItemTransformVec3f(new Vector3f(0, 180, 45), new Vector3f(0, 0, -.1875F), new Vector3f(.5F, .5F, .5F)));//Fixed;
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public ItemCameraTransforms getItemCameraTransforms() {//TODO very much cache this!
|
public ItemCameraTransforms getItemCameraTransforms() {//TODO very much cache this!
|
||||||
return transform;
|
return transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public ItemOverrideList getOverrides() {
|
public ItemOverrideList getOverrides() {
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
|
|
|
@ -32,6 +32,7 @@ import net.minecraftforge.client.model.IModel;
|
||||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||||
import net.minecraftforge.common.model.IModelState;
|
import net.minecraftforge.common.model.IModelState;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -42,7 +43,7 @@ public class PanelModelLoader implements ICustomModelLoader {
|
||||||
public static final String RESOURCE_LOCATION = "smartmodel/panel";
|
public static final String RESOURCE_LOCATION = "smartmodel/panel";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResourceManagerReload(IResourceManager resourceManager) {
|
public void onResourceManagerReload(@Nonnull IResourceManager resourceManager) {
|
||||||
PanelModel.modelCache.invalidateAll();
|
PanelModel.modelCache.invalidateAll();
|
||||||
PanelUtils.PANEL_TEXTURE = null;
|
PanelUtils.PANEL_TEXTURE = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,8 @@ import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import org.lwjgl.util.vector.Vector3f;
|
import org.lwjgl.util.vector.Vector3f;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class RawModelFontRenderer extends FontRenderer {
|
public class RawModelFontRenderer extends FontRenderer {
|
||||||
float[] colorA = new float[4];
|
float[] colorA = new float[4];
|
||||||
private ImmutableList.Builder<RawQuad> builder = ImmutableList.builder();
|
private ImmutableList.Builder<RawQuad> builder = ImmutableList.builder();
|
||||||
|
@ -100,7 +102,7 @@ public class RawModelFontRenderer extends FontRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void bindTexture(ResourceLocation location) {
|
protected void bindTexture(@Nonnull ResourceLocation location) {
|
||||||
//NO-OP
|
//NO-OP
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -24,14 +24,16 @@ import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class ContainerPanelComponent extends Container {
|
public class ContainerPanelComponent extends Container {
|
||||||
public EnumHand hand;
|
public EnumHand hand;
|
||||||
public ContainerPanelComponent(EnumHand h) {
|
public ContainerPanelComponent(EnumHand h) {
|
||||||
hand = h;
|
hand = h;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer playerIn) {
|
public boolean canInteractWith(@Nonnull EntityPlayer playerIn) {
|
||||||
ItemStack held = playerIn.getHeldItem(hand);
|
ItemStack held = playerIn.getHeldItem(hand);
|
||||||
return held!=null&&held.getItem()== IndustrialWires.panelComponent;
|
return !held.isEmpty() && held.getItem() == IndustrialWires.panelComponent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,22 +18,31 @@
|
||||||
|
|
||||||
package malte0811.industrialWires.containers;
|
package malte0811.industrialWires.containers;
|
||||||
|
|
||||||
import blusunrize.immersiveengineering.common.gui.ContainerIEBase;
|
|
||||||
import malte0811.industrialWires.blocks.controlpanel.TileEntityPanelCreator;
|
import malte0811.industrialWires.blocks.controlpanel.TileEntityPanelCreator;
|
||||||
import malte0811.industrialWires.controlpanel.PanelUtils;
|
import malte0811.industrialWires.controlpanel.PanelUtils;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
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 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 Container {
|
||||||
public class ContainerPanelCreator extends ContainerIEBase<TileEntityPanelCreator> {
|
public TileEntityPanelCreator tile;
|
||||||
|
private IInventory inv;
|
||||||
public ContainerPanelCreator(InventoryPlayer inventoryPlayer, TileEntityPanelCreator tile) {
|
public ContainerPanelCreator(InventoryPlayer inventoryPlayer, TileEntityPanelCreator tile) {
|
||||||
super(inventoryPlayer, tile);
|
|
||||||
int slotH = 150;
|
int slotH = 150;
|
||||||
int slotX = 14;
|
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) {
|
addSlotToContainer(new Slot(inv, 0, 7, 37) {
|
||||||
@Override
|
@Override
|
||||||
public int getSlotStackLimit() {
|
public int getSlotStackLimit() {
|
||||||
|
@ -52,4 +61,141 @@ public class ContainerPanelCreator extends ContainerIEBase<TileEntityPanelCreato
|
||||||
for (int i = 0; i < 9; i++)
|
for (int i = 0; i < 9; i++)
|
||||||
addSlotToContainer(new Slot(inventoryPlayer, i, slotX+i*18, slotH+58));
|
addSlotToContainer(new Slot(inventoryPlayer, i, slotX+i*18, slotH+58));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInteractWith(@Nonnull EntityPlayer player) {
|
||||||
|
return player.getDistanceSq(tile.getPos()) < 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SingleSlotInventory implements IInventory {
|
||||||
|
Consumer<ItemStack> set;
|
||||||
|
Supplier<ItemStack> get;
|
||||||
|
Runnable markDirty;
|
||||||
|
Predicate<EntityPlayer> isUsable;
|
||||||
|
String name;
|
||||||
|
|
||||||
|
public SingleSlotInventory(Consumer<ItemStack> set, Supplier<ItemStack> get, Runnable markDirty, Predicate<EntityPlayer> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,13 +22,15 @@ import malte0811.industrialWires.blocks.controlpanel.TileEntityRSPanelConn;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class ContainerRSPanelConn extends Container {
|
public class ContainerRSPanelConn extends Container {
|
||||||
final TileEntityRSPanelConn te;
|
private final TileEntityRSPanelConn te;
|
||||||
public ContainerRSPanelConn(TileEntityRSPanelConn tile) {
|
public ContainerRSPanelConn(TileEntityRSPanelConn tile) {
|
||||||
te = tile;
|
te = tile;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer playerIn) {
|
public boolean canInteractWith(@Nonnull EntityPlayer playerIn) {
|
||||||
return playerIn.getDistanceSq(te.getPos())<64;
|
return playerIn.getDistanceSq(te.getPos())<64;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class CoveredToggleSwitch extends ToggleSwitch {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
if (player.isSneaking()&&state==SwitchState.OPEN) {
|
||||||
state = SwitchState.CLOSED;
|
state = SwitchState.CLOSED;
|
||||||
} else {
|
} else {
|
||||||
|
@ -69,7 +69,6 @@ public class CoveredToggleSwitch extends ToggleSwitch {
|
||||||
setOut(state.active, tile);
|
setOut(state.active, tile);
|
||||||
tile.markDirty();
|
tile.markDirty();
|
||||||
tile.triggerRenderUpdate();
|
tile.triggerRenderUpdate();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -107,8 +107,7 @@ public class IndicatorLight extends PanelComponent implements IConfigurableCompo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean interactWith(Vec3d hitRelative, TileEntityPanel tile, EntityPlayerMP player) {
|
public void interactWith(Vec3d hitRelative, TileEntityPanel tile, EntityPlayerMP player) {
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -95,8 +95,7 @@ public class Label extends PanelComponent implements IConfigurableComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean interactWith(Vec3d hitRelative, TileEntityPanel tile, EntityPlayerMP player) {
|
public void interactWith(Vec3d hitRelative, TileEntityPanel tile, EntityPlayerMP player) {
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -127,10 +126,10 @@ public class Label extends PanelComponent implements IConfigurableComponent {
|
||||||
int left = (int) (gui.getX0()+getX()*gui.panelSize);
|
int left = (int) (gui.getX0()+getX()*gui.panelSize);
|
||||||
int top = (int) (gui.getY0()+getY()*gui.panelSize);
|
int top = (int) (gui.getY0()+getY()*gui.panelSize);
|
||||||
GlStateManager.pushMatrix();
|
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.translate(left, top, 0);
|
||||||
GlStateManager.scale(scale, scale, scale);
|
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();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,9 +109,9 @@ public class LightedButton extends PanelComponent implements IConfigurableCompon
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean interactWith(Vec3d hitRel, TileEntityPanel tile, EntityPlayerMP player) {
|
public void interactWith(Vec3d hitRel, TileEntityPanel tile, EntityPlayerMP player) {
|
||||||
if (!latching&&active) {
|
if (!latching&&active) {
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
setOut(!active, tile);
|
setOut(!active, tile);
|
||||||
if (!latching) {
|
if (!latching) {
|
||||||
|
@ -119,7 +119,6 @@ public class LightedButton extends PanelComponent implements IConfigurableCompon
|
||||||
}
|
}
|
||||||
tile.markDirty();
|
tile.markDirty();
|
||||||
tile.triggerRenderUpdate();
|
tile.triggerRenderUpdate();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -78,7 +78,7 @@ public abstract class PanelComponent {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public abstract AxisAlignedBB getBlockRelativeAABB();
|
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);
|
public abstract void update(TileEntityPanel tile);
|
||||||
|
|
||||||
|
@ -149,7 +149,8 @@ public abstract class PanelComponent {
|
||||||
double px = te.getPos().getX()-TileEntityRendererDispatcher.staticPlayerX;
|
double px = te.getPos().getX()-TileEntityRendererDispatcher.staticPlayerX;
|
||||||
double py = te.getPos().getY()-TileEntityRendererDispatcher.staticPlayerY;
|
double py = te.getPos().getY()-TileEntityRendererDispatcher.staticPlayerY;
|
||||||
double pz = te.getPos().getZ()-TileEntityRendererDispatcher.staticPlayerZ;
|
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.depthMask(true);
|
||||||
GlStateManager.enableTexture2D();
|
GlStateManager.enableTexture2D();
|
||||||
GlStateManager.disableBlend();
|
GlStateManager.disableBlend();
|
||||||
|
|
|
@ -22,8 +22,11 @@ import blusunrize.immersiveengineering.api.Lib;
|
||||||
import blusunrize.immersiveengineering.common.util.chickenbones.Matrix4;
|
import blusunrize.immersiveengineering.common.util.chickenbones.Matrix4;
|
||||||
import ic2.api.item.IC2Items;
|
import ic2.api.item.IC2Items;
|
||||||
import malte0811.industrialWires.IndustrialWires;
|
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.blocks.controlpanel.PropertyComponents.PanelRenderProperties;
|
||||||
import malte0811.industrialWires.client.RawQuad;
|
import malte0811.industrialWires.client.RawQuad;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
@ -39,7 +42,9 @@ import net.minecraft.nbt.NBTTagFloat;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3i;
|
import net.minecraft.util.math.Vec3i;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.model.ModelLoader;
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
import net.minecraftforge.client.model.obj.OBJModel;
|
import net.minecraftforge.client.model.obj.OBJModel;
|
||||||
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
|
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
|
||||||
|
@ -51,8 +56,10 @@ import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.BiPredicate;
|
||||||
|
|
||||||
import static malte0811.industrialWires.controlpanel.PanelComponent.*;
|
import static malte0811.industrialWires.controlpanel.PanelComponent.*;
|
||||||
|
import static malte0811.industrialWires.util.MiscUtils.discoverLocal;
|
||||||
|
|
||||||
public final class PanelUtils {
|
public final class PanelUtils {
|
||||||
public static TextureAtlasSprite PANEL_TEXTURE;
|
public static TextureAtlasSprite PANEL_TEXTURE;
|
||||||
|
@ -327,4 +334,22 @@ public final class PanelUtils {
|
||||||
}
|
}
|
||||||
return panelBase;
|
return panelBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<BlockPos> discoverPanelParts(World w, BlockPos here) {
|
||||||
|
BiPredicate<BlockPos, Integer> 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<BlockPos> all = discoverLocal(w, here, isValid);
|
||||||
|
List<BlockPos> ret = new ArrayList<>();
|
||||||
|
for (BlockPos pos : all) {
|
||||||
|
if (w.getBlockState(pos).getValue(BlockPanel.type) != BlockTypes_Panel.DUMMY) {
|
||||||
|
ret.add(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -125,7 +125,7 @@ public class Slider extends PanelComponent implements IConfigurableComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
double pos = horizontal?hitRelative.xCoord:(length-hitRelative.zCoord);
|
||||||
byte newLevel = (byte)(Math.min(pos*16/length, 15));
|
byte newLevel = (byte)(Math.min(pos*16/length, 15));
|
||||||
if (newLevel!=out) {
|
if (newLevel!=out) {
|
||||||
|
@ -135,9 +135,7 @@ public class Slider extends PanelComponent implements IConfigurableComponent {
|
||||||
out = newLevel;
|
out = newLevel;
|
||||||
tile.markDirty();
|
tile.markDirty();
|
||||||
tile.triggerRenderUpdate();
|
tile.triggerRenderUpdate();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -115,11 +115,10 @@ public class ToggleSwitch extends PanelComponent implements IConfigurableCompone
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean interactWith(Vec3d hitRel, TileEntityPanel tile, EntityPlayerMP player) {
|
public void interactWith(Vec3d hitRel, TileEntityPanel tile, EntityPlayerMP player) {
|
||||||
setOut(!active, tile);
|
setOut(!active, tile);
|
||||||
tile.markDirty();
|
tile.markDirty();
|
||||||
tile.triggerRenderUpdate();
|
tile.triggerRenderUpdate();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -131,7 +131,7 @@ public class Variac extends PanelComponent implements IConfigurableComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 xRel = hitRelative.xCoord - SIZE / 2;
|
||||||
double yRel = -(hitRelative.zCoord - SIZE / 2);
|
double yRel = -(hitRelative.zCoord - SIZE / 2);
|
||||||
double angle = 1.5 * Math.PI - Math.atan2(yRel, xRel);
|
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 -= .5 * Math.PI / 17;
|
||||||
angle /= 2 * Math.PI;
|
angle /= 2 * Math.PI;
|
||||||
if (angle < 0 || angle >= 16 / 17D) {
|
if (angle < 0 || angle >= 16 / 17D) {
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
byte newLevel = (byte) (angle * 17);
|
byte newLevel = (byte) (angle * 17);
|
||||||
if (newLevel > out) {
|
if (newLevel > out) {
|
||||||
|
@ -159,9 +159,7 @@ public class Variac extends PanelComponent implements IConfigurableComponent {
|
||||||
out = newLevel;
|
out = newLevel;
|
||||||
tile.markDirty();
|
tile.markDirty();
|
||||||
tile.triggerRenderUpdate();
|
tile.triggerRenderUpdate();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,13 +22,16 @@ import malte0811.industrialWires.items.ItemIC2Coil;
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class RecipeCoilLength implements IRecipe {
|
public class RecipeCoilLength implements IRecipe {
|
||||||
public final ItemStack coil;
|
public final ItemStack coil;
|
||||||
public final ItemStack cable;
|
public final ItemStack cable;
|
||||||
final int maxLength;
|
private final int maxLength;
|
||||||
public RecipeCoilLength(int meta) {
|
public RecipeCoilLength(int meta) {
|
||||||
coil = new ItemStack(IndustrialWires.coil, 1, meta);
|
coil = new ItemStack(IndustrialWires.coil, 1, meta);
|
||||||
cable = ItemIC2Coil.getUninsulatedCable(coil);
|
cable = ItemIC2Coil.getUninsulatedCable(coil);
|
||||||
|
@ -36,13 +39,14 @@ public class RecipeCoilLength implements IRecipe {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(InventoryCrafting inv, World worldIn) {
|
public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World worldIn) {
|
||||||
int l = getLength(inv);
|
int l = getLength(inv);
|
||||||
return l>0;
|
return l>0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getCraftingResult(InventoryCrafting inv) {
|
public ItemStack getCraftingResult(@Nonnull InventoryCrafting inv) {
|
||||||
ItemStack ret = new ItemStack(IndustrialWires.coil, 1, coil.getItemDamage());
|
ItemStack ret = new ItemStack(IndustrialWires.coil, 1, coil.getItemDamage());
|
||||||
ItemIC2Coil.setLength(ret, Math.min(maxLength, getLength(inv)));
|
ItemIC2Coil.setLength(ret, Math.min(maxLength, getLength(inv)));
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -53,22 +57,25 @@ public class RecipeCoilLength implements IRecipe {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getRecipeOutput() {
|
public ItemStack getRecipeOutput() {
|
||||||
return null;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public ItemStack[] getRemainingItems(InventoryCrafting inv) {
|
public NonNullList<ItemStack> getRemainingItems(@Nonnull InventoryCrafting inv) {
|
||||||
ItemStack[] ret = new ItemStack[inv.getSizeInventory()];
|
NonNullList<ItemStack> ret = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY);
|
||||||
int length = Math.min(getLength(inv), maxLength);
|
int length = Math.min(getLength(inv), maxLength);
|
||||||
for (int i = 0;i<ret.length&&length>0;i++) {
|
for (int i = 0; i < ret.size() && length > 0; i++) {
|
||||||
ItemStack curr = inv.getStackInSlot(i);
|
ItemStack curr = inv.getStackInSlot(i);
|
||||||
if (OreDictionary.itemMatches(curr, coil, false)) {
|
if (OreDictionary.itemMatches(curr, coil, false)) {
|
||||||
length-=ItemIC2Coil.getLength(curr);
|
length-=ItemIC2Coil.getLength(curr);
|
||||||
if (length<0) {
|
if (length<0) {
|
||||||
ret[i] = new ItemStack(IndustrialWires.coil, 1);
|
ItemStack currStack = new ItemStack(IndustrialWires.coil, 1);
|
||||||
ItemIC2Coil.setLength(ret[i], -length);
|
ret.set(i, currStack);
|
||||||
|
ItemIC2Coil.setLength(currStack, -length);
|
||||||
}
|
}
|
||||||
} else if (OreDictionary.itemMatches(curr, cable, false)) {
|
} else if (OreDictionary.itemMatches(curr, cable, false)) {
|
||||||
length--;
|
length--;
|
||||||
|
@ -84,7 +91,7 @@ public class RecipeCoilLength implements IRecipe {
|
||||||
cableLength+=ItemIC2Coil.getLength(curr);
|
cableLength+=ItemIC2Coil.getLength(curr);
|
||||||
} else if (OreDictionary.itemMatches(curr, cable, false)) {
|
} else if (OreDictionary.itemMatches(curr, cable, false)) {
|
||||||
cableLength++;
|
cableLength++;
|
||||||
} else if (curr!=null) {
|
} else if (!curr.isEmpty()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,6 @@
|
||||||
*/
|
*/
|
||||||
package malte0811.industrialWires.items;
|
package malte0811.industrialWires.items;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import blusunrize.immersiveengineering.ImmersiveEngineering;
|
import blusunrize.immersiveengineering.ImmersiveEngineering;
|
||||||
import blusunrize.immersiveengineering.api.Lib;
|
import blusunrize.immersiveengineering.api.Lib;
|
||||||
import blusunrize.immersiveengineering.api.TargetingInfo;
|
import blusunrize.immersiveengineering.api.TargetingInfo;
|
||||||
|
@ -48,30 +44,38 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumActionResult;
|
import net.minecraft.util.EnumActionResult;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.util.text.TextComponentTranslation;
|
import net.minecraft.util.text.TextComponentTranslation;
|
||||||
import net.minecraft.world.World;
|
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 class ItemIC2Coil extends Item implements IWireCoil{
|
||||||
public final static String[] subNames = {"tin", "copper", "gold", "hv", "glass"};
|
public final static String[] subNames = {"tin", "copper", "gold", "hv", "glass"};
|
||||||
public final static String lengthKey = "wireLength";
|
public final static String lengthKey = "wireLength";
|
||||||
|
|
||||||
public ItemIC2Coil() {
|
public ItemIC2Coil() {
|
||||||
setUnlocalizedName(IndustrialWires.MODID+".ic2wireCoil");
|
setUnlocalizedName(IndustrialWires.MODID + ".ic2_wire_coil");
|
||||||
setHasSubtypes(true);
|
setHasSubtypes(true);
|
||||||
this.setCreativeTab(IndustrialWires.creativeTab);
|
this.setCreativeTab(IndustrialWires.creativeTab);
|
||||||
setMaxStackSize(64);
|
setMaxStackSize(64);
|
||||||
ImmersiveEngineering.registerByFullName(this, IndustrialWires.MODID+":"+"ic2WireCoil");
|
ImmersiveEngineering.registerByFullName(this, IndustrialWires.MODID+":"+"ic2WireCoil");
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
|
public void getSubItems(@Nonnull Item itemIn, CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||||
for (int i = 0;i<subNames.length;i++) {
|
for (int i = 0;i<subNames.length;i++) {
|
||||||
ItemStack tmp = new ItemStack(this, 1, i);
|
ItemStack tmp = new ItemStack(this, 1, i);
|
||||||
setLength(tmp, getMaxWireLength(tmp));
|
setLength(tmp, getMaxWireLength(tmp));
|
||||||
subItems.add(tmp);
|
subItems.add(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName(ItemStack stack) {
|
public String getUnlocalizedName(ItemStack stack) {
|
||||||
return this.getUnlocalizedName()+"."+subNames[stack.getMetadata()];
|
return this.getUnlocalizedName()+"."+subNames[stack.getMetadata()];
|
||||||
|
@ -86,17 +90,19 @@ public class ItemIC2Coil extends Item implements IWireCoil{
|
||||||
list.add(I18n.format(IndustrialWires.MODID+".desc.recipe"));
|
list.add(I18n.format(IndustrialWires.MODID+".desc.recipe"));
|
||||||
if(stack.getTagCompound()!=null && stack.getTagCompound().hasKey("linkingPos")) {
|
if(stack.getTagCompound()!=null && stack.getTagCompound().hasKey("linkingPos")) {
|
||||||
int[] link = stack.getTagCompound().getIntArray("linkingPos");
|
int[] link = stack.getTagCompound().getIntArray("linkingPos");
|
||||||
if(link!=null&&link.length>3) {
|
if (link.length > 3) {
|
||||||
list.add(I18n.format(Lib.DESC_INFO+"attachedToDim", link[1],link[2],link[3],link[0]));
|
list.add(I18n.format(Lib.DESC_INFO+"attachedToDim", link[1],link[2],link[3],link[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//mostly copied from IE
|
//mostly copied from IE
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
|
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
|
||||||
if(!world.isRemote) {
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
if (stack.stackSize>1) {
|
if (!world.isRemote && !stack.isEmpty()) {
|
||||||
player.addChatMessage(new TextComponentTranslation(IndustrialWires.MODID+".chat.stackSize"));
|
if (stack.getCount() > 1) {
|
||||||
|
player.sendMessage(new TextComponentTranslation(IndustrialWires.MODID + ".chat.stackSize"));
|
||||||
return EnumActionResult.FAIL;
|
return EnumActionResult.FAIL;
|
||||||
}
|
}
|
||||||
TileEntity tileEntity = world.getTileEntity(pos);
|
TileEntity tileEntity = world.getTileEntity(pos);
|
||||||
|
@ -110,7 +116,7 @@ public class ItemIC2Coil extends Item implements IWireCoil{
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !((IImmersiveConnectable)tileEntity).canConnectCable(wire, target)) {
|
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;
|
return EnumActionResult.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,13 +130,13 @@ public class ItemIC2Coil extends Item implements IWireCoil{
|
||||||
TileEntity tileEntityLinkingPos = world.getTileEntity(linkPos);
|
TileEntity tileEntityLinkingPos = world.getTileEntity(linkPos);
|
||||||
int distanceSq = (int) Math.ceil( linkPos.distanceSq(masterPos) );
|
int distanceSq = (int) Math.ceil( linkPos.distanceSq(masterPos) );
|
||||||
if(array[0]!=world.provider.getDimension()) {
|
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)) {
|
} 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())) {
|
} 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()))) {
|
} 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 {
|
} else {
|
||||||
IImmersiveConnectable nodeHere = (IImmersiveConnectable)tileEntity;
|
IImmersiveConnectable nodeHere = (IImmersiveConnectable)tileEntity;
|
||||||
IImmersiveConnectable nodeLink = (IImmersiveConnectable)tileEntityLinkingPos;
|
IImmersiveConnectable nodeLink = (IImmersiveConnectable)tileEntityLinkingPos;
|
||||||
|
@ -144,7 +150,7 @@ public class ItemIC2Coil extends Item implements IWireCoil{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(connectionExists) {
|
if(connectionExists) {
|
||||||
player.addChatMessage(new TextComponentTranslation(Lib.CHAT_WARN+"connectionExists"));
|
player.sendMessage(new TextComponentTranslation(Lib.CHAT_WARN + "connectionExists"));
|
||||||
} else {
|
} else {
|
||||||
Vec3d rtOff0 = nodeHere.getRaytraceOffset(nodeLink).addVector(masterPos.getX(), masterPos.getY(), masterPos.getZ());
|
Vec3d rtOff0 = nodeHere.getRaytraceOffset(nodeLink).addVector(masterPos.getX(), masterPos.getY(), masterPos.getZ());
|
||||||
Vec3d rtOff1 = nodeLink.getRaytraceOffset(nodeHere).addVector(linkPos.getX(), linkPos.getY(), linkPos.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<lengthOnStack) {
|
if (length<lengthOnStack) {
|
||||||
setLength(stack, lengthOnStack-length);
|
setLength(stack, lengthOnStack-length);
|
||||||
} else {
|
} else {
|
||||||
player.setHeldItem(hand, null);
|
player.setHeldItem(hand, ItemStack.EMPTY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
((TileEntity)nodeHere).markDirty();
|
((TileEntity)nodeHere).markDirty();
|
||||||
|
@ -180,10 +186,10 @@ public class ItemIC2Coil extends Item implements IWireCoil{
|
||||||
state = world.getBlockState(linkPos);
|
state = world.getBlockState(linkPos);
|
||||||
world.notifyBlockUpdate(linkPos, state,state, 3);
|
world.notifyBlockUpdate(linkPos, state,state, 3);
|
||||||
} else {
|
} else {
|
||||||
player.addChatMessage(new TextComponentTranslation(IndustrialWires.MODID+".chat.tooLong"));
|
player.sendMessage(new TextComponentTranslation(IndustrialWires.MODID + ".chat.tooLong"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
player.addChatMessage(new TextComponentTranslation(Lib.CHAT_WARN+"cantSee"));
|
player.sendMessage(new TextComponentTranslation(Lib.CHAT_WARN + "cantSee"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,10 +30,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.*;
|
||||||
import net.minecraft.util.EnumActionResult;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
@ -82,7 +79,7 @@ public class ItemPanelComponent extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubItems(@Nonnull Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
|
public void getSubItems(@Nonnull Item itemIn, CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||||
for (int i = 0; i < types.length; i++) {
|
for (int i = 0; i < types.length; i++) {
|
||||||
subItems.add(new ItemStack(itemIn, 1, i));
|
subItems.add(new ItemStack(itemIn, 1, i));
|
||||||
}
|
}
|
||||||
|
@ -95,7 +92,7 @@ public class ItemPanelComponent extends Item {
|
||||||
return PanelComponent.read(loadFrom);
|
return PanelComponent.read(loadFrom);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nonnull
|
||||||
public static ItemStack stackFromComponent(PanelComponent pc) {
|
public static ItemStack stackFromComponent(PanelComponent pc) {
|
||||||
NBTTagCompound inner = new NBTTagCompound();
|
NBTTagCompound inner = new NBTTagCompound();
|
||||||
pc.writeToNBT(inner, true);
|
pc.writeToNBT(inner, true);
|
||||||
|
@ -108,7 +105,7 @@ public class ItemPanelComponent extends Item {
|
||||||
ret.setTagCompound(outer);
|
ret.setTagCompound(outer);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
return null;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void removeIrrelevantTags(NBTTagCompound inner) {
|
private static void removeIrrelevantTags(NBTTagCompound inner) {
|
||||||
|
@ -148,10 +145,10 @@ public class ItemPanelComponent extends Item {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public ActionResult<ItemStack> onItemRightClick(@Nonnull ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) {
|
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, @Nonnull EnumHand hand) {
|
||||||
if(!worldIn.isRemote) {
|
if(!worldIn.isRemote) {
|
||||||
playerIn.openGui(IndustrialWires.MODID, 1, worldIn, 0, 0, hand==EnumHand.MAIN_HAND?1:0);
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -63,12 +63,12 @@ public class MessageComponentSync implements IMessage {
|
||||||
public static class HandlerServer implements IMessageHandler<MessageComponentSync, IMessage> {
|
public static class HandlerServer implements IMessageHandler<MessageComponentSync, IMessage> {
|
||||||
@Override
|
@Override
|
||||||
public IMessage onMessage(MessageComponentSync message, MessageContext ctx) {
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
private void handle(MessageComponentSync msg, EntityPlayerMP player) {
|
private void handle(MessageComponentSync msg, EntityPlayerMP player) {
|
||||||
ItemStack held = player.getHeldItem(msg.hand);
|
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);
|
PanelComponent old = ItemPanelComponent.componentFromStack(held);
|
||||||
if (old instanceof IConfigurableComponent) {
|
if (old instanceof IConfigurableComponent) {
|
||||||
NBTTagList changes = msg.data.getTagList("data", 10);
|
NBTTagList changes = msg.data.getTagList("data", 10);
|
||||||
|
@ -82,7 +82,7 @@ public class MessageComponentSync implements IMessage {
|
||||||
x.printStackTrace();
|
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);
|
player.setHeldItem(msg.hand, newCmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,12 +57,12 @@ public class MessageGUIInteract implements IMessage {
|
||||||
public static class HandlerServer implements IMessageHandler<MessageGUIInteract, IMessage> {
|
public static class HandlerServer implements IMessageHandler<MessageGUIInteract, IMessage> {
|
||||||
@Override
|
@Override
|
||||||
public IMessage onMessage(MessageGUIInteract message, MessageContext ctx) {
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
private void handle(MessageGUIInteract msg, EntityPlayerMP player) {
|
private void handle(MessageGUIInteract msg, EntityPlayerMP player) {
|
||||||
if (player.getDistanceSqToCenter(msg.pos)<100) {//closer than 10 blocks
|
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) {
|
if (te instanceof INetGUI) {
|
||||||
((INetGUI) te).onChange(msg.data, player);
|
((INetGUI) te).onChange(msg.data, player);
|
||||||
te.markDirty();
|
te.markDirty();
|
||||||
|
|
|
@ -30,13 +30,11 @@ import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||||
|
|
||||||
public class MessagePanelInteract implements IMessage {
|
public class MessagePanelInteract implements IMessage {
|
||||||
private BlockPos pos;
|
private BlockPos pos;
|
||||||
//private int dimension;
|
|
||||||
private int pcId;
|
private int pcId;
|
||||||
private Vec3d hitRelative;
|
private Vec3d hitRelative;
|
||||||
|
|
||||||
public MessagePanelInteract(TileEntityPanel tile, int id, Vec3d hit) {
|
public MessagePanelInteract(TileEntityPanel tile, int id, Vec3d hit) {
|
||||||
pos = tile.getPos();
|
pos = tile.getPos();
|
||||||
//dimension = tile.getWorld().provider.getDimension();
|
|
||||||
pcId = id;
|
pcId = id;
|
||||||
hitRelative = hit;
|
hitRelative = hit;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +44,6 @@ public class MessagePanelInteract implements IMessage {
|
||||||
@Override
|
@Override
|
||||||
public void fromBytes(ByteBuf buf) {
|
public void fromBytes(ByteBuf buf) {
|
||||||
this.pos = new BlockPos(buf.readInt(), buf.readInt(), buf.readInt());
|
this.pos = new BlockPos(buf.readInt(), buf.readInt(), buf.readInt());
|
||||||
//dimension = buf.readInt();
|
|
||||||
pcId = buf.readInt();
|
pcId = buf.readInt();
|
||||||
hitRelative = new Vec3d(buf.readDouble(), buf.readDouble(), buf.readDouble());
|
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.getX());
|
||||||
buf.writeInt(this.pos.getY());
|
buf.writeInt(this.pos.getY());
|
||||||
buf.writeInt(this.pos.getZ());
|
buf.writeInt(this.pos.getZ());
|
||||||
//buf.writeInt(dimension);
|
|
||||||
buf.writeInt(pcId);
|
buf.writeInt(pcId);
|
||||||
buf.writeDouble(hitRelative.xCoord).writeDouble(hitRelative.yCoord).writeDouble(hitRelative.zCoord);
|
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<MessagePanelInteract, IMessage> {
|
public static class HandlerServer implements IMessageHandler<MessagePanelInteract, IMessage> {
|
||||||
@Override
|
@Override
|
||||||
public IMessage onMessage(MessagePanelInteract message, MessageContext ctx) {
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
private void handle(MessagePanelInteract msg, EntityPlayerMP player) {
|
private void handle(MessagePanelInteract msg, EntityPlayerMP player) {
|
||||||
if (player.getDistanceSqToCenter(msg.pos)<100) {//closer than 10 blocks
|
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) {
|
if (te instanceof TileEntityPanel) {
|
||||||
((TileEntityPanel) te).interactServer(msg.hitRelative, msg.pcId, player);
|
((TileEntityPanel) te).interactServer(msg.hitRelative, msg.pcId, player);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,10 @@ package malte0811.industrialWires.util;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
public class DualEnergyStorage {
|
public class DualEnergyStorage {
|
||||||
double storedEU;
|
private double storedEU;
|
||||||
double maxEU;
|
private double maxEU;
|
||||||
double maxOutEU;
|
private double maxOutEU;
|
||||||
double maxInEU;
|
private double maxInEU;
|
||||||
|
|
||||||
public DualEnergyStorage(double maxEU, double maxInEU, double maxOutEU) {
|
public DualEnergyStorage(double maxEU, double maxInEU, double maxOutEU) {
|
||||||
this(0, maxEU, maxInEU, maxOutEU);
|
this(0, maxEU, maxInEU, maxOutEU);
|
||||||
|
|
|
@ -22,10 +22,6 @@ import blusunrize.immersiveengineering.api.ApiUtils;
|
||||||
import blusunrize.immersiveengineering.api.energy.wires.IImmersiveConnectable;
|
import blusunrize.immersiveengineering.api.energy.wires.IImmersiveConnectable;
|
||||||
import blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler;
|
import blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler;
|
||||||
import com.google.common.collect.ImmutableSet;
|
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.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -72,23 +68,6 @@ public final class MiscUtils {
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
public static List<BlockPos> discoverPanelParts(World w, BlockPos here) {
|
|
||||||
BiPredicate<BlockPos, Integer> 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<BlockPos> all = discoverLocal(w, here, isValid);
|
|
||||||
List<BlockPos> 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<BlockPos> discoverLocal(World w, BlockPos here, BiPredicate<BlockPos, Integer> isValid) {
|
public static List<BlockPos> discoverLocal(World w, BlockPos here, BiPredicate<BlockPos, Integer> isValid) {
|
||||||
List<BlockPos> ret = new ArrayList<>();
|
List<BlockPos> ret = new ArrayList<>();
|
||||||
List<BlockPos> open = new ArrayList<>();
|
List<BlockPos> open = new ArrayList<>();
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
protected net.minecraft.client.gui.inventory.GuiContainer func_146977_a(Lnet/minecraft/inventory/Slot;)V #drawSlot
|
|
|
@ -12,9 +12,9 @@
|
||||||
"variants": {
|
"variants": {
|
||||||
"inventory,type=tin_conn": [
|
"inventory,type=tin_conn": [
|
||||||
{
|
{
|
||||||
"model": "immersiveengineering:connector/connectorLV.obj",
|
"model": "immersiveengineering:connector/connector_lv.obj",
|
||||||
"textures": {
|
"textures": {
|
||||||
"#immersiveengineering:blocks/connector_connectorLV": "industrialwires:blocks/ic2_connTin"
|
"#immersiveengineering:blocks/connector_connector_lv": "industrialwires:blocks/ic2_conn_tin"
|
||||||
},
|
},
|
||||||
"transform": {
|
"transform": {
|
||||||
"scale": [ 0.5, 0.5, 0.5 ],
|
"scale": [ 0.5, 0.5, 0.5 ],
|
||||||
|
@ -29,9 +29,9 @@
|
||||||
],
|
],
|
||||||
"inventory,type=tin_relay": [
|
"inventory,type=tin_relay": [
|
||||||
{
|
{
|
||||||
"model": "immersiveengineering:connector/connectorLV.obj",
|
"model": "immersiveengineering:connector/connector_lv.obj",
|
||||||
"textures": {
|
"textures": {
|
||||||
"#immersiveengineering:blocks/connector_connectorLV": "industrialwires:blocks/ic2_relayTin"
|
"#immersiveengineering:blocks/connector_connector_lv": "industrialwires:blocks/ic2_relay_tin"
|
||||||
},
|
},
|
||||||
"transform": {
|
"transform": {
|
||||||
"scale": [ 0.5, 0.5, 0.5 ],
|
"scale": [ 0.5, 0.5, 0.5 ],
|
||||||
|
@ -46,9 +46,9 @@
|
||||||
],
|
],
|
||||||
"inventory,type=copper_conn": [
|
"inventory,type=copper_conn": [
|
||||||
{
|
{
|
||||||
"model": "immersiveengineering:connector/connectorLV.obj",
|
"model": "immersiveengineering:connector/connector_lv.obj",
|
||||||
"textures": {
|
"textures": {
|
||||||
"#immersiveengineering:blocks/connector_connectorLV": "industrialwires:blocks/ic2_connCopper"
|
"#immersiveengineering:blocks/connector_connector_lv": "industrialwires:blocks/ic2_conn_copper"
|
||||||
},
|
},
|
||||||
"transform": {
|
"transform": {
|
||||||
"scale": [ 0.5, 0.5, 0.5 ],
|
"scale": [ 0.5, 0.5, 0.5 ],
|
||||||
|
@ -63,9 +63,9 @@
|
||||||
],
|
],
|
||||||
"inventory,type=copper_relay": [
|
"inventory,type=copper_relay": [
|
||||||
{
|
{
|
||||||
"model": "immersiveengineering:connector/connectorLV.obj",
|
"model": "immersiveengineering:connector/connector_lv.obj",
|
||||||
"textures": {
|
"textures": {
|
||||||
"#immersiveengineering:blocks/connector_connectorLV": "industrialwires:blocks/ic2_relayCopper"
|
"#immersiveengineering:blocks/connector_connector_lv": "industrialwires:blocks/ic2_relay_copper"
|
||||||
},
|
},
|
||||||
"transform": {
|
"transform": {
|
||||||
"scale": [ 0.5, 0.5, 0.5 ],
|
"scale": [ 0.5, 0.5, 0.5 ],
|
||||||
|
@ -80,9 +80,9 @@
|
||||||
],
|
],
|
||||||
"inventory,type=gold_conn": [
|
"inventory,type=gold_conn": [
|
||||||
{
|
{
|
||||||
"model": "immersiveengineering:connector/connectorMV.obj",
|
"model": "immersiveengineering:connector/connector_mv.obj",
|
||||||
"textures": {
|
"textures": {
|
||||||
"#immersiveengineering:blocks/connector_connectorMV": "industrialwires:blocks/ic2_connGold"
|
"#immersiveengineering:blocks/connector_connector_mv": "industrialwires:blocks/ic2_conn_gold"
|
||||||
},
|
},
|
||||||
"transform": {
|
"transform": {
|
||||||
"scale": [ 0.5, 0.5, 0.5 ],
|
"scale": [ 0.5, 0.5, 0.5 ],
|
||||||
|
@ -97,9 +97,9 @@
|
||||||
],
|
],
|
||||||
"inventory,type=gold_relay": [
|
"inventory,type=gold_relay": [
|
||||||
{
|
{
|
||||||
"model": "immersiveengineering:connector/connectorMV.obj",
|
"model": "immersiveengineering:connector/connector_mv.obj",
|
||||||
"textures": {
|
"textures": {
|
||||||
"#immersiveengineering:blocks/connector_connectorMV": "industrialwires:blocks/ic2_relayGold"
|
"#immersiveengineering:blocks/connector_connector_mv": "industrialwires:blocks/ic2_relay_gold"
|
||||||
},
|
},
|
||||||
"transform": {
|
"transform": {
|
||||||
"scale": [ 0.5, 0.5, 0.5 ],
|
"scale": [ 0.5, 0.5, 0.5 ],
|
||||||
|
@ -114,9 +114,9 @@
|
||||||
],
|
],
|
||||||
"inventory,type=hv_conn": [
|
"inventory,type=hv_conn": [
|
||||||
{
|
{
|
||||||
"model": "immersiveengineering:connector/connectorHV.obj",
|
"model": "immersiveengineering:connector/connector_hv.obj",
|
||||||
"textures": {
|
"textures": {
|
||||||
"#immersiveengineering:blocks/connector_connectorHV": "industrialwires:blocks/ic2_connHV"
|
"#immersiveengineering:blocks/connector_connector_hv": "industrialwires:blocks/ic2_conn_hv"
|
||||||
},
|
},
|
||||||
"transform": {
|
"transform": {
|
||||||
"scale": [ 0.5, 0.5, 0.5 ],
|
"scale": [ 0.5, 0.5, 0.5 ],
|
||||||
|
@ -131,7 +131,7 @@
|
||||||
],
|
],
|
||||||
"inventory,type=hv_relay": [
|
"inventory,type=hv_relay": [
|
||||||
{
|
{
|
||||||
"model": "immersiveengineering:connector/relayHV.obj",
|
"model": "immersiveengineering:connector/relay_hv.obj",
|
||||||
"transform": {
|
"transform": {
|
||||||
"scale": [ 0.5, 0.5, 0.5 ],
|
"scale": [ 0.5, 0.5, 0.5 ],
|
||||||
"firstperson_righthand": { "translation": [ 0, 0.25, 0.125 ]},
|
"firstperson_righthand": { "translation": [ 0, 0.25, 0.125 ]},
|
||||||
|
@ -145,9 +145,9 @@
|
||||||
],
|
],
|
||||||
"inventory,type=glass_conn": [
|
"inventory,type=glass_conn": [
|
||||||
{
|
{
|
||||||
"model": "immersiveengineering:connector/connectorHV.obj",
|
"model": "immersiveengineering:connector/connector_hv.obj",
|
||||||
"textures": {
|
"textures": {
|
||||||
"#immersiveengineering:blocks/connector_connectorHV": "industrialwires:blocks/ic2_connGlass"
|
"#immersiveengineering:blocks/connector_connector_hv": "industrialwires:blocks/ic2_conn_glass"
|
||||||
},
|
},
|
||||||
"transform": {
|
"transform": {
|
||||||
"scale": [ 0.5, 0.5, 0.5 ],
|
"scale": [ 0.5, 0.5, 0.5 ],
|
||||||
|
@ -162,9 +162,9 @@
|
||||||
],
|
],
|
||||||
"inventory,type=glass_relay": [
|
"inventory,type=glass_relay": [
|
||||||
{
|
{
|
||||||
"model": "immersiveengineering:connector/relayHV.obj",
|
"model": "immersiveengineering:connector/relay_hv.obj",
|
||||||
"textures": {
|
"textures": {
|
||||||
"#immersiveengineering:blocks/connector_relayHV": "industrialwires:blocks/ic2_relayGlass"
|
"#immersiveengineering:blocks/connector_relay_hv": "industrialwires:blocks/ic2_relay_glass"
|
||||||
},
|
},
|
||||||
"transform": {
|
"transform": {
|
||||||
"scale": [ 0.5, 0.5, 0.5 ],
|
"scale": [ 0.5, 0.5, 0.5 ],
|
|
@ -2,7 +2,7 @@
|
||||||
"forge_marker": 1,
|
"forge_marker": 1,
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"transform": "forge:default-block",
|
"transform": "forge:default-block",
|
||||||
"model": "industrialwires:iwSixSides",
|
"model": "industrialwires:iw_six_sides",
|
||||||
"textures": {
|
"textures": {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
tile.industrialwires.ic2Connector.tin_conn.name=Tin Wire Connector
|
tile.industrialwires.ic2_connector.tin_conn.name=Tin Wire Connector
|
||||||
tile.industrialwires.ic2Connector.tin_relay.name=Tin Wire Relay
|
tile.industrialwires.ic2_connector.tin_relay.name=Tin Wire Relay
|
||||||
tile.industrialwires.ic2Connector.copper_conn.name=Copper Wire Connector
|
tile.industrialwires.ic2_connector.copper_conn.name=Copper Wire Connector
|
||||||
tile.industrialwires.ic2Connector.copper_relay.name=Copper Wire Relay
|
tile.industrialwires.ic2_connector.copper_relay.name=Copper Wire Relay
|
||||||
tile.industrialwires.ic2Connector.gold_conn.name=Gold Wire Connector
|
tile.industrialwires.ic2_connector.gold_conn.name=Gold Wire Connector
|
||||||
tile.industrialwires.ic2Connector.gold_relay.name=Gold Wire Relay
|
tile.industrialwires.ic2_connector.gold_relay.name=Gold Wire Relay
|
||||||
tile.industrialwires.ic2Connector.hv_conn.name=IC2 HV Wire Connector
|
tile.industrialwires.ic2_connector.hv_conn.name=IC2 HV Wire Connector
|
||||||
tile.industrialwires.ic2Connector.hv_relay.name=IC2 HV Wire Relay
|
tile.industrialwires.ic2_connector.hv_relay.name=IC2 HV Wire Relay
|
||||||
tile.industrialwires.ic2Connector.glass_conn.name=Glass Fiber Wire Connector
|
tile.industrialwires.ic2_connector.glass_conn.name=Glass Fiber Wire Connector
|
||||||
tile.industrialwires.ic2Connector.glass_relay.name=Glass Fiber Wire Relay
|
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_motor.name=Rotational Motor
|
||||||
tile.industrialwires.mechanical_converter.ie_to_ic2.name=Converter: Rotational To Kinetic
|
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
|
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.category.control_panels.name=Control Panels
|
||||||
|
|
||||||
ie.manual.entry.industrialWires.wires.name=Industrial Wires
|
ie.manual.entry.industrialwires.wires.name=Industrial Wires
|
||||||
ie.manual.entry.industrialWires.wires.subtext=No complex impedance!
|
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.<br>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.wires0=Wires from the IndustrialWires company allow you to transfer energy like you can with cables from the IndustrialCraft2 company.<br>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.<br>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.wires1=attaching a connector to a power source that would destroy the cable will destroy the connector.<br>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.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.name=Mechanical Converters
|
||||||
ie.manual.entry.industrialWires.mechConv.subtext=I made rotational energy for this!
|
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!<br>To use the "Converter: Rotational To Kinetic" attach a source of IE rotational energy
|
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!<br>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).<br>Unfortunately some energy is
|
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).<br>Unfortunately some energy is
|
||||||
ie.manual.entry.industrialWires.mechConv2=lost with each conversion.<br>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.mechConv2=lost with each conversion.<br>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.name=Jacob's Ladders
|
||||||
ie.manual.entry.industrialWires.jacobs.subtext=Probably contain PCB's!
|
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.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: <config;dA;iwJacobsUsage>. 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.jacobs1=These are the required power values in EU: <config;dA;iwJacobsUsage>. 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.name=Introduction
|
||||||
ie.manual.entry.industrialWires.intro.subtext=
|
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.<br>Buttons, switches, indicator lights and other things that can be placed on a control panel are called §l(Panel) Components§r<br>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.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.<br>Buttons, switches, indicator lights and other things that can be placed on a control panel are called §l(Panel) Components§r<br>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.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.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.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.name=Panel Creator
|
||||||
ie.manual.entry.industrialWires.panel_creator.subtext=
|
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_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_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_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.name=Redstone Connections
|
||||||
ie.manual.entry.industrialWires.redstone.subtext=Could also be blood vessels
|
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.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.redstone1=connectors from Immersive Engineering.
|
||||||
|
|
||||||
ie.manual.entry.industrialWires.components.name=Panel Components
|
ie.manual.entry.industrialwires.components.name=Panel Components
|
||||||
ie.manual.entry.industrialWires.components.subtext=More than just two
|
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.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.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.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.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_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.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.
|
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.
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent":"item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "industrialwires:items/ic2_wire_copper"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent":"item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "industrialwires:items/ic2_wire_glass"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent":"item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "industrialwires:items/ic2_wire_gold"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent":"item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "industrialwires:items/ic2_wire_hv"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent":"item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "industrialwires:items/ic2_wire_tin"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"parent":"item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0":"industrialwires:items/ic2_wireCopper"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"parent":"item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0":"industrialwires:items/ic2_wireGlass"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"parent":"item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0":"industrialwires:items/ic2_wireGold"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"parent":"item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0":"industrialwires:items/ic2_wireHV"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"parent":"item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0":"industrialwires:items/ic2_wireTin"
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 397 B After Width: | Height: | Size: 397 B |
Before Width: | Height: | Size: 444 B After Width: | Height: | Size: 444 B |
Before Width: | Height: | Size: 501 B After Width: | Height: | Size: 501 B |
Before Width: | Height: | Size: 471 B After Width: | Height: | Size: 471 B |
Before Width: | Height: | Size: 370 B After Width: | Height: | Size: 370 B |
Before Width: | Height: | Size: 672 B After Width: | Height: | Size: 672 B |
Before Width: | Height: | Size: 622 B After Width: | Height: | Size: 622 B |
Before Width: | Height: | Size: 567 B After Width: | Height: | Size: 567 B |
Before Width: | Height: | Size: 644 B After Width: | Height: | Size: 644 B |
Before Width: | Height: | Size: 686 B After Width: | Height: | Size: 686 B |
Before Width: | Height: | Size: 664 B After Width: | Height: | Size: 664 B |
Before Width: | Height: | Size: 693 B After Width: | Height: | Size: 693 B |
Before Width: | Height: | Size: 688 B After Width: | Height: | Size: 688 B |
Before Width: | Height: | Size: 684 B After Width: | Height: | Size: 684 B |
|
@ -2,7 +2,7 @@
|
||||||
{
|
{
|
||||||
"modid": "industrialwires",
|
"modid": "industrialwires",
|
||||||
"name": "Industrial Wires",
|
"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}",
|
"version": "${version}",
|
||||||
"mcversion": "${mcversion}",
|
"mcversion": "${mcversion}",
|
||||||
"url": "",
|
"url": "",
|
||||||
|
|