Merge branch 'MC1.12' into mechStuff
This commit is contained in:
commit
56fb9e3b3a
|
@ -47,8 +47,8 @@ repositories {
|
|||
url 'http://maven.modmuss50.me'
|
||||
}
|
||||
maven {
|
||||
name 'jared maven'
|
||||
url 'http://blamejared.com/maven'
|
||||
name 'jared maven'
|
||||
url 'http://blamejared.com/maven'
|
||||
}
|
||||
maven { // Albedo/Mirage Lights
|
||||
url 'https://repo.elytradev.com/'
|
||||
|
@ -59,7 +59,8 @@ repositories {
|
|||
}
|
||||
// dependencies of TR...
|
||||
maven {
|
||||
url 'http://maven.epoxide.xyz'
|
||||
|
||||
url 'http://maven.mcmoddev.com'
|
||||
}
|
||||
maven {
|
||||
// HWYLA
|
||||
|
|
10
changelog.md
10
changelog.md
|
@ -1,4 +1,12 @@
|
|||
#####Version 1.6-23
|
||||
#####Version 1.6-25
|
||||
- Updated to IE build 77
|
||||
- IC2 wires cause damage
|
||||
- Added insulated versions of gold, copper and tin wires. Due to heat sensitive insulation the transfer capacity is half of the normal capacity
|
||||
- Added feedthrough insulators for all IC2 wire types
|
||||
- Wire coils now automatically "merge" when picked up
|
||||
- Config values are applied to the game directly now
|
||||
|
||||
#####Version 1.6-24
|
||||
- Fixed an infinite energy bug
|
||||
- Changed the default value for maximum energy conversion
|
||||
|
||||
|
|
|
@ -17,12 +17,20 @@
|
|||
*/
|
||||
package malte0811.industrialWires;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import blusunrize.immersiveengineering.api.energy.wires.IImmersiveConnectable;
|
||||
import blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public interface IIC2Connector {
|
||||
public interface IIC2Connector extends IImmersiveConnectable {
|
||||
/**
|
||||
* @return leftover energy.
|
||||
*/
|
||||
double insertEnergy(double eu, boolean simulate);
|
||||
void addAvailableEnergy(double amount, Consumer<Double> consume);
|
||||
|
||||
@Override
|
||||
default float getDamageAmount(Entity e, ImmersiveNetHandler.Connection c)
|
||||
{
|
||||
return (float) Math.ceil(IImmersiveConnectable.super.getDamageAmount(e, c));//Same as IC2 uses
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,8 +20,14 @@ package malte0811.industrialWires;
|
|||
import blusunrize.immersiveengineering.common.Config.IEConfig;
|
||||
import net.minecraftforge.common.config.Config;
|
||||
import net.minecraftforge.common.config.Config.Comment;
|
||||
import net.minecraftforge.common.config.Config.RequiresMcRestart;
|
||||
import net.minecraftforge.common.config.ConfigManager;
|
||||
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Config(modid = IndustrialWires.MODID)
|
||||
@Mod.EventBusSubscriber
|
||||
public class IWConfig {
|
||||
@Comment({"The maximum length of a single connection.", "Order: Tin, Copper, Gold, HV, Glass Fiber"})
|
||||
public static int[] maxLengthPerConn = {16, 16, 16, 32, 32};
|
||||
|
@ -29,6 +35,7 @@ public class IWConfig {
|
|||
public static int[] maxLengthOnCoil = {1024, 1024, 1024, 2048, 2048};
|
||||
|
||||
@Comment({"Set this to false to completely disable any conversion between IF and EU (default: true)"})
|
||||
@RequiresMcRestart
|
||||
public static boolean enableConversion = true;
|
||||
|
||||
public static MechConversion mech;
|
||||
|
@ -73,4 +80,11 @@ public class IWConfig {
|
|||
@Comment({"Set to false to disable shaders. They are used for rendering the Marx generator and the Jacob's ladder."})
|
||||
public static boolean enableShaders = true;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent ev) {
|
||||
if (ev.getModID().equals(IndustrialWires.MODID)) {
|
||||
ConfigManager.sync(IndustrialWires.MODID, Config.Type.INSTANCE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ package malte0811.industrialWires;
|
|||
import static malte0811.industrialWires.blocks.wire.BlockTypes_IC2_Connector.*;
|
||||
import static malte0811.industrialWires.wires.IC2Wiretype.*;
|
||||
|
||||
@Mod(modid = IndustrialWires.MODID, version = IndustrialWires.VERSION, dependencies = "required-after:immersiveengineering@[0.12-72,);after:ic2",
|
||||
@Mod(modid = IndustrialWires.MODID, version = IndustrialWires.VERSION, dependencies = "required-after:immersiveengineering@[0.12-77,);after:ic2",
|
||||
certificateFingerprint = "7e11c175d1e24007afec7498a1616bef0000027d")
|
||||
@Mod.EventBusSubscriber
|
||||
public class IndustrialWires {
|
||||
|
@ -231,27 +231,32 @@ public class IndustrialWires {
|
|||
WireApi.registerFeedthroughForWiretype(TIN, new ResourceLocation("immersiveengineering:block/connector/connector_lv.obj"),
|
||||
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv",
|
||||
IndustrialWires.MODID + ":blocks/ic2_conn_tin"), tex, uvs, .5, .5,
|
||||
(state) -> state.getBlock() == ic2conn && state.getValue(BlockIC2Connector.TYPE) == TIN_CONN);
|
||||
(state) -> state.getBlock() == ic2conn && state.getValue(BlockIC2Connector.TYPE) == TIN_CONN,
|
||||
1/64F, TIN.getTransferRate(), f->(float)Math.ceil(f));
|
||||
|
||||
WireApi.registerFeedthroughForWiretype(COPPER_IC2, new ResourceLocation("immersiveengineering:block/connector/connector_lv.obj"),
|
||||
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv",
|
||||
IndustrialWires.MODID + ":blocks/ic2_conn_copper"), tex, uvs, .5, .5,
|
||||
(state) -> state.getBlock() == ic2conn && state.getValue(BlockIC2Connector.TYPE) == COPPER_CONN);
|
||||
(state) -> state.getBlock() == ic2conn && state.getValue(BlockIC2Connector.TYPE) == COPPER_CONN,
|
||||
1/64F, COPPER_IC2.getTransferRate(), f->(float)Math.ceil(f));
|
||||
|
||||
WireApi.registerFeedthroughForWiretype(GOLD, new ResourceLocation("immersiveengineering:block/connector/connector_mv.obj"),
|
||||
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_mv",
|
||||
IndustrialWires.MODID + ":blocks/ic2_conn_gold"), tex, uvs, .5625, .5625,
|
||||
(state) -> state.getBlock() == ic2conn && state.getValue(BlockIC2Connector.TYPE) == GOLD_CONN);
|
||||
(state) -> state.getBlock() == ic2conn && state.getValue(BlockIC2Connector.TYPE) == GOLD_CONN,
|
||||
1/64F, GOLD.getTransferRate(), f->(float)Math.ceil(f));
|
||||
|
||||
WireApi.registerFeedthroughForWiretype(HV, new ResourceLocation("immersiveengineering:block/connector/connector_hv.obj"),
|
||||
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_hv",
|
||||
IndustrialWires.MODID + ":blocks/ic2_conn_hv"), tex, uvs, .75, .75,
|
||||
(state) -> state.getBlock() == ic2conn && state.getValue(BlockIC2Connector.TYPE) == HV_CONN);
|
||||
(state) -> state.getBlock() == ic2conn && state.getValue(BlockIC2Connector.TYPE) == HV_CONN,
|
||||
1/64F, HV.getTransferRate(), f->(float)Math.ceil(f));
|
||||
|
||||
WireApi.registerFeedthroughForWiretype(GLASS, new ResourceLocation("immersiveengineering:block/connector/connector_hv.obj"),
|
||||
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_hv",
|
||||
IndustrialWires.MODID + ":blocks/ic2_conn_glass"), tex, uvs, .75, .75,
|
||||
(state) -> state.getBlock() == ic2conn && state.getValue(BlockIC2Connector.TYPE) == GLASS_CONN);
|
||||
(state) -> state.getBlock() == ic2conn && state.getValue(BlockIC2Connector.TYPE) == GLASS_CONN,
|
||||
1/64F, GLASS.getTransferRate(), f->(float)Math.ceil(f));
|
||||
}
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
|
||||
IWPotions.init();
|
||||
|
|
|
@ -26,6 +26,7 @@ import blusunrize.immersiveengineering.api.energy.wires.WireType;
|
|||
import blusunrize.immersiveengineering.api.energy.wires.redstone.IRedstoneConnector;
|
||||
import blusunrize.immersiveengineering.api.energy.wires.redstone.RedstoneWireNetwork;
|
||||
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces;
|
||||
import malte0811.industrialWires.IndustrialWires;
|
||||
import malte0811.industrialWires.blocks.IBlockBoundsIW;
|
||||
import malte0811.industrialWires.blocks.INetGUI;
|
||||
import malte0811.industrialWires.controlpanel.PanelComponent;
|
||||
|
@ -42,6 +43,7 @@ import net.minecraft.util.ITickable;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
@ -95,7 +97,7 @@ public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound out, boolean updatePacket) {
|
||||
public void writeCustomNBT(@Nonnull NBTTagCompound out, boolean updatePacket) {
|
||||
super.writeCustomNBT(out, updatePacket);
|
||||
out.setByteArray("out", this.out);
|
||||
out.setBoolean("hasConn", hasConn);
|
||||
|
@ -104,7 +106,7 @@ public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound in, boolean updatePacket) {
|
||||
public void readCustomNBT(@Nonnull NBTTagCompound in, boolean updatePacket) {
|
||||
super.readCustomNBT(in, updatePacket);
|
||||
out = in.getByteArray("out");
|
||||
hasConn = in.getBoolean("hasConn");
|
||||
|
@ -238,7 +240,7 @@ public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectCable(WireType wire, TargetingInfo targetingInfo) {
|
||||
public boolean canConnectCable(WireType wire, TargetingInfo targetingInfo, Vec3i offset) {
|
||||
return REDSTONE_CATEGORY.equals(wire.getCategory()) && !hasConn;
|
||||
}
|
||||
|
||||
|
@ -271,12 +273,6 @@ public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implem
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3d getRaytraceOffset(IImmersiveConnectable other) {
|
||||
EnumFacing side = facing.getOpposite();
|
||||
return new Vec3d(.5 + side.getFrontOffsetX() * .0625, .5 + side.getFrontOffsetY() * .0625, .5 + side.getFrontOffsetZ() * .0625);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3d getConnectionOffset(ImmersiveNetHandler.Connection connection) {
|
||||
EnumFacing side = facing.getOpposite();
|
||||
|
|
|
@ -78,9 +78,15 @@ public class TileEntityMechIEtoIC extends TileEntityIWBase implements IDirection
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public int maxrequestkineticenergyTick(EnumFacing enumFacing) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//IC2 kinetic
|
||||
@Override
|
||||
public int maxrequestkineticenergyTick(EnumFacing f) {
|
||||
public int getConnectionBandwidth(EnumFacing f) {
|
||||
if (f == dir) {
|
||||
int stored = (int) (ConversionUtil.kinPerRot() * rotBuffer);
|
||||
return Math.min(maxOutput, stored);
|
||||
|
@ -90,12 +96,20 @@ public class TileEntityMechIEtoIC extends TileEntityIWBase implements IDirection
|
|||
}
|
||||
|
||||
@Override
|
||||
public int requestkineticenergy(EnumFacing f, int requested) {
|
||||
@Deprecated
|
||||
public int requestkineticenergy(EnumFacing enumFacing, int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int drawKineticEnergy(EnumFacing f, int requested, boolean simulate) {
|
||||
if (f == dir) {
|
||||
int stored = (int) (ConversionUtil.kinPerRot() * rotBuffer);
|
||||
int out = Math.min(maxOutput, stored);
|
||||
out = Math.min(requested, out);
|
||||
rotBuffer -= out * ConversionUtil.rotPerKin();
|
||||
if (!simulate) {
|
||||
rotBuffer -= out * ConversionUtil.rotPerKin();
|
||||
}
|
||||
return (int) (out * MechConversion.rotToKinEfficiency);
|
||||
} else {
|
||||
return 0;
|
||||
|
|
|
@ -71,7 +71,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static blusunrize.immersiveengineering.api.energy.wires.WireType.REDSTONE_CATEGORY;
|
||||
import static malte0811.industrialWires.blocks.hv.TileEntityMarx.FiringState.FIRE;
|
||||
|
@ -546,11 +545,6 @@ public class TileEntityMarx extends TileEntityIWMultiblock implements ITickable,
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
//TODO
|
||||
@Override
|
||||
public void addAvailableEnergy(double amount, Consumer<Double> consume) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getConnectionMaster(@Nullable WireType cableType, TargetingInfo target) {
|
||||
|
|
|
@ -47,7 +47,10 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static malte0811.industrialWires.wires.IC2Wiretype.IC2_TIN_CAT;
|
||||
|
@ -59,6 +62,7 @@ import static malte0811.industrialWires.wires.IC2Wiretype.TIN;
|
|||
})
|
||||
public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable implements IEnergySource, IEnergySink, IDirectionalTile,
|
||||
ITickable, IIC2Connector, IBlockBoundsIW {
|
||||
private static final double EPS = .1;
|
||||
EnumFacing facing = EnumFacing.NORTH;
|
||||
boolean relay;
|
||||
private boolean first = true;
|
||||
|
@ -87,9 +91,12 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
|
|||
first = false;
|
||||
}
|
||||
if (!world.isRemote) {
|
||||
if (inBuffer > .1) {
|
||||
if (inBuffer > EPS) {
|
||||
transferPower();
|
||||
}
|
||||
if (inBuffer>EPS) {
|
||||
notifyAvailableEnergy(inBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,24 +106,26 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
|
|||
double outputMax = Math.min(inBuffer, maxToNet);
|
||||
double sum = 0;
|
||||
for (AbstractConnection c : conns) {
|
||||
IImmersiveConnectable iic = ApiUtils.toIIC(c.end, world);
|
||||
if (iic instanceof IIC2Connector&&iic.isEnergyOutput()) {
|
||||
double tmp = outputMax - ((IIC2Connector) iic).insertEnergy(outputMax, true);
|
||||
if (tmp > .00000001) {
|
||||
maxOutputs.put(c, new ImmutablePair<>((IIC2Connector) iic, tmp));
|
||||
sum += tmp;
|
||||
if (c.isEnergyOutput) {
|
||||
IImmersiveConnectable iic = ApiUtils.toIIC(c.end, world);
|
||||
if (iic instanceof IIC2Connector) {
|
||||
double tmp = outputMax - ((IIC2Connector) iic).insertEnergy(outputMax, true);
|
||||
if (tmp > EPS) {
|
||||
maxOutputs.put(c, new ImmutablePair<>((IIC2Connector) iic, tmp));
|
||||
sum += tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sum > .0001) {
|
||||
final double oldInBuf = outputMax;
|
||||
if (sum > EPS) {
|
||||
HashMap<Connection, Integer> transferedPerConn = ImmersiveNetHandler.INSTANCE.getTransferedRates(world.provider.getDimension());
|
||||
for (Map.Entry<AbstractConnection, Pair<IIC2Connector, Double>> entry : maxOutputs.entrySet()) {
|
||||
Pair<IIC2Connector, Double> p = entry.getValue();
|
||||
AbstractConnection c = entry.getKey();
|
||||
double out = oldInBuf * p.getRight() / sum;
|
||||
double out = outputMax * p.getRight() / sum;
|
||||
double loss = getAverageLossRate(c);
|
||||
double inserted = out - p.getLeft().insertEnergy(out - loss, false);
|
||||
out -= loss;
|
||||
double inserted = out - p.getLeft().insertEnergy(out, false);
|
||||
inBuffer -= inserted;
|
||||
float intermediaryLoss = 0;
|
||||
HashSet<IImmersiveConnectable> passedConnectors = new HashSet<>();
|
||||
|
@ -134,14 +143,36 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
|
|||
}
|
||||
}
|
||||
}
|
||||
if (inBuffer>0) {
|
||||
conns.stream().map((ac)->ApiUtils.toIIC(ac.end, world)).forEach((iic)-> {
|
||||
if (iic instanceof IIC2Connector) {
|
||||
((IIC2Connector) iic).addAvailableEnergy(inBuffer, (d)->inBuffer-=d);
|
||||
}
|
||||
});
|
||||
addAvailableEnergy(0D, null);
|
||||
}
|
||||
|
||||
private void notifyAvailableEnergy(double storedNew)
|
||||
{
|
||||
Set<AbstractConnection> outputs = ImmersiveNetHandler.INSTANCE.getIndirectEnergyConnections(pos, world, true);
|
||||
for(AbstractConnection con : outputs)
|
||||
{
|
||||
IImmersiveConnectable end = ApiUtils.toIIC(con.end, world);
|
||||
if(con.cableType!=null && end!=null && end.allowEnergyToPass(null))
|
||||
{
|
||||
Pair<Float, Consumer<Float>> e = getEnergyForConnection(con, storedNew);
|
||||
end.addAvailableEnergy(e.getKey(), e.getValue());
|
||||
}
|
||||
}
|
||||
addAvailableEnergy(-1, null);
|
||||
}
|
||||
|
||||
private Pair<Float, Consumer<Float>> getEnergyForConnection(@Nullable AbstractConnection c, double storedNew)
|
||||
{
|
||||
float loss = c!=null?c.getAverageLossRate():0;
|
||||
float max = (float) (storedNew-loss);
|
||||
Consumer<Float> extract = (energy)->{
|
||||
inBuffer -= energy+loss;
|
||||
};
|
||||
return new ImmutablePair<>(max, extract);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageAmount(Entity e, Connection c) {
|
||||
return (float) Math.ceil(super.getDamageAmount(e, c));
|
||||
}
|
||||
|
||||
private double getAverageLossRate(AbstractConnection conn) {
|
||||
|
@ -268,48 +299,16 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
|
|||
markDirty();
|
||||
}
|
||||
|
||||
|
||||
private List<Pair<Double, Consumer<Double>>> sources = new ArrayList<>();
|
||||
private long lastSourceUpdate = 0;
|
||||
@Override
|
||||
public void addAvailableEnergy(double amount, Consumer<Double> consume) {
|
||||
long currentTime = world.getTotalWorldTime();
|
||||
if (lastSourceUpdate!=currentTime)
|
||||
{
|
||||
sources.clear();
|
||||
Pair<Double, Consumer<Double>> own = getOwnEnergyIC2();
|
||||
if (own!=null)
|
||||
sources.add(own);
|
||||
lastSourceUpdate = currentTime;
|
||||
}
|
||||
if (amount>0&&consume!=null)
|
||||
sources.add(new ImmutablePair<>(amount, consume));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected Pair<Double,Consumer<Double>> getOwnEnergyIC2()
|
||||
protected Pair<Float,Consumer<Float>> getOwnEnergy()
|
||||
{
|
||||
if (isRelay())
|
||||
return null;
|
||||
return new ImmutablePair<>(inBuffer, (d)->inBuffer -= d);
|
||||
return new ImmutablePair<>((float)inBuffer, (d)->inBuffer -= d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageAmount(Entity e, Connection c)
|
||||
{
|
||||
float max = getMaxDamage(c);
|
||||
if (max==0||world.getTotalWorldTime()-lastSourceUpdate>1)
|
||||
return 0;
|
||||
float energy = 0;
|
||||
for (int i = 0;i<sources.size()&&energy<max;i++) {
|
||||
energy += Math.min(sources.get(i).getLeft(), max-energy);
|
||||
}
|
||||
return (float) Math.ceil(energy/64);//Same as IC2 uses
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMaxDamage(Connection c) {
|
||||
return c.cableType.getTransferRate()/8;
|
||||
protected float getBaseDamage(ImmersiveNetHandler.Connection c) {
|
||||
return 1/64F;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -326,10 +325,11 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
|
|||
if (amount > maxToNet) {
|
||||
maxToNet = amount;
|
||||
}
|
||||
notifyAvailableEnergy(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound nbt, boolean descPacket) {
|
||||
public void readCustomNBT(@Nonnull NBTTagCompound nbt, boolean descPacket) {
|
||||
super.readCustomNBT(nbt, descPacket);
|
||||
facing = EnumFacing.getFront(nbt.getInteger("facing"));
|
||||
relay = nbt.getBoolean("relay");
|
||||
|
@ -348,7 +348,7 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound nbt, boolean descPacket) {
|
||||
public void writeCustomNBT(@Nonnull NBTTagCompound nbt, boolean descPacket) {
|
||||
super.writeCustomNBT(nbt, descPacket);
|
||||
nbt.setInteger("facing", facing.getIndex());
|
||||
nbt.setBoolean("relay", relay);
|
||||
|
@ -414,6 +414,8 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
|
|||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (world==null)
|
||||
return 0;
|
||||
int ret = world.provider.getDimension();
|
||||
ret = 31 * ret + pos.hashCode();
|
||||
return ret;
|
||||
|
|
|
@ -65,7 +65,7 @@ import java.util.Map;
|
|||
@Mod.EventBusSubscriber(modid = IndustrialWires.MODID, value = Side.CLIENT)
|
||||
public class ClientEventHandler {
|
||||
public static boolean shouldScreenshot = false;
|
||||
@SubscribeEvent
|
||||
@SubscribeEvent(priority = EventPriority.LOW)
|
||||
public static void renderOverlayPost(RenderGameOverlayEvent.Post e) {
|
||||
if (ClientUtils.mc().player != null && e.getType() == RenderGameOverlayEvent.ElementType.TEXT) {
|
||||
EntityPlayer player = ClientUtils.mc().player;
|
||||
|
@ -76,8 +76,15 @@ public class ClientEventHandler {
|
|||
if (OreDictionary.itemMatches(new ItemStack(IndustrialWires.coil, 1, OreDictionary.WILDCARD_VALUE), equipped, false)) {
|
||||
IC2Wiretype type = IC2Wiretype.ALL[equipped.getItemDamage()];
|
||||
int color = type.getColour(null);
|
||||
final int threshold = 0x40-1;
|
||||
for (int i = 0;i<3;i++) {
|
||||
if (((color>>(8*i))&255)<threshold) {
|
||||
color |= threshold<<(8*i);
|
||||
}
|
||||
}
|
||||
String s = I18n.format(IndustrialWires.MODID + ".desc.wireLength", ItemIC2Coil.getLength(equipped));
|
||||
ClientUtils.font().drawString(s, e.getResolution().getScaledWidth() / 2 - ClientUtils.font().getStringWidth(s) / 2, e.getResolution().getScaledHeight() - GuiIngameForge.left_height - 40, color, true);
|
||||
ClientUtils.font().drawString(s, e.getResolution().getScaledWidth() / 2 - ClientUtils.font().getStringWidth(s) / 2,
|
||||
e.getResolution().getScaledHeight() - GuiIngameForge.left_height - 40, color, true);
|
||||
if (ItemNBTHelper.hasKey(equipped, "linkingPos")) {
|
||||
int[] link = ItemNBTHelper.getIntArray(equipped, "linkingPos");
|
||||
if (link != null && link.length > 3) {
|
||||
|
@ -93,7 +100,8 @@ public class ClientEventHandler {
|
|||
if (length * length < distSquared) {
|
||||
color = 0xdd3333;
|
||||
}
|
||||
ClientUtils.font().drawString(s, e.getResolution().getScaledWidth() / 2 - ClientUtils.font().getStringWidth(s) / 2, e.getResolution().getScaledHeight() - GuiIngameForge.left_height - 20, color, true);
|
||||
ClientUtils.font().drawString(s, e.getResolution().getScaledWidth() / 2 - ClientUtils.font().getStringWidth(s) / 2,
|
||||
e.getResolution().getScaledHeight() - GuiIngameForge.left_height - 20, color, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,9 @@ import blusunrize.immersiveengineering.api.energy.wires.IImmersiveConnectable;
|
|||
import blusunrize.immersiveengineering.api.energy.wires.IWireCoil;
|
||||
import blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler;
|
||||
import blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler.Connection;
|
||||
import blusunrize.immersiveengineering.api.energy.wires.WireType;
|
||||
import blusunrize.immersiveengineering.common.IESaveData;
|
||||
import blusunrize.immersiveengineering.common.blocks.metal.TileEntityBreakerSwitch;
|
||||
import blusunrize.immersiveengineering.common.blocks.metal.TileEntityRedstoneBreaker;
|
||||
import blusunrize.immersiveengineering.common.util.ItemNBTHelper;
|
||||
import blusunrize.immersiveengineering.common.util.Utils;
|
||||
import malte0811.industrialWires.IWConfig;
|
||||
|
@ -91,7 +92,7 @@ public class ItemIC2Coil extends Item implements IWireCoil {
|
|||
}
|
||||
|
||||
@Override
|
||||
public WireType getWireType(ItemStack stack) {
|
||||
public IC2Wiretype getWireType(ItemStack stack) {
|
||||
return IC2Wiretype.ALL[stack.getMetadata()];
|
||||
}
|
||||
|
||||
|
@ -126,14 +127,18 @@ public class ItemIC2Coil extends Item implements IWireCoil {
|
|||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
if (tileEntity instanceof IImmersiveConnectable && ((IImmersiveConnectable) tileEntity).canConnect()) {
|
||||
TargetingInfo target = new TargetingInfo(side, hitX, hitY, hitZ);
|
||||
WireType wire = getWireType(stack);
|
||||
IC2Wiretype wire = getWireType(stack);
|
||||
BlockPos masterPos = ((IImmersiveConnectable) tileEntity).getConnectionMaster(wire, target);
|
||||
Vec3i offset = pos.subtract(masterPos);
|
||||
tileEntity = world.getTileEntity(masterPos);
|
||||
if (!(tileEntity instanceof IImmersiveConnectable) || !((IImmersiveConnectable) tileEntity).canConnect())
|
||||
return EnumActionResult.PASS;
|
||||
|
||||
if (!((IImmersiveConnectable) tileEntity).canConnectCable(wire, target, offset)) {
|
||||
boolean canConnect = ((IImmersiveConnectable) tileEntity).canConnectCable(wire, target, offset);
|
||||
if (canConnect&&tileEntity instanceof TileEntityBreakerSwitch) {
|
||||
canConnect = !wire.isHV()||tileEntity instanceof TileEntityRedstoneBreaker;
|
||||
}
|
||||
if (!canConnect) {
|
||||
if (!world.isRemote)
|
||||
player.sendMessage(new TextComponentTranslation(Lib.CHAT_WARN + "wrongCable"));
|
||||
return EnumActionResult.FAIL;
|
||||
|
@ -225,8 +230,11 @@ public class ItemIC2Coil extends Item implements IWireCoil {
|
|||
world.addBlockEvent(linkPos, ((TileEntity) nodeLink).getBlockType(), -1, 0);
|
||||
state = world.getBlockState(linkPos);
|
||||
world.notifyBlockUpdate(linkPos, state, state, 3);
|
||||
} else
|
||||
player.sendMessage(new TextComponentTranslation(Lib.CHAT_WARN + "cantSee"));
|
||||
} else {
|
||||
player.sendMessage(new TextComponentTranslation(Lib.CHAT_WARN + "tooFar"));
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(new TextComponentTranslation(Lib.CHAT_WARN + "cantSee"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,4 +161,8 @@ public class IC2Wiretype extends WireType {
|
|||
public int getFactor() {
|
||||
return type<5?8:4;
|
||||
}
|
||||
|
||||
public boolean isHV() {
|
||||
return this==HV||this==GLASS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ industrialwires.desc.output=Main Output
|
|||
industrialwires.desc.alt=Replacement
|
||||
industrialwires.desc.ideal_e=Ideal Energy
|
||||
|
||||
industrialwires.desc.wireLength=Wire length: %1s block(s)
|
||||
industrialwires.desc.wireLength=Wire length: %s block(s)
|
||||
industrialwires.desc.recipe=Please check the Engineer's manual for recipe details
|
||||
industrialwires.desc.remove_all=Remove all components from this panel
|
||||
industrialwires.desc.create_panel=Create a new control panel
|
||||
|
@ -111,7 +111,6 @@ industrialwires.chat.marxEnergy=Last discharge was %s kJ per block
|
|||
death.attack.industrialwires.jacobs_ladder=%1$s was electrocuted by a Jacob's Ladder
|
||||
death.attack.industrialwires.marx=%1$s was struck by lightning produced by a Marx generator
|
||||
|
||||
|
||||
itemGroup.industrialwires=Industrial Wires
|
||||
|
||||
ie.manual.category.industrialwires.name=Industrial Wires
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent":"item/generated",
|
||||
"textures": {
|
||||
"layer0": "industrialwires:items/ic2_wire_copper_ins"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent":"item/generated",
|
||||
"textures": {
|
||||
"layer0": "industrialwires:items/ic2_wire_gold_ins"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent":"item/generated",
|
||||
"textures": {
|
||||
"layer0": "industrialwires:items/ic2_wire_tin_ins"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 701 B |
Binary file not shown.
After Width: | Height: | Size: 701 B |
Binary file not shown.
After Width: | Height: | Size: 699 B |
Loading…
Reference in a new issue