Port more stuff
This commit is contained in:
+9
-18
@@ -26,17 +26,11 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.util.math.Quaternion;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.render.Tessellator;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraftforge.client.IRenderHandler;
|
||||
import net.minecraftforge.client.SkyRenderHandler;
|
||||
|
||||
//TODO https://github.com/MinecraftForge/MinecraftForge/pull/6537
|
||||
public class SpatialSkyRender implements SkyRenderHandler {
|
||||
public class SpatialSkyRender {
|
||||
|
||||
private static final SpatialSkyRender INSTANCE = new SpatialSkyRender();
|
||||
|
||||
@@ -48,16 +42,15 @@ public class SpatialSkyRender implements SkyRenderHandler {
|
||||
this.dspList = GL11.glGenLists(1);
|
||||
}
|
||||
|
||||
public static IRenderHandler getInstance() {
|
||||
public static SpatialSkyRender getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private static final Quaternion[] SKYBOX_SIDE_ROTATIONS = { Quaternion.ONE, new Quaternion(90.0F, 0.0F, 0.0F, true),
|
||||
private static final Quaternion[] SKYBOX_SIDE_ROTATIONS = { Quaternion.IDENTITY, new Quaternion(90.0F, 0.0F, 0.0F, true),
|
||||
new Quaternion(-90.0F, 0.0F, 0.0F, true), new Quaternion(180.0F, 0.0F, 0.0F, true),
|
||||
new Quaternion(0.0F, 0.0F, 90.0F, true), new Quaternion(0.0F, 0.0F, -90.0F, true), };
|
||||
|
||||
@Override
|
||||
public void render(int ticks, float partialTicks, MatrixStack matrixStack, ClientWorld world, MinecraftClient mc) {
|
||||
public void render(MatrixStack matrixStack) {
|
||||
final long now = System.currentTimeMillis();
|
||||
if (now - this.cycle > 2000) {
|
||||
this.cycle = now;
|
||||
@@ -86,10 +79,10 @@ public class SpatialSkyRender implements SkyRenderHandler {
|
||||
|
||||
RenderSystem.disableTexture();
|
||||
VertexBuffer.begin(GL11.GL_QUADS, VertexFormats.POSITION);
|
||||
VertexBuffer.pos(-100.0D, -100.0D, -100.0D).next();
|
||||
VertexBuffer.pos(-100.0D, -100.0D, 100.0D).next();
|
||||
VertexBuffer.pos(100.0D, -100.0D, 100.0D).next();
|
||||
VertexBuffer.pos(100.0D, -100.0D, -100.0D).next();
|
||||
VertexBuffer.vertex(-100.0D, -100.0D, -100.0D).next();
|
||||
VertexBuffer.vertex(-100.0D, -100.0D, 100.0D).next();
|
||||
VertexBuffer.vertex(100.0D, -100.0D, 100.0D).next();
|
||||
VertexBuffer.vertex(100.0D, -100.0D, -100.0D).next();
|
||||
tessellator.draw();
|
||||
RenderSystem.enableTexture();
|
||||
matrixStack.pop();
|
||||
@@ -105,8 +98,6 @@ public class SpatialSkyRender implements SkyRenderHandler {
|
||||
RenderSystem.depthMask(false);
|
||||
RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
RenderSystem.color4f(fade, fade, fade, 1.0f);
|
||||
GL11.glCallList(this.dspList);
|
||||
}
|
||||
@@ -160,7 +151,7 @@ public class SpatialSkyRender implements SkyRenderHandler {
|
||||
final double d23 = d17 * d12 - d20 * d13;
|
||||
final double d24 = d23 * d9 - d21 * d10;
|
||||
final double d25 = d21 * d9 + d23 * d10;
|
||||
vb.pos(x + d24, y + d22, z + d25).next();
|
||||
vb.vertex(x + d24, y + d22, z + d25).next();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,14 @@ import appeng.client.render.tesr.ChestTileEntityRenderer;
|
||||
import appeng.client.render.tesr.CrankTESR;
|
||||
import appeng.client.render.tesr.DriveLedTileEntityRenderer;
|
||||
import appeng.client.render.tesr.SkyChestTESR;
|
||||
import appeng.debug.ChunkLoaderBlock;
|
||||
import appeng.debug.ChunkLoaderBlockEntity;
|
||||
import appeng.debug.CubeGeneratorBlock;
|
||||
import appeng.debug.CubeGeneratorBlockEntity;
|
||||
import appeng.debug.ItemGenBlock;
|
||||
import appeng.debug.ItemGenBlockEntity;
|
||||
import appeng.debug.PhantomNodeBlock;
|
||||
import appeng.debug.PhantomNodeBlockEntity;
|
||||
import appeng.decorative.AEDecorativeBlock;
|
||||
import appeng.decorative.solid.*;
|
||||
import appeng.decorative.solid.SkyStoneBlock.SkystoneType;
|
||||
@@ -586,35 +594,35 @@ public final class ApiBlocks implements IBlocks {
|
||||
this.quartzPillarSlab = deco.block("quartz_pillar_slab", () -> new SlabBlock(QUARTZ_PROPERTIES))
|
||||
.addFeatures(AEFeature.CERTUS).build();
|
||||
|
||||
// FIXME this.itemGen = registry.block("debug_item_gen", ItemGenBlock::new)
|
||||
// FIXME .features(AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE)
|
||||
// FIXME .tileEntity(
|
||||
// FIXME registry.tileEntity("debug_item_gen", ItemGenBlockEntity.class, ItemGenBlockEntity::new).build())
|
||||
// FIXME .build();
|
||||
// FIXME this.chunkLoader = registry.block("debug_chunk_loader", ChunkLoaderBlock::new)
|
||||
// FIXME .features(AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE)
|
||||
// FIXME .tileEntity(registry
|
||||
// FIXME .tileEntity("debug_chunk_loader", ChunkLoaderBlockEntity.class, ChunkLoaderBlockEntity::new)
|
||||
// FIXME .build())
|
||||
// FIXME .build();
|
||||
// FIXME this.phantomNode = registry.block("debug_phantom_node", PhantomNodeBlock::new)
|
||||
// FIXME .features(AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE)
|
||||
// FIXME .tileEntity(registry
|
||||
// FIXME .tileEntity("debug_phantom_node", PhantomNodeBlockEntity.class, PhantomNodeBlockEntity::new)
|
||||
// FIXME .build())
|
||||
// FIXME .build();
|
||||
// FIXME this.cubeGenerator = registry.block("debug_cube_gen", CubeGeneratorBlock::new)
|
||||
// FIXME .features(AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE)
|
||||
// FIXME .tileEntity(registry
|
||||
// FIXME .tileEntity("debug_cube_gen", CubeGeneratorBlockEntity.class, CubeGeneratorBlockEntity::new)
|
||||
// FIXME .build())
|
||||
// FIXME .build();
|
||||
// FIXME this.energyGenerator = registry.block("debug_energy_gen", EnergyGeneratorBlock::new)
|
||||
// FIXME .features(AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE)
|
||||
// FIXME .tileEntity(registry
|
||||
// FIXME .tileEntity("debug_energy_gen", EnergyGeneratorBlockEntity.class, EnergyGeneratorBlockEntity::new)
|
||||
// FIXME .build())
|
||||
// FIXME .build();
|
||||
this.itemGen = registry.block("debug_item_gen", ItemGenBlock::new)
|
||||
.features(AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE)
|
||||
.tileEntity(
|
||||
registry.tileEntity("debug_item_gen", ItemGenBlockEntity.class, ItemGenBlockEntity::new).build())
|
||||
.build();
|
||||
this.chunkLoader = registry.block("debug_chunk_loader", ChunkLoaderBlock::new)
|
||||
.features(AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE)
|
||||
.tileEntity(registry
|
||||
.tileEntity("debug_chunk_loader", ChunkLoaderBlockEntity.class, ChunkLoaderBlockEntity::new)
|
||||
.build())
|
||||
.build();
|
||||
this.phantomNode = registry.block("debug_phantom_node", PhantomNodeBlock::new)
|
||||
.features(AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE)
|
||||
.tileEntity(registry
|
||||
.tileEntity("debug_phantom_node", PhantomNodeBlockEntity.class, PhantomNodeBlockEntity::new)
|
||||
.build())
|
||||
.build();
|
||||
this.cubeGenerator = registry.block("debug_cube_gen", CubeGeneratorBlock::new)
|
||||
.features(AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE)
|
||||
.tileEntity(registry
|
||||
.tileEntity("debug_cube_gen", CubeGeneratorBlockEntity.class, CubeGeneratorBlockEntity::new)
|
||||
.build())
|
||||
.build();
|
||||
// FIXME FABRIC this.energyGenerator = registry.block("debug_energy_gen", EnergyGeneratorBlock::new)
|
||||
// FIXME FABRIC .features(AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE)
|
||||
// FIXME FABRIC .tileEntity(registry
|
||||
// FIXME FABRIC .tileEntity("debug_energy_gen", EnergyGeneratorBlockEntity.class, EnergyGeneratorBlockEntity::new)
|
||||
// FIXME FABRIC .build())
|
||||
// FIXME FABRIC .build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,6 +32,7 @@ import appeng.core.features.ItemStackSrc;
|
||||
import appeng.debug.DebugCardItem;
|
||||
import appeng.debug.DebugPartPlacerItem;
|
||||
import appeng.debug.EraserItem;
|
||||
import appeng.debug.MeteoritePlacerItem;
|
||||
import appeng.debug.ReplicatorCardItem;
|
||||
import appeng.entity.GrowingCrystalEntity;
|
||||
import appeng.fluids.items.BasicFluidStorageCell;
|
||||
@@ -287,7 +288,7 @@ public final class ApiItems implements IItems {
|
||||
|
||||
FeatureFactory debugTools = registry.features(AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE);
|
||||
this.toolEraser = debugTools.item("debug_eraser", EraserItem::new).build();
|
||||
// FIXME FABRIC this.toolMeteoritePlacer = debugTools.item("debug_meteorite_placer", MeteoritePlacerItem::new).build();
|
||||
this.toolMeteoritePlacer = debugTools.item("debug_meteorite_placer", MeteoritePlacerItem::new).build();
|
||||
this.toolDebugCard = debugTools.item("debug_card", DebugCardItem::new).build();
|
||||
this.toolReplicatorCard = debugTools.item("debug_replicator_card", ReplicatorCardItem::new).build();
|
||||
debugTools.item("debug_part_placer", DebugPartPlacerItem::new).build();
|
||||
|
||||
+12
-9
@@ -34,22 +34,25 @@ public class ChunkLoaderBlockEntity extends AEBaseBlockEntity implements Tickabl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
super.onLoad();
|
||||
public void onReady() {
|
||||
if (world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
World world = getWorld();
|
||||
if (world instanceof ServerWorld) {
|
||||
ChunkPos chunkPos = new ChunkPos(getPos());
|
||||
((ServerWorld) world).forceChunk(chunkPos.x, chunkPos.z, true);
|
||||
((ServerWorld) world).setChunkForced(chunkPos.x, chunkPos.z, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
public void markRemoved() {
|
||||
super.markRemoved();
|
||||
World world = getWorld();
|
||||
if (world instanceof ServerWorld) {
|
||||
ChunkPos chunkPos = new ChunkPos(getPos());
|
||||
((ServerWorld) world).forceChunk(chunkPos.x, chunkPos.z, false);
|
||||
((ServerWorld) world).setChunkForced(chunkPos.x, chunkPos.z, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,10 +64,10 @@ public class ChunkLoaderBlockEntity extends AEBaseBlockEntity implements Tickabl
|
||||
ChunkPos chunkPos = new ChunkPos(getPos());
|
||||
ServerWorld serverWorld = (ServerWorld) world;
|
||||
|
||||
if (!serverWorld.getForcedChunks().contains(chunkPos.asLong())) {
|
||||
AELog.debug("Force-loading chunk @ %d,%d in %s", chunkPos.x, chunkPos.z,
|
||||
serverWorld.dimension.getType().getRegistryName());
|
||||
serverWorld.forceChunk(chunkPos.x, chunkPos.z, false);
|
||||
if (!serverWorld.getForcedChunks().contains(chunkPos.toLong())) {
|
||||
AELog.debug("Force-loading chunk @ %d,%d in world %s", chunkPos.x, chunkPos.z,
|
||||
serverWorld.getRegistryKey().getValue());
|
||||
serverWorld.setChunkForced(chunkPos.x, chunkPos.z, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-5
@@ -25,6 +25,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUsageContext;
|
||||
import net.minecraft.util.Tickable;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.text.LiteralText;
|
||||
@@ -38,7 +39,6 @@ public class CubeGeneratorBlockEntity extends AEBaseBlockEntity implements Ticka
|
||||
private int size = 3;
|
||||
private ItemStack is = ItemStack.EMPTY;
|
||||
private int countdown = 20 * 10;
|
||||
private PlayerEntity who = null;
|
||||
|
||||
public CubeGeneratorBlockEntity(BlockEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
@@ -50,9 +50,9 @@ public class CubeGeneratorBlockEntity extends AEBaseBlockEntity implements Ticka
|
||||
this.countdown--;
|
||||
|
||||
if (this.countdown % 20 == 0) {
|
||||
for (final PlayerEntity e : AppEng.instance().getPlayers()) {
|
||||
AppEng.instance().getPlayers().forEach(e -> {
|
||||
e.sendSystemMessage(new LiteralText("Spawning in... " + (this.countdown / 20)), Util.NIL_UUID);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this.countdown <= 0) {
|
||||
@@ -75,7 +75,7 @@ public class CubeGeneratorBlockEntity extends AEBaseBlockEntity implements Ticka
|
||||
final BlockPos p = this.pos.add(x, y - 1, z);
|
||||
ItemUsageContext useContext = new AutomaticItemPlacementContext(this.world, p, side, this.is,
|
||||
side.getOpposite());
|
||||
i.onItemUse(useContext);
|
||||
i.useOnBlock(useContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,6 @@ public class CubeGeneratorBlockEntity extends AEBaseBlockEntity implements Ticka
|
||||
void click(final PlayerEntity player) {
|
||||
if (Platform.isServer()) {
|
||||
final ItemStack hand = player.inventory.getMainHandStack();
|
||||
this.who = player;
|
||||
|
||||
if (hand.isEmpty()) {
|
||||
this.is = ItemStack.EMPTY;
|
||||
+26
-53
@@ -18,31 +18,30 @@
|
||||
|
||||
package appeng.debug;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Queue;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import alexiil.mc.lib.attributes.AttributeList;
|
||||
import alexiil.mc.lib.attributes.Simulation;
|
||||
import alexiil.mc.lib.attributes.item.ItemExtractable;
|
||||
import alexiil.mc.lib.attributes.item.filter.ExactItemStackFilter;
|
||||
import alexiil.mc.lib.attributes.item.filter.ItemFilter;
|
||||
import appeng.tile.AEBaseBlockEntity;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.tile.AEBaseBlockEntity;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Queue;
|
||||
|
||||
public class ItemGenBlockEntity extends AEBaseBlockEntity {
|
||||
|
||||
private static final Queue<ItemStack> POSSIBLE_ITEMS = new ArrayDeque<>();
|
||||
|
||||
private final FixedItemInv handler = new QueuedItemHandler();
|
||||
private final ItemExtractable handler = new QueuedItemHandler();
|
||||
|
||||
public ItemGenBlockEntity(BlockEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
@@ -71,55 +70,27 @@ public class ItemGenBlockEntity extends AEBaseBlockEntity {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> LazyOptional<T> getCapability(Capability<T> capability, @Nullable Direction facing) {
|
||||
if (CapabilityItemHandler.ITEM_HANDLER_CAPABILITY == capability) {
|
||||
return (LazyOptional<T>) LazyOptional.of(() -> this.handler);
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
public void addAllAttributes(World world, BlockPos pos, BlockState state, AttributeList<?> to) {
|
||||
to.offer(handler);
|
||||
}
|
||||
|
||||
class QueuedItemHandler implements FixedItemInv {
|
||||
class QueuedItemHandler implements ItemExtractable {
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
|
||||
return stack;
|
||||
}
|
||||
public ItemStack attemptExtraction(ItemFilter itemFilter, int maxAmount, Simulation simulation) {
|
||||
// When item filter asks for a specific item, just return that
|
||||
if (itemFilter instanceof ExactItemStackFilter) {
|
||||
return ((ExactItemStackFilter) itemFilter).stack.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return POSSIBLE_ITEMS.peek() != null ? POSSIBLE_ITEMS.peek().copy() : ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(int slot, @Nonnull ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlots() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxAmount(int slot, ItemStack stack) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack extractItem(int slot, int amount, boolean simulate) {
|
||||
final ItemStack is = POSSIBLE_ITEMS.peek();
|
||||
|
||||
if (is == null) {
|
||||
if (is == null || !itemFilter.matches(is)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
return simulate ? is.copy() : this.getNextItem();
|
||||
return simulation == Simulation.SIMULATE ? is.copy() : this.getNextItem();
|
||||
}
|
||||
|
||||
private ItemStack getNextItem() {
|
||||
@@ -128,5 +99,7 @@ public class ItemGenBlockEntity extends AEBaseBlockEntity {
|
||||
POSSIBLE_ITEMS.add(is);
|
||||
return is.copy();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
;
|
||||
}
|
||||
+12
-9
@@ -18,16 +18,18 @@
|
||||
|
||||
package appeng.debug;
|
||||
|
||||
import appeng.hooks.AEToolItem;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.packet.s2c.play.ChunkDataS2CPacket;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUsageContext;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.play.server.SChunkDataPacket;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.BlockBox;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
@@ -41,8 +43,9 @@ import appeng.worldgen.meteorite.CraterType;
|
||||
import appeng.worldgen.meteorite.MeteoritePlacer;
|
||||
import appeng.worldgen.meteorite.PlacedMeteoriteSettings;
|
||||
import appeng.worldgen.meteorite.debug.MeteoriteSpawner;
|
||||
import net.minecraft.world.chunk.WorldChunk;
|
||||
|
||||
public class MeteoritePlacerItem extends AEBaseItem {
|
||||
public class MeteoritePlacerItem extends AEBaseItem implements AEToolItem {
|
||||
|
||||
private static final String MODE_TAG = "mode";
|
||||
|
||||
@@ -53,7 +56,7 @@ public class MeteoritePlacerItem extends AEBaseItem {
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
|
||||
if (world.isClient()) {
|
||||
return TypedActionResult.resultPass(player.getStackInHand(hand));
|
||||
return TypedActionResult.pass(player.getStackInHand(hand));
|
||||
}
|
||||
|
||||
if (player.isSneaking()) {
|
||||
@@ -71,7 +74,7 @@ public class MeteoritePlacerItem extends AEBaseItem {
|
||||
|
||||
player.sendSystemMessage(new LiteralText(craterType.name()), Util.NIL_UUID);
|
||||
|
||||
return TypedActionResult.resultSuccess(itemStack);
|
||||
return TypedActionResult.success(itemStack);
|
||||
}
|
||||
|
||||
return super.use(world, player, hand);
|
||||
@@ -106,7 +109,7 @@ public class MeteoritePlacerItem extends AEBaseItem {
|
||||
pureCrater, false);
|
||||
|
||||
if (spawned == null) {
|
||||
player.sendMessage(new LiteralText("Un-suitable Location."));
|
||||
player.sendMessage(new LiteralText("Un-suitable Location."), false);
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
|
||||
@@ -121,14 +124,14 @@ public class MeteoritePlacerItem extends AEBaseItem {
|
||||
placer.place();
|
||||
|
||||
player.sendMessage(new LiteralText("Spawned at y=" + spawned.getPos().getY() + " range=" + range
|
||||
+ " biomeCategory=" + world.getBiome(pos).getCategory()));
|
||||
+ " biomeCategory=" + world.getBiome(pos).getCategory()), false);
|
||||
|
||||
// The placer will not send chunks to the player since it's used as part
|
||||
// of world-gen normally, so we'll have to do it ourselves. Since this
|
||||
// is a debug tool, we'll not care about being terribly efficient here
|
||||
ChunkPos.getAllInBox(new ChunkPos(spawned.getPos()), 1).forEach(cp -> {
|
||||
Chunk c = world.getChunk(cp.x, cp.z);
|
||||
player.connection.sendPacket(new SChunkDataPacket(c, 65535)); // 65535 == full chunk
|
||||
ChunkPos.stream(new ChunkPos(spawned.getPos()), 2).forEach(cp -> {
|
||||
WorldChunk c = world.getChunk(cp.x, cp.z);
|
||||
player.networkHandler.sendPacket(new ChunkDataS2CPacket(c, 65535, false)); // 65535 == full chunk
|
||||
});
|
||||
|
||||
return ActionResult.SUCCESS;
|
||||
@@ -0,0 +1,24 @@
|
||||
package appeng.mixins;
|
||||
|
||||
import appeng.spatial.SpatialDimensionManager;
|
||||
import net.minecraft.client.render.SkyProperties;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Mixin(SkyProperties.class)
|
||||
public class SkyPropertiesMixin {
|
||||
|
||||
@Inject(method = "byDimensionType", at = @At("HEAD"), cancellable = true)
|
||||
private static void byDimensionType(Optional<RegistryKey<DimensionType>> optional, CallbackInfoReturnable<SkyProperties> ci) {
|
||||
if (optional.orElse(null) == SpatialDimensionManager.STORAGE_DIMENSION_TYPE) {
|
||||
ci.setReturnValue(SpatialDimensionManager.STORAGE_SKY);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package appeng.mixins;
|
||||
|
||||
import appeng.client.render.SpatialSkyRender;
|
||||
import appeng.spatial.SpatialDimensionManager;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.WorldRenderer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(WorldRenderer.class)
|
||||
public class SkyRenderMixin {
|
||||
|
||||
@Shadow
|
||||
private MinecraftClient client;
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@Inject(method = "renderSky", at = @At("HEAD"), cancellable = true)
|
||||
public void renderSky(MatrixStack matrices, float tickDelta, CallbackInfo ci) {
|
||||
if (client.world.getDimensionRegistryKey() == SpatialDimensionManager.STORAGE_DIMENSION_TYPE) {
|
||||
SpatialSkyRender.getInstance().render(matrices);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,11 +23,13 @@ import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.hooks.DynamicDimensions;
|
||||
import net.minecraft.client.render.SkyProperties;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.World;
|
||||
@@ -46,6 +48,30 @@ public final class SpatialDimensionManager implements ISpatialDimension {
|
||||
|
||||
public static final RegistryKey<DimensionType> STORAGE_DIMENSION_TYPE = RegistryKey.of(Registry.DIMENSION_TYPE_KEY, AppEng.makeId("storage_cell"));
|
||||
|
||||
public static final SkyProperties STORAGE_SKY = new SkyProperties(
|
||||
Float.NaN /* disables clouds */,
|
||||
false,
|
||||
SkyProperties.SkyType.NORMAL /* we use a custom render mixin */,
|
||||
false,
|
||||
false
|
||||
) {
|
||||
@Override
|
||||
public Vec3d adjustSkyColor(Vec3d color, float sunHeight) {
|
||||
return Vec3d.ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useThickFog(int camX, int camY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public float[] getSkyColor(float skyAngle, float tickDelta) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
public static final ISpatialDimension INSTANCE = new SpatialDimensionManager();
|
||||
|
||||
private static final String DIM_ID_PREFIX = "spatial_";
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
"RenderPhaseMixin",
|
||||
"BakedModelManagerAccessor",
|
||||
"RenderEncodedPatternMixin",
|
||||
"ItemRendererAccessor"
|
||||
"ItemRendererAccessor",
|
||||
"SkyRenderMixin",
|
||||
"SkyPropertiesMixin"
|
||||
],
|
||||
"server": [],
|
||||
"injectors": {
|
||||
|
||||
Reference in New Issue
Block a user