Port more stuff
This commit is contained in:
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.render.VertexFormats;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.util.math.Quaternion;
|
||||
import net.minecraft.client.render.Tessellator;
|
||||
|
||||
public class SpatialSkyRender {
|
||||
|
||||
private static final SpatialSkyRender INSTANCE = new SpatialSkyRender();
|
||||
|
||||
private final Random random = new Random();
|
||||
private final int dspList;
|
||||
private long cycle = 0;
|
||||
|
||||
public SpatialSkyRender() {
|
||||
this.dspList = GL11.glGenLists(1);
|
||||
}
|
||||
|
||||
public static SpatialSkyRender getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
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), };
|
||||
|
||||
public void render(MatrixStack matrixStack) {
|
||||
final long now = System.currentTimeMillis();
|
||||
if (now - this.cycle > 2000) {
|
||||
this.cycle = now;
|
||||
GL11.glNewList(this.dspList, GL11.GL_COMPILE);
|
||||
this.renderTwinkles();
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
float fade = now - this.cycle;
|
||||
fade /= 1000;
|
||||
fade = 0.15f * (1.0f - Math.abs((fade - 1.0f) * (fade - 1.0f)));
|
||||
|
||||
RenderSystem.disableFog();
|
||||
RenderSystem.disableAlphaTest();
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.depthMask(false);
|
||||
RenderSystem.color4f(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
final Tessellator tessellator = Tessellator.getInstance();
|
||||
final BufferBuilder VertexBuffer = tessellator.getBuffer();
|
||||
|
||||
// This renders a skybox around the player at a far, fixed distance from them.
|
||||
// The skybox is pitch black and untextured
|
||||
for (Quaternion rotation : SKYBOX_SIDE_ROTATIONS) {
|
||||
matrixStack.push();
|
||||
matrixStack.multiply(rotation);
|
||||
|
||||
RenderSystem.disableTexture();
|
||||
VertexBuffer.begin(GL11.GL_QUADS, VertexFormats.POSITION);
|
||||
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();
|
||||
}
|
||||
|
||||
RenderSystem.depthMask(true);
|
||||
|
||||
if (fade > 0.0f) {
|
||||
RenderSystem.disableFog();
|
||||
RenderSystem.disableAlphaTest();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.depthMask(false);
|
||||
RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
|
||||
RenderSystem.color4f(fade, fade, fade, 1.0f);
|
||||
GL11.glCallList(this.dspList);
|
||||
}
|
||||
|
||||
RenderSystem.depthMask(true);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.enableAlphaTest();
|
||||
RenderSystem.enableTexture();
|
||||
RenderSystem.enableFog();
|
||||
|
||||
RenderSystem.color4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
private void renderTwinkles() {
|
||||
final Tessellator tessellator = Tessellator.getInstance();
|
||||
final BufferBuilder vb = tessellator.getBuffer();
|
||||
vb.begin(GL11.GL_QUADS, VertexFormats.POSITION);
|
||||
|
||||
for (int i = 0; i < 50; ++i) {
|
||||
double iX = this.random.nextFloat() * 2.0F - 1.0F;
|
||||
double iY = this.random.nextFloat() * 2.0F - 1.0F;
|
||||
double iZ = this.random.nextFloat() * 2.0F - 1.0F;
|
||||
final double d3 = 0.05F + this.random.nextFloat() * 0.1F;
|
||||
double dist = iX * iX + iY * iY + iZ * iZ;
|
||||
|
||||
if (dist < 1.0D && dist > 0.01D) {
|
||||
dist = 1.0D / Math.sqrt(dist);
|
||||
iX *= dist;
|
||||
iY *= dist;
|
||||
iZ *= dist;
|
||||
final double x = iX * 100.0D;
|
||||
final double y = iY * 100.0D;
|
||||
final double z = iZ * 100.0D;
|
||||
final double d8 = Math.atan2(iX, iZ);
|
||||
final double d9 = Math.sin(d8);
|
||||
final double d10 = Math.cos(d8);
|
||||
final double d11 = Math.atan2(Math.sqrt(iX * iX + iZ * iZ), iY);
|
||||
final double d12 = Math.sin(d11);
|
||||
final double d13 = Math.cos(d11);
|
||||
final double d14 = this.random.nextDouble() * Math.PI * 2.0D;
|
||||
final double d15 = Math.sin(d14);
|
||||
final double d16 = Math.cos(d14);
|
||||
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
final double d17 = 0.0D;
|
||||
final double d18 = ((j & 2) - 1) * d3;
|
||||
final double d19 = ((j + 1 & 2) - 1) * d3;
|
||||
final double d20 = d18 * d16 - d19 * d15;
|
||||
final double d21 = d19 * d16 + d18 * d15;
|
||||
final double d22 = d20 * d12 + d17 * d13;
|
||||
final double d23 = d17 * d12 - d20 * d13;
|
||||
final double d24 = d23 * d9 - d21 * d10;
|
||||
final double d25 = d21 * d9 + d23 * d10;
|
||||
vb.vertex(x + d24, y + d22, z + d25).next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.debug;
|
||||
|
||||
import net.minecraft.block.Material;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
public class ChunkLoaderBlock extends AEBaseTileBlock<ChunkLoaderBlockEntity> {
|
||||
|
||||
public ChunkLoaderBlock() {
|
||||
super(defaultProps(Material.METAL));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.debug;
|
||||
|
||||
import net.minecraft.util.Tickable;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
|
||||
import appeng.core.AELog;
|
||||
import appeng.tile.AEBaseBlockEntity;
|
||||
|
||||
public class ChunkLoaderBlockEntity extends AEBaseBlockEntity implements Tickable {
|
||||
|
||||
public ChunkLoaderBlockEntity(BlockEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReady() {
|
||||
if (world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
World world = getWorld();
|
||||
if (world instanceof ServerWorld) {
|
||||
ChunkPos chunkPos = new ChunkPos(getPos());
|
||||
((ServerWorld) world).setChunkForced(chunkPos.x, chunkPos.z, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markRemoved() {
|
||||
super.markRemoved();
|
||||
World world = getWorld();
|
||||
if (world instanceof ServerWorld) {
|
||||
ChunkPos chunkPos = new ChunkPos(getPos());
|
||||
((ServerWorld) world).setChunkForced(chunkPos.x, chunkPos.z, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Validate the force-status
|
||||
World world = getWorld();
|
||||
if (world instanceof ServerWorld) {
|
||||
ChunkPos chunkPos = new ChunkPos(getPos());
|
||||
ServerWorld serverWorld = (ServerWorld) world;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.debug;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
public class CubeGeneratorBlock extends AEBaseTileBlock<CubeGeneratorBlockEntity> {
|
||||
|
||||
public CubeGeneratorBlock() {
|
||||
super(defaultProps(Material.METAL));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand,
|
||||
final @Nullable ItemStack heldItem, final BlockHitResult hit) {
|
||||
final CubeGeneratorBlockEntity tcg = this.getBlockEntity(w, pos);
|
||||
if (tcg != null) {
|
||||
tcg.click(player);
|
||||
}
|
||||
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.debug;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.AutomaticItemPlacementContext;
|
||||
import net.minecraft.item.Item;
|
||||
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;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import appeng.tile.AEBaseBlockEntity;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class CubeGeneratorBlockEntity extends AEBaseBlockEntity implements Tickable {
|
||||
|
||||
private int size = 3;
|
||||
private ItemStack is = ItemStack.EMPTY;
|
||||
private int countdown = 20 * 10;
|
||||
|
||||
public CubeGeneratorBlockEntity(BlockEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
if (!this.is.isEmpty() && Platform.isServer()) {
|
||||
this.countdown--;
|
||||
|
||||
if (this.countdown % 20 == 0) {
|
||||
AppEng.instance().getPlayers().forEach(e -> {
|
||||
e.sendSystemMessage(new LiteralText("Spawning in... " + (this.countdown / 20)), Util.NIL_UUID);
|
||||
});
|
||||
}
|
||||
|
||||
if (this.countdown <= 0) {
|
||||
this.spawn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void spawn() {
|
||||
this.world.removeBlock(this.pos, false);
|
||||
|
||||
final Item i = this.is.getItem();
|
||||
final Direction side = Direction.UP;
|
||||
|
||||
final int half = (int) Math.floor(this.size / 2);
|
||||
|
||||
for (int y = 0; y < this.size; y++) {
|
||||
for (int x = -half; x < half; x++) {
|
||||
for (int z = -half; z < half; z++) {
|
||||
final BlockPos p = this.pos.add(x, y - 1, z);
|
||||
ItemUsageContext useContext = new AutomaticItemPlacementContext(this.world, p, side, this.is,
|
||||
side.getOpposite());
|
||||
i.useOnBlock(useContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void click(final PlayerEntity player) {
|
||||
if (Platform.isServer()) {
|
||||
final ItemStack hand = player.inventory.getMainHandStack();
|
||||
|
||||
if (hand.isEmpty()) {
|
||||
this.is = ItemStack.EMPTY;
|
||||
|
||||
if (player.isInSneakingPose()) {
|
||||
this.size--;
|
||||
} else {
|
||||
this.size++;
|
||||
}
|
||||
|
||||
if (this.size < 3) {
|
||||
this.size = 3;
|
||||
}
|
||||
if (this.size > 64) {
|
||||
this.size = 64;
|
||||
}
|
||||
|
||||
player.sendSystemMessage(new LiteralText("Size: " + this.size), Util.NIL_UUID);
|
||||
} else {
|
||||
this.countdown = 20 * 10;
|
||||
this.is = hand;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.debug;
|
||||
|
||||
import net.minecraft.block.Material;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
public class ItemGenBlock extends AEBaseTileBlock<ItemGenBlockEntity> {
|
||||
|
||||
public ItemGenBlock() {
|
||||
super(defaultProps(Material.METAL));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.debug;
|
||||
|
||||
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.BlockPos;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Queue;
|
||||
|
||||
public class ItemGenBlockEntity extends AEBaseBlockEntity {
|
||||
|
||||
private static final Queue<ItemStack> POSSIBLE_ITEMS = new ArrayDeque<>();
|
||||
|
||||
private final ItemExtractable handler = new QueuedItemHandler();
|
||||
|
||||
public ItemGenBlockEntity(BlockEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
if (POSSIBLE_ITEMS.isEmpty()) {
|
||||
for (final Item mi : Registry.ITEM) {
|
||||
if (mi != null && mi != Items.AIR) {
|
||||
if (mi.isDamageable()) {
|
||||
ItemStack sampleStack = new ItemStack(mi);
|
||||
int maxDamage = sampleStack.getMaxDamage();
|
||||
for (int dmg = 0; dmg < maxDamage; dmg++) {
|
||||
ItemStack is = sampleStack.copy();
|
||||
is.setDamage(dmg);
|
||||
POSSIBLE_ITEMS.add(is);
|
||||
}
|
||||
} else {
|
||||
if (mi.getGroup() == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final DefaultedList<ItemStack> list = DefaultedList.of();
|
||||
mi.appendStacks(mi.getGroup(), list);
|
||||
POSSIBLE_ITEMS.addAll(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAllAttributes(World world, BlockPos pos, BlockState state, AttributeList<?> to) {
|
||||
to.offer(handler);
|
||||
}
|
||||
|
||||
class QueuedItemHandler implements ItemExtractable {
|
||||
|
||||
@Override
|
||||
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();
|
||||
}
|
||||
|
||||
final ItemStack is = POSSIBLE_ITEMS.peek();
|
||||
|
||||
if (is == null || !itemFilter.matches(is)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
return simulation == Simulation.SIMULATE ? is.copy() : this.getNextItem();
|
||||
}
|
||||
|
||||
private ItemStack getNextItem() {
|
||||
final ItemStack is = POSSIBLE_ITEMS.poll();
|
||||
|
||||
POSSIBLE_ITEMS.add(is);
|
||||
return is.copy();
|
||||
}
|
||||
}
|
||||
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
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.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;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
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 implements AEToolItem {
|
||||
|
||||
private static final String MODE_TAG = "mode";
|
||||
|
||||
public MeteoritePlacerItem(Settings properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
|
||||
if (world.isClient()) {
|
||||
return TypedActionResult.pass(player.getStackInHand(hand));
|
||||
}
|
||||
|
||||
if (player.isSneaking()) {
|
||||
final ItemStack itemStack = player.getStackInHand(hand);
|
||||
final CompoundTag tag = itemStack.getOrCreateTag();
|
||||
|
||||
if (tag.contains(MODE_TAG)) {
|
||||
final byte mode = tag.getByte("mode");
|
||||
tag.putByte(MODE_TAG, (byte) ((mode + 1) % CraterType.values().length));
|
||||
} else {
|
||||
tag.putByte(MODE_TAG, (byte) CraterType.NORMAL.ordinal());
|
||||
}
|
||||
|
||||
CraterType craterType = CraterType.values()[tag.getByte(MODE_TAG)];
|
||||
|
||||
player.sendSystemMessage(new LiteralText(craterType.name()), Util.NIL_UUID);
|
||||
|
||||
return TypedActionResult.success(itemStack);
|
||||
}
|
||||
|
||||
return super.use(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult onItemUseFirst(ItemStack stack, ItemUsageContext context) {
|
||||
if (context.getWorld().isClient()) {
|
||||
return ActionResult.PASS;
|
||||
}
|
||||
|
||||
ServerPlayerEntity player = (ServerPlayerEntity) context.getPlayer();
|
||||
ServerWorld world = (ServerWorld) context.getWorld();
|
||||
BlockPos pos = context.getBlockPos();
|
||||
|
||||
if (player == null) {
|
||||
return ActionResult.PASS;
|
||||
}
|
||||
|
||||
CompoundTag tag = stack.getOrCreateTag();
|
||||
if (!tag.contains(MODE_TAG)) {
|
||||
tag.putByte(MODE_TAG, (byte) CraterType.NORMAL.ordinal());
|
||||
}
|
||||
|
||||
// See MeteoriteStructure for original code
|
||||
float coreRadius = (Platform.getRandomFloat() * 6.0f) + 2;
|
||||
boolean pureCrater = Platform.getRandomFloat() > 0.5f;
|
||||
CraterType craterType = CraterType.values()[tag.getByte(MODE_TAG)];
|
||||
|
||||
MeteoriteSpawner spawner = new MeteoriteSpawner();
|
||||
PlacedMeteoriteSettings spawned = spawner.trySpawnMeteoriteAtSuitableHeight(world, pos, coreRadius, craterType,
|
||||
pureCrater, false);
|
||||
|
||||
if (spawned == null) {
|
||||
player.sendMessage(new LiteralText("Un-suitable Location."), false);
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
|
||||
// Since we don't know yet if the meteorite will be underground or not,
|
||||
// we have to assume maximum size
|
||||
int range = (int) Math.ceil((coreRadius * 2 + 5) * 5f);
|
||||
|
||||
BlockBox boundingBox = new BlockBox(pos.getX() - range, pos.getY(), pos.getZ() - range,
|
||||
pos.getX() + range, pos.getY(), pos.getZ() + range);
|
||||
|
||||
final MeteoritePlacer placer = new MeteoritePlacer(world, spawned, boundingBox);
|
||||
placer.place();
|
||||
|
||||
player.sendMessage(new LiteralText("Spawned at y=" + spawned.getPos().getY() + " range=" + range
|
||||
+ " 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.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,48 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.debug;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
public class PhantomNodeBlock extends AEBaseTileBlock<PhantomNodeBlockEntity> {
|
||||
|
||||
public PhantomNodeBlock() {
|
||||
super(defaultProps(Material.METAL));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand,
|
||||
final @Nullable ItemStack heldItem, final BlockHitResult hit) {
|
||||
final PhantomNodeBlockEntity tpn = this.getBlockEntity(w, pos);
|
||||
tpn.triggerCrashMode();
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.debug;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.tile.grid.AENetworkBlockEntity;
|
||||
|
||||
public class PhantomNodeBlockEntity extends AENetworkBlockEntity {
|
||||
|
||||
private AENetworkProxy proxy = null;
|
||||
private boolean crashMode = false;
|
||||
|
||||
public PhantomNodeBlockEntity(BlockEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getGridNode(final AEPartLocation dir) {
|
||||
if (!this.crashMode) {
|
||||
return super.getGridNode(dir);
|
||||
}
|
||||
|
||||
return this.proxy.getNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReady() {
|
||||
super.onReady();
|
||||
this.proxy = this.createProxy();
|
||||
this.proxy.onReady();
|
||||
this.crashMode = true;
|
||||
}
|
||||
|
||||
void triggerCrashMode() {
|
||||
if (this.proxy != null) {
|
||||
this.crashMode = true;
|
||||
this.proxy.setValidSides(EnumSet.allOf(Direction.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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_";
|
||||
|
||||
Reference in New Issue
Block a user