Start on json based machine tile + guis
This commit is contained in:
parent
92b3bc6651
commit
7defc53242
14 changed files with 377 additions and 129 deletions
|
@ -56,7 +56,6 @@ public enum EGui implements IMachineGuiHandler {
|
|||
FUSION_CONTROLLER,
|
||||
GAS_TURBINE,
|
||||
GENERATOR,
|
||||
GRINDER,
|
||||
HIGH_VOLTAGE_SU,
|
||||
IDSU,
|
||||
IMPLOSION_COMPRESSOR,
|
||||
|
@ -80,7 +79,9 @@ public enum EGui implements IMachineGuiHandler {
|
|||
VACUUM_FREEZER,
|
||||
SOLID_CANNING_MACHINE,
|
||||
WIRE_MILL,
|
||||
FLUID_REPLICATOR;
|
||||
FLUID_REPLICATOR,
|
||||
|
||||
DATA_DRIVEN;
|
||||
|
||||
private final boolean containerBuilder;
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ import reborncore.client.containerBuilder.IContainerProvider;
|
|||
import techreborn.blockentity.ChargeOMatBlockEntity;
|
||||
import techreborn.blockentity.DigitalChestBlockEntity;
|
||||
import techreborn.blockentity.IndustrialCentrifugeBlockEntity;
|
||||
import techreborn.blockentity.data.DataDrivenBEProvider;
|
||||
import techreborn.blockentity.data.DataDrivenGui;
|
||||
import techreborn.blockentity.fusionReactor.FusionControlComputerBlockEntity;
|
||||
import techreborn.blockentity.generator.PlasmaGeneratorBlockEntity;
|
||||
import techreborn.blockentity.generator.advanced.DieselGeneratorBlockEntity;
|
||||
|
@ -58,7 +60,6 @@ import techreborn.blockentity.storage.LowVoltageSUBlockEntity;
|
|||
import techreborn.blockentity.storage.MediumVoltageSUBlockEntity;
|
||||
import techreborn.blockentity.storage.idsu.InterdimensionalSUBlockEntity;
|
||||
import techreborn.blockentity.storage.lesu.LapotronicSUBlockEntity;
|
||||
import techreborn.client.container.ContainerDestructoPack;
|
||||
import techreborn.client.gui.*;
|
||||
|
||||
public class GuiHandler {
|
||||
|
@ -77,6 +78,10 @@ public class GuiHandler {
|
|||
private static AbstractContainerScreen<?> getClientGuiElement(final EGui gui, final PlayerEntity player, BlockPos pos, int syncID) {
|
||||
final BlockEntity blockEntity = player.world.getBlockEntity(pos);
|
||||
|
||||
if(blockEntity instanceof DataDrivenBEProvider.DataDrivenBlockEntity){
|
||||
return new DataDrivenGui(syncID, player, (DataDrivenBEProvider.DataDrivenBlockEntity) blockEntity);
|
||||
}
|
||||
|
||||
switch (gui) {
|
||||
case AESU:
|
||||
return new GuiAESU(syncID, player, (AdjustableSUBlockEntity) blockEntity);
|
||||
|
@ -114,8 +119,6 @@ public class GuiHandler {
|
|||
return new GuiGasTurbine(syncID, player, (GasTurbineBlockEntity) blockEntity);
|
||||
case GENERATOR:
|
||||
return new GuiGenerator(syncID, player, (SolidFuelGeneratorBlockEntity) blockEntity);
|
||||
case GRINDER:
|
||||
return new GuiGrinder(syncID, player, (GrinderBlockEntity) blockEntity);
|
||||
case IDSU:
|
||||
return new GuiIDSU(syncID, player, (InterdimensionalSUBlockEntity) blockEntity);
|
||||
case IMPLOSION_COMPRESSOR:
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import techreborn.blockentity.machine.tier1.GrinderBlockEntity;
|
||||
|
||||
public class GuiGrinder extends GuiBase<BuiltContainer> {
|
||||
|
||||
GrinderBlockEntity blockEntity;
|
||||
|
||||
public GuiGrinder(int syncID, final PlayerEntity player, final GrinderBlockEntity blockEntity) {
|
||||
super(player, blockEntity, blockEntity.createContainer(syncID, player));
|
||||
this.blockEntity = blockEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
|
||||
super.drawBackground(f, mouseX, mouseY);
|
||||
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
|
||||
|
||||
drawSlot(8, 72, layer);
|
||||
|
||||
drawSlot(55, 45, layer);
|
||||
drawOutputSlot(101, 45, layer);
|
||||
|
||||
builder.drawJEIButton(this, 158, 5, layer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawForeground(final int mouseX, final int mouseY) {
|
||||
super.drawForeground(mouseX, mouseY);
|
||||
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
|
||||
|
||||
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
|
||||
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue