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
@@ -60,7 +60,7 @@ public class AEBaseBlockItem extends BlockItem {
@Environment(EnvType.CLIENT)
public void addCheckedInformation(final ItemStack itemStack, final World world, final List<Text> toolTip,
final TooltipContext advancedTooltips) {
this.blockType.buildTooltip(itemStack, world, toolTip, advancedTooltips);
this.blockType.appendTooltip(itemStack, world, toolTip, advancedTooltips);
}
@Override
@@ -37,6 +37,7 @@ import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import appeng.block.AEBaseTileBlock;
import appeng.block.networking.WirelessBlock.State;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.WirelessContainer;
@@ -70,14 +70,14 @@ public abstract class AEBaseMEScreen<T extends AEBaseContainer> extends AEBaseSc
currentToolTip.add(ButtonToolTips.ItemsRequestable.text(formattedAmount));
}
this.renderTooltip(matrices, currentToolTip, x, y);
this.method_30901(matrices, currentToolTip, x, y);
return;
} else if (stack.getCount() > bigNumber) {
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(stack.getCount());
currentToolTip.add(ButtonToolTips.ItemsStored.text(formattedAmount).formatted(Formatting.GRAY));
this.renderTooltip(matrices, currentToolTip, x, y);
this.method_30901(matrices, currentToolTip, x, y);
return;
}
@@ -225,7 +225,7 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
styledLines.add(lines.get(i).copy().styled(s -> style));
}
this.renderTooltip(matrices, styledLines, x, y);
this.method_30901(matrices, styledLines, x, y);
}
@Override
@@ -51,8 +51,8 @@ public class ChestScreen extends AEBaseScreen<ChestContainer> {
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.Chest.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.Chest.text()), 8, 6, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
}
@Override
@@ -55,8 +55,8 @@ public class CondenserScreen extends AEBaseScreen<CondenserContainer> {
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.Condenser.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.Condenser.text()), 8, 6, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.mode.set(this.handler.getOutput());
this.mode.setFillVar(String.valueOf(this.handler.getOutput().requiredPower));
@@ -66,7 +66,7 @@ public class CraftAmountScreen extends AEBaseScreen<CraftAmountContainer> {
@Override
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
@@ -162,7 +162,7 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
final String byteUsed = NumberFormat.getInstance().format(BytesUsed);
final Text Add = BytesUsed > 0 ? new LiteralText(byteUsed + " ").append(GuiText.BytesUsed.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;
@@ -176,7 +176,7 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
}
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;
@@ -172,7 +172,7 @@ public class CraftingCPUScreen<T extends CraftingCPUContainer> extends AEBaseScr
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 y = 0;
@@ -64,7 +64,7 @@ public class CraftingTermScreen extends MEMonitorableScreen<CraftingTermContaine
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int 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);
}
@@ -51,8 +51,8 @@ public class DriveScreen extends AEBaseScreen<DriveContainer> {
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.Drive.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.Drive.text()), 8, 6, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
}
@Override
@@ -58,8 +58,8 @@ public class FormationPlaneScreen extends UpgradeableScreen<FormationPlaneContai
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.FormationPlane.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.FormationPlane.text()), 8, 6, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
if (this.fuzzyMode != null) {
this.fuzzyMode.set(this.cvb.getFuzzyMode());
@@ -35,8 +35,8 @@ public class GrinderScreen extends AEBaseScreen<GrinderContainer> {
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.GrindStone.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.GrindStone.text()), 8, 6, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
}
@Override
@@ -59,8 +59,8 @@ public class IOPortScreen extends UpgradeableScreen<IOPortContainer> {
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.IOPort.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.IOPort.text()), 8, 6, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
if (this.redstoneMode != null) {
this.redstoneMode.set(this.cvb.getRedStoneMode());
@@ -56,8 +56,8 @@ public class InscriberScreen extends AEBaseScreen<InscriberContainer> {
this.pb.setFullMsg(
new LiteralText(this.handler.getCurrentProgress() * 100 / this.handler.getMaxProgress() + "%"));
this.textRenderer.draw(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, this.getGuiDisplayName(GuiText.Inscriber.text()), 8, 6, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
}
@Override
@@ -68,13 +68,13 @@ public class InterfaceScreen extends UpgradeableScreen<InterfaceContainer> {
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.draw(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.Config.text(), 8, 6 + 11 + 7, 4210752);
this.textRenderer.method_30883(matrices, GuiText.StoredItems.text(), 8, 6 + 60 + 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
@@ -95,8 +95,8 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.InterfaceTerminal.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.InterfaceTerminal.text()), 8, 6, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
final int ex = this.getScrollBar().getCurrentScroll();
@@ -285,8 +285,8 @@ public class MEMonitorableScreen<T extends MEMonitorableContainer> extends AEBas
@Override
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.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(this.myName.text()), 8, 6, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.currentMouseX = mouseX;
this.currentMouseY = mouseY;
@@ -101,7 +101,7 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
@Override
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,
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.textRenderer.draw(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, this.getGuiDisplayName(GuiText.NetworkTool.text()), 8, 6, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
}
@Override
@@ -126,7 +126,7 @@ public class PatternTermScreen extends MEMonitorableScreen<PatternTermContainer>
}
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);
}
@@ -62,7 +62,7 @@ public class PriorityScreen extends AEBaseScreen<PriorityContainer> {
@Override
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
@@ -35,8 +35,8 @@ public class QNBScreen extends AEBaseScreen<QNBContainer> {
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.QuantumLinkChamber.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.QuantumLinkChamber.text()), 8, 6, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
}
@Override
@@ -59,8 +59,8 @@ public class QuartzKnifeScreen extends AEBaseScreen<QuartzKnifeContainer> {
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.QuartzCuttingKnife.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.QuartzCuttingKnife.text()), 8, 6, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
}
@Override
@@ -82,7 +82,7 @@ public class SecurityStationScreen extends MEMonitorableScreen<SecurityStationCo
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int 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);
}
@@ -39,8 +39,8 @@ public class SkyChestScreen extends AEBaseScreen<SkyChestContainer> {
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.SkyChest.text()), 8, 8, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 2, 4210752);
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.SkyChest.text()), 8, 8, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 2, 4210752);
}
@Override
@@ -43,27 +43,27 @@ public class SpatialIOPortScreen extends AEBaseScreen<SpatialIOPortContainer> {
@Override
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)),
13, 21, 4210752);
this.textRenderer.draw(matrices,
this.textRenderer.method_30883(matrices,
GuiText.MaxPower.withSuffix(": " + Platform.formatPowerLong(this.handler.getMaxPower(), false)), 13, 31,
4210752);
this.textRenderer.draw(matrices, GuiText.RequiredPower
this.textRenderer.method_30883(matrices, GuiText.RequiredPower
.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,
4210752);
this.textRenderer.draw(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, this.getGuiDisplayName(GuiText.SpatialIOPort.text()), 8, 6, 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) {
final Text text = GuiText.SCSSize
.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 {
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);
}
@@ -69,8 +69,8 @@ public class StorageBusScreen extends UpgradeableScreen<StorageBusContainer> {
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.StorageBus.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.StorageBus.text()), 8, 6, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
if (this.fuzzyMode != null) {
this.fuzzyMode.set(this.cvb.getFuzzyMode());
@@ -82,8 +82,8 @@ public class UpgradeableScreen<T extends UpgradeableContainer> extends AEBaseScr
@Override
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.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(this.getName().text()), 8, 6, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
if (this.redstoneMode != null) {
this.redstoneMode.set(this.cvb.getRedStoneMode());
@@ -51,8 +51,8 @@ public class VibrationChamberScreen extends AEBaseScreen<VibrationChamberContain
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.VibrationChamber.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.VibrationChamber.text()), 8, 6, 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.handler.getCurrentProgress() / VibrationChamberBlockEntity.DILATION_SCALING + " AE/t"));
@@ -44,8 +44,8 @@ public class WirelessScreen extends AEBaseScreen<WirelessContainer> {
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.Wireless.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.Wireless.text()), 8, 6, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
if (handler.getRange() > 0) {
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.IWideReadableNumberConverter;
import appeng.util.ReadableNumberConverter;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
/**
* @author AlgorithmX2
@@ -46,8 +48,8 @@ public class StackSizeRenderer {
public void renderStackSize(TextRenderer fontRenderer, IAEItemStack aeStack, int xPos, int yPos) {
if (aeStack != null) {
if (aeStack.getStackSize() == 0 && aeStack.isCraftable()) {
final String craftLabelText = AEConfig.instance().isUseLargeFonts() ? GuiText.LargeFontCraft.getLocal()
: GuiText.SmallFontCraft.getLocal();
final Text craftLabelText = AEConfig.instance().isUseLargeFonts() ? GuiText.LargeFontCraft.text()
: GuiText.SmallFontCraft.text();
renderSizeLabel(fontRenderer, xPos, yPos, craftLabelText);
}
@@ -55,13 +57,13 @@ public class StackSizeRenderer {
if (aeStack.getStackSize() > 0) {
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 inverseScaleFactor = 1.0f / scaleFactor;
@@ -76,7 +78,7 @@ public class StackSizeRenderer {
final int Y = (int) ((yPos + offset + 16.0f - 7.0f * scaleFactor) * inverseScaleFactor);
VertexConsumerProvider.Immediate buffer = VertexConsumerProvider
.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();
RenderSystem.enableBlend();
}
@@ -21,7 +21,6 @@ package appeng.client.render.effects;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.particle.*;
import net.minecraft.client.particle.ParticleTextureSheet;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.Vector3f;
@@ -24,7 +24,6 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.particle.*;
import net.minecraft.client.particle.ParticleTextureSheet;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.world.ClientWorld;
@@ -21,9 +21,6 @@ package appeng.client.render.effects;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
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.particle.DefaultParticleType;
@@ -132,7 +132,7 @@ public final class ContainerLocator {
public static ContainerLocator forPart(AEBasePart part) {
IPartHost host = part.getHost();
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() {
@@ -233,7 +233,7 @@ public class RestrictedInputSlot extends AppEngSlot {
// TODO: Can be optimized by somehow caching the Tag's
Item item = i.getItem();
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)) {
return true;
}
+68 -65
View File
@@ -1,56 +1,5 @@
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.definitions.IBlocks;
import appeng.api.definitions.IItems;
@@ -149,9 +98,60 @@ import appeng.spatial.SpatialDimensionManager;
import appeng.spatial.StorageCellBiome;
import appeng.spatial.StorageChunkGenerator;
import appeng.tile.AEBaseBlockEntity;
import appeng.worldgen.BiomeModifier;
import appeng.worldgen.ChargedQuartzOreConfig;
import appeng.worldgen.ChargedQuartzOreFeature;
import appeng.worldgen.meteorite.MeteoriteStructure;
import net.earthcomputer.libstructure.LibStructure;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BannerBlockEntity;
import net.minecraft.block.entity.BeaconBlockEntity;
import net.minecraft.block.entity.BrewingStandBlockEntity;
import net.minecraft.block.entity.ChestBlockEntity;
import net.minecraft.block.entity.CommandBlockBlockEntity;
import net.minecraft.block.entity.ComparatorBlockEntity;
import net.minecraft.block.entity.DaylightDetectorBlockEntity;
import net.minecraft.block.entity.DispenserBlockEntity;
import net.minecraft.block.entity.DropperBlockEntity;
import net.minecraft.block.entity.EnchantingTableBlockEntity;
import net.minecraft.block.entity.EndPortalBlockEntity;
import net.minecraft.block.entity.EnderChestBlockEntity;
import net.minecraft.block.entity.FurnaceBlockEntity;
import net.minecraft.block.entity.HopperBlockEntity;
import net.minecraft.block.entity.MobSpawnerBlockEntity;
import net.minecraft.block.entity.PistonBlockEntity;
import net.minecraft.block.entity.ShulkerBoxBlockEntity;
import net.minecraft.block.entity.SignBlockEntity;
import net.minecraft.block.entity.SkullBlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.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 {
@@ -426,7 +426,7 @@ public abstract class AppEngBase implements AppEng {
@Override
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()) {
return;
}
@@ -450,7 +450,7 @@ public abstract class AppEngBase implements AppEng {
}
protected final <T extends IBootstrapComponent> void callDeferredBootstrapComponents(Class<T> componentClass,
Consumer<T> invoker) {
Consumer<T> invoker) {
final ApiDefinitions definitions = Api.INSTANCE.definitions();
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,
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);
ContainerOpener.addOpener(type, opener);
return type;
@@ -564,6 +564,7 @@ public abstract class AppEngBase implements AppEng {
new MeteoriteStructure(DefaultFeatureConfig.CODEC).configure(DefaultFeatureConfig.INSTANCE));
Registry.register(Registry.FEATURE, AppEng.makeId("charged_quartz_ore"), ChargedQuartzOreFeature.INSTANCE);
// add to all standard biomes
Biome.BIOMES.forEach(b -> {
addMeteoriteWorldGen(b);
addQuartzWorldGen(b);
@@ -579,7 +580,8 @@ public abstract class AppEngBase implements AppEng {
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) {
@@ -587,22 +589,23 @@ public abstract class AppEngBase implements AppEng {
return;
}
BiomeModifier modifier = new BiomeModifier(b);
BlockState quartzOre = Api.instance().definitions().blocks().quartzOre().block().getDefaultState();
b.addFeature(GenerationStep.Feature.UNDERGROUND_ORES, Feature.ORE
.configure(new OreFeatureConfig(OreFeatureConfig.Target.NATURAL_STONE, quartzOre,
modifier.addFeature(GenerationStep.Feature.UNDERGROUND_ORES, Feature.ORE
.configure(new OreFeatureConfig(OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, quartzOre,
AEConfig.instance().getQuartzOresPerCluster()))
.createDecoratedFeature(Decorator.COUNT_RANGE.configure(
new RangeDecoratorConfig(AEConfig.instance().getQuartzOresClusterAmount(), 12, 12, 72))));
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(12, 12, 72))).spreadHorizontally().repeat(AEConfig.instance().getQuartzOresClusterAmount()));
if (AEConfig.instance().isFeatureEnabled(AEFeature.CHARGED_CERTUS_ORE)) {
BlockState chargedQuartzOre = Api.instance().definitions().blocks().quartzOreCharged().block()
.getDefaultState();
b.addFeature(GenerationStep.Feature.UNDERGROUND_DECORATION,
modifier.addFeature(GenerationStep.Feature.UNDERGROUND_DECORATION,
ChargedQuartzOreFeature.INSTANCE
.configure(new ChargedQuartzOreConfig(quartzOre, chargedQuartzOre,
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() {
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);
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,
new DimensionType(OptionalLong.of(12000), false, false, false, false, false, false, true, false,
false, 256, BlockTags.INFINIBURN_OVERWORLD.getId(), 1.0f));
Registry.register(registryTracker.getDimensionTypes(), SpatialDimensionManager.STORAGE_DIMENSION_TYPE.getValue(), dimensionType);
});
}
@@ -21,6 +21,7 @@ package appeng.core.api.definitions;
import static appeng.block.AEBaseBlock.defaultProps;
import static appeng.block.crafting.AbstractCraftingUnitBlock.CraftingUnitType;
import appeng.block.storage.ChestBlock;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
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.block.AEBaseBlockItemChargeable;
import appeng.block.crafting.*;
import appeng.block.crafting.AbstractCraftingUnitBlock.CraftingUnitType;
import appeng.block.grindstone.CrankBlock;
import appeng.block.grindstone.GrinderBlock;
import appeng.block.misc.*;
@@ -50,7 +52,6 @@ import appeng.block.spatial.MatrixFrameBlock;
import appeng.block.spatial.SpatialIOPortBlock;
import appeng.block.spatial.SpatialPylonBlock;
import appeng.block.storage.*;
import appeng.block.storage.ChestBlock;
import appeng.bootstrap.*;
import appeng.bootstrap.components.IInitComponent;
import appeng.bootstrap.definitions.TileEntityDefinition;
@@ -134,7 +134,7 @@ public class MatterCannonAmmoRegistry implements IMatterCannonAmmoRegistry {
// Next, check each item tag
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)) {
return entry.getValue().floatValue();
}
@@ -55,8 +55,8 @@ public class MovableTileRegistry implements IMovableRegistry {
private final Tag<Block> blockTagBlackList;
public MovableTileRegistry() {
this.blockTagWhiteList = BlockTags.getContainer().getOrCreate(TAG_WHITELIST);
this.blockTagBlackList = BlockTags.getContainer().getOrCreate(TAG_BLACKLIST);
this.blockTagWhiteList = BlockTags.getTagGroup().getTagOrEmpty(TAG_WHITELIST);
this.blockTagBlackList = BlockTags.getTagGroup().getTagOrEmpty(TAG_BLACKLIST);
}
@Override
@@ -25,9 +25,6 @@ import java.util.function.Function;
import net.minecraft.network.PacketByteBuf;
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 {
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.filter.ExactItemStackFilter;
import alexiil.mc.lib.attributes.item.filter.ItemFilter;
import appeng.debug.ItemGenBlockEntity.QueuedItemHandler;
import appeng.tile.AEBaseBlockEntity;
public class ItemGenBlockEntity extends AEBaseBlockEntity {
@@ -31,7 +31,6 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.LiteralText;
import net.minecraft.util.*;
import net.minecraft.util.ActionResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
@@ -22,6 +22,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.item.ItemStack;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
@@ -34,7 +35,7 @@ public class QuartzOreBlock extends AEBaseBlock {
}
@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);
if (EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, stack) == 0) {
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) {
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.
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)) {
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,
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) {
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.translate(-0.5D, -0.5D, 0.5D);
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);
mStack.pop();
super.render(tnt, entityYaw, partialTicks, mStack, buffers, packedLight);
@@ -64,10 +64,10 @@ public class FluidInterfaceScreen extends UpgradeableScreen<FluidInterfaceContai
@Override
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.draw(matrices, GuiText.Config.getLocal(), 35, 6 + 11 + 7, 4210752);
this.textRenderer.draw(matrices, GuiText.StoredFluids.getLocal(), 35, 6 + 112 + 7, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.getLocal(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.FluidInterface.text()), 8, 6, 4210752);
this.textRenderer.method_30883(matrices, GuiText.Config.text(), 35, 6 + 11 + 7, 4210752);
this.textRenderer.method_30883(matrices, GuiText.StoredFluids.text(), 35, 6 + 112 + 7, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
}
@Override
@@ -60,7 +60,7 @@ public class FluidLevelEmitterScreen extends UpgradeableScreen<FluidLevelEmitter
public void drawFG(MatrixStack matrices, int offsetX, int offsetY, int mouseX, int 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
@@ -98,8 +98,8 @@ public class FluidStorageBusScreen extends UpgradeableScreen<FluidStorageBusCont
@Override
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.draw(matrices, GuiText.inventory.getLocal(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(this.getName().text()), 8, 6, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
if (this.fuzzyMode != null) {
this.fuzzyMode.set(this.cvb.getFuzzyMode());
@@ -125,8 +125,8 @@ public class FluidTerminalScreen extends AEBaseMEScreen<FluidTerminalContainer>
@Override
public void drawFG(MatrixStack matrices, int offsetX, int offsetY, int mouseX, int mouseY) {
this.textRenderer.draw(matrices, this.getGuiDisplayName(new LiteralText("Fluid Terminal")), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.getLocal(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(new LiteralText("Fluid Terminal")), 8, 6, 4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
}
@Override
@@ -171,7 +171,7 @@ public class FluidTerminalScreen extends AEBaseMEScreen<FluidTerminalContainer>
list.add(new LiteralText(formattedAmount));
list.add(new LiteralText(modName));
this.renderTooltip(matrices, list, mouseX, mouseY);
this.method_30901(matrices, list, mouseX, mouseY);
return;
}
@@ -30,6 +30,9 @@ import appeng.core.AEConfig;
import appeng.util.ISlimReadableNumberConverter;
import appeng.util.IWideReadableNumberConverter;
import appeng.util.ReadableNumberConverter;
import net.minecraft.text.LiteralText;
import net.minecraft.text.StringRenderable;
import net.minecraft.text.Text;
/**
* @author AlgorithmX2
@@ -47,12 +50,12 @@ public class FluidStackSizeRenderer {
public void renderStackSize(TextRenderer fontRenderer, IAEFluidStack aeStack, int xPos, int yPos) {
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);
}
}
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
// custom formatter,
// otherwise pass it to the normal number converter
@@ -63,25 +66,25 @@ public class FluidStackSizeRenderer {
}
if (AEConfig.instance().isUseLargeFonts()) {
return SLIM_CONVERTER.toSlimReadableForm(originalSize / 1000);
return new LiteralText(SLIM_CONVERTER.toSlimReadableForm(originalSize / 1000));
} 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;
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;
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 DecimalFormatSymbols symbols = new DecimalFormatSymbols();
@@ -90,7 +93,7 @@ public class FluidStackSizeRenderer {
format.setDecimalFormatSymbols(symbols);
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) {
Tag<Fluid> tag = FluidTags.getContainer().getOrCreate(TAG_BLACKLIST);
Tag<Fluid> tag = FluidTags.getTagGroup().getTagOrEmpty(TAG_BLACKLIST);
return fluid.isIn(tag);
}
@@ -26,7 +26,6 @@ import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import alexiil.mc.lib.attributes.Simulation;
import alexiil.mc.lib.attributes.fluid.FluidAttributes;
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.EventFactory;
import net.minecraft.util.registry.RegistryTracker;
import net.minecraft.util.registry.DynamicRegistryManager;
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
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();
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 isModel = blockState.getRenderType() == BlockRenderType.MODEL;
@@ -221,7 +221,7 @@ public class ColorApplicatorItem extends AEBasePoweredItem
return ipb.getColor();
} else {
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)) {
return entry.getValue();
}
@@ -185,7 +185,7 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
Entity entity = null;
Vec3d entityIntersection = null;
final List list = w.getEntities(p, bb);
final List list = w.getOtherEntities(p, bb);
double closest = 9999999.0D;
for (int l = 0; l < list.size(); ++l) {
@@ -291,7 +291,7 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
Entity entity = null;
Vec3d entityIntersection = null;
final List list = w.getEntities(p, bb);
final List list = w.getOtherEntities(p, bb);
double closest = 9999999.0D;
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;
import net.minecraft.util.registry.DynamicRegistryManager;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.util.registry.RegistryTracker;
import net.minecraft.world.dimension.DimensionType;
import appeng.hooks.RegisterDimensionTypeCallback;
@@ -14,7 +14,7 @@ import appeng.hooks.RegisterDimensionTypeCallback;
public class DimensionTypeMixin {
@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);
}
@@ -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.collect.ImmutableList;
import net.minecraft.util.registry.DynamicRegistryManager;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -14,7 +15,6 @@ import net.minecraft.server.WorldGenerationProgressListener;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.util.registry.RegistryTracker;
import net.minecraft.world.SaveProperties;
import net.minecraft.world.World;
import net.minecraft.world.border.WorldBorder;
@@ -33,7 +33,7 @@ import appeng.hooks.DynamicDimensions;
public class MinecraftServerMixin implements DynamicDimensions {
@Shadow
private RegistryTracker.Modifiable dimensionTracker;
private DynamicRegistryManager.Impl registryManager;
@Shadow
private Map<RegistryKey<World>, ServerWorld> worlds;
@@ -58,12 +58,12 @@ public class MinecraftServerMixin implements DynamicDimensions {
Preconditions.checkArgument(!generatorOptions.getDimensionMap().containsId(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);
// Create dimension options with the given world-id and chunk generator
DimensionOptions dimensionOptions = new DimensionOptions(
() -> dimensionTracker.getDimensionTypeRegistry().get(dimensionTypeId), chunkGenerator);
() -> registryManager.getDimensionTypes().get(dimensionTypeId), chunkGenerator);
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
RegistryKey<DimensionOptions> dimOptKey = RegistryKey.of(Registry.DIMENSION_OPTIONS, worldId.getValue());
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
// 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;
}
@@ -39,7 +39,6 @@ import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.RayTraceContext;
import net.minecraft.world.World;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.parts.*;
import appeng.api.util.AEPartLocation;
@@ -566,7 +566,7 @@ public class AnnihilationPlanePart extends BasicStatePart implements IGridTickab
// breaking
// i.e. our cable-buses do this (bad practice, really)
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) {
final ItemEntity entityItem = (ItemEntity) ei;
this.storeEntityItem(entityItem);
@@ -616,12 +616,12 @@ public class AnnihilationPlanePart extends BasicStatePart implements IGridTickab
}
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);
}
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);
}
@@ -346,7 +346,7 @@ public class FormationPlanePart extends AbstractFormationPlanePart<IAEItemStack>
private int countEntitesAround(World world, BlockPos pos) {
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();
}
@@ -19,7 +19,7 @@ public final class GrinderRecipes {
@Nullable
public static GrinderRecipe findForInput(World world, ItemStack input) {
// 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) {
if (recipe.getIngredient().test(input) && input.getCount() >= recipe.getIngredientCount()) {
return recipe;
@@ -34,7 +34,7 @@ public final class GrinderRecipes {
*/
public static boolean isValidIngredient(World world, ItemStack stack) {
// 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) {
if (recipe.getIngredient().test(stack)) {
return true;
@@ -3,8 +3,6 @@ package appeng.recipes.handlers;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.*;
import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.Recipe;
import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.world.World;
@@ -170,8 +170,8 @@ public class TestMeteoritesCommand implements ISubCommand {
// Add a tooltip
MutableText tooltip = new LiteralText(settings.toString() + "\nBiome: ")
.append(world.getBiome(pos).getName());
msg.styled(style -> style.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)));
.append(world.getBiome(pos).toString());
msg.styled(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)));
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.ChunkPos;
import net.minecraft.world.BlockView;
import net.minecraft.world.ServerWorldAccess;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
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
// getWorld is
// still the server world. We do need to use the world access to get the chunk
// in question
// 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);
updateArea((ServerWorld) world, chunk);
updateArea(w.toServerWorld(), chunk);
}
public void updateArea(final ServerWorld w, Chunk chunk) {
@@ -18,31 +18,27 @@
package appeng.spatial;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.world.biome.Biome;
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.SurfaceBuilder;
public class StorageCellBiome extends Biome {
public class StorageCellBiome {
public static final StorageCellBiome INSTANCE = new StorageCellBiome();
public StorageCellBiome() {
super(new Biome.Settings()
.surfaceBuilder(new ConfiguredSurfaceBuilder<>(SurfaceBuilder.NOPE, SurfaceBuilder.STONE_CONFIG))
.precipitation(Precipitation.NONE).category(Category.NONE).depth(0).scale(1)
// Copied from the vanilla void biome
.temperature(0.5F).downfall(0.5F)
.effects(new BiomeEffects.Builder().waterColor(4159204).waterFogColor(329011).fogColor(0).build())
.parent(null));
}
@Override
@Environment(EnvType.CLIENT)
public int getSkyColor() {
return 0x111111;
}
public static final Biome INSTANCE = new Biome.Settings()
.generationSettings(new GenerationSettings.Builder()
.surfaceBuilder(new ConfiguredSurfaceBuilder<>(SurfaceBuilder.NOPE, SurfaceBuilder.STONE_CONFIG))
.build())
.precipitation(Biome.Precipitation.NONE).category(Biome.Category.NONE).depth(0).scale(1)
// Copied from the vanilla void biome
.temperature(0.5F).downfall(0.5F)
.effects(new BiomeEffects.Builder().waterColor(4159204).waterFogColor(329011).fogColor(0).skyColor(0x111111).build())
.parent(null)
.spawnSettings(new SpawnSettings.Builder()
.creatureSpawnProbability(0)
.build())
.build();
}
@@ -66,7 +66,7 @@ public class StorageChunkGenerator extends ChunkGenerator {
}
@Override
protected Codec<? extends ChunkGenerator> method_28506() {
protected Codec<? extends ChunkGenerator> getCodec() {
return CODEC;
}
@@ -105,7 +105,7 @@ public class StorageHelper {
// FIXME FABRIC new METeleporter(link)
float yaw = entity.yaw;
entity = entity.changeDimension(link.dim);
entity = entity.moveToWorld(link.dim);
entity.yaw = yaw;
entity.refreshPositionAfterTeleport(link.x, link.y, link.z);
entity.setVelocity(0, 0, 0);
@@ -32,7 +32,7 @@ public final class InscriberRecipes {
* Returns an unmodifiable view of all registered inscriber recipes.
*/
public static Iterable<InscriberRecipe> getRecipes(World world) {
return world.getRecipeManager().method_30027(InscriberRecipe.TYPE);
return world.getRecipeManager().listAllOfType(InscriberRecipe.TYPE);
}
@Nullable
@@ -39,7 +39,6 @@ import net.minecraft.util.Tickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import alexiil.mc.lib.attributes.AttributeList;
import alexiil.mc.lib.attributes.Simulation;
import alexiil.mc.lib.attributes.fluid.FluidInsertable;
+1 -1
View File
@@ -694,7 +694,7 @@ public class Platform {
Entity entity = null;
double closest = 9999999.0D;
if (hitEntities) {
final List<Entity> list = w.getEntities(p, bb);
final List<Entity> list = w.getOtherEntities(p, bb);
for (final Entity entity1 : list) {
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
.group(BlockState.CODEC.fieldOf("target").forGetter((config) -> config.target),
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));
public final BlockState target;
@@ -1,15 +1,12 @@
package appeng.worldgen;
import java.util.Random;
import java.util.function.Predicate;
import com.mojang.serialization.Codec;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
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.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.Feature;
@@ -28,8 +25,7 @@ public class ChargedQuartzOreFeature extends Feature<ChargedQuartzOreConfig> {
}
@Override
public boolean generate(ServerWorldAccess worldIn, net.minecraft.world.gen.StructureAccessor structureAccessor,
ChunkGenerator generator, Random rand, BlockPos pos, ChargedQuartzOreConfig config) {
public boolean generate(StructureWorldAccess worldIn, ChunkGenerator generator, Random rand, BlockPos pos, ChargedQuartzOreConfig config) {
ChunkPos chunkPos = new ChunkPos(pos);
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)) {
final Entity e = (Entity) o;
e.remove();
@@ -26,7 +26,7 @@ import net.minecraft.structure.StructurePieceType;
import net.minecraft.util.math.BlockBox;
import net.minecraft.util.math.BlockPos;
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.chunk.ChunkGenerator;
@@ -85,7 +85,7 @@ public class MeteoriteStructurePiece extends StructurePiece {
}
@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) {
MeteoritePlacer placer = new MeteoritePlacer(world, settings, bounds);
placer.place();
@@ -14,6 +14,7 @@ import net.minecraft.tag.Tag;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockBox;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.DynamicRegistryManager;
import net.minecraft.world.Heightmap;
import net.minecraft.world.Heightmap.Type;
import net.minecraft.world.biome.Biome;
@@ -26,9 +27,9 @@ import appeng.worldgen.meteorite.fallout.FalloutMode;
public class MeteoriteStructureStart extends StructureStart<DefaultFeatureConfig> {
private final Tag<Block> sandTag = BlockTags.getContainer().getOrCreate(new Identifier("minecraft:sand"));
private final Tag<Block> terracottaTag = BlockTags.getContainer()
.getOrCreate(new Identifier("c:terracotta_blocks"));
private final Tag<Block> sandTag = BlockTags.getTagGroup().getTagOrEmpty(new Identifier("minecraft:sand"));
private final Tag<Block> terracottaTag = BlockTags.getTagGroup()
.getTagOrEmpty(new Identifier("c:terracotta_blocks"));
public MeteoriteStructureStart(StructureFeature<DefaultFeatureConfig> feature, int chunkX, int chunkZ, BlockBox box,
int references, long seed) {
@@ -36,8 +37,7 @@ public class MeteoriteStructureStart extends StructureStart<DefaultFeatureConfig
}
@Override
public void init(ChunkGenerator generator, StructureManager templateManagerIn, int chunkX, int chunkZ, Biome biome,
DefaultFeatureConfig config) {
public void init(DynamicRegistryManager dynamicRegistryManager, ChunkGenerator generator, StructureManager structureManager, int chunkX, int chunkZ, Biome biome, DefaultFeatureConfig featureConfig) {
final int centerX = chunkX * 16 + this.random.nextInt(16);
final int centerZ = chunkZ * 16 + this.random.nextInt(16);
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);
CraterType craterType = this.determineCraterType(spawnBiome);
boolean pureCrater = this.random.nextFloat() > .9f;
FalloutMode fallout = getFalloutFromBaseBlock(spawnBiome.getSurfaceConfig().getTopMaterial());
FalloutMode fallout = getFalloutFromBaseBlock(spawnBiome.getGenerationSettings().getSurfaceConfig().getTopMaterial());
children.add(
new MeteoriteStructurePiece(actualPos, meteoriteRadius, craterType, fallout, pureCrater, craterLake));
@@ -37,7 +37,7 @@ public class FalloutCopy extends Fallout {
final BlockState skyStone) {
super(putter, skyStone);
this.putter = putter;
this.block = w.getBiome(pos).getSurfaceConfig().getTopMaterial();
this.block = w.getBiome(pos).getGenerationSettings().getSurfaceConfig().getTopMaterial();
}
@Override