Merge remote-tracking branch 'origin/master' into fabric-1.16

# Conflicts:
#	src/main/java/appeng/block/spatial/SpatialPylonBlock.java
#	src/main/java/appeng/client/render/spatial/SpatialPylonBakedModel.java
#	src/main/java/appeng/core/AppEng.java
#	src/main/java/appeng/hooks/TickHandler.java
#	src/main/java/appeng/me/cluster/MBCalculator.java
#	src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java
#	src/main/java/appeng/me/cluster/implementations/QuantumCluster.java
#	src/main/java/appeng/me/cluster/implementations/SpatialPylonCluster.java
#	src/main/java/appeng/me/helpers/AENetworkProxy.java
#	src/main/java/appeng/tile/networking/CableBusBlockEntity.java
#	src/main/java/appeng/tile/networking/DenseEnergyCellBlockEntity.java
#	src/main/java/appeng/tile/qnb/QuantumBridgeBlockEntity.java
#	src/main/java/appeng/tile/spatial/SpatialPylonBlockEntity.java
#	src/main/java/appeng/util/Platform.java
This commit is contained in:
Sebastian Hartte
2020-07-19 01:05:14 +02:00
34 changed files with 1018 additions and 133 deletions
@@ -423,7 +423,7 @@ public class AEBaseBlockEntity extends BlockEntity implements IOrientable, IComm
if (this.world != null) {
this.world.markDirty(this.pos, this);
if (!this.markDirtyQueued) {
TickHandler.INSTANCE.addCallable(null, this::markDirtyAtEndOfTick);
TickHandler.instance().addCallable(null, this::markDirtyAtEndOfTick);
this.markDirtyQueued = true;
}
}
@@ -118,11 +118,11 @@ public class CraftingBlockEntity extends AENetworkBlockEntity implements IAEMult
public void onReady() {
super.onReady();
this.getProxy().setVisualRepresentation(this.getItemFromTile(this));
this.updateMultiBlock();
this.calc.calculateMultiblock(world, getLocation());
}
public void updateMultiBlock() {
this.calc.calculateMultiblock(this.world, this.getLocation());
public void updateMultiBlock(BlockPos changedPos) {
this.calc.updateMultiblockAfterNeighborUpdate(this.world, this.getLocation(), changedPos);
}
public void updateStatus(final CraftingCPUCluster c) {
@@ -121,7 +121,7 @@ public class CableBusBlockEntity extends AEBaseBlockEntity implements AEMultiTil
@Override
public void cancelRemoval() {
super.cancelRemoval();
TickHandler.INSTANCE.addInit(this);
TickHandler.instance().addInit(this);
}
@Override
@@ -69,4 +69,10 @@ public class CreativeEnergyCellBlockEntity extends AENetworkBlockEntity implemen
public double extractAEPower(final double amt, final Actionable mode, final PowerMultiplier pm) {
return amt;
}
@Override
public int getPriority() {
// MAX_VALUE to move creative cells to the front.
return Integer.MAX_VALUE;
}
}
@@ -22,9 +22,16 @@ import net.minecraft.block.entity.BlockEntityType;
public class DenseEnergyCellBlockEntity extends EnergyCellBlockEntity {
private final static double MAX_STORED = 200000 * 8;
public DenseEnergyCellBlockEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
this.setInternalMaxPower(200000 * 8);
this.setInternalMaxPower(MAX_STORED);
}
@Override
public int getPriority() {
return 1600;
}
}
@@ -37,8 +37,10 @@ import appeng.util.SettingsFrom;
public class EnergyCellBlockEntity extends AENetworkBlockEntity implements IAEPowerStorage {
private static final double MAX_STORED = 200000.0;
private double internalCurrentPower = 0.0;
private double internalMaxPower = 200000.0;
private double internalMaxPower = MAX_STORED;
private byte currentMeta = -1;
@@ -180,6 +182,11 @@ public class EnergyCellBlockEntity extends AENetworkBlockEntity implements IAEPo
return pm.divide(this.extractAEPower(pm.multiply(amt), mode));
}
@Override
public int getPriority() {
return 200;
}
private double extractAEPower(double amt, final Actionable mode) {
if (mode == Actionable.SIMULATE) {
if (this.internalCurrentPower > amt) {
@@ -219,4 +226,5 @@ public class EnergyCellBlockEntity extends AENetworkBlockEntity implements IAEPo
void setInternalMaxPower(final double internalMaxPower) {
this.internalMaxPower = internalMaxPower;
}
}
@@ -33,6 +33,18 @@ import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.util.math.Direction;
import alexiil.mc.lib.attributes.item.impl.EmptyFixedItemInv;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.data.ModelDataMap;
import net.minecraftforge.client.model.data.ModelProperty;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.EmptyHandler;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.networking.GridFlags;
@@ -266,8 +278,8 @@ public class QuantumBridgeBlockEntity extends AENetworkInvBlockEntity implements
return AECableType.DENSE_SMART;
}
public void neighborUpdate() {
this.calc.calculateMultiblock(this.world, this.getLocation());
public void neighborUpdate(BlockPos fromPos) {
this.calc.updateMultiblockAfterNeighborUpdate(this.world, this.getLocation(), fromPos);
}
@Override
@@ -102,7 +102,7 @@ public class SpatialIOPortBlockEntity extends AENetworkInvBlockEntity implements
if (Platform.isServer()) {
final ItemStack cell = this.inv.getInvStack(0);
if (this.isSpatialCell(cell)) {
TickHandler.INSTANCE.addCallable(null, this);// this needs to be cross world synced.
TickHandler.instance().addCallable(null, this);// this needs to be cross world synced.
}
}
}
@@ -24,6 +24,15 @@ import java.util.EnumSet;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.util.math.Direction;
import javax.annotation.Nonnull;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.data.ModelDataMap;
import net.minecraftforge.client.model.data.ModelProperty;
import appeng.api.networking.GridFlags;
import appeng.api.networking.events.MENetworkChannelsChanged;
@@ -77,7 +86,7 @@ public class SpatialPylonBlockEntity extends AENetworkBlockEntity implements IAE
@Override
public void onReady() {
super.onReady();
this.neighborUpdate();
this.calc.calculateMultiblock(world, getLocation());
}
@Override
@@ -86,8 +95,8 @@ public class SpatialPylonBlockEntity extends AENetworkBlockEntity implements IAE
super.markRemoved();
}
public void neighborUpdate() {
this.calc.calculateMultiblock(this.world, this.getLocation());
public void neighborUpdate(BlockPos changedPos) {
this.calc.updateMultiblockAfterNeighborUpdate(this.world, this.getLocation(), changedPos);
}
@Override
@@ -120,9 +129,9 @@ public class SpatialPylonBlockEntity extends AENetworkBlockEntity implements IAE
this.displayBits = 0;
if (this.cluster != null) {
if (this.cluster.getMin().equals(this.getLocation())) {
if (this.cluster.getBoundsMin().equals(this.getLocation())) {
this.displayBits = DISPLAY_END_MIN;
} else if (this.cluster.getMax().equals(this.getLocation())) {
} else if (this.cluster.getBoundsMax().equals(this.getLocation())) {
this.displayBits = DISPLAY_END_MAX;
} else {
this.displayBits = DISPLAY_MIDDLE;