This commit is contained in:
Sebastian Hartte
2020-08-11 16:21:05 +02:00
parent 68a02ed64b
commit 06f30b3daa
44 changed files with 331 additions and 287 deletions
@@ -23,11 +23,11 @@
package appeng.api.config; package appeng.api.config;
import java.util.Locale;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.TranslatableText;
import java.util.Locale;
/** /**
* Represent the security systems basic permissions, these are not for * Represent the security systems basic permissions, these are not for
* anti-griefing, they are part of the mod as a gameplay feature. * anti-griefing, they are part of the mod as a gameplay feature.
@@ -3,10 +3,10 @@ package appeng.data.providers.tags;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path; import java.nio.file.Path;
import appeng.core.Api;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import appeng.core.Api;
import appeng.core.AppEng; import appeng.core.AppEng;
public class ConventionTagProvider extends TagProvider { public class ConventionTagProvider extends TagProvider {
@@ -175,8 +175,8 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
slot.drawContent(getClient(), mouseX, mouseY, partialTicks); slot.drawContent(getClient(), mouseX, mouseY, partialTicks);
if (this.isPointWithinBounds(left, top, slot.getTooltipAreaWidth(), slot.getTooltipAreaHeight(), mouseX, mouseY) if (this.isPointWithinBounds(left, top, slot.getTooltipAreaWidth(), slot.getTooltipAreaHeight(), mouseX,
&& slot.canClick(getPlayer())) { mouseY) && slot.canClick(getPlayer())) {
RenderSystem.colorMask(true, true, true, false); RenderSystem.colorMask(true, true, true, false);
this.fillGradient(matrices, left, top, right, bottom, -2130706433, -2130706433); this.fillGradient(matrices, left, top, right, bottom, -2130706433, -2130706433);
RenderSystem.colorMask(true, true, true, true); RenderSystem.colorMask(true, true, true, true);
@@ -206,7 +206,8 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
if (!tooltipText.isEmpty()) { if (!tooltipText.isEmpty()) {
String[] lines = tooltipText.split("\n"); // FIXME FABRIC String[] lines = tooltipText.split("\n"); // FIXME FABRIC
List<Text> textLines = Arrays.stream(lines).map(LiteralText::new).collect(Collectors.toList()); List<Text> textLines = Arrays.stream(lines).map(LiteralText::new).collect(Collectors.toList());
this.drawTooltip(matrices, x, y, textLines);} this.drawTooltip(matrices, x, y, textLines);
}
} }
// FIXME FABRIC: move out to json (?) // FIXME FABRIC: move out to json (?)
@@ -95,8 +95,7 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
@Override @Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) { public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.InterfaceTerminal.text()), 8, 6, this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.InterfaceTerminal.text()), 8, 6, 4210752);
4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
final int ex = this.getScrollBar().getCurrentScroll(); final int ex = this.getScrollBar().getCurrentScroll();
@@ -104,15 +104,15 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
this.textRenderer.draw(matrices, GuiText.NetworkDetails.text(), 8, 6, 4210752); this.textRenderer.draw(matrices, GuiText.NetworkDetails.text(), 8, 6, 4210752);
this.textRenderer.draw(matrices, this.textRenderer.draw(matrices,
GuiText.StoredPower.withSuffix(": " + Platform.formatPowerLong(handler.getCurrentPower(), false)), 13, 16, GuiText.StoredPower.withSuffix(": " + Platform.formatPowerLong(handler.getCurrentPower(), false)), 13,
4210752); 16, 4210752);
this.textRenderer.draw(matrices, this.textRenderer.draw(matrices,
GuiText.MaxPower.withSuffix(": " + Platform.formatPowerLong(handler.getMaxPower(), false)), 13, 26, GuiText.MaxPower.withSuffix(": " + Platform.formatPowerLong(handler.getMaxPower(), false)), 13, 26,
4210752); 4210752);
this.textRenderer.draw(matrices, this.textRenderer.draw(matrices,
GuiText.PowerInputRate.withSuffix(": " + Platform.formatPowerLong(handler.getAverageAddition(), true)), 13, GuiText.PowerInputRate.withSuffix(": " + Platform.formatPowerLong(handler.getAverageAddition(), true)),
143 - 10, 4210752); 13, 143 - 10, 4210752);
this.textRenderer.draw(matrices, this.textRenderer.draw(matrices,
GuiText.PowerUsageRate.withSuffix(": " + Platform.formatPowerLong(handler.getPowerUsage(), true)), 13, GuiText.PowerUsageRate.withSuffix(": " + Platform.formatPowerLong(handler.getPowerUsage(), true)), 13,
143 - 20, 4210752); 143 - 20, 4210752);
@@ -9,13 +9,13 @@ import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.Element; import net.minecraft.client.gui.Element;
import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import appeng.client.gui.AEBaseScreen; import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.NumberEntryType; import appeng.client.gui.NumberEntryType;
import appeng.client.gui.widgets.ITickingWidget; import appeng.client.gui.widgets.ITickingWidget;
import appeng.client.gui.widgets.NumberBox; import appeng.client.gui.widgets.NumberBox;
import appeng.core.AEConfig; import appeng.core.AEConfig;
import net.minecraft.text.Text;
/** /**
* A utility widget that consists of a text-field to enter a number with * A utility widget that consists of a text-field to enter a number with
@@ -35,8 +35,7 @@ public class QNBScreen extends AEBaseScreen<QNBContainer> {
@Override @Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) { public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.QuantumLinkChamber.text()), 8, 6, this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.QuantumLinkChamber.text()), 8, 6, 4210752);
4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
} }
@@ -59,8 +59,7 @@ public class QuartzKnifeScreen extends AEBaseScreen<QuartzKnifeContainer> {
@Override @Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) { public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.QuartzCuttingKnife.text()), 8, 6, this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.QuartzCuttingKnife.text()), 8, 6, 4210752);
4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
} }
@@ -63,8 +63,8 @@ public class SpatialIOPortScreen extends AEBaseScreen<SpatialIOPortContainer> {
.withSuffix(": " + this.handler.xSize + "x" + this.handler.ySize + "x" + this.handler.zSize); .withSuffix(": " + this.handler.xSize + "x" + this.handler.ySize + "x" + this.handler.zSize);
this.textRenderer.draw(matrices, text, 13, 93, 4210752); this.textRenderer.draw(matrices, text, 13, 93, 4210752);
} else { } else {
this.textRenderer.draw(matrices, GuiText.SCSSize.withSuffix(": ").append(GuiText.SCSInvalid.text()), this.textRenderer.draw(matrices, GuiText.SCSSize.withSuffix(": ").append(GuiText.SCSInvalid.text()), 13, 93,
13, 93, 4210752); 4210752);
} }
} }
@@ -51,8 +51,7 @@ public class VibrationChamberScreen extends AEBaseScreen<VibrationChamberContain
@Override @Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) { public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.VibrationChamber.text()), 8, 6, this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.VibrationChamber.text()), 8, 6, 4210752);
4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.pb.setFullMsg(new LiteralText(VibrationChamberBlockEntity.POWER_PER_TICK this.pb.setFullMsg(new LiteralText(VibrationChamberBlockEntity.POWER_PER_TICK
@@ -18,10 +18,10 @@
package appeng.client.gui.widgets; package appeng.client.gui.widgets;
import net.minecraft.text.Text;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import net.minecraft.text.Text;
/** /**
* AEBaseGui controlled Tooltip Interface. * AEBaseGui controlled Tooltip Interface.
*/ */
@@ -97,7 +97,8 @@ public class QuadRotator implements RenderContext.QuadTransform {
MutableQuadViewImpl quadImpl = (MutableQuadViewImpl) quad; MutableQuadViewImpl quadImpl = (MutableQuadViewImpl) quad;
quadImpl.lightFace(rotation.rotate(quad.lightFace())); quadImpl.lightFace(rotation.rotate(quad.lightFace()));
// Transform the nominal face, setting the cull face will also overwrite the nominialFace, // Transform the nominal face, setting the cull face will also overwrite the
// nominialFace,
// hence saving both first and the order here. // hence saving both first and the order here.
Direction nominalFace = quad.nominalFace(); Direction nominalFace = quad.nominalFace();
Direction cullFace = quad.cullFace(); Direction cullFace = quad.cullFace();
+53 -49
View File
@@ -1,5 +1,54 @@
package appeng.core; package appeng.core;
import java.util.function.Consumer;
import javax.annotation.Nullable;
import net.earthcomputer.libstructure.LibStructure;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BannerBlockEntity;
import net.minecraft.block.entity.BeaconBlockEntity;
import net.minecraft.block.entity.BrewingStandBlockEntity;
import net.minecraft.block.entity.ChestBlockEntity;
import net.minecraft.block.entity.CommandBlockBlockEntity;
import net.minecraft.block.entity.ComparatorBlockEntity;
import net.minecraft.block.entity.DaylightDetectorBlockEntity;
import net.minecraft.block.entity.DispenserBlockEntity;
import net.minecraft.block.entity.DropperBlockEntity;
import net.minecraft.block.entity.EnchantingTableBlockEntity;
import net.minecraft.block.entity.EndPortalBlockEntity;
import net.minecraft.block.entity.EnderChestBlockEntity;
import net.minecraft.block.entity.FurnaceBlockEntity;
import net.minecraft.block.entity.HopperBlockEntity;
import net.minecraft.block.entity.MobSpawnerBlockEntity;
import net.minecraft.block.entity.PistonBlockEntity;
import net.minecraft.block.entity.ShulkerBoxBlockEntity;
import net.minecraft.block.entity.SignBlockEntity;
import net.minecraft.block.entity.SkullBlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.chunk.StructureConfig;
import net.minecraft.world.gen.decorator.Decorator;
import net.minecraft.world.gen.decorator.NopeDecoratorConfig;
import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.FeatureConfig;
import net.minecraft.world.gen.feature.OreFeatureConfig;
import appeng.api.config.Upgrades; import appeng.api.config.Upgrades;
import appeng.api.definitions.IBlocks; import appeng.api.definitions.IBlocks;
import appeng.api.definitions.IItems; import appeng.api.definitions.IItems;
@@ -101,53 +150,6 @@ import appeng.worldgen.BiomeModifier;
import appeng.worldgen.ChargedQuartzOreConfig; import appeng.worldgen.ChargedQuartzOreConfig;
import appeng.worldgen.ChargedQuartzOreFeature; import appeng.worldgen.ChargedQuartzOreFeature;
import appeng.worldgen.meteorite.MeteoriteStructure; import appeng.worldgen.meteorite.MeteoriteStructure;
import net.earthcomputer.libstructure.LibStructure;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BannerBlockEntity;
import net.minecraft.block.entity.BeaconBlockEntity;
import net.minecraft.block.entity.BrewingStandBlockEntity;
import net.minecraft.block.entity.ChestBlockEntity;
import net.minecraft.block.entity.CommandBlockBlockEntity;
import net.minecraft.block.entity.ComparatorBlockEntity;
import net.minecraft.block.entity.DaylightDetectorBlockEntity;
import net.minecraft.block.entity.DispenserBlockEntity;
import net.minecraft.block.entity.DropperBlockEntity;
import net.minecraft.block.entity.EnchantingTableBlockEntity;
import net.minecraft.block.entity.EndPortalBlockEntity;
import net.minecraft.block.entity.EnderChestBlockEntity;
import net.minecraft.block.entity.FurnaceBlockEntity;
import net.minecraft.block.entity.HopperBlockEntity;
import net.minecraft.block.entity.MobSpawnerBlockEntity;
import net.minecraft.block.entity.PistonBlockEntity;
import net.minecraft.block.entity.ShulkerBoxBlockEntity;
import net.minecraft.block.entity.SignBlockEntity;
import net.minecraft.block.entity.SkullBlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.chunk.StructureConfig;
import net.minecraft.world.gen.decorator.Decorator;
import net.minecraft.world.gen.decorator.NopeDecoratorConfig;
import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.FeatureConfig;
import net.minecraft.world.gen.feature.OreFeatureConfig;
import javax.annotation.Nullable;
import java.util.function.Consumer;
public abstract class AppEngBase implements AppEng { public abstract class AppEngBase implements AppEng {
@@ -610,8 +612,10 @@ public abstract class AppEngBase implements AppEng {
} }
private void registerDimension() { private void registerDimension() {
BuiltinRegistries.add(BuiltinRegistries.BIOME, SpatialStorageDimensionIds.BIOME_KEY.getValue(), SpatialStorageBiome.INSTANCE); BuiltinRegistries.add(BuiltinRegistries.BIOME, SpatialStorageDimensionIds.BIOME_KEY.getValue(),
Registry.register(Registry.CHUNK_GENERATOR, SpatialStorageDimensionIds.CHUNK_GENERATOR_ID, SpatialStorageChunkGenerator.CODEC); SpatialStorageBiome.INSTANCE);
Registry.register(Registry.CHUNK_GENERATOR, SpatialStorageDimensionIds.CHUNK_GENERATOR_ID,
SpatialStorageChunkGenerator.CODEC);
} }
} }
@@ -125,8 +125,7 @@ public class FluidTerminalScreen extends AEBaseMEScreen<FluidTerminalContainer>
@Override @Override
public void drawFG(MatrixStack matrices, int offsetX, int offsetY, int mouseX, int mouseY) { public void drawFG(MatrixStack matrices, int offsetX, int offsetY, int mouseX, int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(new LiteralText("Fluid Terminal")), 8, 6, this.textRenderer.draw(matrices, this.getGuiDisplayName(new LiteralText("Fluid Terminal")), 8, 6, 4210752);
4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
} }
@@ -50,8 +50,8 @@ public class OptionalFluidSlotWidget extends FluidSlotWidget {
} }
int oldZOffset = getZOffset(); int oldZOffset = getZOffset();
setZOffset(currentZIndex); setZOffset(currentZIndex);
drawTexture(matrices, guileft + this.getTooltipAreaX() - 1, guitop + this.getTooltipAreaY() - 1, this.srcX - 1, this.srcY - 1, drawTexture(matrices, guileft + this.getTooltipAreaX() - 1, guitop + this.getTooltipAreaY() - 1, this.srcX - 1,
this.getTooltipAreaWidth() + 2, this.getTooltipAreaHeight() + 2); this.srcY - 1, this.getTooltipAreaWidth() + 2, this.getTooltipAreaHeight() + 2);
setZOffset(oldZOffset); setZOffset(oldZOffset);
} }
} }
@@ -6,7 +6,6 @@ import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import appeng.mixins.FluidTagsAccessor;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.FluidDrainable; import net.minecraft.block.FluidDrainable;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
@@ -48,6 +47,7 @@ import appeng.fluids.util.AEFluidStack;
import appeng.items.parts.PartModels; import appeng.items.parts.PartModels;
import appeng.me.GridAccessException; import appeng.me.GridAccessException;
import appeng.me.helpers.MachineSource; import appeng.me.helpers.MachineSource;
import appeng.mixins.FluidTagsAccessor;
import appeng.parts.BasicStatePart; import appeng.parts.BasicStatePart;
import appeng.parts.automation.PlaneConnectionHelper; import appeng.parts.automation.PlaneConnectionHelper;
import appeng.parts.automation.PlaneConnections; import appeng.parts.automation.PlaneConnections;
@@ -56,7 +56,8 @@ import appeng.util.Platform;
public class FluidAnnihilationPlanePart extends BasicStatePart implements IGridTickable { public class FluidAnnihilationPlanePart extends BasicStatePart implements IGridTickable {
public static final Tag.Identified<Fluid> TAG_BLACKLIST = FluidTagsAccessor.register(AppEng.makeId("blacklisted/fluid_annihilation_plane").toString()); public static final Tag.Identified<Fluid> TAG_BLACKLIST = FluidTagsAccessor
.register(AppEng.makeId("blacklisted/fluid_annihilation_plane").toString());
private static final PlaneModels MODELS = new PlaneModels("part/fluid_annihilation_plane", private static final PlaneModels MODELS = new PlaneModels("part/fluid_annihilation_plane",
"part/fluid_annihilation_plane_on"); "part/fluid_annihilation_plane_on");
+18 -13
View File
@@ -1,12 +1,5 @@
package appeng.hooks; package appeng.hooks;
import alexiil.mc.lib.attributes.SearchOption;
import alexiil.mc.lib.attributes.SearchOptions;
import alexiil.mc.lib.attributes.item.ItemAttributes;
import alexiil.mc.lib.attributes.item.ItemExtractable;
import alexiil.mc.lib.attributes.item.ItemInsertable;
import alexiil.mc.lib.attributes.item.ItemInvUtil;
import alexiil.mc.lib.attributes.item.compat.FixedInventoryVanillaWrapper;
import net.minecraft.block.HopperBlock; import net.minecraft.block.HopperBlock;
import net.minecraft.block.entity.Hopper; import net.minecraft.block.entity.Hopper;
import net.minecraft.block.entity.HopperBlockEntity; import net.minecraft.block.entity.HopperBlockEntity;
@@ -16,6 +9,14 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.world.World; import net.minecraft.world.World;
import alexiil.mc.lib.attributes.SearchOption;
import alexiil.mc.lib.attributes.SearchOptions;
import alexiil.mc.lib.attributes.item.ItemAttributes;
import alexiil.mc.lib.attributes.item.ItemExtractable;
import alexiil.mc.lib.attributes.item.ItemInsertable;
import alexiil.mc.lib.attributes.item.ItemInvUtil;
import alexiil.mc.lib.attributes.item.compat.FixedInventoryVanillaWrapper;
// SEE: https://github.com/AlexIIL/LibBlockAttributes/pull/27 // SEE: https://github.com/AlexIIL/LibBlockAttributes/pull/27
public final class HopperHooks { public final class HopperHooks {
@@ -31,7 +32,8 @@ public final class HopperHooks {
return ActionResult.PASS; return ActionResult.PASS;
} }
ItemInsertable insertable = ItemAttributes.INSERTABLE.getFirstOrNull(world, targetPos, SearchOptions.inDirection(towards)); ItemInsertable insertable = ItemAttributes.INSERTABLE.getFirstOrNull(world, targetPos,
SearchOptions.inDirection(towards));
if (insertable == null) { if (insertable == null) {
return ActionResult.PASS; // Let Vanilla handle non-LBA enabled inventories and Entities return ActionResult.PASS; // Let Vanilla handle non-LBA enabled inventories and Entities
} }
@@ -53,8 +55,8 @@ public final class HopperHooks {
private static final SearchOption<? super ItemExtractable> EXTRACT_SEARCH = SearchOptions.inDirection(Direction.UP); private static final SearchOption<? super ItemExtractable> EXTRACT_SEARCH = SearchOptions.inDirection(Direction.UP);
/** /**
* Tries to extract items from an inventory above the given hopper into the hopper. * Tries to extract items from an inventory above the given hopper into the
* Note that the given hopper can also be a hopper minecart. * hopper. Note that the given hopper can also be a hopper minecart.
*/ */
public static ActionResult tryExtract(Hopper hopper) { public static ActionResult tryExtract(Hopper hopper) {
World world = hopper.getWorld(); World world = hopper.getWorld();
@@ -82,9 +84,12 @@ public final class HopperHooks {
} }
private static boolean isVanillaInventoryAt(World world, BlockPos pos) { private static boolean isVanillaInventoryAt(World world, BlockPos pos) {
// If there's a TE at the target position that implements Inventory (such that Hopper would handle it itself) // If there's a TE at the target position that implements Inventory (such that
// defer to Vanilla to avoid injecting ourselves inbetween Vanilla blocks needlessly. // Hopper would handle it itself)
// ItemAttributes.INSERTABLE would return an auto-converted Inventory in such cases. // defer to Vanilla to avoid injecting ourselves inbetween Vanilla blocks
// needlessly.
// ItemAttributes.INSERTABLE would return an auto-converted Inventory in such
// cases.
return world.getBlockEntity(pos) instanceof Inventory; return world.getBlockEntity(pos) instanceof Inventory;
} }
@@ -3,8 +3,6 @@ package appeng.hooks;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import appeng.core.AppEng;
import appeng.mixins.unlitquad.BakedQuadAccessor;
import net.minecraft.client.render.LightmapTextureManager; import net.minecraft.client.render.LightmapTextureManager;
import net.minecraft.client.render.VertexFormat; import net.minecraft.client.render.VertexFormat;
import net.minecraft.client.render.VertexFormatElement; import net.minecraft.client.render.VertexFormatElement;
@@ -17,6 +15,9 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper; import net.minecraft.util.JsonHelper;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import appeng.core.AppEng;
import appeng.mixins.unlitquad.BakedQuadAccessor;
/** /**
* Implementation details of allowing quads to be defined as "unlit" in JSON * Implementation details of allowing quads to be defined as "unlit" in JSON
* models by specifying an "unlit" boolean property on the face. * models by specifying an "unlit" boolean property on the face.
@@ -100,7 +101,8 @@ public class UnlitQuadHooks {
* {@link #makeUnlit(BakedQuad)}. * {@link #makeUnlit(BakedQuad)}.
*/ */
public static class UnlitModelElementFace extends ModelElementFace { public static class UnlitModelElementFace extends ModelElementFace {
public UnlitModelElementFace(Direction cullFaceIn, int tintIndexIn, String textureIn, ModelElementTexture blockFaceUVIn) { public UnlitModelElementFace(Direction cullFaceIn, int tintIndexIn, String textureIn,
ModelElementTexture blockFaceUVIn) {
super(cullFaceIn, tintIndexIn, textureIn, blockFaceUVIn); super(cullFaceIn, tintIndexIn, textureIn, blockFaceUVIn);
} }
} }
@@ -22,15 +22,6 @@ import java.time.Instant;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import appeng.api.implementations.items.ISpatialStorageCell;
import appeng.api.util.WorldCoord;
import appeng.core.AELog;
import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem;
import appeng.spatial.SpatialStorageHelper;
import appeng.spatial.SpatialStoragePlot;
import appeng.spatial.SpatialStoragePlotManager;
import appeng.spatial.TransitionInfo;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.util.NbtType; import net.fabricmc.fabric.api.util.NbtType;
@@ -43,6 +34,16 @@ import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import appeng.api.implementations.items.ISpatialStorageCell;
import appeng.api.util.WorldCoord;
import appeng.core.AELog;
import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem;
import appeng.spatial.SpatialStorageHelper;
import appeng.spatial.SpatialStoragePlot;
import appeng.spatial.SpatialStoragePlotManager;
import appeng.spatial.TransitionInfo;
public class SpatialStorageCellItem extends AEBaseItem implements ISpatialStorageCell { public class SpatialStorageCellItem extends AEBaseItem implements ISpatialStorageCell {
private static final String TAG_PLOT_ID = "plot_id"; private static final String TAG_PLOT_ID = "plot_id";
@@ -62,7 +63,7 @@ public class SpatialStorageCellItem extends AEBaseItem implements ISpatialStorag
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void appendTooltip(final ItemStack stack, final World world, final List<Text> lines, public void appendTooltip(final ItemStack stack, final World world, final List<Text> lines,
final TooltipContext advancedTooltips) { final TooltipContext advancedTooltips) {
int plotId = this.getAllocatedPlotId(stack); int plotId = this.getAllocatedPlotId(stack);
if (plotId == -1) { if (plotId == -1) {
lines.add(GuiText.Unformatted.text().copy().formatted(Formatting.ITALIC)); lines.add(GuiText.Unformatted.text().copy().formatted(Formatting.ITALIC));
@@ -111,7 +112,7 @@ public class SpatialStorageCellItem extends AEBaseItem implements ISpatialStorag
@Override @Override
public boolean doSpatialTransition(final ItemStack is, final ServerWorld w, final WorldCoord min, public boolean doSpatialTransition(final ItemStack is, final ServerWorld w, final WorldCoord min,
final WorldCoord max, int playerId) { final WorldCoord max, int playerId) {
final int targetX = max.x - min.x - 1; final int targetX = max.x - min.x - 1;
final int targetY = max.y - min.y - 1; final int targetY = max.y - min.y - 1;
final int targetZ = max.z - min.z - 1; final int targetZ = max.z - min.z - 1;
@@ -142,8 +143,8 @@ public class SpatialStorageCellItem extends AEBaseItem implements ISpatialStorag
} }
// Store some information about this transition in the plot // Store some information about this transition in the plot
TransitionInfo info = new TransitionInfo(w.getRegistryKey().getValue(), min.getBlockPos(), TransitionInfo info = new TransitionInfo(w.getRegistryKey().getValue(), min.getBlockPos(), max.getBlockPos(),
max.getBlockPos(), Instant.now()); Instant.now());
manager.setLastTransition(plot.getId(), info); manager.setLastTransition(plot.getId(), info);
try { try {
@@ -1,10 +1,11 @@
package appeng.mixins; package appeng.mixins;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.tag.FluidTags; import net.minecraft.tag.FluidTags;
import net.minecraft.tag.Tag; import net.minecraft.tag.Tag;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin(FluidTags.class) @Mixin(FluidTags.class)
public interface FluidTagsAccessor { public interface FluidTagsAccessor {
+6 -4
View File
@@ -1,14 +1,16 @@
package appeng.mixins; package appeng.mixins;
import appeng.hooks.HopperHooks;
import net.minecraft.block.entity.Hopper;
import net.minecraft.block.entity.HopperBlockEntity;
import net.minecraft.util.ActionResult;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.block.entity.Hopper;
import net.minecraft.block.entity.HopperBlockEntity;
import net.minecraft.util.ActionResult;
import appeng.hooks.HopperHooks;
// SEE: https://github.com/AlexIIL/LibBlockAttributes/pull/27 // SEE: https://github.com/AlexIIL/LibBlockAttributes/pull/27
@SuppressWarnings("ConstantConditions") @SuppressWarnings("ConstantConditions")
@Mixin(HopperBlockEntity.class) @Mixin(HopperBlockEntity.class)
@@ -3,12 +3,13 @@ package appeng.mixins.spatial;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.dimension.DimensionOptions;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.ModifyVariable;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.dimension.DimensionOptions;
import appeng.spatial.SpatialStorageDimensionIds; import appeng.spatial.SpatialStorageDimensionIds;
/** /**
@@ -1,18 +1,20 @@
package appeng.mixins.spatial; package appeng.mixins.spatial;
import appeng.spatial.SpatialStorageDimensionIds; import java.util.OptionalLong;
import net.minecraft.tag.BlockTags;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.DynamicRegistryManager;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.dimension.DimensionType;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker; import org.spongepowered.asm.mixin.gen.Invoker;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.OptionalLong; import net.minecraft.tag.BlockTags;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.DynamicRegistryManager;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.dimension.DimensionType;
import appeng.spatial.SpatialStorageDimensionIds;
/** /**
* Adds the storage cell world dimension type as a built-in dimension type. This * Adds the storage cell world dimension type as a built-in dimension type. This
@@ -23,17 +25,21 @@ import java.util.OptionalLong;
public class DimensionTypeMixin { public class DimensionTypeMixin {
@Invoker("<init>") @Invoker("<init>")
static DimensionType create(OptionalLong fixedTime, boolean hasSkylight, boolean hasCeiling, boolean ultrawarm, boolean natural, double coordinateScale, boolean piglinSafe, boolean bedWorks, boolean respawnAnchorWorks, boolean hasRaids, int logicalHeight, Identifier infiniburn, Identifier skyProperties, float ambientLight) { static DimensionType create(OptionalLong fixedTime, boolean hasSkylight, boolean hasCeiling, boolean ultrawarm,
boolean natural, double coordinateScale, boolean piglinSafe, boolean bedWorks, boolean respawnAnchorWorks,
boolean hasRaids, int logicalHeight, Identifier infiniburn, Identifier skyProperties, float ambientLight) {
throw new AssertionError(); throw new AssertionError();
} }
@Inject(method = "addRegistryDefaults", at = @At("TAIL")) @Inject(method = "addRegistryDefaults", at = @At("TAIL"))
private static void addRegistryDefaults(DynamicRegistryManager.Impl registryTracker, CallbackInfoReturnable<?> cir) { private static void addRegistryDefaults(DynamicRegistryManager.Impl registryTracker,
DimensionType dimensionType = create(OptionalLong.of(12000), false, false, false, false, 1.0, CallbackInfoReturnable<?> cir) {
false, false, false, false, 256, BlockTags.INFINIBURN_OVERWORLD.getId(), SpatialStorageDimensionIds.SKY_PROPERTIES_ID, 1.0f); DimensionType dimensionType = create(OptionalLong.of(12000), false, false, false, false, 1.0, false, false,
false, false, 256, BlockTags.INFINIBURN_OVERWORLD.getId(), SpatialStorageDimensionIds.SKY_PROPERTIES_ID,
1.0f);
Registry.register(registryTracker.getDimensionTypes(), Registry.register(registryTracker.getDimensionTypes(), SpatialStorageDimensionIds.DIMENSION_TYPE_ID.getValue(),
SpatialStorageDimensionIds.DIMENSION_TYPE_ID.getValue(), dimensionType); dimensionType);
} }
} }
@@ -1,18 +1,20 @@
package appeng.mixins.spatial; package appeng.mixins.spatial;
import appeng.spatial.SpatialStorageDimensionIds;
import appeng.spatial.SpatialStorageHelper;
import net.minecraft.entity.Entity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.TeleportTarget;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.entity.Entity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.TeleportTarget;
import appeng.spatial.SpatialStorageDimensionIds;
import appeng.spatial.SpatialStorageHelper;
/** /**
* This mixin sets the teleport destination, because otherwise Vanilla will not move * This mixin sets the teleport destination, because otherwise Vanilla will not
* the player. * move the player.
*/ */
@Mixin(Entity.class) @Mixin(Entity.class)
public class EntityMixin { public class EntityMixin {
@@ -1,16 +1,19 @@
package appeng.mixins.spatial; package appeng.mixins.spatial;
import appeng.spatial.SpatialStorageDimensionIds;
import appeng.spatial.SpatialStorageSkyProperties;
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
import net.minecraft.client.render.SkyProperties;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.client.render.SkyProperties;
import net.minecraft.util.Identifier;
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
import appeng.spatial.SpatialStorageDimensionIds;
import appeng.spatial.SpatialStorageSkyProperties;
@Mixin(SkyProperties.class) @Mixin(SkyProperties.class)
public class SkyPropertiesMixin { public class SkyPropertiesMixin {
@@ -1,9 +1,10 @@
package appeng.mixins.unlitquad; package appeng.mixins.unlitquad;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import net.minecraft.client.render.model.BakedQuad; import net.minecraft.client.render.model.BakedQuad;
import net.minecraft.client.texture.Sprite; import net.minecraft.client.texture.Sprite;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(BakedQuad.class) @Mixin(BakedQuad.class)
public interface BakedQuadAccessor { public interface BakedQuadAccessor {
@@ -1,6 +1,10 @@
package appeng.mixins.unlitquad; package appeng.mixins.unlitquad;
import appeng.hooks.UnlitQuadHooks; 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 net.minecraft.client.render.model.BakedQuad; import net.minecraft.client.render.model.BakedQuad;
import net.minecraft.client.render.model.ModelBakeSettings; import net.minecraft.client.render.model.ModelBakeSettings;
import net.minecraft.client.render.model.json.JsonUnbakedModel; import net.minecraft.client.render.model.json.JsonUnbakedModel;
@@ -9,10 +13,8 @@ import net.minecraft.client.render.model.json.ModelElementFace;
import net.minecraft.client.texture.Sprite; import net.minecraft.client.texture.Sprite;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import appeng.hooks.UnlitQuadHooks;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
/** /**
* This mixin hooks into conversion from {@link ModelElementFace} to * This mixin hooks into conversion from {@link ModelElementFace} to
@@ -25,7 +27,7 @@ public class JsonUnbakedModelMixin {
@Inject(method = "createQuad", at = @At("RETURN"), cancellable = true, require = 1, allow = 1) @Inject(method = "createQuad", at = @At("RETURN"), cancellable = true, require = 1, allow = 1)
private static void onBakeFace(ModelElement element, ModelElementFace elementFace, Sprite sprite, Direction side, private static void onBakeFace(ModelElement element, ModelElementFace elementFace, Sprite sprite, Direction side,
ModelBakeSettings settings, Identifier id, CallbackInfoReturnable<BakedQuad> cri) { ModelBakeSettings settings, Identifier id, CallbackInfoReturnable<BakedQuad> cri) {
if (elementFace instanceof UnlitQuadHooks.UnlitModelElementFace) { if (elementFace instanceof UnlitQuadHooks.UnlitModelElementFace) {
cri.setReturnValue(UnlitQuadHooks.makeUnlit(cri.getReturnValue())); cri.setReturnValue(UnlitQuadHooks.makeUnlit(cri.getReturnValue()));
} }
@@ -1,15 +1,18 @@
package appeng.mixins.unlitquad; package appeng.mixins.unlitquad;
import appeng.hooks.UnlitQuadHooks; import java.lang.reflect.Type;
import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import net.minecraft.client.render.model.json.ModelElementFace;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.lang.reflect.Type; import net.minecraft.client.render.model.json.ModelElementFace;
import appeng.hooks.UnlitQuadHooks;
/** /**
* This mixin will call the hook to deserialize the unlit property, but only if * This mixin will call the hook to deserialize the unlit property, but only if
@@ -20,7 +23,7 @@ public class ModelElementFaceDeserializerMixin {
@Inject(method = "deserialize", at = @At("RETURN"), cancellable = true, allow = 1, remap = false) @Inject(method = "deserialize", at = @At("RETURN"), cancellable = true, allow = 1, remap = false)
public void onDeserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext, public void onDeserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext,
CallbackInfoReturnable<ModelElementFace> cri) { CallbackInfoReturnable<ModelElementFace> cri) {
if (!UnlitQuadHooks.isUnlitExtensionEnabled()) { if (!UnlitQuadHooks.isUnlitExtensionEnabled()) {
return; // Not in a model that activated the deserializer return; // Not in a model that activated the deserializer
} }
@@ -1,15 +1,17 @@
package appeng.mixins.unlitquad; package appeng.mixins.unlitquad;
import appeng.hooks.UnlitQuadHooks; import java.io.IOException;
import net.minecraft.client.render.model.ModelLoader;
import net.minecraft.client.render.model.json.JsonUnbakedModel;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.io.IOException; import net.minecraft.client.render.model.ModelLoader;
import net.minecraft.client.render.model.json.JsonUnbakedModel;
import net.minecraft.util.Identifier;
import appeng.hooks.UnlitQuadHooks;
/** /**
* The only job of this mixin is to only enable the unlit extensions if the * The only job of this mixin is to only enable the unlit extensions if the
@@ -18,7 +18,33 @@
package appeng.parts.automation; package appeng.parts.automation;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.AutomaticItemPlacementContext;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import alexiil.mc.lib.attributes.item.FixedItemInv; import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.api.config.AccessRestriction; import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode; import appeng.api.config.FuzzyMode;
@@ -53,30 +79,6 @@ import appeng.util.Platform;
import appeng.util.inv.InvOperation; import appeng.util.inv.InvOperation;
import appeng.util.prioritylist.FuzzyPriorityList; import appeng.util.prioritylist.FuzzyPriorityList;
import appeng.util.prioritylist.PrecisePriorityList; import appeng.util.prioritylist.PrecisePriorityList;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.AutomaticItemPlacementContext;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class FormationPlanePart extends AbstractFormationPlanePart<IAEItemStack> { public class FormationPlanePart extends AbstractFormationPlanePart<IAEItemStack> {
@@ -361,8 +363,8 @@ public class FormationPlanePart extends AbstractFormationPlanePart<IAEItemStack>
} }
/** /**
* A custom {@link AutomaticItemPlacementContext} which also accepts a player needed * A custom {@link AutomaticItemPlacementContext} which also accepts a player
* various blocks like seeds. * needed various blocks like seeds.
* <p> * <p>
* Also removed {@link AutomaticItemPlacementContext#canReplaceExisting} as this * Also removed {@link AutomaticItemPlacementContext#canReplaceExisting} as this
* can cause a {@link StackOverflowError} for certain replaceable blocks. * can cause a {@link StackOverflowError} for certain replaceable blocks.
@@ -371,7 +373,7 @@ public class FormationPlanePart extends AbstractFormationPlanePart<IAEItemStack>
private final Direction lookDirection; private final Direction lookDirection;
public PlaneDirectionalPlaceContext(World world, PlayerEntity player, BlockPos pos, Direction lookDirection, public PlaneDirectionalPlaceContext(World world, PlayerEntity player, BlockPos pos, Direction lookDirection,
ItemStack itemStack, Direction facing) { ItemStack itemStack, Direction facing) {
super(world, player, Hand.MAIN_HAND, itemStack, super(world, player, Hand.MAIN_HAND, itemStack,
new BlockHitResult(Vec3d.ofBottomCenter(pos), facing, pos, false)); new BlockHitResult(Vec3d.ofBottomCenter(pos), facing, pos, false));
this.lookDirection = lookDirection; this.lookDirection = lookDirection;
@@ -397,13 +399,13 @@ public class FormationPlanePart extends AbstractFormationPlanePart<IAEItemStack>
switch (this.lookDirection) { switch (this.lookDirection) {
case DOWN: case DOWN:
default: default:
return new Direction[]{Direction.DOWN, Direction.NORTH, Direction.EAST, Direction.SOUTH, return new Direction[] { Direction.DOWN, Direction.NORTH, Direction.EAST, Direction.SOUTH,
Direction.WEST, Direction.UP}; Direction.WEST, Direction.UP };
case UP: case UP:
return new Direction[]{Direction.DOWN, Direction.UP, Direction.NORTH, Direction.EAST, return new Direction[] { Direction.DOWN, Direction.UP, Direction.NORTH, Direction.EAST,
Direction.SOUTH, Direction.WEST}; Direction.SOUTH, Direction.WEST };
case NORTH: case NORTH:
return new Direction[]{Direction.DOWN, Direction.NORTH, Direction.EAST, Direction.WEST, return new Direction[] { Direction.DOWN, Direction.NORTH, Direction.EAST, Direction.WEST,
Direction.UP, Direction.SOUTH }; Direction.UP, Direction.SOUTH };
case SOUTH: case SOUTH:
return new Direction[] { Direction.DOWN, Direction.SOUTH, Direction.EAST, Direction.WEST, return new Direction[] { Direction.DOWN, Direction.SOUTH, Direction.EAST, Direction.WEST,
@@ -18,6 +18,15 @@
package appeng.parts.p2p; package appeng.parts.p2p;
import java.util.List;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import alexiil.mc.lib.attributes.Attribute; import alexiil.mc.lib.attributes.Attribute;
import alexiil.mc.lib.attributes.AttributeList; import alexiil.mc.lib.attributes.AttributeList;
import alexiil.mc.lib.attributes.SearchOptions; import alexiil.mc.lib.attributes.SearchOptions;
@@ -31,18 +40,11 @@ import alexiil.mc.lib.attributes.fluid.impl.EmptyFluidExtractable;
import alexiil.mc.lib.attributes.fluid.impl.RejectingFluidInsertable; import alexiil.mc.lib.attributes.fluid.impl.RejectingFluidInsertable;
import alexiil.mc.lib.attributes.fluid.volume.FluidKey; import alexiil.mc.lib.attributes.fluid.volume.FluidKey;
import alexiil.mc.lib.attributes.fluid.volume.FluidVolume; import alexiil.mc.lib.attributes.fluid.volume.FluidVolume;
import appeng.api.config.PowerUnits; import appeng.api.config.PowerUnits;
import appeng.api.parts.IPartModel; import appeng.api.parts.IPartModel;
import appeng.items.parts.PartModels; import appeng.items.parts.PartModels;
import appeng.me.GridAccessException; import appeng.me.GridAccessException;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import java.util.List;
public class FluidP2PTunnelPart extends P2PTunnelPart<FluidP2PTunnelPart> { public class FluidP2PTunnelPart extends P2PTunnelPart<FluidP2PTunnelPart> {
@@ -93,7 +95,8 @@ public class FluidP2PTunnelPart extends P2PTunnelPart<FluidP2PTunnelPart> {
return MODELS.getModel(this.isPowered(), this.isActive()); return MODELS.getModel(this.isPowered(), this.isActive());
} }
// Gets the given attribute (or the defaultValue) of the block that this part attaches to // Gets the given attribute (or the defaultValue) of the block that this part
// attaches to
private <T> T getAttachedAttribute(Attribute<T> attribute, T defaultValue) { private <T> T getAttachedAttribute(Attribute<T> attribute, T defaultValue) {
T result = null; T result = null;
if (this.isActive()) { if (this.isActive()) {
@@ -138,7 +141,8 @@ public class FluidP2PTunnelPart extends P2PTunnelPart<FluidP2PTunnelPart> {
} }
if (simulation.isAction()) { if (simulation.isAction()) {
FluidP2PTunnelPart.this.queueTunnelDrain(PowerUnits.RF, amount.sub(overflowAmount).asInexactDouble() * 1000); FluidP2PTunnelPart.this.queueTunnelDrain(PowerUnits.RF,
amount.sub(overflowAmount).asInexactDouble() * 1000);
} }
} catch (GridAccessException ignored) { } catch (GridAccessException ignored) {
} }
+2 -2
View File
@@ -49,8 +49,8 @@ public final class AECommand {
private void add(LiteralArgumentBuilder<ServerCommandSource> builder, Commands subCommand) { private void add(LiteralArgumentBuilder<ServerCommandSource> builder, Commands subCommand) {
LiteralArgumentBuilder<ServerCommandSource> subCommandBuilder = literal(subCommand.name().toLowerCase(Locale.ROOT)) LiteralArgumentBuilder<ServerCommandSource> subCommandBuilder = literal(
.requires(src -> src.hasPermissionLevel(subCommand.level)); subCommand.name().toLowerCase(Locale.ROOT)).requires(src -> src.hasPermissionLevel(subCommand.level));
subCommand.command.addArguments(subCommandBuilder); subCommand.command.addArguments(subCommandBuilder);
subCommandBuilder.executes(ctx -> { subCommandBuilder.executes(ctx -> {
MinecraftServer server = AppEng.instance().getServer(); MinecraftServer server = AppEng.instance().getServer();
@@ -1,5 +1,7 @@
package appeng.server.subcommands; package appeng.server.subcommands;
import static net.minecraft.server.command.CommandManager.literal;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
@@ -7,7 +9,6 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.function.UnaryOperator; import java.util.function.UnaryOperator;
import appeng.core.AppEng;
import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.context.CommandContext;
@@ -16,6 +17,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.command.CommandException; import net.minecraft.command.CommandException;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.ClickEvent; import net.minecraft.text.ClickEvent;
@@ -29,6 +31,7 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import appeng.core.Api; import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.worlddata.WorldData; import appeng.core.worlddata.WorldData;
import appeng.items.storage.SpatialStorageCellItem; import appeng.items.storage.SpatialStorageCellItem;
import appeng.server.ISubCommand; import appeng.server.ISubCommand;
@@ -37,9 +40,6 @@ import appeng.spatial.SpatialStoragePlot;
import appeng.spatial.SpatialStoragePlotManager; import appeng.spatial.SpatialStoragePlotManager;
import appeng.spatial.TransitionInfo; import appeng.spatial.TransitionInfo;
import net.minecraft.server.command.CommandManager;
import static net.minecraft.server.command.CommandManager.literal;
/** /**
* This admin command allows management of spatial storage plots. * This admin command allows management of spatial storage plots.
*/ */
@@ -58,11 +58,12 @@ public class SpatialStorageCommand implements ISubCommand {
}))); })));
// Teleport into the plot // Teleport into the plot
builder.then(literal("tp").then(CommandManager.argument("plotId", IntegerArgumentType.integer(1)).executes(ctx -> { builder.then(
int plotId = IntegerArgumentType.getInteger(ctx, "plotId"); literal("tp").then(CommandManager.argument("plotId", IntegerArgumentType.integer(1)).executes(ctx -> {
teleportToPlot(ctx.getSource(), plotId); int plotId = IntegerArgumentType.getInteger(ctx, "plotId");
return 1; teleportToPlot(ctx.getSource(), plotId);
}))); return 1;
})));
// Teleport from the current plot back to the source of its content, or do the // Teleport from the current plot back to the source of its content, or do the
// same for a given plot id // same for a given plot id
@@ -76,8 +77,8 @@ public class SpatialStorageCommand implements ISubCommand {
}))); })));
// Creates a storage cell for the given plot id and gives it to the player // Creates a storage cell for the given plot id and gives it to the player
builder.then( builder.then(literal("givecell")
literal("givecell").then(CommandManager.argument("plotId", IntegerArgumentType.integer(1)).executes(ctx -> { .then(CommandManager.argument("plotId", IntegerArgumentType.integer(1)).executes(ctx -> {
int plotId = IntegerArgumentType.getInteger(ctx, "plotId"); int plotId = IntegerArgumentType.getInteger(ctx, "plotId");
giveCell(ctx.getSource(), plotId); giveCell(ctx.getSource(), plotId);
return 1; return 1;
@@ -120,8 +121,7 @@ public class SpatialStorageCommand implements ISubCommand {
private void teleportBack(ServerCommandSource source, SpatialStoragePlot plot) { private void teleportBack(ServerCommandSource source, SpatialStoragePlot plot) {
TransitionInfo lastTransition = plot.getLastTransition(); TransitionInfo lastTransition = plot.getLastTransition();
if (lastTransition == null) { if (lastTransition == null) {
throw new CommandException( throw new CommandException(Text.of("This plot doesn't have a last known transition."));
Text.of("This plot doesn't have a last known transition."));
} }
String command = getTeleportCommand(lastTransition.getWorldId(), lastTransition.getMin().add(0, 1, 0)); String command = getTeleportCommand(lastTransition.getWorldId(), lastTransition.getMin().add(0, 1, 0));
@@ -168,8 +168,8 @@ public class SpatialStorageCommand implements ISubCommand {
// clickable link to the source) // clickable link to the source)
TransitionInfo lastTransition = plot.getLastTransition(); TransitionInfo lastTransition = plot.getLastTransition();
if (lastTransition != null) { if (lastTransition != null) {
source.sendFeedback(new LiteralText("Last Transition:").formatted(Formatting.UNDERLINE, source.sendFeedback(new LiteralText("Last Transition:").formatted(Formatting.UNDERLINE, Formatting.BOLD),
Formatting.BOLD), true); true);
String sourceWorldId = lastTransition.getWorldId().toString(); String sourceWorldId = lastTransition.getWorldId().toString();
MutableText sourceLink = new LiteralText( MutableText sourceLink = new LiteralText(
@@ -189,8 +189,7 @@ public class SpatialStorageCommand implements ISubCommand {
private static void teleportToPlot(ServerCommandSource source, int plotId) { private static void teleportToPlot(ServerCommandSource source, int plotId) {
SpatialStoragePlot plot = getPlot(plotId); SpatialStoragePlot plot = getPlot(plotId);
String teleportCommand = getTeleportCommand(SpatialStorageDimensionIds.WORLD_ID.getValue(), String teleportCommand = getTeleportCommand(SpatialStorageDimensionIds.WORLD_ID.getValue(), plot.getOrigin());
plot.getOrigin());
runCommandFor(source, teleportCommand); runCommandFor(source, teleportCommand);
} }
@@ -211,8 +210,7 @@ public class SpatialStorageCommand implements ISubCommand {
} }
if (!(cell.getItem() instanceof SpatialStorageCellItem)) { if (!(cell.getItem() instanceof SpatialStorageCellItem)) {
throw new CommandException( throw new CommandException(Text.of("Storage cell items don't implement the storage cell interface!"));
Text.of("Storage cell items don't implement the storage cell interface!"));
} }
SpatialStorageCellItem spatialCellItem = (SpatialStorageCellItem) cell.getItem(); SpatialStorageCellItem spatialCellItem = (SpatialStorageCellItem) cell.getItem();
@@ -251,8 +249,7 @@ public class SpatialStorageCommand implements ISubCommand {
Text tpLink = new LiteralText("Origin: " + origin) Text tpLink = new LiteralText("Origin: " + origin)
.styled(makeCommandLink("/ae2 spatial tp " + plot.getId(), "Click to teleport into plot")); .styled(makeCommandLink("/ae2 spatial tp " + plot.getId(), "Click to teleport into plot"));
Text message = new LiteralText("").append(infoLink) Text message = new LiteralText("").append(infoLink).append(" Size: " + size + " ").append(tpLink);
.append(" Size: " + size + " ").append(tpLink);
sender.sendFeedback(message, true); sender.sendFeedback(message, true);
} }
@@ -266,7 +263,7 @@ public class SpatialStorageCommand implements ISubCommand {
private static UnaryOperator<Style> makeCommandLink(String command, String tooltip) { private static UnaryOperator<Style> makeCommandLink(String command, String tooltip) {
return style -> style.withFormatting(Formatting.UNDERLINE) return style -> style.withFormatting(Formatting.UNDERLINE)
.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command) ) .withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command))
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.of(tooltip))); .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.of(tooltip)));
} }
@@ -290,8 +287,7 @@ public class SpatialStorageCommand implements ISubCommand {
private static void sendKeyValuePair(ServerCommandSource source, String label, Text value) { private static void sendKeyValuePair(ServerCommandSource source, String label, Text value) {
source.sendFeedback( source.sendFeedback(
new LiteralText("") new LiteralText("").append(new LiteralText(label + ": ").formatted(Formatting.BOLD)).append(value),
.append(new LiteralText(label + ": ").formatted(Formatting.BOLD)).append(value),
true); true);
} }
@@ -39,6 +39,7 @@ import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkSection; import net.minecraft.world.chunk.ChunkSection;
import net.minecraft.world.chunk.WorldChunk; import net.minecraft.world.chunk.WorldChunk;
import net.minecraft.world.chunk.light.LightingProvider;
import appeng.api.movable.IMovableHandler; import appeng.api.movable.IMovableHandler;
import appeng.api.movable.IMovableRegistry; import appeng.api.movable.IMovableRegistry;
@@ -47,7 +48,6 @@ import appeng.api.util.WorldCoord;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.core.Api; import appeng.core.Api;
import appeng.core.worlddata.WorldData; import appeng.core.worlddata.WorldData;
import net.minecraft.world.chunk.light.LightingProvider;
public class CachedPlane { public class CachedPlane {
private final int x_size; private final int x_size;
@@ -68,8 +68,8 @@ public class CachedPlane {
private int verticalBits; private int verticalBits;
private final BlockState matrixBlockState; private final BlockState matrixBlockState;
public CachedPlane(final ServerWorld w, final int minX, final int minY, final int minZ, final int maxX, final int maxY, public CachedPlane(final ServerWorld w, final int minX, final int minY, final int minZ, final int maxX,
final int maxZ) { final int maxY, final int maxZ) {
Block matrixFrameBlock = Api.instance().definitions().blocks().matrixFrame().maybeBlock().orElse(null); Block matrixFrameBlock = Api.instance().definitions().blocks().matrixFrame().maybeBlock().orElse(null);
if (matrixFrameBlock != null) { if (matrixFrameBlock != null) {
@@ -327,8 +327,8 @@ public class CachedPlane {
// FIXME this was sending chunks to players... // FIXME this was sending chunks to players...
ChunkDataS2CPacket cdp = new ChunkDataS2CPacket(c, verticalBits); ChunkDataS2CPacket cdp = new ChunkDataS2CPacket(c, verticalBits);
world.getChunkManager().threadedAnvilChunkStorage world.getChunkManager().threadedAnvilChunkStorage.getPlayersWatchingChunk(c.getPos(), false)
.getPlayersWatchingChunk(c.getPos(), false).forEach(spe -> spe.networkHandler.sendPacket(cdp)); .forEach(spe -> spe.networkHandler.sendPacket(cdp));
} }
} }
@@ -36,9 +36,8 @@ public class SpatialStorageBiome {
.build()) .build())
.precipitation(Biome.Precipitation.NONE).category(Biome.Category.NONE).depth(0).scale(1) .precipitation(Biome.Precipitation.NONE).category(Biome.Category.NONE).depth(0).scale(1)
// Copied from the vanilla void biome // Copied from the vanilla void biome
.temperature(0.5F).downfall(0.5F) .temperature(0.5F).downfall(0.5F).effects(new BiomeEffects.Builder().waterColor(4159204)
.effects(new BiomeEffects.Builder().waterColor(4159204).waterFogColor(329011).fogColor(0).skyColor(0x111111) .waterFogColor(329011).fogColor(0).skyColor(0x111111).build())
.build())
.spawnSettings(new SpawnSettings.Builder().creatureSpawnProbability(0).build()).build(); .spawnSettings(new SpawnSettings.Builder().creatureSpawnProbability(0).build()).build();
} }
@@ -18,8 +18,12 @@
package appeng.spatial; package appeng.spatial;
import appeng.core.Api; import java.util.Arrays;
import java.util.Collections;
import java.util.Optional;
import com.mojang.serialization.Codec; import com.mojang.serialization.Codec;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
@@ -38,9 +42,7 @@ import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.chunk.StructuresConfig; import net.minecraft.world.gen.chunk.StructuresConfig;
import net.minecraft.world.gen.chunk.VerticalBlockSample; import net.minecraft.world.gen.chunk.VerticalBlockSample;
import java.util.Arrays; import appeng.core.Api;
import java.util.Collections;
import java.util.Optional;
/** /**
* Chunk generator the spatial storage world. * Chunk generator the spatial storage world.
@@ -49,12 +51,14 @@ public class SpatialStorageChunkGenerator extends ChunkGenerator {
/** /**
* This codec is necessary to restore the actual instance of the Biome we use, * This codec is necessary to restore the actual instance of the Biome we use,
* since it is sources from the dynamic registries and <em>must be the same object as in the registry!</em>. * since it is sources from the dynamic registries and <em>must be the same
* <p>If it was not the same object, then the Object->ID lookup would fail since it uses an identity hashmap * object as in the registry!</em>.
* internally. * <p>
* If it was not the same object, then the Object->ID lookup would fail since it
* uses an identity hashmap internally.
*/ */
public static final Codec<SpatialStorageChunkGenerator> CODEC public static final Codec<SpatialStorageChunkGenerator> CODEC = RegistryLookupCodec.of(Registry.BIOME_KEY)
= RegistryLookupCodec.of(Registry.BIOME_KEY).xmap(SpatialStorageChunkGenerator::new, SpatialStorageChunkGenerator::getBiomeRegistry).stable().codec(); .xmap(SpatialStorageChunkGenerator::new, SpatialStorageChunkGenerator::getBiomeRegistry).stable().codec();
private final Registry<Biome> biomeRegistry; private final Registry<Biome> biomeRegistry;
@@ -74,7 +78,6 @@ public class SpatialStorageChunkGenerator extends ChunkGenerator {
this.columnSample = new VerticalBlockSample(columnSample); this.columnSample = new VerticalBlockSample(columnSample);
} }
@Override @Override
protected Codec<? extends ChunkGenerator> getCodec() { protected Codec<? extends ChunkGenerator> getCodec() {
return CODEC; return CODEC;
@@ -1,6 +1,5 @@
package appeng.spatial; package appeng.spatial;
import appeng.core.AppEng;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey; import net.minecraft.util.registry.RegistryKey;
@@ -9,6 +8,8 @@ import net.minecraft.world.biome.Biome;
import net.minecraft.world.dimension.DimensionOptions; import net.minecraft.world.dimension.DimensionOptions;
import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.dimension.DimensionType;
import appeng.core.AppEng;
/** /**
* IDs for the spatial storage world related dimension objects. * IDs for the spatial storage world related dimension objects.
*/ */
@@ -19,12 +20,12 @@ public final class SpatialStorageDimensionIds {
* <p> * <p>
* This is defined in {@link appeng.mixins.spatial.DimensionTypeMixin}. * This is defined in {@link appeng.mixins.spatial.DimensionTypeMixin}.
*/ */
public static final RegistryKey<DimensionType> DIMENSION_TYPE_ID = RegistryKey public static final RegistryKey<DimensionType> DIMENSION_TYPE_ID = RegistryKey.of(Registry.DIMENSION_TYPE_KEY,
.of(Registry.DIMENSION_TYPE_KEY, AppEng.makeId("spatial_storage")); AppEng.makeId("spatial_storage"));
/** /**
* ID of the {@link net.minecraft.world.gen.chunk.ChunkGenerator} used for the spatial * ID of the {@link net.minecraft.world.gen.chunk.ChunkGenerator} used for the
* storage world. * spatial storage world.
*/ */
public static final Identifier CHUNK_GENERATOR_ID = AppEng.makeId("spatial_storage"); public static final Identifier CHUNK_GENERATOR_ID = AppEng.makeId("spatial_storage");
@@ -32,7 +33,8 @@ public final class SpatialStorageDimensionIds {
* ID of the {@link net.minecraft.world.biome.Biome} used for the spatial * ID of the {@link net.minecraft.world.biome.Biome} used for the spatial
* storage world. * storage world.
*/ */
public static final RegistryKey<Biome> BIOME_KEY = RegistryKey.of(Registry.BIOME_KEY, AppEng.makeId("spatial_storage")); public static final RegistryKey<Biome> BIOME_KEY = RegistryKey.of(Registry.BIOME_KEY,
AppEng.makeId("spatial_storage"));
/** /**
* ID of the {@link DimensionOptions} used for the spatial storage dimension. * ID of the {@link DimensionOptions} used for the spatial storage dimension.
@@ -51,7 +53,8 @@ public final class SpatialStorageDimensionIds {
AppEng.makeId("spatial_storage")); AppEng.makeId("spatial_storage"));
/** /**
* ID of the {@link net.minecraft.client.render.SkyProperties} used for the spatial storage world. * ID of the {@link net.minecraft.client.render.SkyProperties} used for the
* spatial storage world.
*/ */
public static Identifier SKY_PROPERTIES_ID = AppEng.makeId("spatial_storage"); public static Identifier SKY_PROPERTIES_ID = AppEng.makeId("spatial_storage");
@@ -18,9 +18,9 @@
package appeng.spatial; package appeng.spatial;
import appeng.api.util.WorldCoord; import java.util.ArrayList;
import appeng.core.Api; import java.util.List;
import appeng.core.AppEng;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
@@ -35,8 +35,9 @@ import net.minecraft.world.TeleportTarget;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.chunk.ChunkStatus; import net.minecraft.world.chunk.ChunkStatus;
import java.util.ArrayList; import appeng.api.util.WorldCoord;
import java.util.List; import appeng.core.Api;
import appeng.core.AppEng;
public class SpatialStorageHelper { public class SpatialStorageHelper {
@@ -52,7 +53,8 @@ public class SpatialStorageHelper {
private final ThreadLocal<TeleportTarget> teleportTarget = new ThreadLocal<>(); private final ThreadLocal<TeleportTarget> teleportTarget = new ThreadLocal<>();
/** /**
* If an entity is currently being teleported, this will return the target within the target dimension. * If an entity is currently being teleported, this will return the target
* within the target dimension.
*/ */
public TeleportTarget getTeleportTarget() { public TeleportTarget getTeleportTarget() {
return teleportTarget.get(); return teleportTarget.get();
@@ -104,16 +106,13 @@ public class SpatialStorageHelper {
newWorld.getChunkManager().getChunk(MathHelper.floor(link.x) >> 4, MathHelper.floor(link.z) >> 4, newWorld.getChunkManager().getChunk(MathHelper.floor(link.x) >> 4, MathHelper.floor(link.z) >> 4,
ChunkStatus.FULL, true); ChunkStatus.FULL, true);
if (entity instanceof ServerPlayerEntity if (entity instanceof ServerPlayerEntity && link.dim.getRegistryKey() == SpatialStorageDimensionIds.WORLD_ID) {
&& link.dim.getRegistryKey() == SpatialStorageDimensionIds.WORLD_ID) {
AppEng.instance().getAdvancementTriggers().getSpatialExplorer().trigger((ServerPlayerEntity) entity); AppEng.instance().getAdvancementTriggers().getSpatialExplorer().trigger((ServerPlayerEntity) entity);
} }
// Store in a threadlocal so that EntityMixin can return it for the Vanilla logic to use // Store in a threadlocal so that EntityMixin can return it for the Vanilla
teleportTarget.set(new TeleportTarget(new Vec3d(link.x, link.y, link.z), // logic to use
Vec3d.ZERO, teleportTarget.set(new TeleportTarget(new Vec3d(link.x, link.y, link.z), Vec3d.ZERO, entity.yaw, entity.pitch));
entity.yaw,
entity.pitch));
try { try {
entity = entity.moveToWorld(link.dim); entity = entity.moveToWorld(link.dim);
} finally { } finally {
@@ -22,15 +22,15 @@ import java.util.List;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import appeng.core.AppEng;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.TeleportTarget;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.core.Api; import appeng.core.Api;
import net.minecraft.world.TeleportTarget; import appeng.core.AppEng;
/** /**
* Allocates and manages plots for spatial storage in the spatial storage world. * Allocates and manages plots for spatial storage in the spatial storage world.
@@ -18,12 +18,10 @@
package appeng.tile; package appeng.tile;
import alexiil.mc.lib.attributes.AttributeList; import java.util.List;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import alexiil.mc.lib.attributes.item.impl.EmptyFixedItemInv; import javax.annotation.Nonnull;
import appeng.util.helpers.ItemHandlerUtil;
import appeng.util.inv.IAEAppEngInventory;
import appeng.util.inv.InvOperation;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -32,8 +30,13 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull; import alexiil.mc.lib.attributes.AttributeList;
import java.util.List; import alexiil.mc.lib.attributes.item.FixedItemInv;
import alexiil.mc.lib.attributes.item.impl.EmptyFixedItemInv;
import appeng.util.helpers.ItemHandlerUtil;
import appeng.util.inv.IAEAppEngInventory;
import appeng.util.inv.InvOperation;
public abstract class AEBaseInvBlockEntity extends AEBaseBlockEntity implements IAEAppEngInventory { public abstract class AEBaseInvBlockEntity extends AEBaseBlockEntity implements IAEAppEngInventory {
@@ -18,21 +18,23 @@
package appeng.tile.inventory; package appeng.tile.inventory;
import java.util.Arrays;
import java.util.Iterator;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import alexiil.mc.lib.attributes.Simulation; import alexiil.mc.lib.attributes.Simulation;
import alexiil.mc.lib.attributes.item.FixedItemInv; import alexiil.mc.lib.attributes.item.FixedItemInv;
import alexiil.mc.lib.attributes.item.LimitedFixedItemInv; import alexiil.mc.lib.attributes.item.LimitedFixedItemInv;
import alexiil.mc.lib.attributes.item.filter.ConstantItemFilter; import alexiil.mc.lib.attributes.item.filter.ConstantItemFilter;
import alexiil.mc.lib.attributes.item.filter.ItemFilter; import alexiil.mc.lib.attributes.item.filter.ItemFilter;
import alexiil.mc.lib.attributes.item.impl.DirectFixedItemInv; import alexiil.mc.lib.attributes.item.impl.DirectFixedItemInv;
import appeng.util.Platform; import appeng.util.Platform;
import appeng.util.inv.IAEAppEngInventory; import appeng.util.inv.IAEAppEngInventory;
import appeng.util.inv.InvOperation; import appeng.util.inv.InvOperation;
import appeng.util.inv.filter.IAEItemFilter; import appeng.util.inv.filter.IAEItemFilter;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import java.util.Arrays;
import java.util.Iterator;
// FIXME: the filtering is not correctly implemented and need to be reworked // FIXME: the filtering is not correctly implemented and need to be reworked
public class AppEngInternalInventory extends DirectFixedItemInv implements Iterable<ItemStack> { public class AppEngInternalInventory extends DirectFixedItemInv implements Iterable<ItemStack> {
@@ -18,15 +18,17 @@
package appeng.util.inv; package appeng.util.inv;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import alexiil.mc.lib.attributes.Simulation; import alexiil.mc.lib.attributes.Simulation;
import alexiil.mc.lib.attributes.item.FixedItemInv; import alexiil.mc.lib.attributes.item.FixedItemInv;
import alexiil.mc.lib.attributes.item.ItemStackUtil; import alexiil.mc.lib.attributes.item.ItemStackUtil;
import alexiil.mc.lib.attributes.item.filter.ItemFilter; import alexiil.mc.lib.attributes.item.filter.ItemFilter;
import alexiil.mc.lib.attributes.item.impl.DelegatingFixedItemInv; import alexiil.mc.lib.attributes.item.impl.DelegatingFixedItemInv;
import appeng.util.inv.filter.IAEItemFilter;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull; import appeng.util.inv.filter.IAEItemFilter;
// FIXME: Needs to be double checked, LBA has better ways of doing this // FIXME: Needs to be double checked, LBA has better ways of doing this
public class WrapperFilteredItemHandler extends DelegatingFixedItemInv { public class WrapperFilteredItemHandler extends DelegatingFixedItemInv {
@@ -121,7 +121,8 @@ public class MeteoriteStructureStart extends StructureStart<DefaultFeatureConfig
} }
private CraterType determineCraterType(Biome biome) { private CraterType determineCraterType(Biome biome) {
// The temperature thresholds below are taken from older Vanilla code (temperature categories) // The temperature thresholds below are taken from older Vanilla code
// (temperature categories)
final float temp = biome.getTemperature(); final float temp = biome.getTemperature();
final Category category = biome.getCategory(); final Category category = biome.getCategory();
@@ -1,6 +1,3 @@
{ {
"values": [ "values": ["#c:quartz", "appliedenergistics2:purified_nether_quartz_crystal"]
"#c:quartz",
"appliedenergistics2:purified_nether_quartz_crystal"
]
} }