mirror of
https://github.com/XevianLight/Aphelion.git
synced 2026-05-11 01:50:56 +01:00
RocketEntity.disassemble and dupe fixes. Fixed VAF menu not appearing.
This commit is contained in:
@@ -12,13 +12,14 @@ import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.neoforged.neoforge.items.SlotItemHandler;
|
||||
import net.xevianlight.aphelion.block.entity.custom.ElectricArcFurnaceEntity;
|
||||
import net.xevianlight.aphelion.block.entity.custom.IArcFurnaceLike;
|
||||
import net.xevianlight.aphelion.util.EnergyItemSlot;
|
||||
import net.xevianlight.aphelion.util.ExtractOnlySlot;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ElectricArcFurnaceMenu extends AbstractContainerMenu {
|
||||
|
||||
public final ElectricArcFurnaceEntity blockEntity;
|
||||
public final IArcFurnaceLike blockEntity;
|
||||
private final Level level;
|
||||
private final ContainerData data;
|
||||
|
||||
@@ -28,17 +29,17 @@ public class ElectricArcFurnaceMenu extends AbstractContainerMenu {
|
||||
|
||||
public ElectricArcFurnaceMenu(int i, Inventory inventory, BlockEntity blockEntity, ContainerData data) {
|
||||
super(ModMenuTypes.ELECTRIC_ARC_FURNACE_MENU.get(), i);
|
||||
this.blockEntity = ((ElectricArcFurnaceEntity) blockEntity);
|
||||
this.blockEntity = ((IArcFurnaceLike) blockEntity);
|
||||
this.level = inventory.player.level();
|
||||
this.data = data;
|
||||
|
||||
addPlayerInventory(inventory);
|
||||
addPlayerHotbar(inventory);
|
||||
|
||||
this.addSlot(new EnergyItemSlot(this.blockEntity.inventory, ElectricArcFurnaceEntity.ENERGY_SLOT, 8, 54));
|
||||
this.addSlot(new SlotItemHandler(this.blockEntity.inventory, ElectricArcFurnaceEntity.INPUT_SLOT, 63, 35));
|
||||
this.addSlot(new SlotItemHandler(this.blockEntity.inventory, ElectricArcFurnaceEntity.SECONDARY_INPUT_SLOT, 40, 35));
|
||||
this.addSlot(new ExtractOnlySlot(this.blockEntity.inventory, ElectricArcFurnaceEntity.OUTPUT_SLOT, 125, 35));
|
||||
this.addSlot(new EnergyItemSlot(this.blockEntity.getInventory(), ElectricArcFurnaceEntity.ENERGY_SLOT, 8, 54));
|
||||
this.addSlot(new SlotItemHandler(this.blockEntity.getInventory(), ElectricArcFurnaceEntity.INPUT_SLOT, 63, 35));
|
||||
this.addSlot(new SlotItemHandler(this.blockEntity.getInventory(), ElectricArcFurnaceEntity.SECONDARY_INPUT_SLOT, 40, 35));
|
||||
this.addSlot(new ExtractOnlySlot(this.blockEntity.getInventory(), ElectricArcFurnaceEntity.OUTPUT_SLOT, 125, 35));
|
||||
|
||||
addDataSlots(data);
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ public class ElectricArcFurnaceScreen extends AbstractContainerScreen<ElectricAr
|
||||
}
|
||||
|
||||
private void renderEnergyBar(GuiGraphics guiGraphics, int x, int y) {
|
||||
int stored = menu.blockEntity.getTrueEnergyStorage(null).getEnergyStored();
|
||||
int max = menu.blockEntity.getTrueEnergyStorage(null).getMaxEnergyStored();
|
||||
int stored = menu.blockEntity.getTrueEnergyStorage().getEnergyStored();
|
||||
int max = menu.blockEntity.getTrueEnergyStorage().getMaxEnergyStored();
|
||||
|
||||
int h = (max <= 0) ? 0 : (int) Math.round((stored / (double) max) * 42.0);
|
||||
h = Math.max(0, Math.min(42, h));
|
||||
@@ -79,7 +79,7 @@ public class ElectricArcFurnaceScreen extends AbstractContainerScreen<ElectricAr
|
||||
|
||||
private void assignEnergyInfoArea() {
|
||||
energyInfoArea = new EnergyDisplayTooltipArea(((width - imageWidth) / 2) + 9,
|
||||
((height - imageHeight) / 2 ) + 9, menu.blockEntity.getTrueEnergyStorage(null), 14, 42);
|
||||
((height - imageHeight) / 2 ) + 9, menu.blockEntity.getTrueEnergyStorage(), 14, 42);
|
||||
}
|
||||
|
||||
private void renderEnergyAreaTooltip(GuiGraphics guiGraphics, int pMouseX, int pMouseY, int x, int y) {
|
||||
|
||||
@@ -62,8 +62,8 @@ public class VacuumArcFurnaceScreen extends AbstractContainerScreen<VacuumArcFur
|
||||
}
|
||||
|
||||
private void renderEnergyBar(GuiGraphics guiGraphics, int x, int y) {
|
||||
int stored = menu.blockEntity.getTrueEnergyStorage(null).getEnergyStored();
|
||||
int max = menu.blockEntity.getTrueEnergyStorage(null).getMaxEnergyStored();
|
||||
int stored = menu.blockEntity.getTrueEnergyStorage().getEnergyStored();
|
||||
int max = menu.blockEntity.getTrueEnergyStorage().getMaxEnergyStored();
|
||||
|
||||
int h = (max <= 0) ? 0 : (int) Math.round((stored / (double) max) * 42.0);
|
||||
h = Math.max(0, Math.min(42, h));
|
||||
@@ -79,7 +79,7 @@ public class VacuumArcFurnaceScreen extends AbstractContainerScreen<VacuumArcFur
|
||||
|
||||
private void assignEnergyInfoArea() {
|
||||
energyInfoArea = new EnergyDisplayTooltipArea(((width - imageWidth) / 2) + 9,
|
||||
((height - imageHeight) / 2 ) + 9, menu.blockEntity.getTrueEnergyStorage(null), 14, 42);
|
||||
((height - imageHeight) / 2 ) + 9, menu.blockEntity.getTrueEnergyStorage(), 14, 42);
|
||||
}
|
||||
|
||||
private void renderEnergyAreaTooltip(GuiGraphics guiGraphics, int pMouseX, int pMouseY, int x, int y) {
|
||||
|
||||
Reference in New Issue
Block a user