The Great Renamening of 2020
This commit is contained in:
+12
-12
@@ -35,13 +35,13 @@ import appeng.capabilities.Capabilities;
|
||||
import appeng.items.parts.PartModels;
|
||||
import appeng.me.GridAccessException;
|
||||
|
||||
public class PartP2PFEPower extends PartP2PTunnel<PartP2PFEPower> {
|
||||
public class FEP2PTunnelPart extends P2PTunnelPart<FEP2PTunnelPart> {
|
||||
private static final P2PModels MODELS = new P2PModels("part/p2p/p2p_tunnel_fe");
|
||||
private static final IEnergyStorage NULL_ENERGY_STORAGE = new NullEnergyStorage();
|
||||
private final IEnergyStorage inputHandler = new InputEnergyStorage();
|
||||
private final IEnergyStorage outputHandler = new OutputEnergyStorage();
|
||||
|
||||
public PartP2PFEPower(ItemStack is) {
|
||||
public FEP2PTunnelPart(ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class PartP2PFEPower extends PartP2PTunnel<PartP2PFEPower> {
|
||||
int total = 0;
|
||||
|
||||
try {
|
||||
final int outputTunnels = PartP2PFEPower.this.getOutputs().size();
|
||||
final int outputTunnels = FEP2PTunnelPart.this.getOutputs().size();
|
||||
|
||||
if (outputTunnels == 0 | maxReceive == 0) {
|
||||
return 0;
|
||||
@@ -107,7 +107,7 @@ public class PartP2PFEPower extends PartP2PTunnel<PartP2PFEPower> {
|
||||
final int amountPerOutput = maxReceive / outputTunnels;
|
||||
int overflow = amountPerOutput == 0 ? maxReceive : maxReceive % amountPerOutput;
|
||||
|
||||
for (PartP2PFEPower target : PartP2PFEPower.this.getOutputs()) {
|
||||
for (FEP2PTunnelPart target : FEP2PTunnelPart.this.getOutputs()) {
|
||||
final IEnergyStorage output = target.getAttachedEnergyStorage();
|
||||
final int toSend = amountPerOutput + overflow;
|
||||
final int received = output.receiveEnergy(toSend, simulate);
|
||||
@@ -117,7 +117,7 @@ public class PartP2PFEPower extends PartP2PTunnel<PartP2PFEPower> {
|
||||
}
|
||||
|
||||
if (!simulate) {
|
||||
PartP2PFEPower.this.queueTunnelDrain(PowerUnits.RF, total);
|
||||
FEP2PTunnelPart.this.queueTunnelDrain(PowerUnits.RF, total);
|
||||
}
|
||||
} catch (GridAccessException ignored) {
|
||||
}
|
||||
@@ -140,7 +140,7 @@ public class PartP2PFEPower extends PartP2PTunnel<PartP2PFEPower> {
|
||||
int total = 0;
|
||||
|
||||
try {
|
||||
for (PartP2PFEPower t : PartP2PFEPower.this.getOutputs()) {
|
||||
for (FEP2PTunnelPart t : FEP2PTunnelPart.this.getOutputs()) {
|
||||
total += t.getAttachedEnergyStorage().getMaxEnergyStored();
|
||||
}
|
||||
} catch (GridAccessException e) {
|
||||
@@ -155,7 +155,7 @@ public class PartP2PFEPower extends PartP2PTunnel<PartP2PFEPower> {
|
||||
int total = 0;
|
||||
|
||||
try {
|
||||
for (PartP2PFEPower t : PartP2PFEPower.this.getOutputs()) {
|
||||
for (FEP2PTunnelPart t : FEP2PTunnelPart.this.getOutputs()) {
|
||||
total += t.getAttachedEnergyStorage().getEnergyStored();
|
||||
}
|
||||
} catch (GridAccessException e) {
|
||||
@@ -169,10 +169,10 @@ public class PartP2PFEPower extends PartP2PTunnel<PartP2PFEPower> {
|
||||
private class OutputEnergyStorage implements IEnergyStorage {
|
||||
@Override
|
||||
public int extractEnergy(int maxExtract, boolean simulate) {
|
||||
final int total = PartP2PFEPower.this.getAttachedEnergyStorage().extractEnergy(maxExtract, simulate);
|
||||
final int total = FEP2PTunnelPart.this.getAttachedEnergyStorage().extractEnergy(maxExtract, simulate);
|
||||
|
||||
if (!simulate) {
|
||||
PartP2PFEPower.this.queueTunnelDrain(PowerUnits.RF, total);
|
||||
FEP2PTunnelPart.this.queueTunnelDrain(PowerUnits.RF, total);
|
||||
}
|
||||
|
||||
return total;
|
||||
@@ -185,7 +185,7 @@ public class PartP2PFEPower extends PartP2PTunnel<PartP2PFEPower> {
|
||||
|
||||
@Override
|
||||
public boolean canExtract() {
|
||||
return PartP2PFEPower.this.getAttachedEnergyStorage().canExtract();
|
||||
return FEP2PTunnelPart.this.getAttachedEnergyStorage().canExtract();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -195,12 +195,12 @@ public class PartP2PFEPower extends PartP2PTunnel<PartP2PFEPower> {
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored() {
|
||||
return PartP2PFEPower.this.getAttachedEnergyStorage().getMaxEnergyStored();
|
||||
return FEP2PTunnelPart.this.getAttachedEnergyStorage().getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored() {
|
||||
return PartP2PFEPower.this.getAttachedEnergyStorage().getEnergyStored();
|
||||
return FEP2PTunnelPart.this.getAttachedEnergyStorage().getEnergyStored();
|
||||
}
|
||||
}
|
||||
|
||||
+15
-15
@@ -41,16 +41,16 @@ import appeng.api.parts.IPartModel;
|
||||
import appeng.items.parts.PartModels;
|
||||
import appeng.me.GridAccessException;
|
||||
|
||||
public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFluidHandler {
|
||||
public class FluidP2PTunnelPart extends P2PTunnelPart<FluidP2PTunnelPart> implements IFluidHandler {
|
||||
|
||||
private static final P2PModels MODELS = new P2PModels("part/p2p/p2p_tunnel_fluids");
|
||||
|
||||
private static final ThreadLocal<Deque<PartP2PFluids>> DEPTH = new ThreadLocal<>();;
|
||||
private static final ThreadLocal<Deque<FluidP2PTunnelPart>> DEPTH = new ThreadLocal<>();;
|
||||
|
||||
private LazyOptional<IFluidHandler> cachedTank;
|
||||
private int tmpUsed;
|
||||
|
||||
public PartP2PFluids(final ItemStack is) {
|
||||
public FluidP2PTunnelPart(final ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
|
||||
this.cachedTank = null;
|
||||
|
||||
if (this.isOutput()) {
|
||||
final PartP2PFluids in = this.getInput();
|
||||
final FluidP2PTunnelPart in = this.getInput();
|
||||
if (in != null) {
|
||||
in.onTunnelNetworkChange();
|
||||
}
|
||||
@@ -119,9 +119,9 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
|
||||
@Override
|
||||
public int fill(FluidStack resource, FluidAction action) {
|
||||
|
||||
final Deque<PartP2PFluids> stack = this.getDepth();
|
||||
final Deque<FluidP2PTunnelPart> stack = this.getDepth();
|
||||
|
||||
for (final PartP2PFluids t : stack) {
|
||||
for (final FluidP2PTunnelPart t : stack) {
|
||||
if (t == this) {
|
||||
return 0;
|
||||
}
|
||||
@@ -129,13 +129,13 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
|
||||
|
||||
stack.push(this);
|
||||
|
||||
final List<PartP2PFluids> list = this.getOutputs(resource.getFluid());
|
||||
final List<FluidP2PTunnelPart> list = this.getOutputs(resource.getFluid());
|
||||
int requestTotal = 0;
|
||||
|
||||
Iterator<PartP2PFluids> i = list.iterator();
|
||||
Iterator<FluidP2PTunnelPart> i = list.iterator();
|
||||
|
||||
while (i.hasNext()) {
|
||||
final PartP2PFluids l = i.next();
|
||||
final FluidP2PTunnelPart l = i.next();
|
||||
final IFluidHandler tank = l.getTarget().orElse(null);
|
||||
if (tank != null) {
|
||||
l.tmpUsed = tank.fill(resource.copy(), FluidAction.SIMULATE);
|
||||
@@ -172,7 +172,7 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
|
||||
int used = 0;
|
||||
|
||||
while (i.hasNext() && available > 0) {
|
||||
final PartP2PFluids l = i.next();
|
||||
final FluidP2PTunnelPart l = i.next();
|
||||
|
||||
final FluidStack insert = resource.copy();
|
||||
insert.setAmount((int) Math.ceil(insert.getAmount() * ((double) l.tmpUsed / (double) requestTotal)));
|
||||
@@ -210,8 +210,8 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
|
||||
return FluidStack.EMPTY;
|
||||
}
|
||||
|
||||
private Deque<PartP2PFluids> getDepth() {
|
||||
Deque<PartP2PFluids> s = DEPTH.get();
|
||||
private Deque<FluidP2PTunnelPart> getDepth() {
|
||||
Deque<FluidP2PTunnelPart> s = DEPTH.get();
|
||||
|
||||
if (s == null) {
|
||||
DEPTH.set(s = new ArrayDeque<>());
|
||||
@@ -220,11 +220,11 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
|
||||
return s;
|
||||
}
|
||||
|
||||
private List<PartP2PFluids> getOutputs(final Fluid input) {
|
||||
final List<PartP2PFluids> outs = new ArrayList<>();
|
||||
private List<FluidP2PTunnelPart> getOutputs(final Fluid input) {
|
||||
final List<FluidP2PTunnelPart> outs = new ArrayList<>();
|
||||
|
||||
try {
|
||||
for (final PartP2PFluids l : this.getOutputs()) {
|
||||
for (final FluidP2PTunnelPart l : this.getOutputs()) {
|
||||
final IFluidHandler handler = l.getTarget().orElse(null);
|
||||
|
||||
if (handler != null) {
|
||||
+6
-6
@@ -50,7 +50,7 @@ import appeng.me.cache.helpers.TunnelCollection;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.WrapperChainedItemHandler;
|
||||
|
||||
public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IItemHandler, IGridTickable {
|
||||
public class ItemP2PTunnelPart extends P2PTunnelPart<ItemP2PTunnelPart> implements IItemHandler, IGridTickable {
|
||||
private static final float POWER_DRAIN = 2.0f;
|
||||
private static final P2PModels MODELS = new P2PModels("part/p2p/p2p_tunnel_items");
|
||||
private boolean partVisited = false;
|
||||
@@ -64,14 +64,14 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IItemHa
|
||||
private boolean requested;
|
||||
private IItemHandler cachedInv;
|
||||
|
||||
public PartP2PItems(final ItemStack is) {
|
||||
public ItemP2PTunnelPart(final ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged(IBlockReader w, BlockPos pos, BlockPos neighbor) {
|
||||
this.cachedInv = null;
|
||||
final PartP2PItems input = this.getInput();
|
||||
final ItemP2PTunnelPart input = this.getInput();
|
||||
if (input != null && this.isOutput()) {
|
||||
input.onTunnelNetworkChange();
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IItemHa
|
||||
}
|
||||
|
||||
final List<IItemHandler> outs = new ArrayList<IItemHandler>();
|
||||
final TunnelCollection<PartP2PItems> itemTunnels;
|
||||
final TunnelCollection<ItemP2PTunnelPart> itemTunnels;
|
||||
|
||||
try {
|
||||
itemTunnels = this.getOutputs();
|
||||
@@ -93,7 +93,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IItemHa
|
||||
return EmptyHandler.INSTANCE;
|
||||
}
|
||||
|
||||
for (final PartP2PItems t : itemTunnels) {
|
||||
for (final ItemP2PTunnelPart t : itemTunnels) {
|
||||
final IItemHandler inv = t.getOutputInv();
|
||||
if (inv != null && inv != this) {
|
||||
if (Platform.getRandomInt() % 2 == 0) {
|
||||
@@ -188,7 +188,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IItemHa
|
||||
this.getHost().notifyNeighbors();
|
||||
}
|
||||
} else {
|
||||
final PartP2PItems input = this.getInput();
|
||||
final ItemP2PTunnelPart input = this.getInput();
|
||||
if (input != null) {
|
||||
input.getHost().notifyNeighbors();
|
||||
}
|
||||
+4
-4
@@ -40,7 +40,7 @@ import appeng.core.settings.TickRates;
|
||||
import appeng.items.parts.PartModels;
|
||||
import appeng.me.GridAccessException;
|
||||
|
||||
public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTickable {
|
||||
public class LightP2PTunnelPart extends P2PTunnelPart<LightP2PTunnelPart> implements IGridTickable {
|
||||
|
||||
private static final P2PModels MODELS = new P2PModels("part/p2p/p2p_tunnel_light");
|
||||
|
||||
@@ -52,7 +52,7 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
|
||||
private int lastValue = 0;
|
||||
private int opacity = -1;
|
||||
|
||||
public PartP2PLight(final ItemStack is) {
|
||||
public LightP2PTunnelPart(final ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
|
||||
if (this.lastValue != newLevel && this.getProxy().isActive()) {
|
||||
this.lastValue = newLevel;
|
||||
try {
|
||||
for (final PartP2PLight out : this.getOutputs()) {
|
||||
for (final LightP2PTunnelPart out : this.getOutputs()) {
|
||||
out.setLightLevel(this.lastValue);
|
||||
}
|
||||
} catch (final GridAccessException e) {
|
||||
@@ -165,7 +165,7 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
|
||||
@Override
|
||||
public void onTunnelNetworkChange() {
|
||||
if (this.isOutput()) {
|
||||
final PartP2PLight src = this.getInput();
|
||||
final LightP2PTunnelPart src = this.getInput();
|
||||
if (src != null && src.getProxy().isActive()) {
|
||||
this.setLightLevel(src.lastValue);
|
||||
} else {
|
||||
+5
-5
@@ -49,7 +49,7 @@ import appeng.me.cache.helpers.Connections;
|
||||
import appeng.me.cache.helpers.TunnelConnection;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
|
||||
public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements IGridTickable {
|
||||
public class MEP2PTunnelPart extends P2PTunnelPart<MEP2PTunnelPart> implements IGridTickable {
|
||||
|
||||
private static final P2PModels MODELS = new P2PModels("part/p2p/p2p_tunnel_me");
|
||||
|
||||
@@ -61,7 +61,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||
private final Connections connection = new Connections(this);
|
||||
private final AENetworkProxy outerProxy = new AENetworkProxy(this, "outer", ItemStack.EMPTY, true);
|
||||
|
||||
public PartP2PTunnelME(final ItemStack is) {
|
||||
public MEP2PTunnelPart(final ItemStack is) {
|
||||
super(is);
|
||||
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL, GridFlags.COMPRESSED_CHANNEL);
|
||||
this.outerProxy.setFlags(GridFlags.DENSE_CAPACITY, GridFlags.CANNOT_CARRY_COMPRESSED);
|
||||
@@ -183,15 +183,15 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||
}
|
||||
}
|
||||
|
||||
final List<PartP2PTunnelME> newSides = new ArrayList<>();
|
||||
final List<MEP2PTunnelPart> newSides = new ArrayList<>();
|
||||
try {
|
||||
for (final PartP2PTunnelME me : this.getOutputs()) {
|
||||
for (final MEP2PTunnelPart me : this.getOutputs()) {
|
||||
if (me.getProxy().isActive() && connections.getConnections().get(me.getGridNode()) == null) {
|
||||
newSides.add(me);
|
||||
}
|
||||
}
|
||||
|
||||
for (final PartP2PTunnelME me : newSides) {
|
||||
for (final MEP2PTunnelPart me : newSides) {
|
||||
try {
|
||||
connections.getConnections().put(me.getGridNode(), new TunnelConnection(me, AEApi.instance()
|
||||
.grid().createGridConnection(this.outerProxy.getNode(), me.outerProxy.getNode())));
|
||||
+11
-11
@@ -51,20 +51,20 @@ import appeng.core.AEConfig;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cache.P2PCache;
|
||||
import appeng.me.cache.helpers.TunnelCollection;
|
||||
import appeng.parts.PartBasicState;
|
||||
import appeng.parts.BasicStatePart;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState {
|
||||
public abstract class P2PTunnelPart<T extends P2PTunnelPart> extends BasicStatePart {
|
||||
private final TunnelCollection type = new TunnelCollection<T>(null, this.getClass());
|
||||
private boolean output;
|
||||
private short freq;
|
||||
|
||||
public PartP2PTunnel(final ItemStack is) {
|
||||
public P2PTunnelPart(final ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
|
||||
public TunnelCollection<T> getCollection(final Collection<PartP2PTunnel> collection,
|
||||
final Class<? extends PartP2PTunnel> c) {
|
||||
public TunnelCollection<T> getCollection(final Collection<P2PTunnelPart> collection,
|
||||
final Class<? extends P2PTunnelPart> c) {
|
||||
if (this.type.matches(c)) {
|
||||
this.type.setSource(collection);
|
||||
return this.type;
|
||||
@@ -79,7 +79,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
}
|
||||
|
||||
try {
|
||||
final PartP2PTunnel tunnel = this.getProxy().getP2P().getInput(this.getFrequency());
|
||||
final P2PTunnelPart tunnel = this.getProxy().getP2P().getInput(this.getFrequency());
|
||||
if (this.getClass().isInstance(tunnel)) {
|
||||
return (T) tunnel;
|
||||
}
|
||||
@@ -179,13 +179,13 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
if (!newType.isEmpty()) {
|
||||
if (newType.getItem() instanceof IPartItem) {
|
||||
final IPart testPart = ((IPartItem<?>) newType.getItem()).createPart(newType);
|
||||
if (testPart instanceof PartP2PTunnel) {
|
||||
if (testPart instanceof P2PTunnelPart) {
|
||||
this.getHost().removePart(this.getSide(), true);
|
||||
final AEPartLocation dir = this.getHost().addPart(newType, this.getSide(), player, hand);
|
||||
final IPart newBus = this.getHost().getPart(dir);
|
||||
|
||||
if (newBus instanceof PartP2PTunnel) {
|
||||
final PartP2PTunnel<?> newTunnel = (PartP2PTunnel<?>) newBus;
|
||||
if (newBus instanceof P2PTunnelPart) {
|
||||
final P2PTunnelPart<?> newTunnel = (P2PTunnelPart<?>) newBus;
|
||||
newTunnel.setOutput(true);
|
||||
|
||||
try {
|
||||
@@ -258,8 +258,8 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
final AEPartLocation dir = this.getHost().addPart(newType, this.getSide(), player, hand);
|
||||
final IPart newBus = this.getHost().getPart(dir);
|
||||
|
||||
if (newBus instanceof PartP2PTunnel) {
|
||||
final PartP2PTunnel newTunnel = (PartP2PTunnel) newBus;
|
||||
if (newBus instanceof P2PTunnelPart) {
|
||||
final P2PTunnelPart newTunnel = (P2PTunnelPart) newBus;
|
||||
newTunnel.setOutput(oldOutput);
|
||||
newTunnel.onTunnelNetworkChange();
|
||||
|
||||
+4
-4
@@ -39,7 +39,7 @@ import appeng.items.parts.PartModels;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone> {
|
||||
public class RedstoneP2PTunnelPart extends P2PTunnelPart<RedstoneP2PTunnelPart> {
|
||||
|
||||
private static final P2PModels MODELS = new P2PModels("part/p2p/p2p_tunnel_redstone");
|
||||
|
||||
@@ -51,7 +51,7 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone> {
|
||||
private int power;
|
||||
private boolean recursive = false;
|
||||
|
||||
public PartP2PRedstone(final ItemStack is) {
|
||||
public RedstoneP2PTunnelPart(final ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone> {
|
||||
|
||||
private void setNetworkReady() {
|
||||
if (this.isOutput()) {
|
||||
final PartP2PRedstone in = this.getInput();
|
||||
final RedstoneP2PTunnelPart in = this.getInput();
|
||||
if (in != null) {
|
||||
this.putInput(in.power);
|
||||
}
|
||||
@@ -166,7 +166,7 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone> {
|
||||
|
||||
private void sendToOutput(final int power) {
|
||||
try {
|
||||
for (final PartP2PRedstone rs : this.getOutputs()) {
|
||||
for (final RedstoneP2PTunnelPart rs : this.getOutputs()) {
|
||||
rs.putInput(power);
|
||||
}
|
||||
} catch (final GridAccessException e) {
|
||||
Reference in New Issue
Block a user