Merge remote-tracking branch 'origin/master' into fabric-1.16
# Conflicts: # gradle.properties # src/main/java/appeng/block/AEBaseBlock.java # src/main/java/appeng/block/misc/QuartzFixtureBlock.java # src/main/java/appeng/block/misc/TinyTNTBlock.java # src/main/java/appeng/block/networking/CableBusBlock.java # src/main/java/appeng/helpers/AEMaterials.java # src/unported/java/appeng/block/misc/ChargerBlock.java # src/unported/java/appeng/block/networking/CreativeEnergyCellBlock.java # src/unported/java/appeng/block/networking/EnergyCellBlock.java # src/unported/java/appeng/block/networking/WirelessBlock.java # src/unported/java/appeng/block/paint/PaintSplotchesBlock.java # src/unported/java/appeng/block/qnb/QuantumLinkChamberBlock.java # src/unported/java/appeng/block/spatial/SpatialPylonBlock.java # src/unported/java/appeng/client/render/tesr/DriveLedTileEntityRenderer.java # src/unported/java/appeng/tile/storage/ChestBlockEntity.java
This commit is contained in:
@@ -50,5 +50,5 @@ public enum CellState {
|
||||
/**
|
||||
* Full cell, technically could have free types
|
||||
*/
|
||||
FULL,
|
||||
FULL;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.AEMaterials;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public abstract class AEBaseBlock extends Block {
|
||||
@@ -74,7 +74,7 @@ public abstract class AEBaseBlock extends Block {
|
||||
}
|
||||
|
||||
private static BlockSoundGroup getDefaultSoundByMaterial(Material mat) {
|
||||
if (mat == AEGlassMaterial.INSTANCE || mat == Material.GLASS) {
|
||||
if (mat == AEMaterials.GLASS || mat == Material.GLASS) {
|
||||
return BlockSoundGroup.GLASS;
|
||||
} else if (mat == Material.STONE) {
|
||||
return BlockSoundGroup.STONE;
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
|
||||
package appeng.block.misc;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
@@ -29,7 +29,7 @@ import appeng.client.render.cablebus.CableBusBakedModel;
|
||||
import appeng.client.render.cablebus.CableBusBreakingParticle;
|
||||
import appeng.client.render.cablebus.CableBusRenderState;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.AEMaterials;
|
||||
import appeng.integration.abstraction.IAEFacade;
|
||||
import appeng.parts.ICableBusContainer;
|
||||
import appeng.parts.NullCableBusContainer;
|
||||
@@ -75,7 +75,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
|
||||
|
||||
public CableBusBlock() {
|
||||
super(defaultProps(AEGlassMaterial.INSTANCE)
|
||||
super(defaultProps(AEMaterials.GLASS)
|
||||
.nonOpaque()
|
||||
.dropsNothing()
|
||||
.dynamicBounds());
|
||||
@@ -172,11 +172,12 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
// FIXME FABRIC @Override
|
||||
// FIXME FABRIC public boolean canConnectRedstone(final BlockState state, final BlockView w, final BlockPos pos,
|
||||
// FIXME FABRIC Direction side) {
|
||||
// FIXME FABRIC // TODO: Verify this.
|
||||
// FIXME FABRIC if (side == null) {
|
||||
// FIXME FABRIC side = Direction.UP;
|
||||
// FIXME FABRIC return false;
|
||||
// FIXME FABRIC }
|
||||
// FIXME FABRIC
|
||||
// FIXME FABRIC return this.cb(w, pos).canConnectRedstone(EnumSet.of(side));
|
||||
// FIXME FABRIC return this.cb(w, pos).canConnectRedstone(side.getOpposite());
|
||||
// FIXME FABRIC }
|
||||
|
||||
public ItemStack getPickBlock(BlockState state, HitResult target, BlockView world, BlockPos pos,
|
||||
|
||||
@@ -77,7 +77,7 @@ final class PlayerData extends PersistentState implements IWorldPlayerData {
|
||||
this.mapping.put(profile.getId(), playerId);
|
||||
markDirty();
|
||||
|
||||
AELog.info("Assigning ME player id {} to Minecraft profile {} ({})", playerId, profile.getId(),
|
||||
AELog.info("Assigning ME player id %s to Minecraft profile %s (%s)", playerId, profile.getId(),
|
||||
profile.getName());
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ final class PlayerData extends PersistentState implements IWorldPlayerData {
|
||||
UUID profileId = new UUID(profileIds[i * 2], profileIds[i * 2 + 1]);
|
||||
highestPlayerId = Math.max(playerId, highestPlayerId);
|
||||
mapping.put(profileId, playerId);
|
||||
AELog.debug("AE player ID {} is assigned to profile ID {}", playerId, profileId);
|
||||
AELog.debug("AE player ID %s is assigned to profile ID %s", playerId, profileId);
|
||||
}
|
||||
this.nextPlayerId = highestPlayerId + 1;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.AEMaterials;
|
||||
|
||||
public class QuartzGlassBlock extends AbstractGlassBlock {
|
||||
|
||||
@@ -34,7 +34,7 @@ public class QuartzGlassBlock extends AbstractGlassBlock {
|
||||
@Override
|
||||
public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) {
|
||||
final Material mat = adjacentBlockState.getMaterial();
|
||||
if (mat == Material.GLASS || mat == AEGlassMaterial.INSTANCE) {
|
||||
if (mat == Material.GLASS || mat == AEMaterials.GLASS) {
|
||||
if (adjacentBlockState.getRenderType() == state.getRenderType()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+2
-2
@@ -22,9 +22,9 @@ import net.minecraft.block.Material;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
import net.minecraft.block.piston.PistonBehavior;
|
||||
|
||||
public class AEGlassMaterial {
|
||||
public class AEMaterials {
|
||||
|
||||
public static final Material INSTANCE = new Material(MaterialColor.CLEAR, false, false, true, false, false,
|
||||
public static final Material GLASS = new Material(MaterialColor.CLEAR, false, false, true, false, false,
|
||||
false, PistonBehavior.NORMAL);
|
||||
|
||||
}
|
||||
@@ -624,14 +624,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectRedstone(final EnumSet<Direction> enumSet) {
|
||||
for (final Direction dir : enumSet) {
|
||||
final IPart part = this.getPart(dir);
|
||||
if (part != null && part.canConnectRedstone()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
public boolean canConnectRedstone(final Direction opposite) {
|
||||
final IPart part = this.getPart(opposite);
|
||||
return part != null && part.canConnectRedstone();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
package appeng.parts;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
@@ -43,7 +42,7 @@ public interface ICableBusContainer {
|
||||
|
||||
int isProvidingWeakPower(Direction opposite);
|
||||
|
||||
boolean canConnectRedstone(EnumSet<Direction> of);
|
||||
boolean canConnectRedstone(Direction opposite);
|
||||
|
||||
void onEntityCollision(Entity e);
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
package appeng.parts;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -48,7 +47,7 @@ public class NullCableBusContainer implements ICableBusContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectRedstone(final EnumSet<Direction> of) {
|
||||
public boolean canConnectRedstone(final Direction opposite) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"slot_state": "online|types_full|full"
|
||||
"slot_state": "online|not_empty|types_full|full"
|
||||
},
|
||||
"apply": {
|
||||
"model": "appliedenergistics2:block/chest/lights_on"
|
||||
@@ -45,6 +45,14 @@
|
||||
"model": "appliedenergistics2:block/chest/cell_state_online"
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"slot_state": "not_empty"
|
||||
},
|
||||
"apply": {
|
||||
"model": "appliedenergistics2:block/chest/cell_state_not_empty"
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"slot_state": "types_full"
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"loader": "appliedenergistics2:uvlightmap",
|
||||
"textures": {
|
||||
"backdrop": "appliedenergistics2:block/chest/cell_state_backdrop",
|
||||
"state": "appliedenergistics2:block/chest/cell_state_not_empty"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {
|
||||
"texture": "#backdrop"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {
|
||||
"texture": "#state",
|
||||
"uvlightmap": {
|
||||
"block": 0.007,
|
||||
"sky": 0.007
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 146 B |
@@ -64,7 +64,7 @@ import appeng.util.Platform;
|
||||
public class ChargerBlock extends AEBaseTileBlock<ChargerBlockEntity> {
|
||||
|
||||
public ChargerBlock() {
|
||||
super(defaultProps(Material.METAL));
|
||||
super(defaultProps(Material.METAL).solidBlock(false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.AEMaterials;
|
||||
import appeng.tile.networking.CreativeEnergyCellBlockEntity;
|
||||
|
||||
public class CreativeEnergyCellBlock extends AEBaseTileBlock<CreativeEnergyCellBlockEntity> {
|
||||
|
||||
public CreativeEnergyCellBlock() {
|
||||
super(defaultProps(AEGlassMaterial.INSTANCE));
|
||||
super(defaultProps(AEMaterials.GLASS));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import net.minecraft.state.StateManager;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.AEMaterials;
|
||||
import appeng.tile.networking.EnergyCellBlockEntity;
|
||||
|
||||
public class EnergyCellBlock extends AEBaseTileBlock<EnergyCellBlockEntity> {
|
||||
@@ -38,7 +38,7 @@ public class EnergyCellBlock extends AEBaseTileBlock<EnergyCellBlockEntity> {
|
||||
public static final IntegerProperty ENERGY_STORAGE = IntegerProperty.create("fullness", 0, 7);
|
||||
|
||||
public EnergyCellBlock() {
|
||||
super(defaultProps(AEGlassMaterial.INSTANCE));
|
||||
super(defaultProps(AEMaterials.GLASS));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,7 +40,7 @@ import appeng.block.AEBaseTileBlock;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.implementations.WirelessContainer;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.AEMaterials;
|
||||
import appeng.tile.networking.WirelessBlockEntity;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -58,7 +58,7 @@ public class WirelessBlock extends AEBaseTileBlock<WirelessBlockEntity> {
|
||||
public static final EnumProperty<State> STATE = EnumProperty.create("state", State.class);
|
||||
|
||||
public WirelessBlock() {
|
||||
super(defaultProps(AEGlassMaterial.INSTANCE)
|
||||
super(defaultProps(AEMaterials.GLASS)
|
||||
.nonOpaque()
|
||||
.solidBlock((state, world, pos) -> false)
|
||||
);
|
||||
|
||||
@@ -42,9 +42,7 @@ import appeng.util.Platform;
|
||||
|
||||
public class PaintSplotchesBlock extends AEBaseTileBlock<PaintSplotchesBlockEntity> {
|
||||
public PaintSplotchesBlock() {
|
||||
super(defaultProps(Material.WATER, MaterialColor.CLEAR));
|
||||
this.setFullSize(false);
|
||||
this.setOpaque(false);
|
||||
super(defaultProps(Material.WATER, MaterialColor.CLEAR).notSolid());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,7 +46,6 @@ public abstract class QuantumBaseBlock extends AEBaseTileBlock<QuantumBridgeBloc
|
||||
|
||||
public QuantumBaseBlock(Settings props) {
|
||||
super(props);
|
||||
this.setFullSize(this.setOpaque(false));
|
||||
this.setDefaultState(this.getDefaultState().with(FORMED, false));
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.implementations.QNBContainer;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.AEMaterials;
|
||||
import appeng.tile.qnb.QuantumBridgeBlockEntity;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -56,7 +56,7 @@ public class QuantumLinkChamberBlock extends QuantumBaseBlock {
|
||||
}
|
||||
|
||||
public QuantumLinkChamberBlock() {
|
||||
super(defaultProps(AEGlassMaterial.INSTANCE));
|
||||
super(defaultProps(AEMaterials.GLASS));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,13 +25,13 @@ import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.AEMaterials;
|
||||
import appeng.tile.spatial.SpatialPylonBlockEntity;
|
||||
|
||||
public class SpatialPylonBlock extends AEBaseTileBlock<SpatialPylonBlockEntity> {
|
||||
|
||||
public SpatialPylonBlock() {
|
||||
super(defaultProps(AEGlassMaterial.INSTANCE));
|
||||
super(defaultProps(AEMaterials.GLASS));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,6 +37,9 @@ public enum DriveSlotState implements StringIdentifiable {
|
||||
// Online and free space
|
||||
ONLINE("online"),
|
||||
|
||||
// Online and not space
|
||||
NOT_EMPTY("not_empty"),
|
||||
|
||||
// Types full, space left
|
||||
TYPES_FULL("types_full"),
|
||||
|
||||
@@ -60,8 +63,9 @@ public enum DriveSlotState implements StringIdentifiable {
|
||||
case ABSENT:
|
||||
return DriveSlotState.EMPTY;
|
||||
case EMPTY:
|
||||
case NOT_EMPTY:
|
||||
return DriveSlotState.ONLINE;
|
||||
case NOT_EMPTY:
|
||||
return DriveSlotState.NOT_EMPTY;
|
||||
case TYPES_FULL:
|
||||
return DriveSlotState.TYPES_FULL;
|
||||
case FULL:
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.renderer.RenderState;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
@@ -27,14 +26,6 @@ import appeng.tile.storage.DriveBlockEntity;
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class DriveLedTileEntityRenderer extends BlockEntityRenderer<DriveBlockEntity> {
|
||||
|
||||
private static final RenderState.TransparencyState TRANSLUCENT_TRANSPARENCY = new RenderState.TransparencyState(
|
||||
"translucent_transparency", () -> {
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
}, () -> {
|
||||
RenderSystem.disableBlend();
|
||||
});
|
||||
|
||||
private static final EnumMap<DriveSlotState, Vector3f> STATE_COLORS;
|
||||
|
||||
// Color used for the cell indicator for blinking during recent activity
|
||||
@@ -44,7 +35,8 @@ public class DriveLedTileEntityRenderer extends BlockEntityRenderer<DriveBlockEn
|
||||
STATE_COLORS = new EnumMap<>(DriveSlotState.class);
|
||||
STATE_COLORS.put(DriveSlotState.OFFLINE, new Vector3f(0, 0, 0));
|
||||
STATE_COLORS.put(DriveSlotState.ONLINE, new Vector3f(0, 1, 0));
|
||||
STATE_COLORS.put(DriveSlotState.TYPES_FULL, new Vector3f(0, 0.667f, 0));
|
||||
STATE_COLORS.put(DriveSlotState.NOT_EMPTY, new Vector3f(0f, 0.667f, 1));
|
||||
STATE_COLORS.put(DriveSlotState.TYPES_FULL, new Vector3f(1, 0.667f, 0));
|
||||
STATE_COLORS.put(DriveSlotState.FULL, new Vector3f(1, 0, 0));
|
||||
}
|
||||
|
||||
@@ -89,8 +81,6 @@ public class DriveLedTileEntityRenderer extends BlockEntityRenderer<DriveBlockEn
|
||||
FacingToRotation.get(drive.getForward(), drive.getUp()).push(ms);
|
||||
ms.translate(-0.5, -0.5, -0.5);
|
||||
|
||||
RenderType rt = RenderType.makeType("ae_drive_leds", VertexFormats.POSITION_COLOR, 7, 32565, false, true,
|
||||
RenderType.State.getBuilder().transparency(TRANSLUCENT_TRANSPARENCY).build(false));
|
||||
VertexConsumer buffer = buffers.getBuffer(STATE);
|
||||
|
||||
for (int row = 0; row < 5; row++) {
|
||||
@@ -123,7 +113,6 @@ public class DriveLedTileEntityRenderer extends BlockEntityRenderer<DriveBlockEn
|
||||
}
|
||||
|
||||
ms.pop();
|
||||
|
||||
}
|
||||
|
||||
private Vector3f getColorForSlot(DriveBlockEntity drive, int slot, float partialTicks) {
|
||||
|
||||
@@ -84,7 +84,7 @@ public class StorageChunkGenerator extends ChunkGenerator<GenerationSettings> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int func_222529_a(int p_222529_1_, int p_222529_2_, Heightmap.Type heightmapType) {
|
||||
public int getHeight(int p_222529_1_, int p_222529_2_, Heightmap.Type heightmapType) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -111,6 +111,12 @@ import appeng.util.item.AEItemStack;
|
||||
|
||||
public class ChestBlockEntity extends AENetworkPowerBlockEntity
|
||||
implements IMEChest, ITerminalHost, IPriorityHost, IConfigManagerHost, IColorableTile, Tickable {
|
||||
|
||||
private static final int BIT_POWER_MASK = Byte.MIN_VALUE;
|
||||
private static final int BIT_STATE_MASK = 0b111;
|
||||
|
||||
private static final int BIT_CELL_STATE_MASK = 0b111;
|
||||
private static final int BIT_CELL_STATE_BITS = 3;
|
||||
private final AppEngInternalInventory inputInventory = new AppEngInternalInventory(this, 1);
|
||||
private final AppEngInternalInventory cellInventory = new AppEngInternalInventory(this, 1);
|
||||
private final FixedItemInv internalInventory = new WrapperChainedItemHandler(this.inputInventory,
|
||||
@@ -164,13 +170,13 @@ public class ChestBlockEntity extends AENetworkPowerBlockEntity
|
||||
final int oldState = this.state;
|
||||
|
||||
for (int x = 0; x < this.getCellCount(); x++) {
|
||||
this.state |= (this.getCellStatus(x).ordinal() << (3 * x));
|
||||
this.state |= (this.getCellStatus(x).ordinal() << (BIT_CELL_STATE_BITS * x));
|
||||
}
|
||||
|
||||
if (this.isPowered()) {
|
||||
this.state |= 0x40;
|
||||
this.state |= BIT_POWER_MASK;
|
||||
} else {
|
||||
this.state &= ~0x40;
|
||||
this.state &= ~BIT_POWER_MASK;
|
||||
}
|
||||
|
||||
final boolean currentActive = this.getProxy().isActive();
|
||||
@@ -246,7 +252,7 @@ public class ChestBlockEntity extends AENetworkPowerBlockEntity
|
||||
@Override
|
||||
public CellState getCellStatus(final int slot) {
|
||||
if (isClient()) {
|
||||
return CellState.values()[(this.state >> (slot * 3)) & 3];
|
||||
return CellState.values()[(this.state >> (slot * BIT_CELL_STATE_BITS)) & BIT_CELL_STATE_MASK];
|
||||
}
|
||||
|
||||
this.updateHandler();
|
||||
@@ -274,7 +280,7 @@ public class ChestBlockEntity extends AENetworkPowerBlockEntity
|
||||
@Override
|
||||
public boolean isPowered() {
|
||||
if (isClient()) {
|
||||
return (this.state & 0x40) == 0x40;
|
||||
return (this.state & BIT_POWER_MASK) == BIT_POWER_MASK;
|
||||
}
|
||||
|
||||
boolean gridPowered = this.getAECurrentPower() > 64;
|
||||
@@ -291,12 +297,7 @@ public class ChestBlockEntity extends AENetworkPowerBlockEntity
|
||||
|
||||
@Override
|
||||
public boolean isCellBlinking(final int slot) {
|
||||
final long now = this.world.getGameTime();
|
||||
if (now - this.lastStateChange > 8) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((this.state >> (slot * 3 + 2)) & 0x01) == 0x01;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -328,14 +329,14 @@ public class ChestBlockEntity extends AENetworkPowerBlockEntity
|
||||
try {
|
||||
if (!this.getProxy().getEnergy().isNetworkPowered()) {
|
||||
final double powerUsed = this.extractAEPower(idleUsage, Actionable.MODULATE, PowerMultiplier.CONFIG); // drain
|
||||
if (powerUsed + 0.1 >= idleUsage != (this.state & 0x40) > 0) {
|
||||
if (powerUsed + 0.1 >= idleUsage != (this.state & BIT_POWER_MASK) > 0) {
|
||||
this.recalculateDisplay();
|
||||
}
|
||||
}
|
||||
} catch (final GridAccessException e) {
|
||||
final double powerUsed = this.extractAEPower(this.getProxy().getIdlePowerUsage(), Actionable.MODULATE,
|
||||
PowerMultiplier.CONFIG); // drain
|
||||
if (powerUsed + 0.1 >= idleUsage != (this.state & 0x40) > 0) {
|
||||
if (powerUsed + 0.1 >= idleUsage != (this.state & BIT_POWER_MASK) > 0) {
|
||||
this.recalculateDisplay();
|
||||
}
|
||||
}
|
||||
@@ -349,20 +350,16 @@ public class ChestBlockEntity extends AENetworkPowerBlockEntity
|
||||
protected void writeToStream(final PacketByteBuf data) throws IOException {
|
||||
super.writeToStream(data);
|
||||
|
||||
if (this.world.getGameTime() - this.lastStateChange > 8) {
|
||||
this.state = 0;
|
||||
} else {
|
||||
this.state &= 0x24924924; // just keep the blinks...
|
||||
}
|
||||
this.state = 0;
|
||||
|
||||
for (int x = 0; x < this.getCellCount(); x++) {
|
||||
this.state |= (this.getCellStatus(x).ordinal() << (3 * x));
|
||||
}
|
||||
|
||||
if (this.isPowered()) {
|
||||
this.state |= 0x40;
|
||||
this.state |= BIT_POWER_MASK;
|
||||
} else {
|
||||
this.state &= ~0x40;
|
||||
this.state &= ~BIT_POWER_MASK;
|
||||
}
|
||||
|
||||
data.writeByte(this.state);
|
||||
@@ -520,7 +517,7 @@ public class ChestBlockEntity extends AENetworkPowerBlockEntity
|
||||
}
|
||||
this.lastStateChange = now;
|
||||
|
||||
this.state |= 1 << (slot * 3 + 2);
|
||||
this.state |= 1 << (slot * BIT_CELL_STATE_BITS + 2);
|
||||
|
||||
this.recalculateDisplay();
|
||||
}
|
||||
|
||||
@@ -76,9 +76,11 @@ import appeng.util.inv.filter.IAEItemFilter;
|
||||
|
||||
public class DriveBlockEntity extends AENetworkInvBlockEntity implements IChestOrDrive, IPriorityHost {
|
||||
|
||||
private static final int BIT_POWER_MASK = 0x80000000;
|
||||
private static final int BIT_BLINK_MASK = 0x24924924;
|
||||
private static final int BIT_STATE_MASK = 0xDB6DB6DB;
|
||||
private static final int BIT_POWER_MASK = Integer.MIN_VALUE;
|
||||
private static final int BIT_STATE_MASK = 0b111111111111111111111111111111;
|
||||
|
||||
private static final int BIT_CELL_STATE_MASK = 0b111;
|
||||
private static final int BIT_CELL_STATE_BITS = 3;
|
||||
|
||||
private final AppEngCellInventory inv = new AppEngCellInventory(this, 10);
|
||||
private final ICellHandler[] handlersBySlot = new ICellHandler[10];
|
||||
@@ -94,13 +96,18 @@ public class DriveBlockEntity extends AENetworkInvBlockEntity implements IChestO
|
||||
/**
|
||||
* The state of all cells inside a drive as bitset, using the following format.
|
||||
*
|
||||
* Bit 31: power state. 0 = off, 1 = on. Bit 30: undefined Bit 29-0: 3 bits as
|
||||
* state of each cell with the cell in slot 0 located in the 3 least significant
|
||||
* bits.
|
||||
* - Bit 31: power state. 0 = off, 1 = on.
|
||||
*
|
||||
* - Bit 30: reserved
|
||||
*
|
||||
* - Bit 29-0: 3 bits for the state of each cell
|
||||
*
|
||||
* Cell states: Bit 2: blink. 0 = off, 1 = on. Bit 1-0: cell status
|
||||
* Cell states:
|
||||
*
|
||||
* - Bit 2-0: {@link CellState} ordinal
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
private int state = 0;
|
||||
|
||||
@@ -127,8 +134,11 @@ public class DriveBlockEntity extends AENetworkInvBlockEntity implements IChestO
|
||||
newState |= BIT_POWER_MASK;
|
||||
}
|
||||
for (int x = 0; x < this.getCellCount(); x++) {
|
||||
newState |= (this.getCellStatus(x).ordinal() << (3 * x));
|
||||
final int o = this.getCellStatus(x).ordinal();
|
||||
final int i = (o << (BIT_CELL_STATE_BITS * x));
|
||||
newState |= i;
|
||||
}
|
||||
|
||||
data.writeInt(newState);
|
||||
|
||||
writeCellItemIds(data);
|
||||
@@ -223,7 +233,8 @@ public class DriveBlockEntity extends AENetworkInvBlockEntity implements IChestO
|
||||
@Override
|
||||
public CellState getCellStatus(final int slot) {
|
||||
if (Platform.isClient()) {
|
||||
return CellState.values()[(this.state >> (slot * 3)) & 3];
|
||||
final int cellState = ((this.state >> (slot * BIT_CELL_STATE_BITS)) & BIT_CELL_STATE_MASK);
|
||||
return CellState.values()[cellState];
|
||||
}
|
||||
|
||||
final DriveWatcher handler = this.invBySlot[slot];
|
||||
@@ -245,7 +256,7 @@ public class DriveBlockEntity extends AENetworkInvBlockEntity implements IChestO
|
||||
|
||||
@Override
|
||||
public boolean isCellBlinking(final int slot) {
|
||||
return ((this.state >> (slot * 3 + 2)) & 0x01) == 0x01;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -285,7 +296,7 @@ public class DriveBlockEntity extends AENetworkInvBlockEntity implements IChestO
|
||||
}
|
||||
|
||||
for (int x = 0; x < this.getCellCount(); x++) {
|
||||
newState |= (this.getCellStatus(x).ordinal() << (3 * x));
|
||||
newState |= (this.getCellStatus(x).ordinal() << (BIT_CELL_STATE_BITS * x));
|
||||
}
|
||||
|
||||
if (newState != this.state) {
|
||||
@@ -415,8 +426,6 @@ public class DriveBlockEntity extends AENetworkInvBlockEntity implements IChestO
|
||||
|
||||
@Override
|
||||
public void blinkCell(final int slot) {
|
||||
this.state |= 1 << (slot * 3 + 2);
|
||||
|
||||
this.recalculateDisplay();
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public class MeteoriteStructureStart extends StructureStart {
|
||||
int scanRadius = (int) Math.max(1, meteoriteRadius * 2);
|
||||
for (int x = -scanRadius; x <= scanRadius; x++) {
|
||||
for (int z = -scanRadius; z <= scanRadius; z++) {
|
||||
int h = generator.func_222529_a(centerX + x, centerZ + z, heightmapType);
|
||||
int h = generator.getHeight(centerX + x, centerZ + z, heightmapType);
|
||||
stats.add(h);
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ public class MeteoriteStructureStart extends StructureStart {
|
||||
final double distanceFrom = dx * dx + dz * dz;
|
||||
|
||||
if (maxY > h + distanceFrom * 0.0175 && maxY < h + distanceFrom * 0.02) {
|
||||
int heigth = generator.func_222529_a(blockPos.getX(), blockPos.getZ(), Heightmap.Type.OCEAN_FLOOR);
|
||||
int heigth = generator.getHeight(blockPos.getX(), blockPos.getZ(), Heightmap.Type.OCEAN_FLOOR);
|
||||
if (heigth < seaLevel) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user