Build 1.6-25

This commit is contained in:
malte0811 2018-02-19 18:11:45 +01:00
parent b87b67b17f
commit c3570a1273
6 changed files with 105 additions and 30 deletions

View file

@ -1,5 +1,5 @@
def mainVersion = "1.6" def mainVersion = "1.6"
def buildNumber = "24" def buildNumber = "25"
// For those who want the bleeding edge // For those who want the bleeding edge
buildscript { buildscript {
@ -47,8 +47,8 @@ repositories {
url 'http://maven.modmuss50.me' url 'http://maven.modmuss50.me'
} }
maven { maven {
name 'jared maven' name 'jared maven'
url 'http://blamejared.com/maven' url 'http://blamejared.com/maven'
} }
maven { // Albedo/Mirage Lights maven { // Albedo/Mirage Lights
url 'https://repo.elytradev.com/' url 'https://repo.elytradev.com/'
@ -59,7 +59,8 @@ repositories {
} }
// dependencies of TR... // dependencies of TR...
maven { maven {
url 'http://maven.epoxide.xyz'
url 'http://maven.mcmoddev.com'
} }
maven { maven {
// HWYLA // HWYLA

View file

@ -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 - Fixed an infinite energy bug
- Changed the default value for maximum energy conversion - Changed the default value for maximum energy conversion

View file

@ -19,8 +19,14 @@ package malte0811.industrialWires;
import net.minecraftforge.common.config.Config; import net.minecraftforge.common.config.Config;
import net.minecraftforge.common.config.Config.Comment; 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) @Config(modid = IndustrialWires.MODID)
@Mod.EventBusSubscriber
public class IWConfig { public class IWConfig {
@Comment({"The maximum length of a single connection.", "Order: Tin, Copper, Gold, HV, Glass Fiber"}) @Comment({"The maximum length of a single connection.", "Order: Tin, Copper, Gold, HV, Glass Fiber"})
public static int[] maxLengthPerConn = {16, 16, 16, 32, 32}; public static int[] maxLengthPerConn = {16, 16, 16, 32, 32};
@ -28,6 +34,7 @@ public class IWConfig {
public static int[] maxLengthOnCoil = {1024, 1024, 1024, 2048, 2048}; 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)"}) @Comment({"Set this to false to completely disable any conversion between IF and EU (default: true)"})
@RequiresMcRestart
public static boolean enableConversion = true; public static boolean enableConversion = true;
public static MechConversion mech; public static MechConversion mech;
@ -69,4 +76,11 @@ public class IWConfig {
@Comment({"Set to false to disable shaders. They are used for rendering the Marx generator and the Jacob's ladder."}) @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; 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);
}
}
} }

View file

@ -222,27 +222,32 @@ public class IndustrialWires {
WireApi.registerFeedthroughForWiretype(TIN, new ResourceLocation("immersiveengineering:block/connector/connector_lv.obj"), WireApi.registerFeedthroughForWiretype(TIN, new ResourceLocation("immersiveengineering:block/connector/connector_lv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv",
IndustrialWires.MODID + ":blocks/ic2_conn_tin"), tex, uvs, .5, .5, 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"), WireApi.registerFeedthroughForWiretype(COPPER_IC2, new ResourceLocation("immersiveengineering:block/connector/connector_lv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv",
IndustrialWires.MODID + ":blocks/ic2_conn_copper"), tex, uvs, .5, .5, 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"), WireApi.registerFeedthroughForWiretype(GOLD, new ResourceLocation("immersiveengineering:block/connector/connector_mv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_mv", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_mv",
IndustrialWires.MODID + ":blocks/ic2_conn_gold"), tex, uvs, .5625, .5625, 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"), WireApi.registerFeedthroughForWiretype(HV, new ResourceLocation("immersiveengineering:block/connector/connector_hv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_hv", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_hv",
IndustrialWires.MODID + ":blocks/ic2_conn_hv"), tex, uvs, .75, .75, 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"), WireApi.registerFeedthroughForWiretype(GLASS, new ResourceLocation("immersiveengineering:block/connector/connector_hv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_hv", ImmutableMap.of("#immersiveengineering:blocks/connector_connector_hv",
IndustrialWires.MODID + ":blocks/ic2_conn_glass"), tex, uvs, .75, .75, 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); NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
IWPotions.init(); IWPotions.init();

View file

