API compiles
This commit is contained in:
@@ -25,9 +25,9 @@ import java.util.Map.Entry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.network.play.server.SChunkDataPacket;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.EmptyBlockReader;
|
||||
import net.minecraft.world.ITickList;
|
||||
@@ -45,7 +45,6 @@ import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class CachedPlane {
|
||||
private final int x_size;
|
||||
@@ -58,7 +57,7 @@ public class CachedPlane {
|
||||
private final int y_size;
|
||||
private final Chunk[][] myChunks;
|
||||
private final Column[][] myColumns;
|
||||
private final List<TileEntity> tiles = new ArrayList<>();
|
||||
private final List<BlockEntity> tiles = new ArrayList<>();
|
||||
private final List<NextTickListEntry<Block>> ticks = new ArrayList<>();
|
||||
private final World world;
|
||||
private final IMovableRegistry reg = AEApi.instance().registries().movable();
|
||||
@@ -121,10 +120,10 @@ public class CachedPlane {
|
||||
final Chunk c = w.getChunk(minCX + cx, minCZ + cz);
|
||||
this.myChunks[cx][cz] = c;
|
||||
|
||||
final List<Entry<BlockPos, TileEntity>> rawTiles = new ArrayList<>(c.getTileEntityMap().entrySet());
|
||||
for (final Entry<BlockPos, TileEntity> tx : rawTiles) {
|
||||
final List<Entry<BlockPos, BlockEntity>> rawTiles = new ArrayList<>(c.getTileEntityMap().entrySet());
|
||||
for (final Entry<BlockPos, BlockEntity> tx : rawTiles) {
|
||||
final BlockPos cp = tx.getKey();
|
||||
final TileEntity te = tx.getValue();
|
||||
final BlockEntity te = tx.getValue();
|
||||
|
||||
final BlockPos tePOS = te.getPos();
|
||||
if (tePOS.getX() >= minX && tePOS.getX() <= maxX && tePOS.getY() >= minY && tePOS.getY() <= maxY
|
||||
@@ -167,7 +166,7 @@ public class CachedPlane {
|
||||
}
|
||||
}
|
||||
|
||||
for (final TileEntity te : this.tiles) {
|
||||
for (final BlockEntity te : this.tiles) {
|
||||
try {
|
||||
this.getWorld().loadedTileEntityList.remove(te);
|
||||
if (te instanceof ITickableTileEntity) {
|
||||
@@ -179,7 +178,7 @@ public class CachedPlane {
|
||||
}
|
||||
}
|
||||
|
||||
private IMovableHandler getHandler(final TileEntity te) {
|
||||
private IMovableHandler getHandler(final BlockEntity te) {
|
||||
final IMovableRegistry mr = AEApi.instance().registries().movable();
|
||||
return mr.getHandler(te);
|
||||
}
|
||||
@@ -221,13 +220,13 @@ public class CachedPlane {
|
||||
long duration = endTime - startTime;
|
||||
AELog.info("Block Copy Time: " + duration);
|
||||
|
||||
for (final TileEntity te : this.tiles) {
|
||||
for (final BlockEntity te : this.tiles) {
|
||||
final BlockPos tePOS = te.getPos();
|
||||
dst.addTile(tePOS.getX() - this.x_offset, tePOS.getY() - this.y_offset, tePOS.getZ() - this.z_offset,
|
||||
te, this, mr);
|
||||
}
|
||||
|
||||
for (final TileEntity te : dst.tiles) {
|
||||
for (final BlockEntity te : dst.tiles) {
|
||||
final BlockPos tePOS = te.getPos();
|
||||
this.addTile(tePOS.getX() - dst.x_offset, tePOS.getY() - dst.y_offset, tePOS.getZ() - dst.z_offset, te,
|
||||
dst, mr);
|
||||
@@ -268,7 +267,7 @@ public class CachedPlane {
|
||||
entry.priority);
|
||||
}
|
||||
|
||||
private void addTile(final int x, final int y, final int z, final TileEntity te,
|
||||
private void addTile(final int x, final int y, final int z, final BlockEntity te,
|
||||
final CachedPlane alternateDestination, final IMovableRegistry mr) {
|
||||
try {
|
||||
final Column c = this.myColumns[x][z];
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.spatial;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
@@ -36,12 +36,12 @@ public class DefaultSpatialHandler implements IMovableHandler {
|
||||
* @return true
|
||||
*/
|
||||
@Override
|
||||
public boolean canHandle(final Class<? extends TileEntity> myClass, final TileEntity tile) {
|
||||
public boolean canHandle(final Class<? extends BlockEntity> myClass, final BlockEntity tile) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveTile(final TileEntity te, final World w, final BlockPos newPosition) {
|
||||
public void moveTile(final BlockEntity te, final World w, final BlockPos newPosition) {
|
||||
te.setWorldAndPos(w, newPosition);
|
||||
|
||||
final Chunk c = w.getChunkAt(newPosition);
|
||||
|
||||
@@ -4,7 +4,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import appeng.core.AELog;
|
||||
@@ -13,7 +13,7 @@ import appeng.core.AELog;
|
||||
* Helps with encoding and decoding the extra data we attach to the spatial
|
||||
* {@link net.minecraft.world.dimension.DimensionType} as "extra data". Keep in
|
||||
* mind this data will also be sent to the client unless
|
||||
* {@link net.minecraftforge.common.ModDimension#write(PacketBuffer, boolean)}
|
||||
* {@link net.minecraftforge.common.ModDimension#write(PacketByteBuf, boolean)}
|
||||
* is overridden.
|
||||
*/
|
||||
public final class SpatialDimensionExtraData {
|
||||
@@ -32,8 +32,8 @@ public final class SpatialDimensionExtraData {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public PacketBuffer write() {
|
||||
PacketBuffer buf = new PacketBuffer(Unpooled.buffer());
|
||||
public PacketByteBuf write() {
|
||||
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
|
||||
buf.writeByte(CURRENT_FORMAT);
|
||||
buf.writeBlockPos(size);
|
||||
buf.capacity(buf.writerIndex()); // This cuts the backing buffer to the required size
|
||||
@@ -45,7 +45,7 @@ public final class SpatialDimensionExtraData {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static SpatialDimensionExtraData read(@Nullable PacketBuffer buf) {
|
||||
public static SpatialDimensionExtraData read(@Nullable PacketByteBuf buf) {
|
||||
if (buf == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -23,13 +23,13 @@ import java.util.Locale;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
||||
|
||||
@@ -54,10 +54,10 @@ public final class SpatialDimensionManager implements ISpatialDimension {
|
||||
|
||||
@Override
|
||||
public DimensionType createNewCellDimension(BlockPos size) {
|
||||
ResourceLocation dimKey = findFreeDimensionId();
|
||||
Identifier dimKey = findFreeDimensionId();
|
||||
AELog.info("Allocating storage cell dimension '%s'", dimKey);
|
||||
|
||||
PacketBuffer extraData = new SpatialDimensionExtraData(size).write();
|
||||
PacketByteBuf extraData = new SpatialDimensionExtraData(size).write();
|
||||
|
||||
return DimensionManager.registerDimension(dimKey, StorageCellModDimension.INSTANCE, extraData, true);
|
||||
}
|
||||
@@ -66,10 +66,10 @@ public final class SpatialDimensionManager implements ISpatialDimension {
|
||||
* Tries finding the next free storage cell dimension ID based on the currently
|
||||
* registered storage cell dimensions.
|
||||
*/
|
||||
private ResourceLocation findFreeDimensionId() {
|
||||
private Identifier findFreeDimensionId() {
|
||||
int maxId = 0;
|
||||
for (DimensionType dimensionType : DimensionType.getAll()) {
|
||||
ResourceLocation regName = dimensionType.getRegistryName();
|
||||
Identifier regName = dimensionType.getRegistryName();
|
||||
if (regName == null || !AppEng.MOD_ID.equals(regName.getNamespace())) {
|
||||
continue;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ public final class SpatialDimensionManager implements ISpatialDimension {
|
||||
|
||||
++maxId;
|
||||
|
||||
return new ResourceLocation(AppEng.MOD_ID, DIM_ID_PREFIX + maxId);
|
||||
return new Identifier(AppEng.MOD_ID, DIM_ID_PREFIX + maxId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -126,9 +126,9 @@ public final class SpatialDimensionManager implements ISpatialDimension {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCellDimensionTooltip(DimensionType cellDim, List<ITextComponent> lines) {
|
||||
public void addCellDimensionTooltip(DimensionType cellDim, List<Text> lines) {
|
||||
// Check if the cell dimension type is even registered
|
||||
ResourceLocation registryName = cellDim.getRegistryName();
|
||||
Identifier registryName = cellDim.getRegistryName();
|
||||
if (registryName == null || !AppEng.MOD_ID.equals(registryName.getNamespace())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -20,15 +20,15 @@ package appeng.spatial;
|
||||
|
||||
import net.minecraft.util.SharedSeedRandom;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.ChunkGenerator;
|
||||
import net.minecraft.world.gen.GenerationSettings;
|
||||
import net.minecraft.world.gen.GenerationStage;
|
||||
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
public class StorageCellBiome extends Biome {
|
||||
|
||||
@@ -46,7 +46,7 @@ public class StorageCellBiome extends Biome {
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Environment(EnvType.CLIENT)
|
||||
public int getSkyColor() {
|
||||
return 0x111111;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class StorageCellBiome extends Biome {
|
||||
|
||||
@Override
|
||||
public void decorate(GenerationStage.Decoration stage, ChunkGenerator<? extends GenerationSettings> chunkGenerator,
|
||||
IWorld worldIn, long seed, SharedSeedRandom random, BlockPos pos) {
|
||||
WorldAccess worldIn, long seed, SharedSeedRandom random, BlockPos pos) {
|
||||
// Nothing should ever generate here...
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,16 +20,15 @@ package appeng.spatial;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.dimension.Dimension;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.gen.ChunkGenerator;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.minecraftforge.client.IRenderHandler;
|
||||
|
||||
import appeng.client.render.SpatialSkyRender;
|
||||
@@ -62,7 +61,7 @@ public class StorageCellDimension extends Dimension {
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Environment(EnvType.CLIENT)
|
||||
public float[] calcSunriseSunsetColors(final float celestialAngle, final float partialTicks) {
|
||||
return null;
|
||||
}
|
||||
@@ -78,7 +77,7 @@ public class StorageCellDimension extends Dimension {
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Environment(EnvType.CLIENT)
|
||||
public boolean isSkyColored() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ package appeng.spatial;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.dimension.Dimension;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraftforge.common.ModDimension;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ package appeng.spatial;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.provider.BiomeProvider;
|
||||
import net.minecraft.world.biome.provider.SingleBiomeProvider;
|
||||
@@ -80,7 +80,7 @@ public class StorageChunkGenerator extends ChunkGenerator<GenerationSettings> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void makeBase(IWorld worldIn, IChunk chunkIn) {
|
||||
public void makeBase(WorldAccess worldIn, IChunk chunkIn) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,18 +27,17 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraftforge.common.util.ITeleporter;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class StorageHelper {
|
||||
|
||||
@@ -144,10 +143,10 @@ public class StorageHelper {
|
||||
dstY + scaleY + 1, dstZ + scaleZ + 1,
|
||||
new WrapInMatrixFrame(matrixFrameBlock.getDefaultState(), dstWorld)));
|
||||
|
||||
final AxisAlignedBB srcBox = new AxisAlignedBB(srcX, srcY, srcZ, srcX + scaleX + 1, srcY + scaleY + 1,
|
||||
final Box srcBox = new Box(srcX, srcY, srcZ, srcX + scaleX + 1, srcY + scaleY + 1,
|
||||
srcZ + scaleZ + 1);
|
||||
|
||||
final AxisAlignedBB dstBox = new AxisAlignedBB(dstX, dstY, dstZ, dstX + scaleX + 1, dstY + scaleY + 1,
|
||||
final Box dstBox = new Box(dstX, dstY, dstZ, dstX + scaleX + 1, dstY + scaleY + 1,
|
||||
dstZ + scaleZ + 1);
|
||||
|
||||
final CachedPlane cDst = new CachedPlane(dstWorld, dstX, dstY, dstZ, dstX + scaleX, dstY + scaleY,
|
||||
@@ -228,8 +227,8 @@ public class StorageHelper {
|
||||
private final double y;
|
||||
private final double z;
|
||||
|
||||
TelDestination(final World dimension, final AxisAlignedBB srcBox, final double x, final double y,
|
||||
final double z, final int tileX, final int tileY, final int tileZ) {
|
||||
TelDestination(final World dimension, final Box srcBox, final double x, final double y,
|
||||
final double z, final int tileX, final int tileY, final int tileZ) {
|
||||
this.dim = dimension;
|
||||
this.x = Math.min(srcBox.maxX - 0.5, Math.max(srcBox.minX + 0.5, x + tileX));
|
||||
this.y = Math.min(srcBox.maxY - 0.5, Math.max(srcBox.minY + 0.5, y + tileY));
|
||||
|
||||
Reference in New Issue
Block a user