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
@@ -175,8 +175,8 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
slot.drawContent(getClient(), mouseX, mouseY, partialTicks);
if (this.isPointWithinBounds(left, top, slot.getTooltipAreaWidth(), slot.getTooltipAreaHeight(), mouseX, mouseY)
&& slot.canClick(getPlayer())) {
if (this.isPointWithinBounds(left, top, slot.getTooltipAreaWidth(), slot.getTooltipAreaHeight(), mouseX,
mouseY) && slot.canClick(getPlayer())) {
RenderSystem.colorMask(true, true, true, false);
this.fillGradient(matrices, left, top, right, bottom, -2130706433, -2130706433);
RenderSystem.colorMask(true, true, true, true);
@@ -206,7 +206,8 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
if (!tooltipText.isEmpty()) {
String[] lines = tooltipText.split("\n"); // FIXME FABRIC
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 (?)
@@ -95,8 +95,7 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
@Override
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,
4210752);
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.InterfaceTerminal.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
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.StoredPower.withSuffix(": " + Platform.formatPowerLong(handler.getCurrentPower(), false)), 13, 16,
4210752);
GuiText.StoredPower.withSuffix(": " + Platform.formatPowerLong(handler.getCurrentPower(), false)), 13,
16, 4210752);
this.textRenderer.draw(matrices,
GuiText.MaxPower.withSuffix(": " + Platform.formatPowerLong(handler.getMaxPower(), false)), 13, 26,
4210752);
this.textRenderer.draw(matrices,
GuiText.PowerInputRate.withSuffix(": " + Platform.formatPowerLong(handler.getAverageAddition(), true)), 13,
143 - 10, 4210752);
GuiText.PowerInputRate.withSuffix(": " + Platform.formatPowerLong(handler.getAverageAddition(), true)),
13, 143 - 10, 4210752);
this.textRenderer.draw(matrices,
GuiText.PowerUsageRate.withSuffix(": " + Platform.formatPowerLong(handler.getPowerUsage(), true)), 13,
143 - 20, 4210752);
@@ -9,13 +9,13 @@ import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.Element;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.NumberEntryType;
import appeng.client.gui.widgets.ITickingWidget;
import appeng.client.gui.widgets.NumberBox;
import appeng.core.AEConfig;
import net.minecraft.text.Text;
/**
* 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
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,
4210752);
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.QuantumLinkChamber.text()), 8, 6, 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
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,
4210752);
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.QuartzCuttingKnife.text()), 8, 6, 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);
this.textRenderer.draw(matrices, text, 13, 93, 4210752);
} else {
this.textRenderer.draw(matrices, GuiText.SCSSize.withSuffix(": ").append(GuiText.SCSInvalid.text()),
13, 93, 4210752);
this.textRenderer.draw(matrices, GuiText.SCSSize.withSuffix(": ").append(GuiText.SCSInvalid.text()), 13, 93,
4210752);
}
}
@@ -51,8 +51,7 @@ public class VibrationChamberScreen extends AEBaseScreen<VibrationChamberContain
@Override
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,
4210752);
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.VibrationChamber.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.pb.setFullMsg(new LiteralText(VibrationChamberBlockEntity.POWER_PER_TICK
@@ -18,10 +18,10 @@
package appeng.client.gui.widgets;
import net.minecraft.text.Text;
import javax.annotation.Nonnull;
import net.minecraft.text.Text;
/**
* AEBaseGui controlled Tooltip Interface.
*/
@@ -97,7 +97,8 @@ public class QuadRotator implements RenderContext.QuadTransform {
MutableQuadViewImpl quadImpl = (MutableQuadViewImpl) quad;
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.
Direction nominalFace = quad.nominalFace();
Direction cullFace = quad.cullFace();
+53 -49
View File
@@ -1,5 +1,54 @@
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.definitions.IBlocks;
import appeng.api.definitions.IItems;
@@ -101,53 +150,6 @@ import appeng.worldgen.BiomeModifier;
import appeng.worldgen.ChargedQuartzOreConfig;
import appeng.worldgen.ChargedQuartzOreFeature;
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 {
@@ -610,8 +612,10 @@ public abstract class AppEngBase implements AppEng {
}
private void registerDimension() {
BuiltinRegistries.add(BuiltinRegistries.BIOME, SpatialStorageDimensionIds.BIOME_KEY.getValue(), SpatialStorageBiome.INSTANCE);
Registry.register(Registry.CHUNK_GENERATOR, SpatialStorageDimensionIds.CHUNK_GENERATOR_ID, SpatialStorageChunkGenerator.CODEC);
BuiltinRegistries.add(BuiltinRegistries.BIOME, SpatialStorageDimensionIds.BIOME_KEY.getValue(),
SpatialStorageBiome.INSTANCE);
Registry.register(Registry.CHUNK_GENERATOR, SpatialStorageDimensionIds.CHUNK_GENERATOR_ID,
SpatialStorageChunkGenerator.CODEC);
}
}
@@ -125,8 +125,7 @@ public class FluidTerminalScreen extends AEBaseMEScreen<FluidTerminalContainer>
@Override
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,
4210752);
this.textRenderer.draw(matrices, this.getGuiDisplayName(new LiteralText("Fluid Terminal")), 8, 6, 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();
setZOffset(currentZIndex);
drawTexture(matrices, guileft + this.getTooltipAreaX() - 1, guitop + this.getTooltipAreaY() - 1, this.srcX - 1, this.srcY - 1,
this.getTooltipAreaWidth() + 2, this.getTooltipAreaHeight() + 2);
drawTexture(matrices, guileft + this.getTooltipAreaX() - 1, guitop + this.getTooltipAreaY() - 1, this.srcX - 1,
this.srcY - 1, this.getTooltipAreaWidth() + 2, this.getTooltipAreaHeight() + 2);
setZOffset(oldZOffset);
}
}
@@ -6,7 +6,6 @@ import java.util.List;
import javax.annotation.Nonnull;
import appeng.mixins.FluidTagsAccessor;
import net.minecraft.block.BlockState;
import net.minecraft.block.FluidDrainable;
import net.minecraft.block.entity.BlockEntity;
@@ -48,6 +47,7 @@ import appeng.fluids.util.AEFluidStack;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
import appeng.me.helpers.MachineSource;
import appeng.mixins.FluidTagsAccessor;
import appeng.parts.BasicStatePart;
import appeng.parts.automation.PlaneConnectionHelper;
import appeng.parts.automation.PlaneConnections;
@@ -56,7 +56,8 @@ import appeng.util.Platform;
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",
"part/fluid_annihilation_plane_on");
+18 -13
View File
@@ -1,12 +1,5 @@
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.entity.Hopper;
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.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
public final class HopperHooks {
@@ -31,7 +32,8 @@ public final class HopperHooks {
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) {
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);
/**
* Tries to extract items from an inventory above the given hopper into the hopper.
* Note that the given hopper can also be a hopper minecart.
* Tries to extract items from an inventory above the given hopper into the
* hopper. Note that the given hopper can also be a hopper minecart.
*/
public static ActionResult tryExtract(Hopper hopper) {
World world = hopper.getWorld();
@@ -82,9 +84,12 @@ public final class HopperHooks {
}
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)
// defer to Vanilla to avoid injecting ourselves inbetween Vanilla blocks needlessly.
// ItemAttributes.INSERTABLE would return an auto-converted Inventory in such cases.
// If there's a TE at the target position that implements Inventory (such that
// Hopper would handle it itself)
// 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;
}
@@ -3,8 +3,6 @@ package appeng.hooks;
import com.google.gson.JsonElement;
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.VertexFormat;
import net.minecraft.client.render.VertexFormatElement;
@@ -17,6 +15,9 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
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
* models by specifying an "unlit" boolean property on the face.
@@ -100,7 +101,8 @@ public class UnlitQuadHooks {
* {@link #makeUnlit(BakedQuad)}.
*/
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);
}
}
@@ -22,15 +22,6 @@ import java.time.Instant;
import java.util.List;
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.Environment;
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.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 {
private static final String TAG_PLOT_ID = "plot_id";
@@ -62,7 +63,7 @@ public class SpatialStorageCellItem extends AEBaseItem implements ISpatialStorag
@Environment(EnvType.CLIENT)
@Override
public void appendTooltip(final ItemStack stack, final World world, final List<Text> lines,
final TooltipContext advancedTooltips) {
final TooltipContext advancedTooltips) {
int plotId = this.getAllocatedPlotId(stack);
if (plotId == -1) {
lines.add(GuiText.Unformatted.text().copy().formatted(Formatting.ITALIC));
@@ -111,7 +112,7 @@ public class SpatialStorageCellItem extends AEBaseItem implements ISpatialStorag
@Override
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 targetY = max.y - min.y - 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
TransitionInfo info = new TransitionInfo(w.getRegistryKey().getValue(), min.getBlockPos(),
max.getBlockPos(), Instant.now());
TransitionInfo info = new TransitionInfo(w.getRegistryKey().getValue(), min.getBlockPos(), max.getBlockPos(),
Instant.now());
manager.setLastTransition(plot.getId(), info);
try {
@@ -1,10 +1,11 @@
package appeng.mixins;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
import net.minecraft.fluid.Fluid;
import net.minecraft.tag.FluidTags;
import net.minecraft.tag.Tag;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin(FluidTags.class)
public interface FluidTagsAccessor {
+6 -4
View File
@@ -1,14 +1,16 @@
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.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
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
@SuppressWarnings("ConstantConditions")
@Mixin(HopperBlockEntity.class)
@@ -3,12 +3,13 @@ package appeng.mixins.spatial;
import java.util.List;
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.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.dimension.DimensionOptions;
import appeng.spatial.SpatialStorageDimensionIds;
/**
@@ -1,18 +1,20 @@
package appeng.mixins.spatial;
import appeng.spatial.SpatialStorageDimensionIds;
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 java.util.OptionalLong;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
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.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
@@ -23,17 +25,21 @@ import java.util.OptionalLong;
public class DimensionTypeMixin {
@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();
}
@Inject(method = "addRegistryDefaults", at = @At("TAIL"))
private static void addRegistryDefaults(DynamicRegistryManager.Impl registryTracker, CallbackInfoReturnable<?> cir) {
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);
private static void addRegistryDefaults(DynamicRegistryManager.Impl registryTracker,
CallbackInfoReturnable<?> cir) {
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(),
SpatialStorageDimensionIds.DIMENSION_TYPE_ID.getValue(), dimensionType);
Registry.register(registryTracker.getDimensionTypes(), SpatialStorageDimensionIds.DIMENSION_TYPE_ID.getValue(),
dimensionType);
}
}
@@ -1,18 +1,20 @@
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.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
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
* the player.
* This mixin sets the teleport destination, because otherwise Vanilla will not
* move the player.
*/
@Mixin(Entity.class)
public class EntityMixin {
@@ -1,16 +1,19 @@
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.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
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)
public class SkyPropertiesMixin {
@@ -1,9 +1,10 @@
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.texture.Sprite;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(BakedQuad.class)
public interface BakedQuadAccessor {
@@ -1,6 +1,10 @@
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.ModelBakeSettings;
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.util.Identifier;
import net.minecraft.util.math.Direction;
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 appeng.hooks.UnlitQuadHooks;
/**
* 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)
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) {
cri.setReturnValue(UnlitQuadHooks.makeUnlit(cri.getReturnValue()));
}
@@ -1,15 +1,18 @@
package appeng.mixins.unlitquad;
import appeng.hooks.UnlitQuadHooks;
import java.lang.reflect.Type;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonElement;
import net.minecraft.client.render.model.json.ModelElementFace;
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.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
@@ -20,7 +23,7 @@ public class ModelElementFaceDeserializerMixin {
@Inject(method = "deserialize", at = @At("RETURN"), cancellable = true, allow = 1, remap = false)
public void onDeserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext,
CallbackInfoReturnable<ModelElementFace> cri) {
CallbackInfoReturnable<ModelElementFace> cri) {
if (!UnlitQuadHooks.isUnlitExtensionEnabled()) {
return; // Not in a model that activated the deserializer
}
@@ -1,15 +1,17 @@
package appeng.mixins.unlitquad;
import appeng.hooks.UnlitQuadHooks;
import net.minecraft.client.render.model.ModelLoader;
import net.minecraft.client.render.model.json.JsonUnbakedModel;
import net.minecraft.util.Identifier;
import java.io.IOException;
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.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
@@ -18,7 +18,33 @@
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 appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
@@ -53,30 +79,6 @@ import appeng.util.Platform;
import appeng.util.inv.InvOperation;
import appeng.util.prioritylist.FuzzyPriorityList;
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> {
@@ -361,8 +363,8 @@ public class FormationPlanePart extends AbstractFormationPlanePart<IAEItemStack>
}
/**
* A custom {@link AutomaticItemPlacementContext} which also accepts a player needed
* various blocks like seeds.
* A custom {@link AutomaticItemPlacementContext} which also accepts a player
* needed various blocks like seeds.
* <p>
* Also removed {@link AutomaticItemPlacementContext#canReplaceExisting} as this
* can cause a {@link StackOverflowError} for certain replaceable blocks.
@@ -371,7 +373,7 @@ public class FormationPlanePart extends AbstractFormationPlanePart<IAEItemStack>
private final 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,
new BlockHitResult(Vec3d.ofBottomCenter(pos), facing, pos, false));
this.lookDirection = lookDirection;
@@ -397,13 +399,13 @@ public class FormationPlanePart extends AbstractFormationPlanePart<IAEItemStack>
switch (this.lookDirection) {
case DOWN:
default:
return new Direction[]{Direction.DOWN, Direction.NORTH, Direction.EAST, Direction.SOUTH,
Direction.WEST, Direction.UP};
return new Direction[] { Direction.DOWN, Direction.NORTH, Direction.EAST, Direction.SOUTH,
Direction.WEST, Direction.UP };
case UP:
return new Direction[]{Direction.DOWN, Direction.UP, Direction.NORTH, Direction.EAST,
Direction.SOUTH, Direction.WEST};
return new Direction[] { Direction.DOWN, Direction.UP, Direction.NORTH, Direction.EAST,
Direction.SOUTH, Direction.WEST };
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 };
case SOUTH:
return new Direction[] { Direction.DOWN, Direction.SOUTH, Direction.EAST, Direction.WEST,
@@ -18,6 +18,15 @@
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.AttributeList;
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.volume.FluidKey;
import alexiil.mc.lib.attributes.fluid.volume.FluidVolume;
import appeng.api.config.PowerUnits;
import appeng.api.parts.IPartModel;
import appeng.items.parts.PartModels;
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> {
@@ -93,7 +95,8 @@ public class FluidP2PTunnelPart extends P2PTunnelPart<FluidP2PTunnelPart> {
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) {
T result = null;
if (this.isActive()) {
@@ -138,7 +141,8 @@ public class FluidP2PTunnelPart extends P2PTunnelPart<FluidP2PTunnelPart> {
}
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) {
}
+2 -2
View File
@@ -49,8 +49,8 @@ public final class AECommand {
private void add(LiteralArgumentBuilder<ServerCommandSource> builder, Commands subCommand) {
LiteralArgumentBuilder<ServerCommandSource> subCommandBuilder = literal(subCommand.name().toLowerCase(Locale.ROOT))
.requires(src -> src.hasPermissionLevel(subCommand.level));
LiteralArgumentBuilder<ServerCommandSource> subCommandBuilder = literal(
subCommand.name().toLowerCase(Locale.ROOT)).requires(src -> src.hasPermissionLevel(subCommand.level));
subCommand.command.addArguments(subCommandBuilder);
subCommandBuilder.executes(ctx -> {
MinecraftServer server = AppEng.instance().getServer();
@@ -1,5 +1,7 @@
package appeng.server.subcommands;
import static net.minecraft.server.command.CommandManager.literal;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Comparator;
@@ -7,7 +9,6 @@ import java.util.List;
import java.util.UUID;
import java.util.function.UnaryOperator;
import appeng.core.AppEng;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.context.CommandContext;
@@ -16,6 +17,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.command.CommandException;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.ClickEvent;
@@ -29,6 +31,7 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.worlddata.WorldData;
import appeng.items.storage.SpatialStorageCellItem;
import appeng.server.ISubCommand;
@@ -37,9 +40,6 @@ import appeng.spatial.SpatialStoragePlot;
import appeng.spatial.SpatialStoragePlotManager;
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.
*/
@@ -58,11 +58,12 @@ public class SpatialStorageCommand implements ISubCommand {
})));
// Teleport into the plot
builder.then(literal("tp").then(CommandManager.argument("plotId", IntegerArgumentType.integer(1)).executes(ctx -> {
int plotId = IntegerArgumentType.getInteger(ctx, "plotId");
teleportToPlot(ctx.getSource(), plotId);
return 1;
})));
builder.then(
literal("tp").then(CommandManager.argument("plotId", IntegerArgumentType.integer(1)).executes(ctx -> {
int plotId = IntegerArgumentType.getInteger(ctx, "plotId");
teleportToPlot(ctx.getSource(), plotId);
return 1;
})));
// Teleport from the current plot back to the source of its content, or do the
// 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
builder.then(
literal("givecell").then(CommandManager.argument("plotId", IntegerArgumentType.integer(1)).executes(ctx -> {
builder.then(literal("givecell")
.then(CommandManager.argument("plotId", IntegerArgumentType.integer(1)).executes(ctx -> {
int plotId = IntegerArgumentType.getInteger(ctx, "plotId");
giveCell(ctx.getSource(), plotId);
return 1;
@@ -120,8 +121,7 @@ public class SpatialStorageCommand implements ISubCommand {
private void teleportBack(ServerCommandSource source, SpatialStoragePlot plot) {
TransitionInfo lastTransition = plot.getLastTransition();
if (lastTransition == null) {
throw new CommandException(
Text.of("This plot doesn't have a last known transition."));
throw new CommandException(Text.of("This plot doesn't have a last known transition."));
}
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)
TransitionInfo lastTransition = plot.getLastTransition();
if (lastTransition != null) {
source.sendFeedback(new LiteralText("Last Transition:").formatted(Formatting.UNDERLINE,
Formatting.BOLD), true);
source.sendFeedback(new LiteralText("Last Transition:").formatted(Formatting.UNDERLINE, Formatting.BOLD),
true);
String sourceWorldId = lastTransition.getWorldId().toString();
MutableText sourceLink = new LiteralText(
@@ -189,8 +189,7 @@ public class SpatialStorageCommand implements ISubCommand {
private static void teleportToPlot(ServerCommandSource source, int plotId) {
SpatialStoragePlot plot = getPlot(plotId);
String teleportCommand = getTeleportCommand(SpatialStorageDimensionIds.WORLD_ID.getValue(),
plot.getOrigin());
String teleportCommand = getTeleportCommand(SpatialStorageDimensionIds.WORLD_ID.getValue(), plot.getOrigin());
runCommandFor(source, teleportCommand);
}
@@ -211,8 +210,7 @@ public class SpatialStorageCommand implements ISubCommand {
}
if (!(cell.getItem() instanceof SpatialStorageCellItem)) {
throw new CommandException(
Text.of("Storage cell items don't implement the storage cell interface!"));
throw new CommandException(Text.of("Storage cell items don't implement the storage cell interface!"));
}
SpatialStorageCellItem spatialCellItem = (SpatialStorageCellItem) cell.getItem();
@@ -251,8 +249,7 @@ public class SpatialStorageCommand implements ISubCommand {
Text tpLink = new LiteralText("Origin: " + origin)
.styled(makeCommandLink("/ae2 spatial tp " + plot.getId(), "Click to teleport into plot"));
Text message = new LiteralText("").append(infoLink)
.append(" Size: " + size + " ").append(tpLink);
Text message = new LiteralText("").append(infoLink).append(" Size: " + size + " ").append(tpLink);
sender.sendFeedback(message, true);
}
@@ -266,7 +263,7 @@ public class SpatialStorageCommand implements ISubCommand {
private static UnaryOperator<Style> makeCommandLink(String command, String tooltip) {
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)));
}
@@ -290,8 +287,7 @@ public class SpatialStorageCommand implements ISubCommand {
private static void sendKeyValuePair(ServerCommandSource source, String label, Text value) {
source.sendFeedback(
new LiteralText("")
.append(new LiteralText(label + ": ").formatted(Formatting.BOLD)).append(value),
new LiteralText("").append(new LiteralText(label + ": ").formatted(Formatting.BOLD)).append(value),
true);
}
@@ -39,6 +39,7 @@ import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkSection;
import net.minecraft.world.chunk.WorldChunk;
import net.minecraft.world.chunk.light.LightingProvider;
import appeng.api.movable.IMovableHandler;
import appeng.api.movable.IMovableRegistry;
@@ -47,7 +48,6 @@ import appeng.api.util.WorldCoord;
import appeng.core.AELog;
import appeng.core.Api;
import appeng.core.worlddata.WorldData;
import net.minecraft.world.chunk.light.LightingProvider;
public class CachedPlane {
private final int x_size;
@@ -68,8 +68,8 @@ public class CachedPlane {
private int verticalBits;
private final BlockState matrixBlockState;
public CachedPlane(final ServerWorld w, final int minX, final int minY, final int minZ, final int maxX, final int maxY,
final int maxZ) {
public CachedPlane(final ServerWorld w, final int minX, final int minY, final int minZ, final int maxX,
final int maxY, final int maxZ) {
Block matrixFrameBlock = Api.instance().definitions().blocks().matrixFrame().maybeBlock().orElse(null);
if (matrixFrameBlock != null) {
@@ -327,8 +327,8 @@ public class CachedPlane {
// FIXME this was sending chunks to players...
ChunkDataS2CPacket cdp = new ChunkDataS2CPacket(c, verticalBits);
world.getChunkManager().threadedAnvilChunkStorage
.getPlayersWatchingChunk(c.getPos(), false).forEach(spe -> spe.networkHandler.sendPacket(cdp));
world.getChunkManager().threadedAnvilChunkStorage.getPlayersWatchingChunk(c.getPos(), false)
.forEach(spe -> spe.networkHandler.sendPacket(cdp));
}
}
@@ -36,9 +36,8 @@ public class SpatialStorageBiome {
.build())
.precipitation(Biome.Precipitation.NONE).category(Biome.Category.NONE).depth(0).scale(1)
// Copied from the vanilla void biome
.temperature(0.5F).downfall(0.5F)
.effects(new BiomeEffects.Builder().waterColor(4159204).waterFogColor(329011).fogColor(0).skyColor(0x111111)
.build())
.temperature(0.5F).downfall(0.5F).effects(new BiomeEffects.Builder().waterColor(4159204)
.waterFogColor(329011).fogColor(0).skyColor(0x111111).build())
.spawnSettings(new SpawnSettings.Builder().creatureSpawnProbability(0).build()).build();
}
@@ -18,8 +18,12 @@
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 net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
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.VerticalBlockSample;
import java.util.Arrays;
import java.util.Collections;
import java.util.Optional;
import appeng.core.Api;
/**
* 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,
* since it is sources from the dynamic registries and <em>must be the same object as in the registry!</em>.
* <p>If it was not the same object, then the Object->ID lookup would fail since it uses an identity hashmap
* internally.
* since it is sources from the dynamic registries and <em>must be the same
* object as in the registry!</em>.
* <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
= RegistryLookupCodec.of(Registry.BIOME_KEY).xmap(SpatialStorageChunkGenerator::new, SpatialStorageChunkGenerator::getBiomeRegistry).stable().codec();
public static final Codec<SpatialStorageChunkGenerator> CODEC = RegistryLookupCodec.of(Registry.BIOME_KEY)
.xmap(SpatialStorageChunkGenerator::new, SpatialStorageChunkGenerator::getBiomeRegistry).stable().codec();
private final Registry<Biome> biomeRegistry;
@@ -74,7 +78,6 @@ public class SpatialStorageChunkGenerator extends ChunkGenerator {
this.columnSample = new VerticalBlockSample(columnSample);
}
@Override
protected Codec<? extends ChunkGenerator> getCodec() {
return CODEC;
@@ -1,6 +1,5 @@
package appeng.spatial;
import appeng.core.AppEng;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
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.DimensionType;
import appeng.core.AppEng;
/**
* IDs for the spatial storage world related dimension objects.
*/
@@ -19,12 +20,12 @@ public final class SpatialStorageDimensionIds {
* <p>
* This is defined in {@link appeng.mixins.spatial.DimensionTypeMixin}.
*/
public static final RegistryKey<DimensionType> DIMENSION_TYPE_ID = RegistryKey
.of(Registry.DIMENSION_TYPE_KEY, AppEng.makeId("spatial_storage"));
public static final RegistryKey<DimensionType> DIMENSION_TYPE_ID = RegistryKey.of(Registry.DIMENSION_TYPE_KEY,
AppEng.makeId("spatial_storage"));
/**
* ID of the {@link net.minecraft.world.gen.chunk.ChunkGenerator} used for the spatial
* storage world.
* ID of the {@link net.minecraft.world.gen.chunk.ChunkGenerator} used for the
* spatial storage world.
*/
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
* 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.
@@ -51,7 +53,8 @@ public final class SpatialStorageDimensionIds {
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");
@@ -18,9 +18,9 @@
package appeng.spatial;
import appeng.api.util.WorldCoord;
import appeng.core.Api;
import appeng.core.AppEng;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
@@ -35,8 +35,9 @@ import net.minecraft.world.TeleportTarget;
import net.minecraft.world.World;
import net.minecraft.world.chunk.ChunkStatus;
import java.util.ArrayList;
import java.util.List;
import appeng.api.util.WorldCoord;
import appeng.core.Api;
import appeng.core.AppEng;
public class SpatialStorageHelper {
@@ -52,7 +53,8 @@ public class SpatialStorageHelper {
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() {
return teleportTarget.get();
@@ -104,16 +106,13 @@ public class SpatialStorageHelper {
newWorld.getChunkManager().getChunk(MathHelper.floor(link.x) >> 4, MathHelper.floor(link.z) >> 4,
ChunkStatus.FULL, true);
if (entity instanceof ServerPlayerEntity
&& link.dim.getRegistryKey() == SpatialStorageDimensionIds.WORLD_ID) {
if (entity instanceof ServerPlayerEntity && link.dim.getRegistryKey() == SpatialStorageDimensionIds.WORLD_ID) {
AppEng.instance().getAdvancementTriggers().getSpatialExplorer().trigger((ServerPlayerEntity) entity);
}
// Store in a threadlocal so that EntityMixin can return it for the Vanilla logic to use
teleportTarget.set(new TeleportTarget(new Vec3d(link.x, link.y, link.z),
Vec3d.ZERO,
entity.yaw,
entity.pitch));
// Store in a threadlocal so that EntityMixin can return it for the Vanilla
// logic to use
teleportTarget.set(new TeleportTarget(new Vec3d(link.x, link.y, link.z), Vec3d.ZERO, entity.yaw, entity.pitch));
try {
entity = entity.moveToWorld(link.dim);
} finally {
@@ -22,15 +22,15 @@ import java.util.List;
import javax.annotation.Nullable;
import appeng.core.AppEng;
import net.minecraft.block.BlockState;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.TeleportTarget;
import appeng.core.AELog;
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.
@@ -18,12 +18,10 @@
package appeng.tile;
import alexiil.mc.lib.attributes.AttributeList;
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;
import java.util.List;
import javax.annotation.Nonnull;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.item.ItemStack;
@@ -32,8 +30,13 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.List;
import alexiil.mc.lib.attributes.AttributeList;
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 {
@@ -18,21 +18,23 @@
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.item.FixedItemInv;
import alexiil.mc.lib.attributes.item.LimitedFixedItemInv;
import alexiil.mc.lib.attributes.item.filter.ConstantItemFilter;
import alexiil.mc.lib.attributes.item.filter.ItemFilter;
import alexiil.mc.lib.attributes.item.impl.DirectFixedItemInv;
import appeng.util.Platform;
import appeng.util.inv.IAEAppEngInventory;
import appeng.util.inv.InvOperation;
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
public class AppEngInternalInventory extends DirectFixedItemInv implements Iterable<ItemStack> {
@@ -18,15 +18,17 @@
package appeng.util.inv;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import alexiil.mc.lib.attributes.Simulation;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import alexiil.mc.lib.attributes.item.ItemStackUtil;
import alexiil.mc.lib.attributes.item.filter.ItemFilter;
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
public class WrapperFilteredItemHandler extends DelegatingFixedItemInv {
@@ -121,7 +121,8 @@ public class MeteoriteStructureStart extends StructureStart<DefaultFeatureConfig
}
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 Category category = biome.getCategory();