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 buildNumber = "24"
def buildNumber = "25"
// For those who want the bleeding edge
buildscript {
@ -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

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
- 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.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};
@ -28,6 +34,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;
@ -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."})
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"),
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();

View file

@ -75,9 +75,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);
@ -87,12 +93,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;

View file

@ -32,6 +32,7 @@ import ic2.api.energy.tile.IEnergySource;
import malte0811.industrialWires.IIC2Connector;
import malte0811.industrialWires.IndustrialWires;
import malte0811.industrialWires.blocks.IBlockBoundsIW;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
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,
ITickable, IIC2Connector, IBlockBoundsIW {
private static final double EPS = .1;
EnumFacing facing = EnumFacing.NORTH;
boolean relay;
private boolean first = true;
@ -89,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);
}
}
}
@ -101,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<>();
@ -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));
addAvailableEnergy(0, 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) {
@ -293,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");
@ -315,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);