Updated to 1.16.2-rc2

This commit is contained in:
Sebastian Hartte
2020-08-11 16:20:31 +02:00
parent c59a6e34eb
commit 68a02ed64b
68 changed files with 278 additions and 205 deletions
@@ -70,14 +70,14 @@ public abstract class AEBaseMEScreen<T extends AEBaseContainer> extends AEBaseSc
currentToolTip.add(ButtonToolTips.ItemsRequestable.text(formattedAmount));
}
this.method_30901(matrices, currentToolTip, x, y);
this.renderTooltip(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.method_30901(matrices, currentToolTip, x, y);
this.renderTooltip(matrices, currentToolTip, x, y);
return;
}
@@ -226,7 +226,7 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
styledLines.add(lines.get(i).copy().styled(s -> style));
}
this.method_30901(matrices, styledLines, x, y);
this.renderTooltip(matrices, styledLines, x, y);
}
@Override
@@ -535,7 +535,7 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
}
}
if (theSlot.getMaxStackAmount() == 64) {
if (theSlot.getMaxItemCount() == 64) {
this.onMouseClick(theSlot, theSlot.id, j, SlotActionType.SWAP);
return true;
} else {
@@ -48,13 +48,13 @@ class Size1Slot extends Slot {
}
@Override
public int getMaxStackAmount() {
return this.delegate.getMaxStackAmount();
public int getMaxItemCount() {
return this.delegate.getMaxItemCount();
}
@Override
public int getMaxStackAmount(ItemStack stack) {
return this.delegate.getMaxStackAmount(stack);
public int getMaxItemCount(ItemStack stack) {
return this.delegate.getMaxItemCount(stack);
}
@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.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);
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);
}
@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.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.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.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.method_30883(matrices, GuiText.SelectAmount.text(), 8, 6, 4210752);
this.textRenderer.draw(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.method_30883(matrices, GuiText.CraftingPlan.withSuffix(" - ").append(Add), 8, 7, 4210752);
this.textRenderer.draw(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.method_30883(matrices, dsp, offset, 165, 4210752);
this.textRenderer.draw(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.method_30883(matrices, title, TITLE_LEFT_OFFSET, TITLE_TOP_OFFSET, TEXT_COLOR);
this.textRenderer.draw(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.method_30883(matrices, GuiText.CraftingTerminal.text(), 8,
this.textRenderer.draw(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.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);
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);
}
@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.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);
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);
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.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);
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);
}
@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.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);
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);
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.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);
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);
}
@Override
@@ -68,13 +68,13 @@ public class InterfaceScreen extends UpgradeableScreen<InterfaceContainer> {
this.interfaceMode.setState(((InterfaceContainer) this.cvb).getInterfaceTerminalMode() == YesNo.YES);
}
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(GuiText.Interface.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.Interface.text()), 8, 6, 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.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.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
}
@Override
@@ -95,9 +95,9 @@ 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.method_30883(matrices, this.getGuiDisplayName(GuiText.InterfaceTerminal.text()), 8, 6,
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.InterfaceTerminal.text()), 8, 6,
4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
final int ex = this.getScrollBar().getCurrentScroll();
@@ -156,7 +156,7 @@ public class MEMonitorableScreen<T extends MEMonitorableContainer> extends AEBas
@Override
public void init() {
getClient().keyboard.enableRepeatEvents(true);
getClient().keyboard.setRepeatEvents(true);
this.maxRows = this.getMaxRows();
TerminalStyle terminalStyle = AEConfig.instance().getTerminalStyle();
@@ -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.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.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.currentMouseX = mouseX;
this.currentMouseY = mouseY;
@@ -313,7 +313,7 @@ public class MEMonitorableScreen<T extends MEMonitorableContainer> extends AEBas
@Override
public void removed() {
super.removed();
getClient().keyboard.enableRepeatEvents(false);
getClient().keyboard.setRepeatEvents(false);
memoryText = this.searchField.getText();
}
@@ -101,19 +101,19 @@ 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.method_30883(matrices, GuiText.NetworkDetails.text(), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.NetworkDetails.text(), 8, 6, 4210752);
this.textRenderer.method_30883(matrices,
this.textRenderer.draw(matrices,
GuiText.StoredPower.withSuffix(": " + Platform.formatPowerLong(handler.getCurrentPower(), false)), 13, 16,
4210752);
this.textRenderer.method_30883(matrices,
this.textRenderer.draw(matrices,
GuiText.MaxPower.withSuffix(": " + Platform.formatPowerLong(handler.getMaxPower(), false)), 13, 26,
4210752);
this.textRenderer.method_30883(matrices,
this.textRenderer.draw(matrices,
GuiText.PowerInputRate.withSuffix(": " + Platform.formatPowerLong(handler.getAverageAddition(), true)), 13,
143 - 10, 4210752);
this.textRenderer.method_30883(matrices,
this.textRenderer.draw(matrices,
GuiText.PowerUsageRate.withSuffix(": " + Platform.formatPowerLong(handler.getPowerUsage(), true)), 13,
143 - 20, 4210752);
@@ -58,8 +58,8 @@ public class NetworkToolScreen extends AEBaseScreen<NetworkToolContainer> {
this.tFacades.setState(handler.isFacadeMode());
}
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);
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);
}
@Override
@@ -23,8 +23,8 @@ import net.minecraft.text.Text;
*/
public class NumberEntryWidget implements ITickingWidget {
private static final Text PLUS = Text.method_30163("+");
private static final Text MINUS = Text.method_30163("+");
private static final Text PLUS = Text.of("+");
private static final Text MINUS = Text.of("+");
private final AEBaseScreen<?> parent;
@@ -126,7 +126,7 @@ public class PatternTermScreen extends MEMonitorableScreen<PatternTermContainer>
}
super.drawFG(matrices, offsetX, offsetY, mouseX, mouseY);
this.textRenderer.method_30883(matrices, GuiText.PatternTerminal.text(), 8,
this.textRenderer.draw(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.method_30883(matrices, GuiText.Priority.text(), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.Priority.text(), 8, 6, 4210752);
}
@Override
@@ -35,9 +35,9 @@ 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.method_30883(matrices, this.getGuiDisplayName(GuiText.QuantumLinkChamber.text()), 8, 6,
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.QuantumLinkChamber.text()), 8, 6,
4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
}
@Override
@@ -59,9 +59,9 @@ 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.method_30883(matrices, this.getGuiDisplayName(GuiText.QuartzCuttingKnife.text()), 8, 6,
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.QuartzCuttingKnife.text()), 8, 6,
4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.draw(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.method_30883(matrices, GuiText.SecurityCardEditor.text(), 8,
this.textRenderer.draw(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.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);
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);
}
@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.method_30883(matrices,
this.textRenderer.draw(matrices,
GuiText.StoredPower.withSuffix(": " + Platform.formatPowerLong(this.handler.getCurrentPower(), false)),
13, 21, 4210752);
this.textRenderer.method_30883(matrices,
this.textRenderer.draw(matrices,
GuiText.MaxPower.withSuffix(": " + Platform.formatPowerLong(this.handler.getMaxPower(), false)), 13, 31,
4210752);
this.textRenderer.method_30883(matrices, GuiText.RequiredPower
this.textRenderer.draw(matrices, GuiText.RequiredPower
.withSuffix(": " + Platform.formatPowerLong(this.handler.getRequiredPower(), false)), 13, 73, 4210752);
this.textRenderer.method_30883(matrices,
this.textRenderer.draw(matrices,
GuiText.Efficiency.withSuffix(": " + (((float) this.handler.getEfficency()) / 100) + '%'), 13, 83,
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);
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.SpatialIOPort.text()), 8, 6, 4210752);
this.textRenderer.draw(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.method_30883(matrices, text, 13, 93, 4210752);
this.textRenderer.draw(matrices, text, 13, 93, 4210752);
} else {
this.textRenderer.method_30883(matrices, GuiText.SCSSize.withSuffix(": ").append(GuiText.SCSInvalid.text()),
this.textRenderer.draw(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.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);
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);
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.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);
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);
if (this.redstoneMode != null) {
this.redstoneMode.set(this.cvb.getRedStoneMode());
@@ -51,9 +51,9 @@ 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.method_30883(matrices, this.getGuiDisplayName(GuiText.VibrationChamber.text()), 8, 6,
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.VibrationChamber.text()), 8, 6,
4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.pb.setFullMsg(new LiteralText(VibrationChamberBlockEntity.POWER_PER_TICK
* this.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.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);
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);
if (handler.getRange() > 0) {
final String firstMessage = GuiText.Range.text() + ": " + (handler.getRange() / 10.0) + " m";
@@ -71,7 +71,7 @@ public class SlotDisconnected extends AppEngSlot {
}
@Override
public int getMaxStackAmount() {
public int getMaxItemCount() {
return 0;
}
@@ -74,7 +74,7 @@ public class SlotFluidME extends Slot implements IMEFluidSlot {
}
@Override
public int getMaxStackAmount() {
public int getMaxItemCount() {
return 0;
}
+1 -1
View File
@@ -66,7 +66,7 @@ public class SlotME extends Slot {
}
@Override
public int getMaxStackAmount() {
public int getMaxItemCount() {
return 0;
}
@@ -78,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.method_30882(text, X, Y, 16777215, true, tm.getMatrix(), buffer, false, 0, 15728880);
fontRenderer.draw(text, X, Y, 16777215, true, tm.getMatrix(), buffer, false, 0, 15728880);
buffer.draw();
RenderSystem.enableBlend();
}
@@ -424,8 +424,8 @@ public abstract class AEBaseContainer extends ScreenHandler {
if (Platform.itemComparisons().isSameItem(t, tis)) {
int maxSize = t.getMaxCount();
if (maxSize > d.getMaxStackAmount()) {
maxSize = d.getMaxStackAmount();
if (maxSize > d.getMaxItemCount()) {
maxSize = d.getMaxItemCount();
}
int placeable = maxSize - t.getCount();
@@ -468,8 +468,8 @@ public abstract class AEBaseContainer extends ScreenHandler {
if (Platform.itemComparisons().isSameItem(t, tis)) {
int maxSize = t.getMaxCount();
if (maxSize > d.getMaxStackAmount()) {
maxSize = d.getMaxStackAmount();
if (maxSize > d.getMaxItemCount()) {
maxSize = d.getMaxItemCount();
}
int placeable = maxSize - t.getCount();
@@ -497,8 +497,8 @@ public abstract class AEBaseContainer extends ScreenHandler {
}
} else {
int maxSize = tis.getMaxCount();
if (maxSize > d.getMaxStackAmount()) {
maxSize = d.getMaxStackAmount();
if (maxSize > d.getMaxItemCount()) {
maxSize = d.getMaxItemCount();
}
final ItemStack tmp = tis.copy();
@@ -964,25 +964,25 @@ public abstract class AEBaseContainer extends ScreenHandler {
ItemStack testB = isA.isEmpty() ? ItemStack.EMPTY : isA.copy();
// can put some back?
if (!testA.isEmpty() && testA.getCount() > a.getMaxStackAmount()) {
if (!testA.isEmpty() && testA.getCount() > a.getMaxItemCount()) {
if (!testB.isEmpty()) {
return;
}
final int totalA = testA.getCount();
testA.setCount(a.getMaxStackAmount());
testA.setCount(a.getMaxItemCount());
testB = testA.copy();
testB.setCount(totalA - testA.getCount());
}
if (!testB.isEmpty() && testB.getCount() > b.getMaxStackAmount()) {
if (!testB.isEmpty() && testB.getCount() > b.getMaxItemCount()) {
if (!testA.isEmpty()) {
return;
}
final int totalB = testB.getCount();
testB.setCount(b.getMaxStackAmount());
testB.setCount(b.getMaxItemCount());
testA = testB.copy();
testA.setCount(totalB - testA.getCount());
@@ -126,13 +126,13 @@ public class AppEngSlot extends Slot {
}
@Override
public int getMaxStackAmount() {
public int getMaxItemCount() {
return this.backingSlot.getMaxAmount(ItemStack.EMPTY);
}
@Override
public int getMaxStackAmount(@Nonnull ItemStack stack) {
return Math.min(this.getMaxStackAmount(), stack.getMaxCount());
public int getMaxItemCount(@Nonnull ItemStack stack) {
return Math.min(this.getMaxItemCount(), stack.getMaxCount());
}
@Override
@@ -80,11 +80,11 @@ public class RestrictedInputSlot extends AppEngSlot {
}
@Override
public int getMaxStackAmount() {
public int getMaxItemCount() {
if (this.stackLimit != -1) {
return this.stackLimit;
}
return super.getMaxStackAmount();
return super.getMaxItemCount();
}
public boolean isValid(final ItemStack is, final World theWorld) {
+3 -5
View File
@@ -101,7 +101,6 @@ import appeng.worldgen.BiomeModifier;
import appeng.worldgen.ChargedQuartzOreConfig;
import appeng.worldgen.ChargedQuartzOreFeature;
import appeng.worldgen.meteorite.MeteoriteStructure;
import appeng.worldgen.meteorite.MeteoriteStructurePiece;
import net.earthcomputer.libstructure.LibStructure;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry;
@@ -549,15 +548,14 @@ public abstract class AppEngBase implements AppEng {
}
private void registerWorldGen() {
MeteoriteStructurePiece.register();
LibStructure.registerStructure(MeteoriteStructure.ID, MeteoriteStructure.INSTANCE,
GenerationStep.Feature.TOP_LAYER_MODIFICATION, new StructureConfig(32, 8, 124895654),
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 -> {
// TODO: Wrong...
BuiltinRegistries.BIOME.forEach(b -> {
addMeteoriteWorldGen(b);
addQuartzWorldGen(b);
});
@@ -612,7 +610,7 @@ public abstract class AppEngBase implements AppEng {
}
private void registerDimension() {
Registry.register(BuiltinRegistries.BIOME, SpatialStorageDimensionIds.BIOME_ID, SpatialStorageBiome.INSTANCE);
BuiltinRegistries.add(BuiltinRegistries.BIOME, SpatialStorageDimensionIds.BIOME_KEY.getValue(), SpatialStorageBiome.INSTANCE);
Registry.register(Registry.CHUNK_GENERATOR, SpatialStorageDimensionIds.CHUNK_GENERATOR_ID, SpatialStorageChunkGenerator.CODEC);
}
@@ -1,7 +1,6 @@
package appeng.core.config;
import java.util.Arrays;
import java.util.Locale;
import java.util.stream.Collectors;
import com.google.common.base.Preconditions;
@@ -34,7 +33,7 @@ public class EnumOption<T extends Enum<T>> extends BaseOption {
@Override
protected JsonElement write() {
return new JsonPrimitive(currentValue.name().toLowerCase(Locale.ROOT));
return new JsonPrimitive(currentValue.name().toLowerCase());
}
@Override
@@ -56,7 +55,7 @@ public class EnumOption<T extends Enum<T>> extends BaseOption {
}
}
String allowedValues = Arrays.stream(enumConstants).map(e -> e.name().toLowerCase(Locale.ROOT))
String allowedValues = Arrays.stream(enumConstants).map(e -> e.name().toLowerCase())
.collect(Collectors.joining(", "));
throw new ConfigValidationException(this, "Expected one of: " + allowedValues);
}
@@ -68,12 +67,12 @@ public class EnumOption<T extends Enum<T>> extends BaseOption {
@Override
public String getDefaultAsString() {
return String.valueOf(defaultValue.name().toLowerCase(Locale.ROOT));
return String.valueOf(defaultValue.name().toLowerCase());
}
@Override
public String getCurrentValueAsString() {
return String.valueOf(currentValue.name().toLowerCase(Locale.ROOT));
return String.valueOf(currentValue.name().toLowerCase());
}
}
@@ -67,7 +67,7 @@ public final class WorldGenRegistry implements IWorldGen {
throw new IllegalArgumentException("Bad Provider Passed");
}
Identifier id = w.getDimensionRegistryKey().getValue();
Identifier id = w.getRegistryKey().getValue();
final boolean isBadDimension = this.types[type.ordinal()].badDimensions.contains(id);
final boolean isGoodDimension = this.types[type.ordinal()].enabledDimensions.contains(id);
@@ -27,7 +27,7 @@ import com.google.common.base.Preconditions;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.World;
import appeng.services.CompassService;
import appeng.services.compass.CompassThreadFactory;
@@ -62,7 +62,7 @@ public final class WorldData implements IWorldData {
Preconditions.checkNotNull(overworld);
// Attach shared data to the server's overworld dimension
if (overworld.getDimension() != DimensionType.getOverworldDimensionType()) {
if (overworld.getRegistryKey() != World.OVERWORLD) {
throw new IllegalStateException(
"The server doesn't have an Overworld dimension we could store our data on!");
}
@@ -34,7 +34,6 @@ import net.minecraft.util.math.BlockBox;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.WorldChunk;
import appeng.hooks.AEToolItem;
@@ -131,7 +130,7 @@ public class MeteoritePlacerItem extends AEBaseItem implements AEToolItem {
// is a debug tool, we'll not care about being terribly efficient here
ChunkPos.stream(new ChunkPos(spawned.getPos()), 2).forEach(cp -> {
WorldChunk c = world.getChunk(cp.x, cp.z);
player.networkHandler.sendPacket(new ChunkDataS2CPacket(c, 65535, false)); // 65535 == full chunk
player.networkHandler.sendPacket(new ChunkDataS2CPacket(c, 65535)); // 65535 == full chunk
});
return ActionResult.SUCCESS;
@@ -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.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);
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.FluidInterface.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.Config.text(), 35, 6 + 11 + 7, 4210752);
this.textRenderer.draw(matrices, GuiText.StoredFluids.text(), 35, 6 + 112 + 7, 4210752);
this.textRenderer.draw(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.method_30883(matrices, GuiText.FluidLevelEmitterUnit.text(), 110, 44, COLOR_DARK_GRAY);
this.textRenderer.draw(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.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);
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);
if (this.fuzzyMode != null) {
this.fuzzyMode.set(this.cvb.getFuzzyMode());
@@ -125,9 +125,9 @@ public class FluidTerminalScreen extends AEBaseMEScreen<FluidTerminalContainer>
@Override
public void drawFG(MatrixStack matrices, int offsetX, int offsetY, int mouseX, int mouseY) {
this.textRenderer.method_30883(matrices, this.getGuiDisplayName(new LiteralText("Fluid Terminal")), 8, 6,
this.textRenderer.draw(matrices, this.getGuiDisplayName(new LiteralText("Fluid Terminal")), 8, 6,
4210752);
this.textRenderer.method_30883(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
}
@Override
@@ -172,7 +172,7 @@ public class FluidTerminalScreen extends AEBaseMEScreen<FluidTerminalContainer>
list.add(new LiteralText(formattedAmount));
list.add(new LiteralText(modName));
this.method_30901(matrices, list, mouseX, mouseY);
this.renderTooltip(matrices, list, mouseX, mouseY);
return;
}
@@ -24,7 +24,6 @@ import java.text.DecimalFormatSymbols;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.text.LiteralText;
import net.minecraft.text.StringRenderable;
import net.minecraft.text.Text;
import appeng.api.storage.data.IAEFluidStack;
@@ -6,6 +6,7 @@ import java.util.List;
import javax.annotation.Nonnull;
import appeng.mixins.FluidTagsAccessor;
import net.minecraft.block.BlockState;
import net.minecraft.block.FluidDrainable;
import net.minecraft.block.entity.BlockEntity;
@@ -13,18 +14,13 @@ import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemStack;
import net.minecraft.tag.FluidTags;
import net.minecraft.tag.Tag;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import alexiil.mc.lib.attributes.fluid.FluidAttributes;
import alexiil.mc.lib.attributes.fluid.amount.FluidAmount;
import alexiil.mc.lib.attributes.fluid.volume.FluidKeys;
import alexiil.mc.lib.attributes.fluid.volume.FluidVolume;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
@@ -60,8 +56,7 @@ import appeng.util.Platform;
public class FluidAnnihilationPlanePart extends BasicStatePart implements IGridTickable {
public static final Identifier TAG_BLACKLIST = new Identifier(AppEng.MOD_ID,
"blacklisted/fluid_annihilation_plane");
public static final Tag.Identified<Fluid> TAG_BLACKLIST = FluidTagsAccessor.register(AppEng.makeId("blacklisted/fluid_annihilation_plane").toString());
private static final PlaneModels MODELS = new PlaneModels("part/fluid_annihilation_plane",
"part/fluid_annihilation_plane_on");
@@ -217,8 +212,7 @@ public class FluidAnnihilationPlanePart extends BasicStatePart implements IGridT
}
private boolean isFluidBlacklisted(Fluid fluid) {
Tag<Fluid> tag = FluidTags.getTagGroup().getTagOrEmpty(TAG_BLACKLIST);
return fluid.isIn(tag);
return fluid.isIn(TAG_BLACKLIST);
}
}
@@ -0,0 +1,17 @@
package appeng.mixins;
import net.minecraft.fluid.Fluid;
import net.minecraft.tag.FluidTags;
import net.minecraft.tag.Tag;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin(FluidTags.class)
public interface FluidTagsAccessor {
@Invoker("register")
static Tag.Identified<Fluid> register(String id) {
throw new AssertionError();
}
}
@@ -2,10 +2,12 @@ package appeng.mixins.spatial;
import appeng.spatial.SpatialStorageDimensionIds;
import net.minecraft.tag.BlockTags;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.DynamicRegistryManager;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.dimension.DimensionType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@@ -20,10 +22,15 @@ import java.util.OptionalLong;
@Mixin(DimensionType.class)
public class DimensionTypeMixin {
@Invoker("<init>")
static DimensionType create(OptionalLong fixedTime, boolean hasSkylight, boolean hasCeiling, boolean ultrawarm, boolean natural, double coordinateScale, boolean piglinSafe, boolean bedWorks, boolean respawnAnchorWorks, boolean hasRaids, int logicalHeight, Identifier infiniburn, Identifier skyProperties, float ambientLight) {
throw new AssertionError();
}
@Inject(method = "addRegistryDefaults", at = @At("TAIL"))
private static void addRegistryDefaults(DynamicRegistryManager.Impl registryTracker, CallbackInfoReturnable<?> cir) {
DimensionType dimensionType = new DimensionType(OptionalLong.of(12000), false, false, false, false, false,
false, true, false, false, 256, BlockTags.INFINIBURN_OVERWORLD.getId(), 1.0f);
DimensionType dimensionType = create(OptionalLong.of(12000), false, false, false, false, 1.0,
false, false, false, false, 256, BlockTags.INFINIBURN_OVERWORLD.getId(), SpatialStorageDimensionIds.SKY_PROPERTIES_ID, 1.0f);
Registry.register(registryTracker.getDimensionTypes(),
SpatialStorageDimensionIds.DIMENSION_TYPE_ID.getValue(), dimensionType);
@@ -0,0 +1,31 @@
package appeng.mixins.spatial;
import appeng.spatial.SpatialStorageDimensionIds;
import appeng.spatial.SpatialStorageHelper;
import net.minecraft.entity.Entity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.TeleportTarget;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
/**
* This mixin sets the teleport destination, because otherwise Vanilla will not move
* the player.
*/
@Mixin(Entity.class)
public class EntityMixin {
@Inject(method = "getTeleportTarget", at = @At("HEAD"), cancellable = true, allow = 1)
public void getTeleportTarget(ServerWorld destination, CallbackInfoReturnable<TeleportTarget> cri) {
// Check if a destination has been set for the entity currently being teleported
if (destination.getRegistryKey() == SpatialStorageDimensionIds.WORLD_ID) {
TeleportTarget target = SpatialStorageHelper.getInstance().getTeleportTarget();
if (target != null) {
cri.setReturnValue(target);
}
}
}
}
@@ -1,28 +1,25 @@
package appeng.mixins.spatial;
import java.util.Optional;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.client.render.SkyProperties;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.dimension.DimensionType;
import appeng.spatial.SpatialStorageDimensionIds;
import appeng.spatial.SpatialStorageSkyProperties;
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
import net.minecraft.client.render.SkyProperties;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(SkyProperties.class)
public class SkyPropertiesMixin {
@Inject(method = "byDimensionType", at = @At("HEAD"), cancellable = true)
private static void byDimensionType(Optional<RegistryKey<DimensionType>> optional,
CallbackInfoReturnable<SkyProperties> ci) {
if (optional.orElse(null) == SpatialStorageDimensionIds.DIMENSION_TYPE_ID) {
ci.setReturnValue(SpatialStorageSkyProperties.INSTANCE);
}
@Shadow
private static Object2ObjectMap<Identifier, SkyProperties> BY_IDENTIFIER;
@Inject(method = "<clinit>", at = @At("TAIL"))
private static void init(CallbackInfo ci) {
BY_IDENTIFIER.put(SpatialStorageDimensionIds.SKY_PROPERTIES_ID, SpatialStorageSkyProperties.INSTANCE);
}
}
@@ -91,7 +91,7 @@ public class SpatialStorageCommand implements ISubCommand {
private void teleportBack(ServerCommandSource source) {
if (source.getWorld().getRegistryKey() != SpatialStorageDimensionIds.WORLD_ID) {
throw new CommandException(Text.method_30163("Must be within the spatial storage world."));
throw new CommandException(Text.of("Must be within the spatial storage world."));
}
BlockPos playerPos = new BlockPos(source.getPosition());
@@ -110,7 +110,7 @@ public class SpatialStorageCommand implements ISubCommand {
}
}
throw new CommandException(Text.method_30163("Couldn't find a plot for the current position."));
throw new CommandException(Text.of("Couldn't find a plot for the current position."));
}
@@ -121,7 +121,7 @@ public class SpatialStorageCommand implements ISubCommand {
TransitionInfo lastTransition = plot.getLastTransition();
if (lastTransition == null) {
throw new CommandException(
Text.method_30163("This plot doesn't have a last known transition."));
Text.of("This plot doesn't have a last known transition."));
}
String command = getTeleportCommand(lastTransition.getWorldId(), lastTransition.getMin().add(0, 1, 0));
@@ -181,7 +181,7 @@ public class SpatialStorageCommand implements ISubCommand {
sendKeyValuePair(source, "Source", sourceLink);
sendKeyValuePair(source, "When", lastTransition.getTimestamp().toString());
} else {
source.sendFeedback(Text.method_30163("Last Transition unknown"), true);
source.sendFeedback(Text.of("Last Transition unknown"), true);
}
}
@@ -212,7 +212,7 @@ public class SpatialStorageCommand implements ISubCommand {
if (!(cell.getItem() instanceof SpatialStorageCellItem)) {
throw new CommandException(
Text.method_30163("Storage cell items don't implement the storage cell interface!"));
Text.of("Storage cell items don't implement the storage cell interface!"));
}
SpatialStorageCellItem spatialCellItem = (SpatialStorageCellItem) cell.getItem();
@@ -267,7 +267,7 @@ public class SpatialStorageCommand implements ISubCommand {
return style -> style.withFormatting(Formatting.UNDERLINE)
.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command) )
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.method_30163(tooltip)));
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.of(tooltip)));
}
@@ -283,7 +283,7 @@ public class SpatialStorageCommand implements ISubCommand {
private static SpatialStoragePlot getPlot(int plotId) {
SpatialStoragePlot plot = SpatialStoragePlotManager.INSTANCE.getPlot(plotId);
if (plot == null) {
throw new CommandException(Text.method_30163("Plot not found: " + plotId));
throw new CommandException(Text.of("Plot not found: " + plotId));
}
return plot;
}
@@ -296,7 +296,7 @@ public class SpatialStorageCommand implements ISubCommand {
}
private static void sendKeyValuePair(ServerCommandSource source, String label, String value) {
sendKeyValuePair(source, label, Text.method_30163(value));
sendKeyValuePair(source, label, Text.of(value));
}
/**
@@ -304,7 +304,7 @@ public class SpatialStorageCommand implements ISubCommand {
*/
private static SpatialStoragePlot getCurrentPlot(ServerCommandSource source) {
if (source.getWorld().getRegistryKey() != SpatialStorageDimensionIds.WORLD_ID) {
throw new CommandException(Text.method_30163("Must be within the spatial storage world."));
throw new CommandException(Text.of("Must be within the spatial storage world."));
}
BlockPos playerPos = new BlockPos(source.getPosition());
@@ -321,7 +321,7 @@ public class SpatialStorageCommand implements ISubCommand {
}
}
throw new CommandException(Text.method_30163("Couldn't find a plot for the current position."));
throw new CommandException(Text.of("Couldn't find a plot for the current position."));
}
}
@@ -326,7 +326,7 @@ public class CachedPlane {
WorldData.instance().compassData().service().updateArea((ServerWorld) this.getWorld(), c);
// FIXME this was sending chunks to players...
ChunkDataS2CPacket cdp = new ChunkDataS2CPacket(c, verticalBits, false);
ChunkDataS2CPacket cdp = new ChunkDataS2CPacket(c, verticalBits);
world.getChunkManager().threadedAnvilChunkStorage
.getPlayersWatchingChunk(c.getPos(), false).forEach(spe -> spe.networkHandler.sendPacket(cdp));
@@ -30,7 +30,7 @@ import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
*/
public class SpatialStorageBiome {
public static final Biome INSTANCE = new Biome.Settings()
public static final Biome INSTANCE = new Biome.Builder()
.generationSettings(new GenerationSettings.Builder()
.surfaceBuilder(new ConfiguredSurfaceBuilder<>(SurfaceBuilder.NOPE, SurfaceBuilder.STONE_CONFIG))
.build())
@@ -39,6 +39,6 @@ public class SpatialStorageBiome {
.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();
.spawnSettings(new SpawnSettings.Builder().creatureSpawnProbability(0).build()).build();
}
@@ -18,21 +18,18 @@
package appeng.spatial;
import java.util.Arrays;
import java.util.Collections;
import java.util.Optional;
import appeng.core.Api;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryLookupCodec;
import net.minecraft.world.BlockView;
import net.minecraft.world.ChunkRegion;
import net.minecraft.world.Heightmap;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.source.BiomeAccess;
import net.minecraft.world.biome.source.BiomeSource;
import net.minecraft.world.biome.source.FixedBiomeSource;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.gen.GenerationStep;
@@ -41,25 +38,34 @@ import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.chunk.StructuresConfig;
import net.minecraft.world.gen.chunk.VerticalBlockSample;
import appeng.core.Api;
import java.util.Arrays;
import java.util.Collections;
import java.util.Optional;
/**
* Chunk generator the spatial storage world.
*/
public class SpatialStorageChunkGenerator extends ChunkGenerator {
/**
* This codec is necessary to restore the actual instance of the Biome we use,
* since it is sources from the dynamic registries and <em>must be the same object as in the registry!</em>.
* <p>If it was not the same object, then the Object->ID lookup would fail since it uses an identity hashmap
* internally.
*/
public static final Codec<SpatialStorageChunkGenerator> CODEC
= RegistryLookupCodec.of(Registry.BIOME_KEY).xmap(SpatialStorageChunkGenerator::new, SpatialStorageChunkGenerator::getBiomeRegistry).stable().codec();
private final Registry<Biome> biomeRegistry;
private final VerticalBlockSample columnSample;
public static final SpatialStorageChunkGenerator INSTANCE = new SpatialStorageChunkGenerator();
public static final Codec<SpatialStorageChunkGenerator> CODEC = RecordCodecBuilder
.create((instance) -> instance.stable(INSTANCE));
private final BlockState defaultBlockState;
private SpatialStorageChunkGenerator() {
super(createBiomeProvider(), createSettings());
private SpatialStorageChunkGenerator(Registry<Biome> biomeRegistry) {
super(createBiomeSource(biomeRegistry), createSettings());
this.defaultBlockState = Api.instance().definitions().blocks().matrixFrame().block().getDefaultState();
this.biomeRegistry = biomeRegistry;
// Vertical sample is mostly used for Feature generation, for those purposes
// we're all filled with matrix blocks
@@ -68,13 +74,18 @@ public class SpatialStorageChunkGenerator extends ChunkGenerator {
this.columnSample = new VerticalBlockSample(columnSample);
}
@Override
protected Codec<? extends ChunkGenerator> getCodec() {
return CODEC;
}
private static BiomeSource createBiomeProvider() {
return new FixedBiomeSource(SpatialStorageBiome.INSTANCE);
private static FixedBiomeSource createBiomeSource(Registry<Biome> biomeRegistry) {
return new FixedBiomeSource(biomeRegistry.method_31140(SpatialStorageDimensionIds.BIOME_KEY));
}
public Registry<Biome> getBiomeRegistry() {
return biomeRegistry;
}
private static StructuresConfig createSettings() {
@@ -5,6 +5,7 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.dimension.DimensionOptions;
import net.minecraft.world.dimension.DimensionType;
@@ -31,7 +32,7 @@ public final class SpatialStorageDimensionIds {
* ID of the {@link net.minecraft.world.biome.Biome} used for the spatial
* storage world.
*/
public static final Identifier BIOME_ID = AppEng.makeId("spatial_storage");
public static final RegistryKey<Biome> BIOME_KEY = RegistryKey.of(Registry.BIOME_KEY, AppEng.makeId("spatial_storage"));
/**
* ID of the {@link DimensionOptions} used for the spatial storage dimension.
@@ -49,6 +50,11 @@ public final class SpatialStorageDimensionIds {
public static final RegistryKey<World> WORLD_ID = RegistryKey.of(Registry.DIMENSION,
AppEng.makeId("spatial_storage"));
/**
* ID of the {@link net.minecraft.client.render.SkyProperties} used for the spatial storage world.
*/
public static Identifier SKY_PROPERTIES_ID = AppEng.makeId("spatial_storage");
private SpatialStorageDimensionIds() {
}
@@ -18,9 +18,9 @@
package appeng.spatial;
import java.util.ArrayList;
import java.util.List;
import appeng.api.util.WorldCoord;
import appeng.core.Api;
import appeng.core.AppEng;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
@@ -30,15 +30,13 @@ import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.TeleportTarget;
import net.minecraft.world.World;
import net.minecraft.world.chunk.ChunkStatus;
import net.minecraft.world.dimension.DimensionType;
import appeng.api.util.WorldCoord;
import appeng.core.Api;
import appeng.core.AppEng;
import java.util.ArrayList;
import java.util.List;
public class SpatialStorageHelper {
@@ -51,12 +49,20 @@ public class SpatialStorageHelper {
return instance;
}
private final ThreadLocal<TeleportTarget> teleportTarget = new ThreadLocal<>();
/**
* If an entity is currently being teleported, this will return the target within the target dimension.
*/
public TeleportTarget getTeleportTarget() {
return teleportTarget.get();
}
/**
* Mostly from dimensional doors.. which mostly got it form X-Comp.
*
* @param entity to be teleported entity
* @param link destination
*
* @return teleported entity
*/
private Entity teleportEntity(Entity entity, final TelDestination link) {
@@ -99,16 +105,20 @@ public class SpatialStorageHelper {
ChunkStatus.FULL, true);
if (entity instanceof ServerPlayerEntity
&& link.dim.getDimensionRegistryKey() == SpatialStorageDimensionIds.DIMENSION_TYPE_ID) {
&& link.dim.getRegistryKey() == SpatialStorageDimensionIds.WORLD_ID) {
AppEng.instance().getAdvancementTriggers().getSpatialExplorer().trigger((ServerPlayerEntity) entity);
}
// FIXME FABRIC new METeleporter(link)
float yaw = entity.yaw;
entity = entity.moveToWorld(link.dim);
entity.yaw = yaw;
entity.refreshPositionAfterTeleport(link.x, link.y, link.z);
entity.setVelocity(0, 0, 0);
// Store in a threadlocal so that EntityMixin can return it for the Vanilla logic to use
teleportTarget.set(new TeleportTarget(new Vec3d(link.x, link.y, link.z),
Vec3d.ZERO,
entity.yaw,
entity.pitch));
try {
entity = entity.moveToWorld(link.dim);
} finally {
teleportTarget.remove();
}
if (!passengersOnOtherSide.isEmpty()) {
for (Entity passanger : passengersOnOtherSide) {
@@ -30,6 +30,7 @@ import net.minecraft.util.math.BlockPos;
import appeng.core.AELog;
import appeng.core.Api;
import net.minecraft.world.TeleportTarget;
/**
* Allocates and manages plots for spatial storage in the spatial storage world.
@@ -121,7 +121,8 @@ public class MeteoriteStructureStart extends StructureStart<DefaultFeatureConfig
}
private CraterType determineCraterType(Biome biome) {
final Biome.TemperatureGroup temp = biome.getTemperatureGroup();
// The temperature thresholds below are taken from older Vanilla code (temperature categories)
final float temp = biome.getTemperature();
final Category category = biome.getCategory();
// No craters in oceans
@@ -138,7 +139,7 @@ public class MeteoriteStructureStart extends StructureStart<DefaultFeatureConfig
}
// Warm biomes, higher chance for lava
if (temp == Biome.TemperatureGroup.WARM) {
if (temp >= 1) {
// 50% chance to actually spawn as lava
final boolean lava = random.nextFloat() > .5f;
@@ -161,7 +162,7 @@ public class MeteoriteStructureStart extends StructureStart<DefaultFeatureConfig
}
// Temperate biomes. Water or maybe lava
if (temp == Biome.TemperatureGroup.MEDIUM) {
if (temp < 1 && temp >= 0.2) {
// 75% chance to actually spawn with a crater lake
final boolean lake = random.nextFloat() > .25f;
// 20% to spawn with lava
@@ -187,7 +188,7 @@ public class MeteoriteStructureStart extends StructureStart<DefaultFeatureConfig
}
// Cold biomes, Snow or Ice, maybe water and very rarely lava.
if (temp == Biome.TemperatureGroup.COLD) {
if (temp < 0.2) {
// 75% chance to actually spawn with a crater lake
final boolean lake = random.nextFloat() > .25f;
// 5% to spawn with lava