@ -75,9 +75,15 @@ public class TileEntityMechIEtoIC extends TileEntityIWBase implements IDirection
return true; return true;
} }
@Override
@Deprecated
public int maxrequestkineticenergyTick(EnumFacing enumFacing) {
return 0;
}
//IC2 kinetic //IC2 kinetic
@Override @Override
public int maxrequestkineticenergyTick(EnumFacing f) { public int getConnectionBandwidth(EnumFacing f) {
if (f == dir) { if (f == dir) {
int stored = (int) (ConversionUtil.kinPerRot() * rotBuffer); int stored = (int) (ConversionUtil.kinPerRot() * rotBuffer);
return Math.min(maxOutput, stored); return Math.min(maxOutput, stored);
@ -87,12 +93,20 @@ public class TileEntityMechIEtoIC extends TileEntityIWBase implements IDirection
} }
@Override @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) { if (f == dir) {
int stored = (int) (ConversionUtil.kinPerRot() * rotBuffer); int stored = (int) (ConversionUtil.kinPerRot() * rotBuffer);
int out = Math.min(maxOutput, stored); int out = Math.min(maxOutput, stored);
out = Math.min(requested, out); out = Math.min(requested, out);
rotBuffer -= out * ConversionUtil.rotPerKin(); if (!simulate) {
rotBuffer -= out * ConversionUtil.rotPerKin();
}
return (int) (out * MechConversion.rotToKinEfficiency); return (int) (out * MechConversion.rotToKinEfficiency);
} else { } else {
return 0; return 0;

View file

@ -32,6 +32,7 @@ import ic2.api.energy.tile.IEnergySource;
import malte0811.industrialWires.IIC2Connector; import malte0811.industrialWires.IIC2Connector;
import malte0811.industrialWires.IndustrialWires; import malte0811.industrialWires.IndustrialWires;
import malte0811.industrialWires.blocks.IBlockBoundsIW; import malte0811.industrialWires.blocks.IBlockBoundsIW;
import net.minecraft.entity.Entity;
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;
@ -61,6 +62,7 @@ import static malte0811.industrialWires.wires.IC2Wiretype.TIN;
}) })
public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable implements IEnergySource, IEnergySink, IDirectionalTile, public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable implements IEnergySource, IEnergySink, IDirectionalTile,
ITickable, IIC2Connector, IBlockBoundsIW { ITickable, IIC2Connector, IBlockBoundsIW {
private static final double EPS = .1;
EnumFacing facing = EnumFacing.NORTH; EnumFacing facing = EnumFacing.NORTH;
boolean relay; boolean relay;
private boolean first = true; private boolean first = true;
@ -89,9 +91,12 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
first = false; first = false;
} }
if (!world.isRemote) { if (!world.isRemote) {
if (inBuffer > .1) { if (inBuffer > EPS) {
transferPower(); transferPower();
} }
if (inBuffer>EPS) {
notifyAvailableEnergy(inBuffer);
}
} }
} }
@ -101,24 +106,26 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
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, world); if (c.isEnergyOutput) {
if (iic instanceof IIC2Connector&&iic.isEnergyOutput()) { IImmersiveConnectable iic = ApiUtils.toIIC(c.end, world);
double tmp = outputMax - ((IIC2Connector) iic).insertEnergy(outputMax, true); if (iic instanceof IIC2Connector) {
if (tmp > .00000001) { double tmp = outputMax - ((IIC2Connector) iic).insertEnergy(outputMax, true);
maxOutputs.put(c, new ImmutablePair<>((IIC2Connector) iic, tmp)); if (tmp > EPS) {
sum += tmp; maxOutputs.put(c, new ImmutablePair<>((IIC2Connector) iic, tmp));
sum += tmp;
}
} }
} }
} }
if (sum > .0001) { if (sum > EPS) {
final double oldInBuf = outputMax;
HashMap<Connection, Integer> transferedPerConn = ImmersiveNetHandler.INSTANCE.getTransferedRates(world.provider.getDimension()); HashMap<Connection, Integer> transferedPerConn = ImmersiveNetHandler.INSTANCE.getTransferedRates(world.provider.getDimension());
for (Map.Entry<AbstractConnection, Pair<IIC2Connector, Double>> entry : maxOutputs.entrySet()) { for (Map.Entry<AbstractConnection, Pair<IIC2Connector, Double>> entry : maxOutputs.entrySet()) {
Pair<IIC2Connector, Double> p = entry.getValue(); Pair<IIC2Connector, Double> p = entry.getValue();
AbstractConnection c = entry.getKey(); AbstractConnection c = entry.getKey();
double out = oldInBuf * p.getRight() / sum; double out = outputMax * p.getRight() / sum;
double loss = getAverageLossRate(c); 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; inBuffer -= inserted;
float intermediaryLoss = 0; float intermediaryLoss = 0;
HashSet<IImmersiveConnectable> passedConnectors = new HashSet<>(); HashSet<IImmersiveConnectable> passedConnectors = new HashSet<>();
@ -136,11 +143,36 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
} }
} }
} }
if (inBuffer>0) { }
conns.stream().map((ac)->ApiUtils.toIIC(ac.end, world))
.forEach((iic)-> iic.addAvailableEnergy((float) inBuffer, (d)->inBuffer-=d)); private void notifyAvailableEnergy(double storedNew)
addAvailableEnergy(0, null); {
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) { private double getAverageLossRate(AbstractConnection conn) {
@ -293,10 +325,11 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
if (amount > maxToNet) { if (amount > maxToNet) {
maxToNet = amount; maxToNet = amount;
} }
notifyAvailableEnergy(amount);
} }
@Override @Override
public void readCustomNBT(NBTTagCompound nbt, boolean descPacket) { public void readCustomNBT(@Nonnull NBTTagCompound nbt, boolean descPacket) {
super.readCustomNBT(nbt, descPacket); super.readCustomNBT(nbt, descPacket);
facing = EnumFacing.getFront(nbt.getInteger("facing")); facing = EnumFacing.getFront(nbt.getInteger("facing"));
relay = nbt.getBoolean("relay"); relay = nbt.getBoolean("relay");
@ -315,7 +348,7 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
} }
@Override @Override
public void writeCustomNBT(NBTTagCompound nbt, boolean descPacket) { public void writeCustomNBT(@Nonnull NBTTagCompound nbt, boolean descPacket) {
super.writeCustomNBT(nbt, descPacket); super.writeCustomNBT(nbt, descPacket);
nbt.setInteger("facing", facing.getIndex()); nbt.setInteger("facing", facing.getIndex());
nbt.setBoolean("relay", relay); nbt.setBoolean("relay", relay);