mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +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 com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerXPSolidifier;
|
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.tile.TileEntityXPSolidifier;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
import net.minecraft.client.gui.components.Button;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
import net.neoforged.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.neoforged.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
@ -38,35 +41,43 @@ public class GuiXPSolidifier extends AAScreen<ContainerXPSolidifier> {
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
super.init();
|
super.init();
|
||||||
//
|
|
||||||
// Button buttonOne = new GuiInputter.SmallerButton(this.leftPos + 62, this.topPos + 44, new StringTextComponent("1"), btn -> {
|
Button buttonOne = this.addRenderableWidget(Button.builder(Component.literal("1"), btn -> {
|
||||||
// });
|
PacketHandlerHelper.sendButtonPacket(this.solidifier, 0);
|
||||||
// Button buttonFive = new GuiInputter.SmallerButton(this.leftPos + 80, this.topPos + 44, new StringTextComponent("5"), btn -> {
|
this.solidifier.onButtonPressed(0, minecraft.player);
|
||||||
// });
|
}).bounds(this.leftPos + 62, this.topPos + 44, 16, 16).build());
|
||||||
// Button buttonTen = new GuiInputter.SmallerButton(this.leftPos + 99, this.topPos + 44, new StringTextComponent("10"), btn -> {
|
Button buttonFive = this.addRenderableWidget(Button.builder(Component.literal("5"), btn -> {
|
||||||
// });
|
PacketHandlerHelper.sendButtonPacket(this.solidifier, 1);
|
||||||
// Button buttonTwenty = new GuiInputter.SmallerButton(this.leftPos + 62, this.topPos + 61, new StringTextComponent("20"), btn -> {
|
this.solidifier.onButtonPressed(1, minecraft.player);
|
||||||
// });
|
}).bounds(this.leftPos + 80, this.topPos + 44, 16, 16).build());
|
||||||
// Button buttonThirty = new GuiInputter.SmallerButton(this.leftPos + 80, this.topPos + 61, new StringTextComponent("30"), btn -> {
|
Button buttonTen = this.addRenderableWidget(Button.builder(Component.literal("10"), btn -> {
|
||||||
// });
|
PacketHandlerHelper.sendButtonPacket(this.solidifier, 2);
|
||||||
// Button buttonForty = new GuiInputter.SmallerButton(this.leftPos + 99, this.topPos + 61, new StringTextComponent("40"), btn -> {
|
this.solidifier.onButtonPressed(2, minecraft.player);
|
||||||
// });
|
}).bounds(this.leftPos + 99, this.topPos + 44, 16, 16).build());
|
||||||
// Button buttonFifty = new GuiInputter.SmallerButton(this.leftPos + 62, this.topPos + 78, new StringTextComponent("50"), btn -> {
|
Button buttonTwenty = this.addRenderableWidget(Button.builder(Component.literal("20"), btn -> {
|
||||||
// });
|
PacketHandlerHelper.sendButtonPacket(this.solidifier, 3);
|
||||||
// Button buttonSixtyFour = new GuiInputter.SmallerButton(this.leftPos + 80, this.topPos + 78, new StringTextComponent("64"), btn -> {
|
this.solidifier.onButtonPressed(3, minecraft.player);
|
||||||
// });
|
}).bounds(this.leftPos + 62, this.topPos + 61, 16, 16).build());
|
||||||
// Button buttonAll = new GuiInputter.SmallerButton(this.leftPos + 99, this.topPos + 78, new StringTextComponent("All"), btn -> {
|
Button buttonThirty = this.addRenderableWidget(Button.builder(Component.literal("30"), btn -> {
|
||||||
// });
|
PacketHandlerHelper.sendButtonPacket(this.solidifier, 4);
|
||||||
//
|
this.solidifier.onButtonPressed(4, minecraft.player);
|
||||||
// this.addButton(buttonOne);
|
}).bounds(this.leftPos + 80, this.topPos + 61, 16, 16).build());
|
||||||
// this.addButton(buttonFive);
|
Button buttonForty = this.addRenderableWidget(Button.builder(Component.literal("40"), btn -> {
|
||||||
// this.addButton(buttonTen);
|
PacketHandlerHelper.sendButtonPacket(this.solidifier, 5);
|
||||||
// this.addButton(buttonTwenty);
|
this.solidifier.onButtonPressed(5, minecraft.player);
|
||||||
// this.addButton(buttonThirty);
|
}).bounds(this.leftPos + 99, this.topPos + 61, 16, 16).build());
|
||||||
// this.addButton(buttonForty);
|
Button buttonFifty = this.addRenderableWidget(Button.builder(Component.literal("50"), btn -> {
|
||||||
// this.addButton(buttonFifty);
|
PacketHandlerHelper.sendButtonPacket(this.solidifier, 6);
|
||||||
// this.addButton(buttonSixtyFour);
|
this.solidifier.onButtonPressed(6, minecraft.player);
|
||||||
// this.addButton(buttonAll);
|
}).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
|
@Override
|
||||||
|
@ -77,13 +88,6 @@ public class GuiXPSolidifier extends AAScreen<ContainerXPSolidifier> {
|
||||||
|
|
||||||
guiGraphics.blit(RES_LOC, this.leftPos, this.topPos, 0, 0, 176, 93);
|
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));
|
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()) {
|
if (orbs != null && !orbs.isEmpty()) {
|
||||||
for (ExperienceOrb orb : orbs) {
|
for (ExperienceOrb orb : orbs) {
|
||||||
// TODO: [port] validate the getPersistentData is correct
|
|
||||||
if (orb != null && orb.isAlive() && !orb.getPersistentData().getBoolean(ActuallyAdditions.MODID + "FromSolidified")) {
|
if (orb != null && orb.isAlive() && !orb.getPersistentData().getBoolean(ActuallyAdditions.MODID + "FromSolidified")) {
|
||||||
tile.singlePointAmount += orb.getValue();
|
tile.singlePointAmount += orb.getValue();
|
||||||
orb.discard();
|
orb.discard();
|
||||||
|
@ -223,7 +222,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getDisplayName() {
|
public Component getDisplayName() {
|
||||||
return Component.empty();
|
return Component.translatable("container.actuallyadditions.experienceSolidifier");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -169,7 +169,7 @@
|
||||||
"block.actuallyadditions.ender_casing": "Ender Casing",
|
"block.actuallyadditions.ender_casing": "Ender Casing",
|
||||||
"block.actuallyadditions.flax": "Flax Plant",
|
"block.actuallyadditions.flax": "Flax Plant",
|
||||||
"block.actuallyadditions.coffee_machine": "Coffee Maker",
|
"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.leaf_generator": "Leaf-Eating Generator (wip)",
|
||||||
"block.actuallyadditions.long_range_breaker": "Long-Range Breaker (wip)",
|
"block.actuallyadditions.long_range_breaker": "Long-Range Breaker (wip)",
|
||||||
"block.actuallyadditions.ranged_collector": "Ranged Collector (wip)",
|
"block.actuallyadditions.ranged_collector": "Ranged Collector (wip)",
|
||||||
|
@ -585,6 +585,7 @@
|
||||||
"container.actuallyadditions.laserRelayFluids": "Fluid Laser Relay",
|
"container.actuallyadditions.laserRelayFluids": "Fluid Laser Relay",
|
||||||
"container.actuallyadditions.distributorItem": "Item Distributor",
|
"container.actuallyadditions.distributorItem": "Item Distributor",
|
||||||
"container.actuallyadditions.fireworkBox": "Firework Box",
|
"container.actuallyadditions.fireworkBox": "Firework Box",
|
||||||
|
"container.actuallyadditions.experienceSolidifier": "Experience Solidifier",
|
||||||
"_comment": "Update Information",
|
"_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.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\"}]",
|
"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