Ported to 1.16.2-pre

This commit is contained in:
Sebastian Hartte
2020-08-01 17:14:12 +02:00
parent 3d1a919e69
commit 1b31185cdb
90 changed files with 356 additions and 258 deletions
+4 -2
View File
@@ -109,8 +109,10 @@ dependencies {
include "alexiil.mc.lib:libblockattributes-items:${libblockattributes_version}" include "alexiil.mc.lib:libblockattributes-items:${libblockattributes_version}"
include "alexiil.mc.lib:libblockattributes-fluids:${libblockattributes_version}" include "alexiil.mc.lib:libblockattributes-fluids:${libblockattributes_version}"
modImplementation "me.shedaniel:RoughlyEnoughItems:4.6.6" modCompileOnly "me.shedaniel:RoughlyEnoughItems:4.6.6"
modImplementation "mcp.mobius.waila:Hwyla:1.16.1-1.9.22-75" modCompileOnly "mcp.mobius.waila:Hwyla:1.16.1-1.9.22-75"
// modRuntimeOnly "me.shedaniel:RoughlyEnoughItems:4.6.6"
// modRuntimeOnly "mcp.mobius.waila:Hwyla:1.16.1-1.9.22-75"
implementation 'com.google.code.findbugs:jsr305:3.0.2' implementation 'com.google.code.findbugs:jsr305:3.0.2'
+4 -4
View File
@@ -9,12 +9,12 @@ org.gradle.jvmargs=-Xmx2G
# Fabric Properties # Fabric Properties
# Check these on https://modmuss50.me/fabric.html # Check these on https://modmuss50.me/fabric.html
minecraft_version=1.16.1 minecraft_version=1.16.2-pre1
yarn_mappings=1.16.1+build.19 yarn_mappings=1.16.2-pre1+build.5
loader_version=0.8.9+build.203 loader_version=0.9.0+build.204
#Fabric api #Fabric api
fabric_version=0.16.0+build.384-1.16.1 fabric_version=0.16.1+build.387-1.16
loom_version=0.4-SNAPSHOT loom_version=0.4-SNAPSHOT
@@ -25,6 +25,7 @@ package appeng.api.util;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.dimension.DimensionType;
@@ -33,7 +34,7 @@ import net.minecraft.world.dimension.DimensionType;
*/ */
public class DimensionalCoord extends WorldCoord { public class DimensionalCoord extends WorldCoord {
private final WorldAccess world; private final World world;
private final DimensionType dimension; private final DimensionType dimension;
public DimensionalCoord(final DimensionalCoord coordinate) { public DimensionalCoord(final DimensionalCoord coordinate) {
@@ -48,13 +49,13 @@ public class DimensionalCoord extends WorldCoord {
this.dimension = this.world.getDimension(); this.dimension = this.world.getDimension();
} }
public DimensionalCoord(final WorldAccess world, final int x, final int y, final int z) { public DimensionalCoord(final World world, final int x, final int y, final int z) {
super(x, y, z); super(x, y, z);
this.world = world; this.world = world;
this.dimension = world.getDimension(); this.dimension = world.getDimension();
} }
public DimensionalCoord(final WorldAccess world, final BlockPos pos) { public DimensionalCoord(final World world, final BlockPos pos) {
super(pos); super(pos);
this.world = world; this.world = world;
this.dimension = world.getDimension(); this.dimension = world.getDimension();
@@ -84,7 +85,7 @@ public class DimensionalCoord extends WorldCoord {
return this.world == world; return this.world == world;
} }
public WorldAccess getWorld() { public World getWorld() {
return this.world; return this.world;
} }
+1 -2
View File
@@ -12,8 +12,7 @@
"license": "LGPL", "license": "LGPL",
"icon": "assets/appliedenergistics2/icon.png", "icon": "assets/appliedenergistics2/icon.png",
"environment": "client",
"environment": "*",
"entrypoints": { "entrypoints": {
"preLaunch": ["appeng.data.Entrypoint"] "preLaunch": ["appeng.data.Entrypoint"]
}, },
@@ -60,7 +60,7 @@ public class AEBaseBlockItem extends BlockItem {
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public void addCheckedInformation(final ItemStack itemStack, final World world, final List<Text> toolTip, public void addCheckedInformation(final ItemStack itemStack, final World world, final List<Text> toolTip,
final TooltipContext advancedTooltips) { final TooltipContext advancedTooltips) {
this.blockType.buildTooltip(itemStack, world, toolTip, advancedTooltips); this.blockType.appendTooltip(itemStack, world, toolTip, advancedTooltips);
} }
@Override @Override
@@ -37,6 +37,7 @@ import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import appeng.block.AEBaseTileBlock; import appeng.block.AEBaseTileBlock;
import appeng.block.networking.WirelessBlock.State;
import appeng.container.ContainerLocator; import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener; import appeng.container.ContainerOpener;
import appeng.container.implementations.WirelessContainer; import appeng.container.implementations.WirelessContainer;
@@ -70,14 +70,14 @@ public abstract class AEBaseMEScreen<T extends AEBaseContainer> extends AEBaseSc
currentToolTip.add(ButtonToolTips.ItemsRequestable.text(formattedAmount)); currentToolTip.add(ButtonToolTips.ItemsRequestable.text(formattedAmount));
} }
this.renderTooltip(matrices, currentToolTip, x, y); this.method_30901(matrices, currentToolTip, x, y);
return; return;
} else if (stack.getCount() > bigNumber) { } else if (stack.getCount() > bigNumber) {
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(stack.getCount()); final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(stack.getCount());
currentToolTip.add(ButtonToolTips.ItemsStored.text(formattedAmount).formatted(Formatting.GRAY)); currentToolTip.add(ButtonToolTips.ItemsStored.text(formattedAmount).formatted(Formatting.GRAY));
this.renderTooltip(matrices, currentToolTip, x, y); this.method_30901(matrices, currentToolTip, x, y);
return; return;
} }
@@ -225,7 +225,7 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
styledLines.add(lines.get(i).copy().styled(s -> style)); styledLines.add(lines.get(i).copy().styled(s -> style));
} }
this.renderTooltip(matrices, styledLines, x, y); this.method_30901(matrices, styledLines, x, y);
} }
@Override @Override
@@ -51,8 +51,8 @@ public class ChestScreen extends AEBaseScreen<ChestContainer> {
@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.Chest.text()), 8, 6, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.Chest.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
} }
@Override @Override
@@ -55,8 +55,8 @@ public class CondenserScreen extends AEBaseScreen<CondenserContainer> {
@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.Condenser.text()), 8, 6, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.Condenser.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.mode.set(this.handler.getOutput()); this.mode.set(this.handler.getOutput());
this.mode.setFillVar(String.valueOf(this.handler.getOutput().requiredPower)); this.mode.setFillVar(String.valueOf(this.handler.getOutput().requiredPower));
@@ -66,7 +66,7 @@ public class CraftAmountScreen extends AEBaseScreen<CraftAmountContainer> {
@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, GuiText.SelectAmount.text(), 8, 6, 4210752); this.textRenderer.method_30883(matrices, GuiText.SelectAmount.text(), 8, 6, 4210752);
} }
@Override @Override
@@ -162,7 +162,7 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
final String byteUsed = NumberFormat.getInstance().format(BytesUsed); final String byteUsed = NumberFormat.getInstance().format(BytesUsed);
final Text Add = BytesUsed > 0 ? new LiteralText(byteUsed + " ").append(GuiText.BytesUsed.text()) final Text Add = BytesUsed > 0 ? new LiteralText(byteUsed + " ").append(GuiText.BytesUsed.text())
: GuiText.CalculatingWait.text(); : GuiText.CalculatingWait.text();
this.textRenderer.draw(matrices, GuiText.CraftingPlan.withSuffix(" - ").append(Add), 8, 7, 4210752); this.textRenderer.method_30883(matrices, GuiText.CraftingPlan.withSuffix(" - ").append(Add), 8, 7, 4210752);
Text dsp; Text dsp;
@@ -176,7 +176,7 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
} }
final int offset = (219 - this.textRenderer.getWidth(dsp)) / 2; final int offset = (219 - this.textRenderer.getWidth(dsp)) / 2;
this.textRenderer.draw(matrices, dsp, offset, 165, 4210752); this.textRenderer.method_30883(matrices, dsp, offset, 165, 4210752);
final int sectionLength = 67; final int sectionLength = 67;
@@ -172,7 +172,7 @@ public class CraftingCPUScreen<T extends CraftingCPUContainer> extends AEBaseScr
title = title.copy().append(" - " + etaTimeText); title = title.copy().append(" - " + etaTimeText);
} }
this.textRenderer.draw(matrices, title, TITLE_LEFT_OFFSET, TITLE_TOP_OFFSET, TEXT_COLOR); this.textRenderer.method_30883(matrices, title, TITLE_LEFT_OFFSET, TITLE_TOP_OFFSET, TEXT_COLOR);
int x = 0; int x = 0;
int y = 0; int y = 0;
@@ -64,7 +64,7 @@ public class CraftingTermScreen extends MEMonitorableScreen<CraftingTermContaine
@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) {
super.drawFG(matrices, offsetX, offsetY, mouseX, mouseY); super.drawFG(matrices, offsetX, offsetY, mouseX, mouseY);
this.textRenderer.draw(matrices, GuiText.CraftingTerminal.text(), 8, this.textRenderer.method_30883(matrices, GuiText.CraftingTerminal.text(), 8,
this.backgroundHeight - 96 + 1 - this.getReservedSpace(), 4210752); this.backgroundHeight - 96 + 1 - this.getReservedSpace(), 4210752);
} }
@@ -51,8 +51,8 @@ public class DriveScreen extends AEBaseScreen<DriveContainer> {
@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.Drive.text()), 8, 6, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.Drive.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
} }
@Override @Override
@@ -58,8 +58,8 @@ public class FormationPlaneScreen extends UpgradeableScreen<FormationPlaneContai
@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.FormationPlane.text()), 8, 6, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.FormationPlane.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
if (this.fuzzyMode != null) { if (this.fuzzyMode != null) {
this.fuzzyMode.set(this.cvb.getFuzzyMode()); this.fuzzyMode.set(this.cvb.getFuzzyMode());
@@ -35,8 +35,8 @@ public class GrinderScreen extends AEBaseScreen<GrinderContainer> {
@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.GrindStone.text()), 8, 6, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.GrindStone.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
} }
@Override @Override
@@ -59,8 +59,8 @@ public class IOPortScreen extends UpgradeableScreen<IOPortContainer> {
@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.IOPort.text()), 8, 6, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.IOPort.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
if (this.redstoneMode != null) { if (this.redstoneMode != null) {
this.redstoneMode.set(this.cvb.getRedStoneMode()); this.redstoneMode.set(this.cvb.getRedStoneMode());
@@ -56,8 +56,8 @@ public class InscriberScreen extends AEBaseScreen<InscriberContainer> {
this.pb.setFullMsg( this.pb.setFullMsg(
new LiteralText(this.handler.getCurrentProgress() * 100 / this.handler.getMaxProgress() + "%")); new LiteralText(this.handler.getCurrentProgress() * 100 / this.handler.getMaxProgress() + "%"));
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.Inscriber.text()), 8, 6, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.Inscriber.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
} }
@Override @Override
@@ -68,13 +68,13 @@ public class InterfaceScreen extends UpgradeableScreen<InterfaceContainer> {
this.interfaceMode.setState(((InterfaceContainer) this.cvb).getInterfaceTerminalMode() == YesNo.YES); this.interfaceMode.setState(((InterfaceContainer) this.cvb).getInterfaceTerminalMode() == YesNo.YES);
} }
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.Interface.text()), 8, 6, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.Interface.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.Config.text(), 8, 6 + 11 + 7, 4210752); this.textRenderer.method_30883(matrices, GuiText.Config.text(), 8, 6 + 11 + 7, 4210752);
this.textRenderer.draw(matrices, GuiText.StoredItems.text(), 8, 6 + 60 + 7, 4210752); this.textRenderer.method_30883(matrices, GuiText.StoredItems.text(), 8, 6 + 60 + 7, 4210752);
this.textRenderer.draw(matrices, GuiText.Patterns.text(), 8, 6 + 73 + 7, 4210752); this.textRenderer.method_30883(matrices, GuiText.Patterns.text(), 8, 6 + 73 + 7, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
} }
@Override @Override
@@ -95,8 +95,8 @@ 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, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.InterfaceTerminal.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
final int ex = this.getScrollBar().getCurrentScroll(); final int ex = this.getScrollBar().getCurrentScroll();
@@ -285,8 +285,8 @@ public class MEMonitorableScreen<T extends MEMonitorableContainer> extends AEBas
@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(this.myName.text()), 8, 6, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(this.myName.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.currentMouseX = mouseX; this.currentMouseX = mouseX;
this.currentMouseY = mouseY; this.currentMouseY = mouseY;
@@ -101,7 +101,7 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
@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, GuiText.NetworkDetails.text(), 8, 6, 4210752); this.textRenderer.method_30883(matrices, GuiText.NetworkDetails.text(), 8, 6, 4210752);
this.textRenderer.draw(matrices, this.textRenderer.draw(matrices,
GuiText.StoredPower.text() + ": " + Platform.formatPowerLong(handler.getCurrentPower(), false), 13, 16, GuiText.StoredPower.text() + ": " + Platform.formatPowerLong(handler.getCurrentPower(), false), 13, 16,
@@ -58,8 +58,8 @@ public class NetworkToolScreen extends AEBaseScreen<NetworkToolContainer> {
this.tFacades.setState(handler.isFacadeMode()); this.tFacades.setState(handler.isFacadeMode());
} }
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.NetworkTool.text()), 8, 6, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.NetworkTool.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
} }
@Override @Override
@@ -126,7 +126,7 @@ public class PatternTermScreen extends MEMonitorableScreen<PatternTermContainer>
} }
super.drawFG(matrices, offsetX, offsetY, mouseX, mouseY); super.drawFG(matrices, offsetX, offsetY, mouseX, mouseY);
this.textRenderer.draw(matrices, GuiText.PatternTerminal.text(), 8, this.textRenderer.method_30883(matrices, GuiText.PatternTerminal.text(), 8,
this.backgroundHeight - 96 + 2 - this.getReservedSpace(), 4210752); this.backgroundHeight - 96 + 2 - this.getReservedSpace(), 4210752);
} }
@@ -62,7 +62,7 @@ public class PriorityScreen extends AEBaseScreen<PriorityContainer> {
@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, GuiText.Priority.text(), 8, 6, 4210752); this.textRenderer.method_30883(matrices, GuiText.Priority.text(), 8, 6, 4210752);
} }
@Override @Override
@@ -35,8 +35,8 @@ 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, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.QuantumLinkChamber.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
} }
@Override @Override
@@ -59,8 +59,8 @@ 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, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.QuartzCuttingKnife.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
} }
@Override @Override
@@ -82,7 +82,7 @@ public class SecurityStationScreen extends MEMonitorableScreen<SecurityStationCo
@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) {
super.drawFG(matrices, offsetX, offsetY, mouseX, mouseY); super.drawFG(matrices, offsetX, offsetY, mouseX, mouseY);
this.textRenderer.draw(matrices, GuiText.SecurityCardEditor.text(), 8, this.textRenderer.method_30883(matrices, GuiText.SecurityCardEditor.text(), 8,
this.backgroundHeight - 96 + 1 - this.getReservedSpace(), 4210752); this.backgroundHeight - 96 + 1 - this.getReservedSpace(), 4210752);
} }
@@ -39,8 +39,8 @@ public class SkyChestScreen extends AEBaseScreen<SkyChestContainer> {
@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.SkyChest.text()), 8, 8, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.SkyChest.text()), 8, 8, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 2, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 2, 4210752);
} }
@Override @Override
@@ -43,27 +43,27 @@ public class SpatialIOPortScreen extends AEBaseScreen<SpatialIOPortContainer> {
@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.textRenderer.method_30883(matrices,
GuiText.StoredPower.withSuffix(": " + Platform.formatPowerLong(this.handler.getCurrentPower(), false)), GuiText.StoredPower.withSuffix(": " + Platform.formatPowerLong(this.handler.getCurrentPower(), false)),
13, 21, 4210752); 13, 21, 4210752);
this.textRenderer.draw(matrices, this.textRenderer.method_30883(matrices,
GuiText.MaxPower.withSuffix(": " + Platform.formatPowerLong(this.handler.getMaxPower(), false)), 13, 31, GuiText.MaxPower.withSuffix(": " + Platform.formatPowerLong(this.handler.getMaxPower(), false)), 13, 31,
4210752); 4210752);
this.textRenderer.draw(matrices, GuiText.RequiredPower this.textRenderer.method_30883(matrices, GuiText.RequiredPower
.withSuffix(": " + Platform.formatPowerLong(this.handler.getRequiredPower(), false)), 13, 73, 4210752); .withSuffix(": " + Platform.formatPowerLong(this.handler.getRequiredPower(), false)), 13, 73, 4210752);
this.textRenderer.draw(matrices, this.textRenderer.method_30883(matrices,
GuiText.Efficiency.withSuffix(": " + (((float) this.handler.getEfficency()) / 100) + '%'), 13, 83, GuiText.Efficiency.withSuffix(": " + (((float) this.handler.getEfficency()) / 100) + '%'), 13, 83,
4210752); 4210752);
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.SpatialIOPort.text()), 8, 6, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.SpatialIOPort.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96, 4210752);
if (this.handler.xSize != 0 && this.handler.ySize != 0 && this.handler.zSize != 0) { if (this.handler.xSize != 0 && this.handler.ySize != 0 && this.handler.zSize != 0) {
final Text text = GuiText.SCSSize final Text text = GuiText.SCSSize
.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.method_30883(matrices, text, 13, 93, 4210752);
} else { } else {
this.textRenderer.draw(matrices, GuiText.SCSSize.withSuffix(": ").append(GuiText.SCSInvalid.text()), 13, 93, this.textRenderer.method_30883(matrices, GuiText.SCSSize.withSuffix(": ").append(GuiText.SCSInvalid.text()), 13, 93,
4210752); 4210752);
} }
@@ -69,8 +69,8 @@ public class StorageBusScreen extends UpgradeableScreen<StorageBusContainer> {
@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.StorageBus.text()), 8, 6, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.StorageBus.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
if (this.fuzzyMode != null) { if (this.fuzzyMode != null) {
this.fuzzyMode.set(this.cvb.getFuzzyMode()); this.fuzzyMode.set(this.cvb.getFuzzyMode());
@@ -82,8 +82,8 @@ public class UpgradeableScreen<T extends UpgradeableContainer> extends AEBaseScr
@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(this.getName().text()), 8, 6, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(this.getName().text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
if (this.redstoneMode != null) { if (this.redstoneMode != null) {
this.redstoneMode.set(this.cvb.getRedStoneMode()); this.redstoneMode.set(this.cvb.getRedStoneMode());
@@ -51,8 +51,8 @@ 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, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.VibrationChamber.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(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
* this.handler.getCurrentProgress() / VibrationChamberBlockEntity.DILATION_SCALING + " AE/t")); * this.handler.getCurrentProgress() / VibrationChamberBlockEntity.DILATION_SCALING + " AE/t"));
@@ -44,8 +44,8 @@ public class WirelessScreen extends AEBaseScreen<WirelessContainer> {
@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.Wireless.text()), 8, 6, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.Wireless.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
if (handler.getRange() > 0) { if (handler.getRange() > 0) {
final String firstMessage = GuiText.Range.text() + ": " + (handler.getRange() / 10.0) + " m"; final String firstMessage = GuiText.Range.text() + ": " + (handler.getRange() / 10.0) + " m";
@@ -32,6 +32,8 @@ import appeng.core.localization.GuiText;
import appeng.util.ISlimReadableNumberConverter; import appeng.util.ISlimReadableNumberConverter;
import appeng.util.IWideReadableNumberConverter; import appeng.util.IWideReadableNumberConverter;
import appeng.util.ReadableNumberConverter; import appeng.util.ReadableNumberConverter;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
/** /**
* @author AlgorithmX2 * @author AlgorithmX2
@@ -46,8 +48,8 @@ public class StackSizeRenderer {
public void renderStackSize(TextRenderer fontRenderer, IAEItemStack aeStack, int xPos, int yPos) { public void renderStackSize(TextRenderer fontRenderer, IAEItemStack aeStack, int xPos, int yPos) {
if (aeStack != null) { if (aeStack != null) {
if (aeStack.getStackSize() == 0 && aeStack.isCraftable()) { if (aeStack.getStackSize() == 0 && aeStack.isCraftable()) {
final String craftLabelText = AEConfig.instance().isUseLargeFonts() ? GuiText.LargeFontCraft.getLocal() final Text craftLabelText = AEConfig.instance().isUseLargeFonts() ? GuiText.LargeFontCraft.text()
: GuiText.SmallFontCraft.getLocal(); : GuiText.SmallFontCraft.text();
renderSizeLabel(fontRenderer, xPos, yPos, craftLabelText); renderSizeLabel(fontRenderer, xPos, yPos, craftLabelText);
} }
@@ -55,13 +57,13 @@ public class StackSizeRenderer {
if (aeStack.getStackSize() > 0) { if (aeStack.getStackSize() > 0) {
final String stackSize = this.getToBeRenderedStackSize(aeStack.getStackSize()); final String stackSize = this.getToBeRenderedStackSize(aeStack.getStackSize());
renderSizeLabel(fontRenderer, xPos, yPos, stackSize); renderSizeLabel(fontRenderer, xPos, yPos, new LiteralText(stackSize));
} }
} }
} }
public static void renderSizeLabel(TextRenderer fontRenderer, float xPos, float yPos, String text) { public static void renderSizeLabel(TextRenderer fontRenderer, float xPos, float yPos, Text text) {
final float scaleFactor = AEConfig.instance().isUseLargeFonts() ? 0.85f : 0.5f; final float scaleFactor = AEConfig.instance().isUseLargeFonts() ? 0.85f : 0.5f;
final float inverseScaleFactor = 1.0f / scaleFactor; final float inverseScaleFactor = 1.0f / scaleFactor;
@@ -76,7 +78,7 @@ public class StackSizeRenderer {
final int Y = (int) ((yPos + offset + 16.0f - 7.0f * scaleFactor) * inverseScaleFactor); final int Y = (int) ((yPos + offset + 16.0f - 7.0f * scaleFactor) * inverseScaleFactor);
VertexConsumerProvider.Immediate buffer = VertexConsumerProvider VertexConsumerProvider.Immediate buffer = VertexConsumerProvider
.immediate(Tessellator.getInstance().getBuffer()); .immediate(Tessellator.getInstance().getBuffer());
fontRenderer.draw(text, X, Y, 16777215, true, tm.getMatrix(), buffer, false, 0, 15728880); fontRenderer.method_30882(text, X, Y, 16777215, true, tm.getMatrix(), buffer, false, 0, 15728880);
buffer.draw(); buffer.draw();
RenderSystem.enableBlend(); RenderSystem.enableBlend();
} }
@@ -21,7 +21,6 @@ package appeng.client.render.effects;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.client.particle.*; import net.minecraft.client.particle.*;
import net.minecraft.client.particle.ParticleTextureSheet;
import net.minecraft.client.render.Camera; import net.minecraft.client.render.Camera;
import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.Vector3f; import net.minecraft.client.util.math.Vector3f;
@@ -24,7 +24,6 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.particle.*; import net.minecraft.client.particle.*;
import net.minecraft.client.particle.ParticleTextureSheet;
import net.minecraft.client.render.Camera; import net.minecraft.client.render.Camera;
import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.world.ClientWorld; import net.minecraft.client.world.ClientWorld;
@@ -21,9 +21,6 @@ package appeng.client.render.effects;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.client.particle.*; import net.minecraft.client.particle.*;
import net.minecraft.client.particle.ParticleFactory;
import net.minecraft.client.particle.ParticleTextureSheet;
import net.minecraft.client.particle.SpriteProvider;
import net.minecraft.client.world.ClientWorld; import net.minecraft.client.world.ClientWorld;
import net.minecraft.particle.DefaultParticleType; import net.minecraft.particle.DefaultParticleType;
@@ -132,7 +132,7 @@ public final class ContainerLocator {
public static ContainerLocator forPart(AEBasePart part) { public static ContainerLocator forPart(AEBasePart part) {
IPartHost host = part.getHost(); IPartHost host = part.getHost();
DimensionalCoord pos = host.getLocation(); DimensionalCoord pos = host.getLocation();
return new ContainerLocator(Type.PART, -1, pos.getWorld().getWorld(), pos.getBlockPos(), part.getSide()); return new ContainerLocator(Type.PART, -1, pos.getWorld(), pos.getBlockPos(), part.getSide());
} }
public boolean hasItemIndex() { public boolean hasItemIndex() {
@@ -233,7 +233,7 @@ public class RestrictedInputSlot extends AppEngSlot {
// TODO: Can be optimized by somehow caching the Tag's // TODO: Can be optimized by somehow caching the Tag's
Item item = i.getItem(); Item item = i.getItem();
for (Identifier tagName : METAL_INGOT_TAGS) { for (Identifier tagName : METAL_INGOT_TAGS) {
Tag<Item> ingotTag = ItemTags.getContainer().get(tagName); Tag<Item> ingotTag = ItemTags.getTagGroup().getTag(tagName);
if (ingotTag != null && item.isIn(ingotTag)) { if (ingotTag != null && item.isIn(ingotTag)) {
return true; return true;
} }
+68 -65
View File
@@ -1,56 +1,5 @@
package appeng.core; package appeng.core;
import java.util.OptionalLong;
import java.util.function.Consumer;
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.recipe.Recipe;
import net.minecraft.recipe.RecipeType;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.tag.BlockTags;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
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;
@@ -149,9 +98,60 @@ import appeng.spatial.SpatialDimensionManager;
import appeng.spatial.StorageCellBiome; import appeng.spatial.StorageCellBiome;
import appeng.spatial.StorageChunkGenerator; import appeng.spatial.StorageChunkGenerator;
import appeng.tile.AEBaseBlockEntity; import appeng.tile.AEBaseBlockEntity;
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.recipe.Recipe;
import net.minecraft.recipe.RecipeType;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.tag.BlockTags;
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 java.util.OptionalLong;
import java.util.function.Consumer;
public abstract class AppEngBase implements AppEng { public abstract class AppEngBase implements AppEng {
@@ -426,7 +426,7 @@ public abstract class AppEngBase implements AppEng {
@Override @Override
public void sendToAllNearExcept(final PlayerEntity p, final double x, final double y, final double z, public void sendToAllNearExcept(final PlayerEntity p, final double x, final double y, final double z,
final double dist, final World w, final BasePacket packet) { final double dist, final World w, final BasePacket packet) {
if (w.isClient()) { if (w.isClient()) {
return; return;
} }
@@ -450,7 +450,7 @@ public abstract class AppEngBase implements AppEng {
} }
protected final <T extends IBootstrapComponent> void callDeferredBootstrapComponents(Class<T> componentClass, protected final <T extends IBootstrapComponent> void callDeferredBootstrapComponents(Class<T> componentClass,
Consumer<T> invoker) { Consumer<T> invoker) {
final ApiDefinitions definitions = Api.INSTANCE.definitions(); final ApiDefinitions definitions = Api.INSTANCE.definitions();
definitions.getRegistry().getBootstrapComponents(componentClass).forEachRemaining(invoker); definitions.getRegistry().getBootstrapComponents(componentClass).forEachRemaining(invoker);
} }
@@ -552,7 +552,7 @@ public abstract class AppEngBase implements AppEng {
} }
private <T extends AEBaseContainer> ScreenHandlerType<T> registerScreenHandler(String id, private <T extends AEBaseContainer> ScreenHandlerType<T> registerScreenHandler(String id,
ScreenHandlerRegistry.ExtendedClientHandlerFactory<T> factory, ContainerOpener.Opener<T> opener) { ScreenHandlerRegistry.ExtendedClientHandlerFactory<T> factory, ContainerOpener.Opener<T> opener) {
ScreenHandlerType<T> type = ScreenHandlerRegistry.registerExtended(AppEng.makeId(id), factory); ScreenHandlerType<T> type = ScreenHandlerRegistry.registerExtended(AppEng.makeId(id), factory);
ContainerOpener.addOpener(type, opener); ContainerOpener.addOpener(type, opener);
return type; return type;
@@ -564,6 +564,7 @@ public abstract class AppEngBase implements AppEng {
new MeteoriteStructure(DefaultFeatureConfig.CODEC).configure(DefaultFeatureConfig.INSTANCE)); new MeteoriteStructure(DefaultFeatureConfig.CODEC).configure(DefaultFeatureConfig.INSTANCE));
Registry.register(Registry.FEATURE, AppEng.makeId("charged_quartz_ore"), ChargedQuartzOreFeature.INSTANCE); Registry.register(Registry.FEATURE, AppEng.makeId("charged_quartz_ore"), ChargedQuartzOreFeature.INSTANCE);
// add to all standard biomes
Biome.BIOMES.forEach(b -> { Biome.BIOMES.forEach(b -> {
addMeteoriteWorldGen(b); addMeteoriteWorldGen(b);
addQuartzWorldGen(b); addQuartzWorldGen(b);
@@ -579,7 +580,8 @@ public abstract class AppEngBase implements AppEng {
return; return;
} }
b.addStructureFeature(MeteoriteStructure.INSTANCE.configure(FeatureConfig.DEFAULT)); BiomeModifier modifier = new BiomeModifier(b);
modifier.addStructureFeature(MeteoriteStructure.INSTANCE.configure(FeatureConfig.DEFAULT));
} }
private static void addQuartzWorldGen(Biome b) { private static void addQuartzWorldGen(Biome b) {
@@ -587,22 +589,23 @@ public abstract class AppEngBase implements AppEng {
return; return;
} }
BiomeModifier modifier = new BiomeModifier(b);
BlockState quartzOre = Api.instance().definitions().blocks().quartzOre().block().getDefaultState(); BlockState quartzOre = Api.instance().definitions().blocks().quartzOre().block().getDefaultState();
b.addFeature(GenerationStep.Feature.UNDERGROUND_ORES, Feature.ORE modifier.addFeature(GenerationStep.Feature.UNDERGROUND_ORES, Feature.ORE
.configure(new OreFeatureConfig(OreFeatureConfig.Target.NATURAL_STONE, quartzOre, .configure(new OreFeatureConfig(OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, quartzOre,
AEConfig.instance().getQuartzOresPerCluster())) AEConfig.instance().getQuartzOresPerCluster()))
.createDecoratedFeature(Decorator.COUNT_RANGE.configure( .decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(12, 12, 72))).spreadHorizontally().repeat(AEConfig.instance().getQuartzOresClusterAmount()));
new RangeDecoratorConfig(AEConfig.instance().getQuartzOresClusterAmount(), 12, 12, 72))));
if (AEConfig.instance().isFeatureEnabled(AEFeature.CHARGED_CERTUS_ORE)) { if (AEConfig.instance().isFeatureEnabled(AEFeature.CHARGED_CERTUS_ORE)) {
BlockState chargedQuartzOre = Api.instance().definitions().blocks().quartzOreCharged().block() BlockState chargedQuartzOre = Api.instance().definitions().blocks().quartzOreCharged().block()
.getDefaultState(); .getDefaultState();
b.addFeature(GenerationStep.Feature.UNDERGROUND_DECORATION, modifier.addFeature(GenerationStep.Feature.UNDERGROUND_DECORATION,
ChargedQuartzOreFeature.INSTANCE ChargedQuartzOreFeature.INSTANCE
.configure(new ChargedQuartzOreConfig(quartzOre, chargedQuartzOre, .configure(new ChargedQuartzOreConfig(quartzOre, chargedQuartzOre,
AEConfig.instance().getSpawnChargedChance())) AEConfig.instance().getSpawnChargedChance()))
.createDecoratedFeature(Decorator.NOPE.configure(NopeDecoratorConfig.field_24892))); .decorate(Decorator.NOPE.configure(NopeDecoratorConfig.INSTANCE)));
} }
} }
@@ -615,14 +618,14 @@ public abstract class AppEngBase implements AppEng {
} }
private void registerDimension() { private void registerDimension() {
Registry.register(Registry.BIOME, AppEng.makeId("storage"), StorageCellBiome.INSTANCE); Registry.register(BuiltinRegistries.BIOME, AppEng.makeId("storage"), StorageCellBiome.INSTANCE);
Registry.register(Registry.CHUNK_GENERATOR, AppEng.makeId("storage"), StorageChunkGenerator.CODEC); Registry.register(Registry.CHUNK_GENERATOR, AppEng.makeId("storage"), StorageChunkGenerator.CODEC);
RegisterDimensionTypeCallback.EVENT.register(registryTracker -> { RegisterDimensionTypeCallback.EVENT.register(registryTracker -> {
DimensionType dimensionType = new DimensionType(OptionalLong.of(12000), false, false, false, false, false, false, true, false,
false, 256, BlockTags.INFINIBURN_OVERWORLD.getId(), 1.0f);
registryTracker.addDimensionType(SpatialDimensionManager.STORAGE_DIMENSION_TYPE, Registry.register(registryTracker.getDimensionTypes(), SpatialDimensionManager.STORAGE_DIMENSION_TYPE.getValue(), dimensionType);
new DimensionType(OptionalLong.of(12000), false, false, false, false, false, false, true, false,
false, 256, BlockTags.INFINIBURN_OVERWORLD.getId(), 1.0f));
}); });
} }
@@ -21,6 +21,7 @@ package appeng.core.api.definitions;
import static appeng.block.AEBaseBlock.defaultProps; import static appeng.block.AEBaseBlock.defaultProps;
import static appeng.block.crafting.AbstractCraftingUnitBlock.CraftingUnitType; import static appeng.block.crafting.AbstractCraftingUnitBlock.CraftingUnitType;
import appeng.block.storage.ChestBlock;
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.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
@@ -37,6 +38,7 @@ import appeng.api.definitions.ITileDefinition;
import appeng.api.features.AEFeature; import appeng.api.features.AEFeature;
import appeng.block.AEBaseBlockItemChargeable; import appeng.block.AEBaseBlockItemChargeable;
import appeng.block.crafting.*; import appeng.block.crafting.*;
import appeng.block.crafting.AbstractCraftingUnitBlock.CraftingUnitType;
import appeng.block.grindstone.CrankBlock; import appeng.block.grindstone.CrankBlock;
import appeng.block.grindstone.GrinderBlock; import appeng.block.grindstone.GrinderBlock;
import appeng.block.misc.*; import appeng.block.misc.*;
@@ -50,7 +52,6 @@ import appeng.block.spatial.MatrixFrameBlock;
import appeng.block.spatial.SpatialIOPortBlock; import appeng.block.spatial.SpatialIOPortBlock;
import appeng.block.spatial.SpatialPylonBlock; import appeng.block.spatial.SpatialPylonBlock;
import appeng.block.storage.*; import appeng.block.storage.*;
import appeng.block.storage.ChestBlock;
import appeng.bootstrap.*; import appeng.bootstrap.*;
import appeng.bootstrap.components.IInitComponent; import appeng.bootstrap.components.IInitComponent;
import appeng.bootstrap.definitions.TileEntityDefinition; import appeng.bootstrap.definitions.TileEntityDefinition;
@@ -134,7 +134,7 @@ public class MatterCannonAmmoRegistry implements IMatterCannonAmmoRegistry {
// Next, check each item tag // Next, check each item tag
for (Map.Entry<Identifier, Double> entry : tagDamageModifiers.entrySet()) { for (Map.Entry<Identifier, Double> entry : tagDamageModifiers.entrySet()) {
Tag<Item> itemTag = ItemTags.getContainer().get(entry.getKey()); Tag<Item> itemTag = ItemTags.getTagGroup().getTag(entry.getKey());
if (itemTag != null && itemTag.contains(item)) { if (itemTag != null && itemTag.contains(item)) {
return entry.getValue().floatValue(); return entry.getValue().floatValue();
} }
@@ -55,8 +55,8 @@ public class MovableTileRegistry implements IMovableRegistry {
private final Tag<Block> blockTagBlackList; private final Tag<Block> blockTagBlackList;
public MovableTileRegistry() { public MovableTileRegistry() {
this.blockTagWhiteList = BlockTags.getContainer().getOrCreate(TAG_WHITELIST); this.blockTagWhiteList = BlockTags.getTagGroup().getTagOrEmpty(TAG_WHITELIST);
this.blockTagBlackList = BlockTags.getContainer().getOrCreate(TAG_BLACKLIST); this.blockTagBlackList = BlockTags.getTagGroup().getTagOrEmpty(TAG_BLACKLIST);
} }
@Override @Override
@@ -25,9 +25,6 @@ import java.util.function.Function;
import net.minecraft.network.PacketByteBuf; import net.minecraft.network.PacketByteBuf;
import appeng.core.sync.packets.*; import appeng.core.sync.packets.*;
import appeng.core.sync.packets.CompassResponsePacket;
import appeng.core.sync.packets.PartPlacementPacket;
import appeng.core.sync.packets.SpawnEntityPacket;
public class BasePacketHandler { public class BasePacketHandler {
private static final Map<Class<? extends BasePacket>, PacketTypes> REVERSE_LOOKUP = new HashMap<>(); private static final Map<Class<? extends BasePacket>, PacketTypes> REVERSE_LOOKUP = new HashMap<>();
@@ -36,7 +36,7 @@ import alexiil.mc.lib.attributes.Simulation;
import alexiil.mc.lib.attributes.item.ItemExtractable; import alexiil.mc.lib.attributes.item.ItemExtractable;
import alexiil.mc.lib.attributes.item.filter.ExactItemStackFilter; import alexiil.mc.lib.attributes.item.filter.ExactItemStackFilter;
import alexiil.mc.lib.attributes.item.filter.ItemFilter; import alexiil.mc.lib.attributes.item.filter.ItemFilter;
import appeng.debug.ItemGenBlockEntity.QueuedItemHandler;
import appeng.tile.AEBaseBlockEntity; import appeng.tile.AEBaseBlockEntity;
public class ItemGenBlockEntity extends AEBaseBlockEntity { public class ItemGenBlockEntity extends AEBaseBlockEntity {
@@ -31,7 +31,6 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.LiteralText; import net.minecraft.text.LiteralText;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.ActionResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@@ -22,6 +22,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments; import net.minecraft.enchantment.Enchantments;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -34,7 +35,7 @@ public class QuartzOreBlock extends AEBaseBlock {
} }
@Override @Override
public void onStacksDropped(BlockState state, World world, BlockPos pos, ItemStack stack) { public void onStacksDropped(BlockState state, ServerWorld world, BlockPos pos, ItemStack stack) {
super.onStacksDropped(state, world, pos, stack); super.onStacksDropped(state, world, pos, stack);
if (EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, stack) == 0) { if (EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, stack) == 0) {
int i = MathHelper.nextInt(world.random, 2, 5); int i = MathHelper.nextInt(world.random, 2, 5);
@@ -45,7 +45,7 @@ public abstract class AEBaseItemEntity extends ItemEntity {
} }
protected List<Entity> getCheckedEntitiesWithinAABBExcludingEntity(final Box region) { protected List<Entity> getCheckedEntitiesWithinAABBExcludingEntity(final Box region) {
return this.world.getEntities(this, region); return this.world.getOtherEntities(this, region);
} }
} }
@@ -96,7 +96,7 @@ public final class SingularityEntity extends AEBaseItemEntity {
// check... other name. // check... other name.
if (!matches) { if (!matches) {
Tag<Item> tag = ItemTags.getContainer().get(TAG_ENDER_PEARL); Tag<Item> tag = ItemTags.getTagGroup().getTag(TAG_ENDER_PEARL);
if (tag != null && other.getItem().isIn(tag)) { if (tag != null && other.getItem().isIn(tag)) {
matches = true; matches = true;
} }
@@ -134,7 +134,7 @@ public final class TinyTNTPrimedEntity extends TntEntity implements ICustomEntit
final Box area = new Box(this.getX() - 1.5, this.getY() - 1.5f, this.getZ() - 1.5, this.getX() + 1.5, final Box area = new Box(this.getX() - 1.5, this.getY() - 1.5f, this.getZ() - 1.5, this.getX() + 1.5,
this.getY() + 1.5, this.getZ() + 1.5); this.getY() + 1.5, this.getZ() + 1.5);
final List<Entity> list = this.world.getEntities(this, area); final List<Entity> list = this.world.getOtherEntities(this, area);
for (final Entity e : list) { for (final Entity e : list) {
e.damage(DamageSource.explosion(ex), 6); e.damage(DamageSource.explosion(ex), 6);
@@ -66,7 +66,7 @@ public class TinyTNTPrimedRenderer extends EntityRenderer<TinyTNTPrimedEntity> {
mStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-90.0F)); mStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-90.0F));
mStack.translate(-0.5D, -0.5D, 0.5D); mStack.translate(-0.5D, -0.5D, 0.5D);
mStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(90.0F)); mStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(90.0F));
TntMinecartEntityRenderer.method_23190(Blocks.TNT.getDefaultState(), mStack, buffers, packedLight, TntMinecartEntityRenderer.renderFlashingBlock(Blocks.TNT.getDefaultState(), mStack, buffers, packedLight,
tnt.getFuse() / 5 % 2 == 0); tnt.getFuse() / 5 % 2 == 0);
mStack.pop(); mStack.pop();
super.render(tnt, entityYaw, partialTicks, mStack, buffers, packedLight); super.render(tnt, entityYaw, partialTicks, mStack, buffers, packedLight);
@@ -64,10 +64,10 @@ public class FluidInterfaceScreen extends UpgradeableScreen<FluidInterfaceContai
@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(GuiText.FluidInterface.text()), 8, 6, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.FluidInterface.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.Config.getLocal(), 35, 6 + 11 + 7, 4210752); this.textRenderer.method_30883(matrices, GuiText.Config.text(), 35, 6 + 11 + 7, 4210752);
this.textRenderer.draw(matrices, GuiText.StoredFluids.getLocal(), 35, 6 + 112 + 7, 4210752); this.textRenderer.method_30883(matrices, GuiText.StoredFluids.text(), 35, 6 + 112 + 7, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.getLocal(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
} }
@Override @Override
@@ -60,7 +60,7 @@ public class FluidLevelEmitterScreen extends UpgradeableScreen<FluidLevelEmitter
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) {
super.drawFG(matrices, offsetX, offsetY, mouseX, mouseY); super.drawFG(matrices, offsetX, offsetY, mouseX, mouseY);
this.textRenderer.draw(matrices, GuiText.FluidLevelEmitterUnit.getLocal(), 110, 44, COLOR_DARK_GRAY); this.textRenderer.method_30883(matrices, GuiText.FluidLevelEmitterUnit.text(), 110, 44, COLOR_DARK_GRAY);
} }
@Override @Override
@@ -98,8 +98,8 @@ public class FluidStorageBusScreen extends UpgradeableScreen<FluidStorageBusCont
@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(this.getName().text()), 8, 6, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(this.getName().text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.getLocal(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
if (this.fuzzyMode != null) { if (this.fuzzyMode != null) {
this.fuzzyMode.set(this.cvb.getFuzzyMode()); this.fuzzyMode.set(this.cvb.getFuzzyMode());
@@ -125,8 +125,8 @@ 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, 4210752); this.textRenderer.method_30883(matrices, this.getGuiDisplayName(new LiteralText("Fluid Terminal")), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.getLocal(), 8, this.backgroundHeight - 96 + 3, 4210752); this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
} }
@Override @Override
@@ -171,7 +171,7 @@ public class FluidTerminalScreen extends AEBaseMEScreen<FluidTerminalContainer>
list.add(new LiteralText(formattedAmount)); list.add(new LiteralText(formattedAmount));
list.add(new LiteralText(modName)); list.add(new LiteralText(modName));
this.renderTooltip(matrices, list, mouseX, mouseY); this.method_30901(matrices, list, mouseX, mouseY);
return; return;
} }
@@ -30,6 +30,9 @@ import appeng.core.AEConfig;
import appeng.util.ISlimReadableNumberConverter; import appeng.util.ISlimReadableNumberConverter;
import appeng.util.IWideReadableNumberConverter; import appeng.util.IWideReadableNumberConverter;
import appeng.util.ReadableNumberConverter; import appeng.util.ReadableNumberConverter;
import net.minecraft.text.LiteralText;
import net.minecraft.text.StringRenderable;
import net.minecraft.text.Text;
/** /**
* @author AlgorithmX2 * @author AlgorithmX2
@@ -47,12 +50,12 @@ public class FluidStackSizeRenderer {
public void renderStackSize(TextRenderer fontRenderer, IAEFluidStack aeStack, int xPos, int yPos) { public void renderStackSize(TextRenderer fontRenderer, IAEFluidStack aeStack, int xPos, int yPos) {
if (aeStack != null && aeStack.getStackSize() > 0) { if (aeStack != null && aeStack.getStackSize() > 0) {
final String stackSize = this.getToBeRenderedStackSize(aeStack.getStackSize()); final Text stackSize = this.getToBeRenderedStackSize(aeStack.getStackSize());
StackSizeRenderer.renderSizeLabel(fontRenderer, xPos, yPos, stackSize); StackSizeRenderer.renderSizeLabel(fontRenderer, xPos, yPos, stackSize);
} }
} }
private String getToBeRenderedStackSize(final long originalSize) { private Text getToBeRenderedStackSize(final long originalSize) {
// Handle any value below 100 (large font) or 1000 (small font) Buckets with a // Handle any value below 100 (large font) or 1000 (small font) Buckets with a
// custom formatter, // custom formatter,
// otherwise pass it to the normal number converter // otherwise pass it to the normal number converter
@@ -63,25 +66,25 @@ public class FluidStackSizeRenderer {
} }
if (AEConfig.instance().isUseLargeFonts()) { if (AEConfig.instance().isUseLargeFonts()) {
return SLIM_CONVERTER.toSlimReadableForm(originalSize / 1000); return new LiteralText(SLIM_CONVERTER.toSlimReadableForm(originalSize / 1000));
} else { } else {
return WIDE_CONVERTER.toWideReadableForm(originalSize / 1000); return new LiteralText(WIDE_CONVERTER.toWideReadableForm(originalSize / 1000));
} }
} }
private String getSlimRenderedStacksize(final long originalSize) { private Text getSlimRenderedStacksize(final long originalSize) {
final int log = 1 + (int) Math.floor(Math.log10(originalSize)) / 2; final int log = 1 + (int) Math.floor(Math.log10(originalSize)) / 2;
return this.getRenderedFluidStackSize(originalSize, log); return this.getRenderedFluidStackSize(originalSize, log);
} }
private String getWideRenderedStacksize(final long originalSize) { private Text getWideRenderedStacksize(final long originalSize) {
final int log = (int) Math.floor(Math.log10(originalSize)) / 2; final int log = (int) Math.floor(Math.log10(originalSize)) / 2;
return this.getRenderedFluidStackSize(originalSize, log); return this.getRenderedFluidStackSize(originalSize, log);
} }
private String getRenderedFluidStackSize(final long originalSize, final int log) { private Text getRenderedFluidStackSize(final long originalSize, final int log) {
final int index = Math.max(0, Math.min(3, log)); final int index = Math.max(0, Math.min(3, log));
final DecimalFormatSymbols symbols = new DecimalFormatSymbols(); final DecimalFormatSymbols symbols = new DecimalFormatSymbols();
@@ -90,7 +93,7 @@ public class FluidStackSizeRenderer {
format.setDecimalFormatSymbols(symbols); format.setDecimalFormatSymbols(symbols);
format.setRoundingMode(RoundingMode.DOWN); format.setRoundingMode(RoundingMode.DOWN);
return format.format(originalSize / 1000d); return new LiteralText(format.format(originalSize / 1000d));
} }
} }
@@ -315,7 +315,7 @@ public class FluidAnnihilationPlanePart extends BasicStatePart implements IGridT
} }
private boolean isFluidBlacklisted(Fluid fluid) { private boolean isFluidBlacklisted(Fluid fluid) {
Tag<Fluid> tag = FluidTags.getContainer().getOrCreate(TAG_BLACKLIST); Tag<Fluid> tag = FluidTags.getTagGroup().getTagOrEmpty(TAG_BLACKLIST);
return fluid.isIn(tag); return fluid.isIn(tag);
} }
@@ -26,7 +26,6 @@ import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import alexiil.mc.lib.attributes.Simulation; import alexiil.mc.lib.attributes.Simulation;
import alexiil.mc.lib.attributes.fluid.FluidAttributes; import alexiil.mc.lib.attributes.fluid.FluidAttributes;
import alexiil.mc.lib.attributes.fluid.FluidExtractable; import alexiil.mc.lib.attributes.fluid.FluidExtractable;
@@ -2,7 +2,7 @@ package appeng.hooks;
import net.fabricmc.fabric.api.event.Event; import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory; import net.fabricmc.fabric.api.event.EventFactory;
import net.minecraft.util.registry.RegistryTracker; import net.minecraft.util.registry.DynamicRegistryManager;
public interface RegisterDimensionTypeCallback { public interface RegisterDimensionTypeCallback {
@@ -13,6 +13,6 @@ public interface RegisterDimensionTypeCallback {
} }
}); });
void addDimensionTypes(RegistryTracker.Modifiable registryTracker); void addDimensionTypes(DynamicRegistryManager registryTracker);
} }
@@ -28,7 +28,7 @@ public class FacadeRecipeCategory extends DefaultCraftingCategory {
@Override @Override
public String getCategoryName() { public String getCategoryName() {
return I18n.translate(FacadeCreativeTab.getGroup().getTranslationKey()); return FacadeCreativeTab.getGroup().getTranslationKey().getString();
} }
} }
@@ -104,7 +104,7 @@ public class FacadeItem extends AEBaseItem implements IFacadeItem, IAlphaPassIte
BlockState blockState = block.getDefaultState(); BlockState blockState = block.getDefaultState();
final boolean areTileEntitiesEnabled = AEConfig.instance().isFeatureEnabled(AEFeature.TILE_ENTITY_FACADES); final boolean areTileEntitiesEnabled = AEConfig.instance().isFeatureEnabled(AEFeature.TILE_ENTITY_FACADES);
Tag<Block> whitelistTag = BlockTags.getContainer().getOrCreate(TAG_WHITELISTED); Tag<Block> whitelistTag = BlockTags.getTagGroup().getTagOrEmpty(TAG_WHITELISTED);
final boolean isWhiteListed = block.isIn(whitelistTag); final boolean isWhiteListed = block.isIn(whitelistTag);
final boolean isModel = blockState.getRenderType() == BlockRenderType.MODEL; final boolean isModel = blockState.getRenderType() == BlockRenderType.MODEL;
@@ -221,7 +221,7 @@ public class ColorApplicatorItem extends AEBasePoweredItem
return ipb.getColor(); return ipb.getColor();
} else { } else {
for (Map.Entry<Identifier, AEColor> entry : TAG_TO_COLOR.entrySet()) { for (Map.Entry<Identifier, AEColor> entry : TAG_TO_COLOR.entrySet()) {
Tag<Item> tag = ItemTags.getContainer().get(entry.getKey()); Tag<Item> tag = ItemTags.getTagGroup().getTag(entry.getKey());
if (tag != null && paintBall.getItem().isIn(tag)) { if (tag != null && paintBall.getItem().isIn(tag)) {
return entry.getValue(); return entry.getValue();
} }
@@ -185,7 +185,7 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
Entity entity = null; Entity entity = null;
Vec3d entityIntersection = null; Vec3d entityIntersection = null;
final List list = w.getEntities(p, bb); final List list = w.getOtherEntities(p, bb);
double closest = 9999999.0D; double closest = 9999999.0D;
for (int l = 0; l < list.size(); ++l) { for (int l = 0; l < list.size(); ++l) {
@@ -291,7 +291,7 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
Entity entity = null; Entity entity = null;
Vec3d entityIntersection = null; Vec3d entityIntersection = null;
final List list = w.getEntities(p, bb); final List list = w.getOtherEntities(p, bb);
double closest = 9999999.0D; double closest = 9999999.0D;
for (int l = 0; l < list.size(); ++l) { for (int l = 0; l < list.size(); ++l) {
@@ -0,0 +1,18 @@
package appeng.mixins;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.GenerationSettings;
import net.minecraft.world.gen.feature.StructureFeature;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import java.util.List;
import java.util.Map;
@Mixin(Biome.class)
public interface BiomeAccessor {
@Accessor
Map<Integer, List<StructureFeature<?>>> getField_26634();
}
@@ -1,11 +1,11 @@
package appeng.mixins; package appeng.mixins;
import net.minecraft.util.registry.DynamicRegistryManager;
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.util.registry.RegistryTracker;
import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.dimension.DimensionType;
import appeng.hooks.RegisterDimensionTypeCallback; import appeng.hooks.RegisterDimensionTypeCallback;
@@ -14,7 +14,7 @@ import appeng.hooks.RegisterDimensionTypeCallback;
public class DimensionTypeMixin { public class DimensionTypeMixin {
@Inject(method = "addRegistryDefaults", at = @At("TAIL")) @Inject(method = "addRegistryDefaults", at = @At("TAIL"))
private static void addRegistryDefaults(RegistryTracker.Modifiable registryTracker, CallbackInfoReturnable<?> cir) { private static void addRegistryDefaults(DynamicRegistryManager.Impl registryTracker, CallbackInfoReturnable<?> cir) {
RegisterDimensionTypeCallback.EVENT.invoker().addDimensionTypes(registryTracker); RegisterDimensionTypeCallback.EVENT.invoker().addDimensionTypes(registryTracker);
} }
@@ -0,0 +1,27 @@
package appeng.mixins;
import net.minecraft.world.biome.GenerationSettings;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import java.util.List;
import java.util.function.Supplier;
@Mixin(GenerationSettings.class)
public interface GenerationSettingsAccessor {
@Accessor
List<List<Supplier<ConfiguredFeature<?, ?>>>> getFeatures();
@Accessor
void setFeatures(List<List<Supplier<ConfiguredFeature<?, ?>>>> features);
@Accessor
List<Supplier<ConfiguredStructureFeature<?, ?>>> getStructureFeatures();
@Accessor
void setStructureFeatures(List<Supplier<ConfiguredStructureFeature<?, ?>>> structureFeatures);
}
@@ -6,6 +6,7 @@ import java.util.concurrent.Executor;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import net.minecraft.util.registry.DynamicRegistryManager;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
@@ -14,7 +15,6 @@ import net.minecraft.server.WorldGenerationProgressListener;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey; import net.minecraft.util.registry.RegistryKey;
import net.minecraft.util.registry.RegistryTracker;
import net.minecraft.world.SaveProperties; import net.minecraft.world.SaveProperties;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.border.WorldBorder; import net.minecraft.world.border.WorldBorder;
@@ -33,7 +33,7 @@ import appeng.hooks.DynamicDimensions;
public class MinecraftServerMixin implements DynamicDimensions { public class MinecraftServerMixin implements DynamicDimensions {
@Shadow @Shadow
private RegistryTracker.Modifiable dimensionTracker; private DynamicRegistryManager.Impl registryManager;
@Shadow @Shadow
private Map<RegistryKey<World>, ServerWorld> worlds; private Map<RegistryKey<World>, ServerWorld> worlds;
@@ -58,12 +58,12 @@ public class MinecraftServerMixin implements DynamicDimensions {
Preconditions.checkArgument(!generatorOptions.getDimensionMap().containsId(worldId.getValue()), Preconditions.checkArgument(!generatorOptions.getDimensionMap().containsId(worldId.getValue()),
"Dimension config with id %s already exists.", worldId.getValue()); "Dimension config with id %s already exists.", worldId.getValue());
DimensionType dimensionType = dimensionTracker.getDimensionTypeRegistry().get(dimensionTypeId); DimensionType dimensionType = registryManager.getDimensionTypes().get(dimensionTypeId);
Preconditions.checkArgument(dimensionType != null, "dimensionTypeId %s is not registered", dimensionTypeId); Preconditions.checkArgument(dimensionType != null, "dimensionTypeId %s is not registered", dimensionTypeId);
// Create dimension options with the given world-id and chunk generator // Create dimension options with the given world-id and chunk generator
DimensionOptions dimensionOptions = new DimensionOptions( DimensionOptions dimensionOptions = new DimensionOptions(
() -> dimensionTracker.getDimensionTypeRegistry().get(dimensionTypeId), chunkGenerator); () -> registryManager.getDimensionTypes().get(dimensionTypeId), chunkGenerator);
ServerWorldProperties serverWorldProperties = this.saveProperties.getMainWorldProperties(); ServerWorldProperties serverWorldProperties = this.saveProperties.getMainWorldProperties();
@@ -93,10 +93,11 @@ public class MinecraftServerMixin implements DynamicDimensions {
// Adding it here will cause the world to be re-created on server restart // Adding it here will cause the world to be re-created on server restart
RegistryKey<DimensionOptions> dimOptKey = RegistryKey.of(Registry.DIMENSION_OPTIONS, worldId.getValue()); RegistryKey<DimensionOptions> dimOptKey = RegistryKey.of(Registry.DIMENSION_OPTIONS, worldId.getValue());
generatorOptions.getDimensionMap().add(dimOptKey, dimensionOptions); generatorOptions.getDimensionMap().add(dimOptKey, dimensionOptions);
generatorOptions.getDimensionMap().markLoaded(dimOptKey); // Otherwise it wont be saved // FIXME FABRIC: might not be needed anymore if dimensions will save regardless
// FIXME FABRIC generatorOptions.getDimensionMap().markLoaded(dimOptKey); // Otherwise it wont be saved
// Ensure the save properties are saved, or the world will potentially be lost // Ensure the save properties are saved, or the world will potentially be lost
// on restart // on restart
this.session.method_27426(this.dimensionTracker, this.saveProperties, self.getPlayerManager().getUserData()); this.session.method_27426(this.registryManager, this.saveProperties, self.getPlayerManager().getUserData());
return world; return world;
} }
@@ -39,7 +39,6 @@ import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.RayTraceContext; import net.minecraft.world.RayTraceContext;
import net.minecraft.world.World; import net.minecraft.world.World;
import appeng.api.definitions.IBlockDefinition; import appeng.api.definitions.IBlockDefinition;
import appeng.api.parts.*; import appeng.api.parts.*;
import appeng.api.util.AEPartLocation; import appeng.api.util.AEPartLocation;
@@ -566,7 +566,7 @@ public class AnnihilationPlanePart extends BasicStatePart implements IGridTickab
// breaking // breaking
// i.e. our cable-buses do this (bad practice, really) // i.e. our cable-buses do this (bad practice, really)
final Box box = new Box(pos).expand(0.2); final Box box = new Box(pos).expand(0.2);
for (final Object ei : w.getEntities(ItemEntity.class, box, null)) { for (final Object ei : w.getEntitiesByClass(ItemEntity.class, box, null)) {
if (ei instanceof ItemEntity) { if (ei instanceof ItemEntity) {
final ItemEntity entityItem = (ItemEntity) ei; final ItemEntity entityItem = (ItemEntity) ei;
this.storeEntityItem(entityItem); this.storeEntityItem(entityItem);
@@ -616,12 +616,12 @@ public class AnnihilationPlanePart extends BasicStatePart implements IGridTickab
} }
public static boolean isBlockBlacklisted(Block b) { public static boolean isBlockBlacklisted(Block b) {
Tag<Block> tag = BlockTags.getContainer().getOrCreate(TAG_BLACKLIST); Tag<Block> tag = BlockTags.getTagGroup().getTagOrEmpty(TAG_BLACKLIST);
return b.isIn(tag); return b.isIn(tag);
} }
public static boolean isItemBlacklisted(Item i) { public static boolean isItemBlacklisted(Item i) {
Tag<Item> tag = ItemTags.getContainer().getOrCreate(TAG_BLACKLIST); Tag<Item> tag = ItemTags.getTagGroup().getTagOrEmpty(TAG_BLACKLIST);
return i.isIn(tag); return i.isIn(tag);
} }
@@ -346,7 +346,7 @@ public class FormationPlanePart extends AbstractFormationPlanePart<IAEItemStack>
private int countEntitesAround(World world, BlockPos pos) { private int countEntitesAround(World world, BlockPos pos) {
final Box t = new Box(pos).expand(8); final Box t = new Box(pos).expand(8);
final List<Entity> list = world.getEntities(Entity.class, t, null); final List<Entity> list = world.getEntitiesByClass(Entity.class, t, null);
return list.size(); return list.size();
} }
@@ -19,7 +19,7 @@ public final class GrinderRecipes {
@Nullable @Nullable
public static GrinderRecipe findForInput(World world, ItemStack input) { public static GrinderRecipe findForInput(World world, ItemStack input) {
// FIXME: this is slow, this creates a full copy of the list everytime // FIXME: this is slow, this creates a full copy of the list everytime
List<GrinderRecipe> grinderRecipes = world.getRecipeManager().method_30027(GrinderRecipe.TYPE); List<GrinderRecipe> grinderRecipes = world.getRecipeManager().listAllOfType(GrinderRecipe.TYPE);
for (GrinderRecipe recipe : grinderRecipes) { for (GrinderRecipe recipe : grinderRecipes) {
if (recipe.getIngredient().test(input) && input.getCount() >= recipe.getIngredientCount()) { if (recipe.getIngredient().test(input) && input.getCount() >= recipe.getIngredientCount()) {
return recipe; return recipe;
@@ -34,7 +34,7 @@ public final class GrinderRecipes {
*/ */
public static boolean isValidIngredient(World world, ItemStack stack) { public static boolean isValidIngredient(World world, ItemStack stack) {
// FIXME: this is slow, this creates a full copy of the list everytime // FIXME: this is slow, this creates a full copy of the list everytime
List<GrinderRecipe> grinderRecipes = world.getRecipeManager().method_30027(GrinderRecipe.TYPE); List<GrinderRecipe> grinderRecipes = world.getRecipeManager().listAllOfType(GrinderRecipe.TYPE);
for (GrinderRecipe recipe : grinderRecipes) { for (GrinderRecipe recipe : grinderRecipes) {
if (recipe.getIngredient().test(stack)) { if (recipe.getIngredient().test(stack)) {
return true; return true;
@@ -3,8 +3,6 @@ package appeng.recipes.handlers;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.recipe.*; import net.minecraft.recipe.*;
import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.Recipe;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.collection.DefaultedList;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -170,8 +170,8 @@ public class TestMeteoritesCommand implements ISubCommand {
// Add a tooltip // Add a tooltip
MutableText tooltip = new LiteralText(settings.toString() + "\nBiome: ") MutableText tooltip = new LiteralText(settings.toString() + "\nBiome: ")
.append(world.getBiome(pos).getName()); .append(world.getBiome(pos).toString());
msg.styled(style -> style.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip))); msg.styled(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)));
sender.sendFeedback(msg, true); sender.sendFeedback(msg, true);
} }
@@ -33,6 +33,7 @@ import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.ServerWorldAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
@@ -89,18 +90,14 @@ public final class CompassService {
} }
} }
public void tryUpdateArea(final WorldAccess w, ChunkPos chunkPos) { public void tryUpdateArea(final ServerWorldAccess w, ChunkPos chunkPos) {
// If this seems weird: during worldgen, WorldAccess is a specific region, but // If this seems weird: during worldgen, WorldAccess is a specific region, but
// getWorld is // getWorld is
// still the server world. We do need to use the world access to get the chunk // still the server world. We do need to use the world access to get the chunk
// in question // in question
// though, since during worldgen, it's not comitted to the actual world yet. // though, since during worldgen, it's not comitted to the actual world yet.
World world = w.getWorld();
if (!(world instanceof ServerWorld)) {
return;
}
Chunk chunk = w.getChunk(chunkPos.x, chunkPos.z); Chunk chunk = w.getChunk(chunkPos.x, chunkPos.z);
updateArea((ServerWorld) world, chunk); updateArea(w.toServerWorld(), chunk);
} }
public void updateArea(final ServerWorld w, Chunk chunk) { public void updateArea(final ServerWorld w, Chunk chunk) {
@@ -18,31 +18,27 @@
package appeng.spatial; package appeng.spatial;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeEffects; import net.minecraft.world.biome.BiomeEffects;
import net.minecraft.world.biome.GenerationSettings;
import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.gen.surfacebuilder.ConfiguredSurfaceBuilder; import net.minecraft.world.gen.surfacebuilder.ConfiguredSurfaceBuilder;
import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder; import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
public class StorageCellBiome extends Biome { public class StorageCellBiome {
public static final StorageCellBiome INSTANCE = new StorageCellBiome(); public static final Biome INSTANCE = new Biome.Settings()
.generationSettings(new GenerationSettings.Builder()
public StorageCellBiome() { .surfaceBuilder(new ConfiguredSurfaceBuilder<>(SurfaceBuilder.NOPE, SurfaceBuilder.STONE_CONFIG))
super(new Biome.Settings() .build())
.surfaceBuilder(new ConfiguredSurfaceBuilder<>(SurfaceBuilder.NOPE, SurfaceBuilder.STONE_CONFIG)) .precipitation(Biome.Precipitation.NONE).category(Biome.Category.NONE).depth(0).scale(1)
.precipitation(Precipitation.NONE).category(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).waterFogColor(329011).fogColor(0).skyColor(0x111111).build())
.effects(new BiomeEffects.Builder().waterColor(4159204).waterFogColor(329011).fogColor(0).build()) .parent(null)
.parent(null)); .spawnSettings(new SpawnSettings.Builder()
} .creatureSpawnProbability(0)
.build())
@Override .build();
@Environment(EnvType.CLIENT)
public int getSkyColor() {
return 0x111111;
}
} }
@@ -66,7 +66,7 @@ public class StorageChunkGenerator extends ChunkGenerator {
} }
@Override @Override
protected Codec<? extends ChunkGenerator> method_28506() { protected Codec<? extends ChunkGenerator> getCodec() {
return CODEC; return CODEC;
} }
@@ -105,7 +105,7 @@ public class StorageHelper {
// FIXME FABRIC new METeleporter(link) // FIXME FABRIC new METeleporter(link)
float yaw = entity.yaw; float yaw = entity.yaw;
entity = entity.changeDimension(link.dim); entity = entity.moveToWorld(link.dim);
entity.yaw = yaw; entity.yaw = yaw;
entity.refreshPositionAfterTeleport(link.x, link.y, link.z); entity.refreshPositionAfterTeleport(link.x, link.y, link.z);
entity.setVelocity(0, 0, 0); entity.setVelocity(0, 0, 0);
@@ -32,7 +32,7 @@ public final class InscriberRecipes {
* Returns an unmodifiable view of all registered inscriber recipes. * Returns an unmodifiable view of all registered inscriber recipes.
*/ */
public static Iterable<InscriberRecipe> getRecipes(World world) { public static Iterable<InscriberRecipe> getRecipes(World world) {
return world.getRecipeManager().method_30027(InscriberRecipe.TYPE); return world.getRecipeManager().listAllOfType(InscriberRecipe.TYPE);
} }
@Nullable @Nullable
@@ -39,7 +39,6 @@ import net.minecraft.util.Tickable;
import net.minecraft.util.math.BlockPos; 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.AttributeList; import alexiil.mc.lib.attributes.AttributeList;
import alexiil.mc.lib.attributes.Simulation; import alexiil.mc.lib.attributes.Simulation;
import alexiil.mc.lib.attributes.fluid.FluidInsertable; import alexiil.mc.lib.attributes.fluid.FluidInsertable;
+1 -1
View File
@@ -694,7 +694,7 @@ public class Platform {
Entity entity = null; Entity entity = null;
double closest = 9999999.0D; double closest = 9999999.0D;
if (hitEntities) { if (hitEntities) {
final List<Entity> list = w.getEntities(p, bb); final List<Entity> list = w.getOtherEntities(p, bb);
for (final Entity entity1 : list) { for (final Entity entity1 : list) {
if (entity1.isAlive() && entity1 != p && !(entity1 instanceof ItemEntity)) { if (entity1.isAlive() && entity1 != p && !(entity1 instanceof ItemEntity)) {
@@ -0,0 +1,62 @@
package appeng.worldgen;
import appeng.mixins.BiomeAccessor;
import appeng.mixins.GenerationSettingsAccessor;
import com.google.common.collect.Lists;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
import net.minecraft.world.gen.feature.StructureFeature;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;
public final class BiomeModifier {
private final BiomeAccessor biomeAccessor;
private final GenerationSettingsAccessor generationSettingsAccessor;
@SuppressWarnings("ConstantConditions")
public BiomeModifier(Biome biome) {
this.biomeAccessor = (BiomeAccessor) (Object) biome;
this.generationSettingsAccessor = (GenerationSettingsAccessor) biome.getGenerationSettings();
}
public void addFeature(GenerationStep.Feature step, ConfiguredFeature<?, ?> feature) {
int stepIndex = step.ordinal();
List<List<Supplier<ConfiguredFeature<?, ?>>>> featuresByStep = new ArrayList<>(generationSettingsAccessor.getFeatures());
while (featuresByStep.size() <= stepIndex) {
featuresByStep.add(Lists.newArrayList());
}
List<Supplier<ConfiguredFeature<?, ?>>> features = new ArrayList<>(featuresByStep.get(stepIndex));
features.add(() -> feature);
featuresByStep.set(stepIndex, features);
generationSettingsAccessor.setFeatures(featuresByStep);
}
public void addStructureFeature(ConfiguredStructureFeature<?, ?> structure) {
List<Supplier<ConfiguredStructureFeature<?, ?>>> features = new ArrayList<>(generationSettingsAccessor.getStructureFeatures());
features.add(() -> structure);
generationSettingsAccessor.setStructureFeatures(features);
// Add it to the structures that will generate pieces within this biome,
// this is only half-correct since a structure can start in an adjacent biome
// and extend into biomes that would usually not start the structure
Map<Integer, List<StructureFeature<?>>> structuresByStage = biomeAccessor.getField_26634();
int step = structure.feature.getGenerationStep().ordinal();
if (!structuresByStage.containsKey(step)) {
structuresByStage.put(step, new ArrayList<>());
}
structuresByStage.get(step).add(structure.feature);
}
}
@@ -15,7 +15,7 @@ public class ChargedQuartzOreConfig implements FeatureConfig {
public static final Codec<ChargedQuartzOreConfig> CODEC = RecordCodecBuilder.create((instance) -> instance public static final Codec<ChargedQuartzOreConfig> CODEC = RecordCodecBuilder.create((instance) -> instance
.group(BlockState.CODEC.fieldOf("target").forGetter((config) -> config.target), .group(BlockState.CODEC.fieldOf("target").forGetter((config) -> config.target),
BlockState.CODEC.fieldOf("state").forGetter((config) -> config.state), BlockState.CODEC.fieldOf("state").forGetter((config) -> config.state),
Codec.FLOAT.fieldOf("chance").withDefault(0f).forGetter((config) -> config.chance)) Codec.FLOAT.fieldOf("chance").orElse(0f).forGetter((config) -> config.chance))
.apply(instance, ChargedQuartzOreConfig::new)); .apply(instance, ChargedQuartzOreConfig::new));
public final BlockState target; public final BlockState target;
@@ -1,15 +1,12 @@
package appeng.worldgen; package appeng.worldgen;
import java.util.Random; import java.util.Random;
import java.util.function.Predicate;
import com.mojang.serialization.Codec; import com.mojang.serialization.Codec;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.Heightmap; import net.minecraft.world.Heightmap;
import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.Feature;
@@ -28,8 +25,7 @@ public class ChargedQuartzOreFeature extends Feature<ChargedQuartzOreConfig> {
} }
@Override @Override
public boolean generate(ServerWorldAccess worldIn, net.minecraft.world.gen.StructureAccessor structureAccessor, public boolean generate(StructureWorldAccess worldIn, ChunkGenerator generator, Random rand, BlockPos pos, ChargedQuartzOreConfig config) {
ChunkGenerator generator, Random rand, BlockPos pos, ChargedQuartzOreConfig config) {
ChunkPos chunkPos = new ChunkPos(pos); ChunkPos chunkPos = new ChunkPos(pos);
BlockPos.Mutable bpos = new BlockPos.Mutable(); BlockPos.Mutable bpos = new BlockPos.Mutable();
@@ -193,7 +193,7 @@ public final class MeteoritePlacer {
} }
} }
for (final Object o : world.getEntities(ItemEntity.class, for (final Object o : world.getEntitiesByClass(ItemEntity.class,
new Box(minX(x - 30), y - 5, minZ(z - 30), maxX(x + 30), y + 30, maxZ(z + 30)), null)) { new Box(minX(x - 30), y - 5, minZ(z - 30), maxX(x + 30), y + 30, maxZ(z + 30)), null)) {
final Entity e = (Entity) o; final Entity e = (Entity) o;
e.remove(); e.remove();
@@ -26,7 +26,7 @@ import net.minecraft.structure.StructurePieceType;
import net.minecraft.util.math.BlockBox; import net.minecraft.util.math.BlockBox;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.StructureAccessor; import net.minecraft.world.gen.StructureAccessor;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.ChunkGenerator;
@@ -85,7 +85,7 @@ public class MeteoriteStructurePiece extends StructurePiece {
} }
@Override @Override
public boolean generate(ServerWorldAccess world, StructureAccessor structureAccessor, ChunkGenerator chunkGenerator, public boolean generate(StructureWorldAccess world, StructureAccessor structureAccessor, ChunkGenerator chunkGenerator,
Random random, BlockBox bounds, ChunkPos chunkPos, BlockPos blockPos) { Random random, BlockBox bounds, ChunkPos chunkPos, BlockPos blockPos) {
MeteoritePlacer placer = new MeteoritePlacer(world, settings, bounds); MeteoritePlacer placer = new MeteoritePlacer(world, settings, bounds);
placer.place(); placer.place();
@@ -14,6 +14,7 @@ import net.minecraft.tag.Tag;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockBox; import net.minecraft.util.math.BlockBox;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.DynamicRegistryManager;
import net.minecraft.world.Heightmap; import net.minecraft.world.Heightmap;
import net.minecraft.world.Heightmap.Type; import net.minecraft.world.Heightmap.Type;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
@@ -26,9 +27,9 @@ import appeng.worldgen.meteorite.fallout.FalloutMode;
public class MeteoriteStructureStart extends StructureStart<DefaultFeatureConfig> { public class MeteoriteStructureStart extends StructureStart<DefaultFeatureConfig> {
private final Tag<Block> sandTag = BlockTags.getContainer().getOrCreate(new Identifier("minecraft:sand")); private final Tag<Block> sandTag = BlockTags.getTagGroup().getTagOrEmpty(new Identifier("minecraft:sand"));
private final Tag<Block> terracottaTag = BlockTags.getContainer() private final Tag<Block> terracottaTag = BlockTags.getTagGroup()
.getOrCreate(new Identifier("c:terracotta_blocks")); .getTagOrEmpty(new Identifier("c:terracotta_blocks"));
public MeteoriteStructureStart(StructureFeature<DefaultFeatureConfig> feature, int chunkX, int chunkZ, BlockBox box, public MeteoriteStructureStart(StructureFeature<DefaultFeatureConfig> feature, int chunkX, int chunkZ, BlockBox box,
int references, long seed) { int references, long seed) {
@@ -36,8 +37,7 @@ public class MeteoriteStructureStart extends StructureStart<DefaultFeatureConfig
} }
@Override @Override
public void init(ChunkGenerator generator, StructureManager templateManagerIn, int chunkX, int chunkZ, Biome biome, public void init(DynamicRegistryManager dynamicRegistryManager, ChunkGenerator generator, StructureManager structureManager, int chunkX, int chunkZ, Biome biome, DefaultFeatureConfig featureConfig) {
DefaultFeatureConfig config) {
final int centerX = chunkX * 16 + this.random.nextInt(16); final int centerX = chunkX * 16 + this.random.nextInt(16);
final int centerZ = chunkZ * 16 + this.random.nextInt(16); final int centerZ = chunkZ * 16 + this.random.nextInt(16);
final float meteoriteRadius = (this.random.nextFloat() * 6.0f) + 2; final float meteoriteRadius = (this.random.nextFloat() * 6.0f) + 2;
@@ -75,7 +75,7 @@ public class MeteoriteStructureStart extends StructureStart<DefaultFeatureConfig
boolean craterLake = this.locateWaterAroundTheCrater(generator, actualPos, meteoriteRadius); boolean craterLake = this.locateWaterAroundTheCrater(generator, actualPos, meteoriteRadius);
CraterType craterType = this.determineCraterType(spawnBiome); CraterType craterType = this.determineCraterType(spawnBiome);
boolean pureCrater = this.random.nextFloat() > .9f; boolean pureCrater = this.random.nextFloat() > .9f;
FalloutMode fallout = getFalloutFromBaseBlock(spawnBiome.getSurfaceConfig().getTopMaterial()); FalloutMode fallout = getFalloutFromBaseBlock(spawnBiome.getGenerationSettings().getSurfaceConfig().getTopMaterial());
children.add( children.add(
new MeteoriteStructurePiece(actualPos, meteoriteRadius, craterType, fallout, pureCrater, craterLake)); new MeteoriteStructurePiece(actualPos, meteoriteRadius, craterType, fallout, pureCrater, craterLake));
@@ -37,7 +37,7 @@ public class FalloutCopy extends Fallout {
final BlockState skyStone) { final BlockState skyStone) {
super(putter, skyStone); super(putter, skyStone);
this.putter = putter; this.putter = putter;
this.block = w.getBiome(pos).getSurfaceConfig().getTopMaterial(); this.block = w.getBiome(pos).getGenerationSettings().getSurfaceConfig().getTopMaterial();
} }
@Override @Override
@@ -12,7 +12,9 @@
"TntAccessor", "TntAccessor",
"DimensionTypeMixin", "DimensionTypeMixin",
"MinecraftServerMixin", "MinecraftServerMixin",
"ThreadedAnvilChunkStorageAccessor" "ThreadedAnvilChunkStorageAccessor",
"GenerationSettingsAccessor",
"BiomeAccessor"
], ],
"client": [ "client": [
"ModelsReloadMixin", "ModelsReloadMixin",