mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 07:13:28 +01:00
Restore XP Solidifier GUI
Remove todo about validating Persistent Data as it's correct
This commit is contained in:
parent
18ac77022e
commit
a4cc12d993
3 changed files with 44 additions and 40 deletions
|
@ -12,14 +12,17 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
|||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerXPSolidifier;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
@ -38,35 +41,43 @@ public class GuiXPSolidifier extends AAScreen<ContainerXPSolidifier> {
|
|||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
//
|
||||
// Button buttonOne = new GuiInputter.SmallerButton(this.leftPos + 62, this.topPos + 44, new StringTextComponent("1"), btn -> {
|
||||
// });
|
||||
// Button buttonFive = new GuiInputter.SmallerButton(this.leftPos + 80, this.topPos + 44, new StringTextComponent("5"), btn -> {
|
||||
// });
|
||||
// Button buttonTen = new GuiInputter.SmallerButton(this.leftPos + 99, this.topPos + 44, new StringTextComponent("10"), btn -> {
|
||||
// });
|
||||
// Button buttonTwenty = new GuiInputter.SmallerButton(this.leftPos + 62, this.topPos + 61, new StringTextComponent("20"), btn -> {
|
||||
// });
|
||||
// Button buttonThirty = new GuiInputter.SmallerButton(this.leftPos + 80, this.topPos + 61, new StringTextComponent("30"), btn -> {
|
||||
// });
|
||||
// Button buttonForty = new GuiInputter.SmallerButton(this.leftPos + 99, this.topPos + 61, new StringTextComponent("40"), btn -> {
|
||||
// });
|
||||
// Button buttonFifty = new GuiInputter.SmallerButton(this.leftPos + 62, this.topPos + 78, new StringTextComponent("50"), btn -> {
|
||||
// });
|
||||
// Button buttonSixtyFour = new GuiInputter.SmallerButton(this.leftPos + 80, this.topPos + 78, new StringTextComponent("64"), btn -> {
|
||||
// });
|
||||
// Button buttonAll = new GuiInputter.SmallerButton(this.leftPos + 99, this.topPos + 78, new StringTextComponent("All"), btn -> {
|
||||
// });
|
||||
//
|
||||
// this.addButton(buttonOne);
|
||||
// this.addButton(buttonFive);
|
||||
// this.addButton(buttonTen);
|
||||
// this.addButton(buttonTwenty);
|
||||
// this.addButton(buttonThirty);
|
||||
// this.addButton(buttonForty);
|
||||
// this.addButton(buttonFifty);
|
||||
// this.addButton(buttonSixtyFour);
|
||||
// this.addButton(buttonAll);
|
||||
|
||||
Button buttonOne = this.addRenderableWidget(Button.builder(Component.literal("1"), btn -> {
|
||||
PacketHandlerHelper.sendButtonPacket(this.solidifier, 0);
|
||||
this.solidifier.onButtonPressed(0, minecraft.player);
|
||||
}).bounds(this.leftPos + 62, this.topPos + 44, 16, 16).build());
|
||||
Button buttonFive = this.addRenderableWidget(Button.builder(Component.literal("5"), btn -> {
|
||||
PacketHandlerHelper.sendButtonPacket(this.solidifier, 1);
|
||||
this.solidifier.onButtonPressed(1, minecraft.player);
|
||||
}).bounds(this.leftPos + 80, this.topPos + 44, 16, 16).build());
|
||||
Button buttonTen = this.addRenderableWidget(Button.builder(Component.literal("10"), btn -> {
|
||||
PacketHandlerHelper.sendButtonPacket(this.solidifier, 2);
|
||||
this.solidifier.onButtonPressed(2, minecraft.player);
|
||||
}).bounds(this.leftPos + 99, this.topPos + 44, 16, 16).build());
|
||||
Button buttonTwenty = this.addRenderableWidget(Button.builder(Component.literal("20"), btn -> {
|
||||
PacketHandlerHelper.sendButtonPacket(this.solidifier, 3);
|
||||
this.solidifier.onButtonPressed(3, minecraft.player);
|
||||
}).bounds(this.leftPos + 62, this.topPos + 61, 16, 16).build());
|
||||
Button buttonThirty = this.addRenderableWidget(Button.builder(Component.literal("30"), btn -> {
|
||||
PacketHandlerHelper.sendButtonPacket(this.solidifier, 4);
|
||||
this.solidifier.onButtonPressed(4, minecraft.player);
|
||||
}).bounds(this.leftPos + 80, this.topPos + 61, 16, 16).build());
|
||||
Button buttonForty = this.addRenderableWidget(Button.builder(Component.literal("40"), btn -> {
|
||||
PacketHandlerHelper.sendButtonPacket(this.solidifier, 5);
|
||||
this.solidifier.onButtonPressed(5, minecraft.player);
|
||||
}).bounds(this.leftPos + 99, this.topPos + 61, 16, 16).build());
|
||||
Button buttonFifty = this.addRenderableWidget(Button.builder(Component.literal("50"), btn -> {
|
||||
PacketHandlerHelper.sendButtonPacket(this.solidifier, 6);
|
||||
this.solidifier.onButtonPressed(6, minecraft.player);
|
||||
}).bounds(this.leftPos + 62, this.topPos + 78, 16, 16).build());
|
||||
Button buttonSixtyFour = this.addRenderableWidget(Button.builder(Component.literal("64"), btn -> {
|
||||
PacketHandlerHelper.sendButtonPacket(this.solidifier, 7);
|
||||
this.solidifier.onButtonPressed(7, minecraft.player);
|
||||
}).bounds(this.leftPos + 80, this.topPos + 78, 16, 16).build());
|
||||
Button buttonAll = this.addRenderableWidget(Button.builder(Component.literal("All"), btn -> {
|
||||
PacketHandlerHelper.sendButtonPacket(this.solidifier, 8);
|
||||
this.solidifier.onButtonPressed(8, minecraft.player);
|
||||
}).bounds(this.leftPos + 99, this.topPos + 78, 16, 16).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,13 +88,6 @@ public class GuiXPSolidifier extends AAScreen<ContainerXPSolidifier> {
|
|||
|
||||
guiGraphics.blit(RES_LOC, this.leftPos, this.topPos, 0, 0, 176, 93);
|
||||
|
||||
guiGraphics.drawCenteredString(this.font, Integer.toString(this.solidifier.amount), this.leftPos + 88, this.topPos + 30, 0xFFFFFF);
|
||||
guiGraphics.drawCenteredString(this.font, Integer.toString(this.solidifier.amount), this.leftPos + 88, this.topPos + 34, 0xFFFFFF);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void actionPerformed(Button button) {
|
||||
// PacketHandlerHelper.sendButtonPacket(this.solidifier, button.id);
|
||||
//
|
||||
// this.solidifier.onButtonPressed(button.id, Minecraft.getInstance().player);
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -159,7 +159,6 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
|||
List<ExperienceOrb> orbs = level.getEntitiesOfClass(ExperienceOrb.class, new AABB(pos.getX() - range, pos.getY() - range, pos.getZ() - range, pos.getX() + 1 + range, pos.getY() + 1 + range, pos.getZ() + 1 + range));
|
||||
if (orbs != null && !orbs.isEmpty()) {
|
||||
for (ExperienceOrb orb : orbs) {
|
||||
// TODO: [port] validate the getPersistentData is correct
|
||||
if (orb != null && orb.isAlive() && !orb.getPersistentData().getBoolean(ActuallyAdditions.MODID + "FromSolidified")) {
|
||||
tile.singlePointAmount += orb.getValue();
|
||||
orb.discard();
|
||||
|
@ -223,7 +222,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
|||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return Component.empty();
|
||||
return Component.translatable("container.actuallyadditions.experienceSolidifier");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -169,7 +169,7 @@
|
|||
"block.actuallyadditions.ender_casing": "Ender Casing",
|
||||
"block.actuallyadditions.flax": "Flax Plant",
|
||||
"block.actuallyadditions.coffee_machine": "Coffee Maker",
|
||||
"block.actuallyadditions.xp_solidifier": "Experience Solidifier (wip)",
|
||||
"block.actuallyadditions.xp_solidifier": "Experience Solidifier",
|
||||
"block.actuallyadditions.leaf_generator": "Leaf-Eating Generator (wip)",
|
||||
"block.actuallyadditions.long_range_breaker": "Long-Range Breaker (wip)",
|
||||
"block.actuallyadditions.ranged_collector": "Ranged Collector (wip)",
|
||||
|
@ -585,6 +585,7 @@
|
|||
"container.actuallyadditions.laserRelayFluids": "Fluid Laser Relay",
|
||||
"container.actuallyadditions.distributorItem": "Item Distributor",
|
||||
"container.actuallyadditions.fireworkBox": "Firework Box",
|
||||
"container.actuallyadditions.experienceSolidifier": "Experience Solidifier",
|
||||
"_comment": "Update Information",
|
||||
"info.actuallyadditions.update.generic": "[{\"text\":\"There is an Update for \"},{\"text\":\"Actually Additions \",\"color\":\"dark_green\"},{\"text\":\"available!\",\"color\":\"none\"}]",
|
||||
"info.actuallyadditions.update.versionCompare": "[{\"text\":\"Current Version: \"},{\"text\":\"%s\",\"color\":\"dark_red\"},{\"text\":\", newest Version: \",\"color\":\"none\"},{\"text\":\"%s\",\"color\":\"dark_green\"}]",
|
||||
|
|
Loading…
Reference in a new issue