From 880d3507209affc60e66b1ec8c8644ad3624035d Mon Sep 17 00:00:00 2001 From: malte0811 Date: Fri, 22 Jun 2018 18:51:51 +0200 Subject: [PATCH] Misc fixes for the mechanical multiblocks --- build.gradle | 2 +- .../blocks/converter/TileEntityMechMB.java | 15 ++++++++++++--- .../industrialWires/mech_mb/MechEnergy.java | 3 +++ .../industrialWires/mech_mb/MechMBPart.java | 5 ++++- .../mech_mb/MechPartSpeedometer.java | 4 ++-- .../assets/industrialwires/lang/en_US.lang | 2 +- .../textures/blocks/converter/electrodes.png | Bin 2140 -> 2062 bytes 7 files changed, 23 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index b21cc62..6cec2eb 100644 --- a/build.gradle +++ b/build.gradle @@ -71,7 +71,7 @@ repositories { dependencies { deobfCompile 'net.industrial-craft:industrialcraft-2:2.8.+' - deobfCompile "blusunrize:ImmersiveEngineering:0.12-+:deobf" + deobfCompile "blusunrize:ImmersiveEngineering:0.12-+" compileOnly "TechReborn:TechReborn-1.12:2.6.+:dev" compileOnly "RebornCore:RebornCore-1.12:3.2.+:dev" compileOnly 'com.elytradev:mirage:2.0.1-SNAPSHOT' diff --git a/src/main/java/malte0811/industrialWires/blocks/converter/TileEntityMechMB.java b/src/main/java/malte0811/industrialWires/blocks/converter/TileEntityMechMB.java index 63a98c6..4e64fc8 100644 --- a/src/main/java/malte0811/industrialWires/blocks/converter/TileEntityMechMB.java +++ b/src/main/java/malte0811/industrialWires/blocks/converter/TileEntityMechMB.java @@ -248,13 +248,19 @@ public class TileEntityMechMB extends TileEntityIWMultiblock implements ITickabl double totalAvailable = 0; double totalRequested = 0; for (int i = 0; i < available.length; i++) { - if (availableWf[i].equals(waveform)) { - totalAvailable += available[i]; - } else { + if (!availableWf[i].equals(waveform)) { available[i] = 0; } totalRequested += requested[i]; } + for (int i = 0; i < available.length; i++) { + if (available[i]>0) { + available[i] = Math.min(available[i], totalRequested-requested[i]); + totalAvailable += available[i]; + } + } + if (totalAvailable==0) + return 0; double[] ins = new double[section[1]-section[0]]; double[] extracted = new double[section[1]-section[0]]; for (int i = section[0]; i < section[1]; i++) { @@ -346,6 +352,9 @@ public class TileEntityMechMB extends TileEntityIWMultiblock implements ITickabl } electricalStartEnd = electrical.toArray(new int[electrical.size()][]); decay = Math.pow(DECAY_BASE, mechanical.length); + if (energyState!=null) { + energyState.invalid = true; + } energyState = new MechEnergy(weight, speed); } diff --git a/src/main/java/malte0811/industrialWires/mech_mb/MechEnergy.java b/src/main/java/malte0811/industrialWires/mech_mb/MechEnergy.java index ca2c5fe..ed6dc06 100644 --- a/src/main/java/malte0811/industrialWires/mech_mb/MechEnergy.java +++ b/src/main/java/malte0811/industrialWires/mech_mb/MechEnergy.java @@ -20,6 +20,7 @@ import net.minecraft.util.math.MathHelper; public final class MechEnergy { private double speed = 0; + public boolean invalid = false; public final double weight; public MechEnergy(double weight, double speed) { @@ -97,6 +98,8 @@ public final class MechEnergy { } private float getTotalVolume() { + if (invalid) + return 0; float ret = (float) (weight / 20e3 * Math.tanh(getSpeedForSound()/30)); ret = Math.min(ret, 1.5F); return ret; diff --git a/src/main/java/malte0811/industrialWires/mech_mb/MechMBPart.java b/src/main/java/malte0811/industrialWires/mech_mb/MechMBPart.java index 6f068ec..3685bcb 100644 --- a/src/main/java/malte0811/industrialWires/mech_mb/MechMBPart.java +++ b/src/main/java/malte0811/industrialWires/mech_mb/MechMBPart.java @@ -271,7 +271,10 @@ public abstract class MechMBPart { for (int x = -1; x <= 1; x++) { for (int y = -1; y <= 1; y++) { pos.setPos(x, y, -z); - world.setBlockState(pos, getOriginalBlock(pos)); + IBlockState state = getOriginalBlock(pos); + if (state.getBlock()!=Blocks.AIR) { + world.setBlockState(pos, state); + } } } } diff --git a/src/main/java/malte0811/industrialWires/mech_mb/MechPartSpeedometer.java b/src/main/java/malte0811/industrialWires/mech_mb/MechPartSpeedometer.java index 055db31..ba0a1f1 100644 --- a/src/main/java/malte0811/industrialWires/mech_mb/MechPartSpeedometer.java +++ b/src/main/java/malte0811/industrialWires/mech_mb/MechPartSpeedometer.java @@ -46,7 +46,7 @@ import static blusunrize.immersiveengineering.common.IEContent.blockMetalDecorat import static blusunrize.immersiveengineering.common.blocks.metal.BlockTypes_MetalDecoration0.RS_ENGINEERING; import static malte0811.industrialWires.blocks.converter.MechanicalMBBlockType.SPEEDOMETER; import static net.minecraft.util.EnumFacing.Axis.X; -import static net.minecraft.util.EnumFacing.AxisDirection.POSITIVE; +import static net.minecraft.util.EnumFacing.AxisDirection.NEGATIVE; import static net.minecraft.util.math.BlockPos.ORIGIN; public class MechPartSpeedometer extends MechMBPart implements IRedstoneOutput { @@ -192,7 +192,7 @@ public class MechPartSpeedometer extends MechMBPart implements IRedstoneOutput { @Override public int getStrongRSOutput(@Nonnull IBlockState state, @Nonnull EnumFacing side) { if (side.getAxis() == X) { - if (side.getAxisDirection() == POSITIVE) { + if (side.getAxisDirection() == NEGATIVE) { return currentOutputLog; } else { return currentOutputLin; diff --git a/src/main/resources/assets/industrialwires/lang/en_US.lang b/src/main/resources/assets/industrialwires/lang/en_US.lang index 9db08a4..62fc244 100644 --- a/src/main/resources/assets/industrialwires/lang/en_US.lang +++ b/src/main/resources/assets/industrialwires/lang/en_US.lang @@ -150,7 +150,7 @@ ie.manual.entry.industrialwires.mech_mb=Mechanical multiblocks serve two main pu ie.manual.entry.industrialwires.mech_mb_parts.name=Mechanical Multiblock Parts ie.manual.entry.industrialwires.mech_mb_parts.subtext= -ie.manual.entry.industrialwires.mech_mb_parts=The shaft is the simplest part imaginable: It does not do anything. This can be useful for seperating electrical sections of the multiblock. It consists of a single heavy engineering block in the middle of the multiblock.<&0>The flywheel is another very simple part: Its only job is to add inertia to increase energy storage. Various materials can be used instead of the lead blocks in the above schematic. The table on the next page shows all available materials, their inertia and their maximum speed.<&1><&2>Coils produce synchronous AC power from the multiblocks rotation or convert AC power (both synchronous and asynchronous will work) into multiblock rotation. For a four-phase coil replace the light engineering blocks on the level of the shaft with copper coil blocks. The maximum speed is 100 radians/second for a single-phase coil and 500 radians/second for a four-phase coil, the maximum energy transfer is 200 kW (4096 Flux/tick) for single-phase coil and 8 times as much on the four-phase version.<&3>Electrodes are the standard way of transferring energy out of or into a mechanical multiblock. The above plan shows the four-phase version, the single phase version if formed from a single generator block in the place of the shaft. Both AC and DC power can be connected to it. The maximum energy transfer rates match those of the corresponding coils, but is split equally between the connections.The speedometer does what one would expect it to do: It measures the speed the multiblock is turning at. It consists of a single redstone engineering block in the place of the shaft. Right-clicking with a Voltmeter will give the exact speed, but its most common use is to automatically limit the speed of a multiblock. One side (the one marked with a line) will output a redstone signal proportional to the speed, the other one (marked "ln") will output a signal proportional to the logarithm of the speed plus one. To change what speed equates to a full strength signal you can (shift-) right-click the speedometer with an engineer's hammer.
Both signals have hysteresis to prevent flickering: For the signal to drop from n to n-1 the exact signal strength has to drop below n-0.1. To rise from n to n+1 the exact strength has to be above n+1.1. +ie.manual.entry.industrialwires.mech_mb_parts=The shaft is the simplest part imaginable: It does not do anything. This can be useful for seperating electrical sections of the multiblock. It consists of a single heavy engineering block in the middle of the multiblock.<&0>The flywheel is another very simple part: Its only job is to add inertia to increase energy storage. Various materials can be used instead of the lead blocks in the above schematic. The table on the next page shows all available materials, their inertia and their maximum speed.<&1><&2>Coils produce synchronous AC power from the multiblocks rotation or convert AC power (both synchronous and asynchronous will work) into multiblock rotation. For a four-phase coil replace the light engineering blocks on the level of the shaft with copper coil blocks. The maximum speed is 100 radians/second for a single-phase coil and 500 radians/second for a four-phase coil, the maximum energy transfer is 200 kW (4096 Flux/tick) for single-phase coil and 8 times as much on the four-phase version.<&3>Electrodes are the standard way of transferring energy out of or into a mechanical multiblock. The above plan shows the four-phase version, the single phase version if formed from a single generator block in the place of the shaft. Both AC and DC power can be connected to it. The maximum energy transfer rates match those of the corresponding coils, but is split equally between the connections. The energy connections can be set to input, output and not connected by hitting them with an Engineer's hammer.The speedometer does what one would expect it to do: It measures the speed the multiblock is turning at. It consists of a single redstone engineering block in the place of the shaft. Right-clicking with a Voltmeter will give the exact speed, but its most common use is to automatically limit the speed of a multiblock. One side (the one marked with a line) will output a redstone signal proportional to the speed, the other one (marked "ln") will output a signal proportional to the logarithm of the speed plus one. To change what speed equates to a full strength signal you can (shift-) right-click the speedometer with an engineer's hammer.
Both signals have hysteresis to prevent flickering: For the signal to drop from n to n-1 the exact signal strength has to drop below n-0.1. To rise from n to n+1 the exact strength has to be above n+1.1. ie.manual.entry.industrialwires.mech_mb_parts.commutator=<&4>The commutator converts synchronous AC to DC and vice versa. The above plan shows the four-phase version, the single-phase version consists of a single kinetic generator from IC2 in the place of the shaft. It transfers half as much power as the corresponding electrodes can. ie.manual.entry.industrialwires.intro.name=Introduction diff --git a/src/main/resources/assets/industrialwires/textures/blocks/converter/electrodes.png b/src/main/resources/assets/industrialwires/textures/blocks/converter/electrodes.png index 6c377c1c8fcbbe06385a71984466fc98984a1537..edf2aca5aa1d23605a71f7215023d82ca0b71c31 100644 GIT binary patch delta 1979 zcmV;s2SoVX5RMR#K?oKQ0XRTa$7PX8EPsSaL_t(o!|hqiZd_Rv-RF64T|Y{$#IXrh z0wttIabnqV%qU7GjQN607$6}81Ac%J0|xv7KhT3#BYuEMV1|$oQcqfPA}5Mc!CkJ$ zb=}8#F<8!~i0vk2VPL==l&;S{XP*eKTA}Y%ggLPe7Ys<164u{X5Kc__=8Dqp|Aq4NeF$Sg( zQA$ZE<(yMWg%DCoLI@ZaV}wXbDWyEqC8dBG4Ag0@l~Pj5 z5Q0+5dk?5$j97MXa8TDZz>`wq41ZEej68busA(Fy(j&FjS(XVQwARi!@4XPBZQB@Q zO366~Bb;+UNGU}`M@L74!9WOsGw=g|AqBt-8`QRKN~x+U<_$KMQYxkJ;=R{eYpsEY z)_OD=ZEkK}<`GDZG3?Ecf3z`%i1Ix5-V+gy2n#?3A%t^|hyYcL5w5}ds(-5b{XXIV z(l>A3Fs0bV3m61N;EE6eeDdBi7(@hyh7dp(Y=)QDuU``prlpkD*Vlmxr1)LTW!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