Fix the Marx generator not breaking/processing ores, closes #47

Fix panel wire connectors not working when connected directly to another one or the Marge generator
This commit is contained in:
malte0811 2018-11-27 21:26:07 +01:00
parent 208fc0611e
commit 43bd502095
2 changed files with 8 additions and 19 deletions

View File

@ -116,9 +116,7 @@ public class TileEntityRSPanelIE extends TileEntityRSPanel//TODO what parts of T
@Override
public void connectCable(WireType wireType, TargetingInfo targetingInfo, IImmersiveConnectable other) {
hasConn = true;
if (other instanceof IRedstoneConnector && ((IRedstoneConnector) other).getNetwork() != wireNetwork) {
wireNetwork.mergeNetwork(((IRedstoneConnector) other).getNetwork());
}
RedstoneWireNetwork.updateConnectors(pos, world, wireNetwork);
}
@Override
@ -128,7 +126,7 @@ public class TileEntityRSPanelIE extends TileEntityRSPanel//TODO what parts of T
@Override
public boolean allowEnergyToPass(ImmersiveNetHandler.Connection connection) {
return false;
return true;
}
@Override

View File

@ -72,7 +72,6 @@ import java.util.*;
import static blusunrize.immersiveengineering.api.energy.wires.WireType.REDSTONE_CATEGORY;
import static malte0811.industrialwires.blocks.hv.TileEntityMarx.FiringState.FIRE;
import static malte0811.industrialwires.util.MiscUtils.getOffset;
import static malte0811.industrialwires.util.MiscUtils.offset;
import static malte0811.industrialwires.util.NBTKeys.*;
import static malte0811.industrialwires.wires.MixedWireType.IC2_HV_CAT;
@ -285,11 +284,11 @@ public class TileEntityMarx extends TileEntityIWMultiblock implements ITickable,
private void handleOreProcessing(double energyStored) {
BlockPos bottom = getBottomElectrode();
Set<BlockPos> toBreak = new HashSet<>(stageCount-2);
List<BlockPos> toBreak = new ArrayList<>(stageCount - 2);
int ores = 0;
for (int i = 1;i<stageCount-1;i++) {
BlockPos blockHere = bottom.up(i);
if (!world.isAirBlock(blockHere) && canBreak(blockHere)) {
if (!world.isAirBlock(blockHere)) {
toBreak.add(blockHere);
ores++;
}
@ -328,7 +327,7 @@ public class TileEntityMarx extends TileEntityIWMultiblock implements ITickable,
double tinnitusDistSqu = Math.sqrt(energyStored)/50;
Vec3d v0 = getMiddle();
AxisAlignedBB aabb = new AxisAlignedBB(v0.x, v0.y, v0.z, v0.x, v0.y, v0.z);
aabb = aabb.grow(0, stageCount/2-1,0);
aabb = aabb.grow(0, stageCount / 2. - 1, 0);
aabb = aabb.grow(tinnitusDistSqu);
List<Entity> fools = world.getEntitiesWithinAABB(Entity.class, aabb);
damageDistSqu *= damageDistSqu;
@ -370,16 +369,6 @@ public class TileEntityMarx extends TileEntityIWMultiblock implements ITickable,
}
}
//checks whether the given pos can't be broken because it is part of the generator
private boolean canBreak(BlockPos pos) {
BlockPos dischargePos = offset(this.pos, facing, mirrored, 1, 3, 0);
Vec3i offset = getOffset(dischargePos, facing, mirrored, pos);
if (offset.getZ()<1||offset.getZ()>=stageCount-1) {
return false;
}
return Math.abs(offset.getX())>Math.abs(offset.getY());
}
private int getRSSignalFromVoltage(double voltage) {
return (int) (Math.round(255 * voltage / MAX_VOLTAGE)&0xff);
}
@ -566,6 +555,8 @@ public class TileEntityMarx extends TileEntityIWMultiblock implements ITickable,
@Override
public void connectCable(WireType cableType, TargetingInfo target, IImmersiveConnectable other) {
hasConnection = true;
if (WireType.REDSTONE_CATEGORY.equals(cableType.getCategory()))
RedstoneWireNetwork.updateConnectors(pos, world, getNetwork());
}
@Override
@ -575,7 +566,7 @@ public class TileEntityMarx extends TileEntityIWMultiblock implements ITickable,
@Override
public boolean allowEnergyToPass(ImmersiveNetHandler.Connection con) {
return false;
return true;
}
@Override