调整充电站外部输入方法
This commit is contained in:
parent
bfefe85f21
commit
fdabea761e
3 changed files with 5 additions and 5 deletions
|
@ -207,7 +207,7 @@ public class ChargingStationBlockEntity extends BlockEntity implements WorldlyCo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] getSlotsForFace(Direction pSide) {
|
public int[] getSlotsForFace(Direction pSide) {
|
||||||
return new int[0];
|
return new int[]{SLOT_FUEL};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -289,7 +289,6 @@ public class ChargingStationBlockEntity extends BlockEntity implements WorldlyCo
|
||||||
public CompoundTag getUpdateTag() {
|
public CompoundTag getUpdateTag() {
|
||||||
CompoundTag compoundtag = new CompoundTag();
|
CompoundTag compoundtag = new CompoundTag();
|
||||||
ContainerHelper.saveAllItems(compoundtag, this.items, true);
|
ContainerHelper.saveAllItems(compoundtag, this.items, true);
|
||||||
getCapability(ForgeCapabilities.ENERGY).ifPresent(handler -> compoundtag.put("Energy", ((EnergyStorage) handler).serializeNBT()));
|
|
||||||
return compoundtag;
|
return compoundtag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class ChargingStationMenu extends AbstractContainerMenu {
|
||||||
this.containerData = containerData;
|
this.containerData = containerData;
|
||||||
|
|
||||||
this.addSlot(new Slot(container, 0, 44, 54));
|
this.addSlot(new Slot(container, 0, 44, 54));
|
||||||
this.addSlot(new ChargingStationMenu.ChargingSlot(container, 1, 116, 54));
|
this.addSlot(new ChargingSlot(container, 1, 116, 54));
|
||||||
|
|
||||||
this.addDataSlots(containerData);
|
this.addDataSlots(containerData);
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ public class ChargingStationMenu extends AbstractContainerMenu {
|
||||||
return this.containerData.get(2);
|
return this.containerData.get(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChargingSlot extends Slot {
|
static class ChargingSlot extends Slot {
|
||||||
|
|
||||||
public ChargingSlot(Container pContainer, int pSlot, int pX, int pY) {
|
public ChargingSlot(Container pContainer, int pSlot, int pX, int pY) {
|
||||||
super(pContainer, pSlot, pX, pY);
|
super(pContainer, pSlot, pX, pY);
|
||||||
|
|
|
@ -65,7 +65,8 @@ public class ChargingStationScreen extends AbstractContainerScreen<ChargingStati
|
||||||
int j = (this.height - this.imageHeight) / 2;
|
int j = (this.height - this.imageHeight) / 2;
|
||||||
|
|
||||||
List<Component> tooltip = new ArrayList<>();
|
List<Component> tooltip = new ArrayList<>();
|
||||||
tooltip.add(Component.translatable("des.superbwarfare.charging_station.energy", this.menu.getEnergy(), ChargingStationBlockEntity.MAX_ENERGY));
|
tooltip.add(Component.translatable("des.superbwarfare.charging_station.energy", ChargingStationScreen.this.menu.getEnergy(),
|
||||||
|
ChargingStationBlockEntity.MAX_ENERGY));
|
||||||
|
|
||||||
if ((pX - i) >= 80 && (pX - i) <= 96 && (pY - j) >= 16 && (pY - j) <= 70) {
|
if ((pX - i) >= 80 && (pX - i) <= 96 && (pY - j) >= 16 && (pY - j) <= 70) {
|
||||||
pGuiGraphics.renderTooltip(this.font, tooltip, Optional.empty(), pX, pY);
|
pGuiGraphics.renderTooltip(this.font, tooltip, Optional.empty(), pX, pY);
|
||||||
|
|
Loading…
Add table
Reference in a new issue