it compiles :D

This commit is contained in:
modmuss50 2019-06-12 19:29:04 +01:00
parent 500ff29dbd
commit 6b9f6cb4f8
142 changed files with 755 additions and 1724 deletions

View file

@ -24,23 +24,17 @@
package techreborn.client;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import techreborn.init.TRContent;
public class ClientEventHandler {
@SubscribeEvent
public static void renderPlayer(RenderPlayerEvent.Pre event) {
PlayerEntity player = event.getEntityPlayer();
Item chestslot = !player.getEquippedStack(EquipmentSlot.CHEST).isEmpty()
? player.getEquippedStack(EquipmentSlot.CHEST).getItem() : null;
if (chestslot != null && chestslot == TRContent.CLOAKING_DEVICE) {
event.setCanceled(true);
}
}
//TODO 1.14
// @SubscribeEvent
// public static void renderPlayer(RenderPlayerEvent.Pre event) {
// PlayerEntity player = event.getEntityPlayer();
// Item chestslot = !player.getEquippedStack(EquipmentSlot.CHEST).isEmpty()
// ? player.getEquippedStack(EquipmentSlot.CHEST).getItem() : null;
// if (chestslot != null && chestslot == TRContent.CLOAKING_DEVICE) {
// event.setCanceled(true);
// }
// }
}

View file

@ -24,53 +24,15 @@
package techreborn.client;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.ContainerScreen;
import net.minecraft.container.Container;
import net.fabricmc.fabric.api.container.ContainerProviderRegistry;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IInteractionObject;
import net.minecraft.world.World;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.containerBuilder.IContainerProvider;
import techreborn.client.container.ContainerDestructoPack;
import techreborn.tiles.*;
import techreborn.tiles.fusionReactor.TileFusionControlComputer;
import techreborn.tiles.generator.*;
import techreborn.tiles.generator.advanced.TileDieselGenerator;
import techreborn.tiles.generator.advanced.TileGasTurbine;
import techreborn.tiles.generator.advanced.TileSemiFluidGenerator;
import techreborn.tiles.generator.advanced.TileThermalGenerator;
import techreborn.tiles.generator.basic.TileSolidFuelGenerator;
import techreborn.tiles.machine.iron.TileIronAlloyFurnace;
import techreborn.tiles.machine.iron.TileIronFurnace;
import techreborn.tiles.machine.multiblock.*;
import techreborn.tiles.machine.tier1.*;
import techreborn.tiles.machine.tier3.TileChunkLoader;
import techreborn.tiles.machine.tier3.TileMatterFabricator;
import techreborn.tiles.machine.tier3.TileQuantumChest;
import techreborn.tiles.machine.tier3.TileQuantumTank;
import techreborn.tiles.storage.TileAdjustableSU;
import techreborn.tiles.storage.TileHighVoltageSU;
import techreborn.tiles.storage.TileLowVoltageSU;
import techreborn.tiles.storage.TileMediumVoltageSU;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.function.Consumer;
import techreborn.client.gui.*;
import techreborn.tiles.storage.idsu.TileInterdimensionalSU;
import techreborn.tiles.storage.lesu.TileLapotronicSU;
import java.util.stream.Stream;
public enum EGui implements IMachineGuiHandler {
@ -120,111 +82,10 @@ public enum EGui implements IMachineGuiHandler {
private final boolean containerBuilder;
private EGui(final boolean containerBuilder) {
EGui(final boolean containerBuilder) {
this.containerBuilder = containerBuilder;
}
static {
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.GUIFACTORY, ()-> EGui::getClientGuiElement);
}
public static ContainerScreen getClientGuiElement(FMLPlayMessages.OpenContainer msg) {
EGui gui = byID(msg.getId());
PlayerEntity player = MinecraftClient.getInstance().player;
BlockPos pos = msg.getAdditionalData().readBlockPos();
BlockEntity tile = player.world.getBlockEntity(pos);
switch (gui) {
case AESU:
return new GuiAESU(player, (TileAdjustableSU) tile);
case ALLOY_FURNACE:
return new GuiAlloyFurnace(player, (TileIronAlloyFurnace) tile);
case ALLOY_SMELTER:
return new GuiAlloySmelter(player, (TileAlloySmelter) tile);
case ASSEMBLING_MACHINE:
return new GuiAssemblingMachine(player, (TileAssemblingMachine) tile);
case LOW_VOLTAGE_SU:
return new GuiBatbox(player, (TileLowVoltageSU) tile);
case BLAST_FURNACE:
return new GuiBlastFurnace(player, (TileIndustrialBlastFurnace) tile);
case CENTRIFUGE:
return new GuiCentrifuge(player, (TileIndustrialCentrifuge) tile);
case CHARGEBENCH:
return new GuiChargeBench(player, (TileChargeOMat) tile);
case CHEMICAL_REACTOR:
return new GuiChemicalReactor(player, (TileChemicalReactor) tile);
case CHUNK_LOADER:
return new GuiChunkLoader(player, (TileChunkLoader) tile);
case COMPRESSOR:
return new GuiCompressor(player, (TileCompressor) tile);
case DESTRUCTOPACK:
return new GuiDestructoPack(new ContainerDestructoPack(player));
case DIESEL_GENERATOR:
return new GuiDieselGenerator(player, (TileDieselGenerator) tile);
case DIGITAL_CHEST:
return new GuiDigitalChest(player, (TileDigitalChest) tile);
case ELECTRIC_FURNACE:
return new GuiElectricFurnace(player, (TileElectricFurnace) tile);
case EXTRACTOR:
return new GuiExtractor(player, (TileExtractor) tile);
case FUSION_CONTROLLER:
return new GuiFusionReactor(player, (TileFusionControlComputer) tile);
case GAS_TURBINE:
return new GuiGasTurbine(player, (TileGasTurbine) tile);
case GENERATOR:
return new GuiGenerator(player, (TileSolidFuelGenerator) tile);
case GRINDER:
return new GuiGrinder(player, (TileGrinder) tile);
case IDSU:
return new GuiIDSU(player, (TileInterdimensionalSU) tile);
case IMPLOSION_COMPRESSOR:
return new GuiImplosionCompressor(player, (TileImplosionCompressor) tile);
case INDUSTRIAL_ELECTROLYZER:
return new GuiIndustrialElectrolyzer(player, (TileIndustrialElectrolyzer) tile);
case INDUSTRIAL_GRINDER:
return new GuiIndustrialGrinder(player, (TileIndustrialGrinder) tile);
case IRON_FURNACE:
return new GuiIronFurnace(player, (TileIronFurnace) tile);
case LESU:
return new GuiLESU(player, (TileLapotronicSU) tile);
case MATTER_FABRICATOR:
return new GuiMatterFabricator(player, (TileMatterFabricator) tile);
case MEDIUM_VOLTAGE_SU:
return new GuiMFE(player, (TileMediumVoltageSU) tile);
case HIGH_VOLTAGE_SU:
return new GuiMFSU(player, (TileHighVoltageSU) tile);
case QUANTUM_CHEST:
return new GuiQuantumChest(player, (TileQuantumChest) tile);
case QUANTUM_TANK:
return new GuiQuantumTank(player, (TileQuantumTank) tile);
case RECYCLER:
return new GuiRecycler(player, (TileRecycler) tile);
case ROLLING_MACHINE:
return new GuiRollingMachine(player, (TileRollingMachine) tile);
case SAWMILL:
return new GuiIndustrialSawmill(player, (TileIndustrialSawmill) tile);
case SCRAPBOXINATOR:
return new GuiScrapboxinator(player, (TileScrapboxinator) tile);
case SEMIFLUID_GENERATOR:
return new GuiSemifluidGenerator(player, (TileSemiFluidGenerator) tile);
case THERMAL_GENERATOR:
return new GuiThermalGenerator(player, (TileThermalGenerator) tile);
case VACUUM_FREEZER:
return new GuiVacuumFreezer(player, (TileVacuumFreezer) tile);
case AUTO_CRAFTING_TABLE:
return new GuiAutoCrafting(player, (TileAutoCraftingTable) tile);
case PLASMA_GENERATOR:
return new GuiPlasmaGenerator(player, (TilePlasmaGenerator) tile);
case EnvTypeILLATION_TOWER:
return new GuiEnvTypeillationTower(player, (TileEnvTypeillationTower) tile);
case FLUID_REPLICATOR:
return new GuiFluidReplicator(player, (TileFluidReplicator) tile);
default:
throw new RuntimeException("No gui found for " + msg.getId());
}
}
public static EGui byID(Identifier resourceLocation){
return Arrays.stream(values())
.filter(eGui -> eGui.name().toLowerCase().equals(resourceLocation.getPath()))
@ -232,41 +93,18 @@ public enum EGui implements IMachineGuiHandler {
.orElseThrow(() -> new RuntimeException("Failed to find gui for " + resourceLocation));
}
public static Stream<EGui> stream(){
return Arrays.stream(values());
}
public Identifier getID(){
return new Identifier("techreborn", name().toLowerCase());
}
@Override
public void open(PlayerEntity player, BlockPos pos, World world) {
if(!world.isClient){
EGui gui = this;
NetworkHooks.openGui((ServerPlayerEntity) player, new IInteractionObject() {
@Override
public Container createContainer(PlayerInventory playerInventory, PlayerEntity playerIn) {
BlockEntity tileEntity = playerIn.world.getBlockEntity(pos);
if (tileEntity instanceof IContainerProvider) {
return ((IContainerProvider) tileEntity).createContainer(player);
}
return null;
}
@Override
public String getGuiID() {
return "techreborn:" + gui.name().toLowerCase();
}
@Override
public Component getName() {
return new TextComponent(getGuiID());
}
@Override
public boolean hasCustomName() {
return false;
}
@Nullable
@Override
public Component getCustomName() {
return null;
}
}, packetBuffer -> packetBuffer.writeBlockPos(pos));
ContainerProviderRegistry.INSTANCE.openContainer(getID(), player, packetByteBuf -> packetByteBuf.writeBlockPos(pos));
}
}

View file

@ -24,15 +24,25 @@
package techreborn.client;
import net.fabricmc.fabric.api.client.screen.ScreenProviderRegistry;
import net.fabricmc.fabric.api.container.ContainerFactory;
import net.fabricmc.fabric.api.container.ContainerProviderRegistry;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.gui.screen.ContainerScreenRegistry;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen;
import net.minecraft.container.Container;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.PacketByteBuf;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.client.containerBuilder.IContainerProvider;
import techreborn.client.container.ContainerDestructoPack;
import techreborn.client.gui.*;
import techreborn.tiles.*;
import techreborn.tiles.TileChargeOMat;
import techreborn.tiles.TileDigitalChest;
import techreborn.tiles.TileIndustrialCentrifuge;
import techreborn.tiles.fusionReactor.TileFusionControlComputer;
import techreborn.tiles.generator.TilePlasmaGenerator;
import techreborn.tiles.generator.advanced.TileDieselGenerator;
@ -55,32 +65,23 @@ import techreborn.tiles.storage.TileMediumVoltageSU;
import techreborn.tiles.storage.idsu.TileInterdimensionalSU;
import techreborn.tiles.storage.lesu.TileLapotronicSU;
public class GuiHandler implements IGuiHandler {
import java.util.Arrays;
import java.util.function.Consumer;
@Override
public Object getServerGuiElement(final int ID, final PlayerEntity player, final World world, final int x,
final int y, final int z) {
public class GuiHandler {
final EGui gui = EGui.values()[ID];
final BlockEntity tile = world.getBlockEntity(new BlockPos(x, y, z));
public static void register(){
if (gui.useContainerBuilder() && tile != null)
return ((IContainerProvider) tile).createContainer(player);
EGui.stream().forEach(gui -> ContainerProviderRegistry.INSTANCE.registerFactory(gui.getID(), (i, identifier, playerEntity, packetByteBuf) -> {
final BlockEntity tile = playerEntity.world.getBlockEntity(packetByteBuf.readBlockPos());
return ((IContainerProvider) tile).createContainer(playerEntity);
}));
switch (gui) {
case DESTRUCTOPACK:
return new ContainerDestructoPack(player);
default:
break;
}
return null;
EGui.stream().forEach(gui -> ScreenProviderRegistry.INSTANCE.registerFactory(gui.getID(), (i, identifier, playerEntity, packetByteBuf) -> getClientGuiElement(EGui.byID(identifier), playerEntity, packetByteBuf.readBlockPos())));
}
@Override
public Object getClientGuiElement(final int ID, final PlayerEntity player, final World world, final int x,
final int y, final int z) {
final EGui gui = EGui.values()[ID];
final BlockEntity tile = world.getBlockEntity(new BlockPos(x, y, z));
private static AbstractContainerScreen getClientGuiElement(final EGui gui, final PlayerEntity player, BlockPos pos) {
final BlockEntity tile = player.world.getBlockEntity(pos);
switch (gui) {
case AESU:
@ -164,9 +165,7 @@ public class GuiHandler implements IGuiHandler {
case PLASMA_GENERATOR:
return new GuiPlasmaGenerator(player, (TilePlasmaGenerator) tile);
case EnvTypeILLATION_TOWER:
return new GuiEnvTypeillationTower(player, (TileEnvTypeillationTower) tile);
case MANUAL:
return new GuiManual(player);
return new GuiDistillationTower(player, (TileDistillationTower) tile);
case FLUID_REPLICATOR:
return new GuiFluidReplicator(player, (TileFluidReplicator) tile);
default:

View file

@ -27,6 +27,7 @@ package techreborn.client.container;
import net.minecraft.container.Slot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.network.chat.TextComponent;
import reborncore.client.gui.slots.SlotFilteredVoid;
import reborncore.common.container.RebornContainer;
import reborncore.common.util.Inventory;
@ -38,7 +39,7 @@ public class ContainerDestructoPack extends RebornContainer {
private Inventory<?> inv;
public ContainerDestructoPack(PlayerEntity player) {
super(null);
super(null, new TextComponent("destructopack"));
this.player = player;
inv = new Inventory<>(1, "destructopack", 64, null);
buildContainer();

View file

@ -25,21 +25,21 @@
package techreborn.client.container.builder.slot;
import net.minecraft.block.entity.FurnaceBlockEntity;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import reborncore.client.gui.slots.BaseSlot;
public class FurnaceFuelSlot extends BaseSlot {
public FurnaceFuelSlot(IItemHandler inventoryIn, int index, int xPosition, int yPosition) {
public FurnaceFuelSlot(Inventory inventoryIn, int index, int xPosition, int yPosition) {
super(inventoryIn, index, xPosition, yPosition);
}
@Override
public boolean canInsert(ItemStack stack)
{
return FurnaceBlockEntity.isItemFuel(stack) || isBucket(stack);
return FurnaceBlockEntity.canUseAsFuel(stack) || isBucket(stack);
}
@Override

View file

@ -25,7 +25,7 @@
package techreborn.client.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
@ -72,15 +72,13 @@ public class GuiAESU extends GuiBase {
builder.drawMultiEnergyBar(this, 81, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
buttons.add(new GuiButtonUpDown(300, 121, 79, this, layer).clickHandler(this::onClick));
buttons.add(new GuiButtonUpDown(301, 121 + 12, 79, this, layer).clickHandler(this::onClick));
buttons.add(new GuiButtonUpDown(302, 121 + 24, 79, this, layer).clickHandler(this::onClick));
buttons.add(new GuiButtonUpDown(303, 121 + 36, 79, this, layer).clickHandler(this::onClick));
buttons.add(new GuiButtonUpDown(121, 79, this, layer, this::onClick));
buttons.add(new GuiButtonUpDown(121 + 12, 79, this, layer, this::onClick));
buttons.add(new GuiButtonUpDown(121 + 24, 79, this, layer, this::onClick));
buttons.add(new GuiButtonUpDown(121 + 36, 79, this, layer, this::onClick));
}
public void onClick(GuiButtonExtended button, Double x, Double y){
if (button.id >= 300 && button.id <= 303) {
NetworkManager.sendToServer(ServerboundPackets.createPacketAesu(button.id, tile));
}
public void onClick(ButtonWidget button){
NetworkManager.sendToServer(ServerboundPackets.createPacketAesu(1, tile));
}
}

View file

@ -28,6 +28,7 @@ import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Identifier;
import techreborn.tiles.machine.iron.TileIronAlloyFurnace;
@ -39,7 +40,7 @@ public class GuiAlloyFurnace extends AbstractContainerScreen {
TileIronAlloyFurnace alloyfurnace;
public GuiAlloyFurnace(final PlayerEntity player, final TileIronAlloyFurnace alloyFurnace) {
super(alloyFurnace.createContainer(player));
super(alloyFurnace.createContainer(player), player.inventory, new TextComponent("techreborn.alloy_furnace"));
this.containerWidth = 176;
this.containerHeight = 167;
this.alloyfurnace = alloyFurnace;
@ -47,7 +48,7 @@ public class GuiAlloyFurnace extends AbstractContainerScreen {
@Override
protected void drawBackground(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
this.drawDefaultBackground();
this.renderBackground();
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.minecraft.getTextureManager().bindTexture(GuiAlloyFurnace.texture);
final int k = (this.width - this.containerWidth) / 2;

View file

@ -25,8 +25,8 @@
package techreborn.client.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.GuiLighting;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Recipe;
@ -54,21 +54,7 @@ public class GuiAutoCrafting extends GuiBase {
}
public void renderItemStack(ItemStack stack, int x, int y) {
if (stack != EMPTY) {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
GuiLighting.enableForItems();
itemRenderer.renderGuiItem(stack, x, y);
GlStateManager.disableLighting();
GlStateManager.pushMatrix();
GlStateManager.disableDepthTest();
GlStateManager.color4f(1, 1, 1, 1F / 3F);
drawRect(x - 4, y- 4, x + 20, y + 20, -2139062144);
GlStateManager.enableDepthTest();
GlStateManager.color4f(1F, 1F, 1F, 1F);
GlStateManager.enableBlend();
GlStateManager.popMatrix();
}
MinecraftClient.getInstance().getItemRenderer().renderGuiItem(stack, x, y);
}
@Override
@ -95,7 +81,7 @@ public class GuiAutoCrafting extends GuiBase {
}
drawOutputSlot(145, 42, layer);
drawOutputSlot(95, 42, layer);
draw("Inventory", 8, 82, 4210752, layer);
drawString("Inventory", 8, 82, 4210752, layer);
builder.drawLockButton(this, 145, 4, mouseX, mouseY, layer, tileAutoCraftingTable.locked);
}

View file

@ -25,7 +25,6 @@
package techreborn.client.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.powerSystem.PowerSystem;

View file

@ -24,8 +24,8 @@
package techreborn.client.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
@ -50,8 +50,8 @@ public class GuiBlastFurnace extends GuiBase {
}
@Override
public void initGui() {
super.initGui();
public void init() {
super.init();
this.hasMultiBlock = this.tile.getCachedHeat() != 0;
ClientProxy.multiblockRenderEvent.setMultiblock(null);
}
@ -96,7 +96,7 @@ public class GuiBlastFurnace extends GuiBase {
}
public void onClick(GuiButtonExtended button, Double x, Double y){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -25,12 +25,11 @@
package techreborn.client.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.gui.ContainerScreen;
import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Identifier;
import reborncore.client.gui.builder.widget.GuiButtonSimple;
import techreborn.tiles.machine.tier3.TileChunkLoader;
@ -46,7 +45,7 @@ public class GuiChunkLoader extends AbstractContainerScreen {
private ButtonWidget minusTenButton;
public GuiChunkLoader(final PlayerEntity player, final TileChunkLoader chunkLoader) {
super(chunkLoader.createContainer(player));
super(chunkLoader.createContainer(player), player.inventory, new TextComponent("techreborn.chunkloader"));
this.containerWidth = 176;
this.containerHeight = 167;
this.chunkloader = chunkLoader;
@ -57,11 +56,11 @@ public class GuiChunkLoader extends AbstractContainerScreen {
super.init();
this.left = this.width / 2 - this.containerWidth / 2;
this.top = this.height / 2 - this.containerHeight / 2;
this.plusOneButton = new GuiButtonSimple(0, this.left + 5, this.top + 37, 40, 20, "+1");
this.plusTenButton = new GuiButtonSimple(0, this.left + 45, this.top + 37, 40, 20, "+10");
this.plusOneButton = new GuiButtonSimple(this.left + 5, this.top + 37, 40, 20, "+1", buttonWidget -> {});
this.plusTenButton = new GuiButtonSimple(this.left + 45, this.top + 37, 40, 20, "+10", buttonWidget -> {});
this.minusOneButton = new GuiButtonSimple(0, this.left + 90, this.top + 37, 40, 20, "-1");
this.minusTenButton = new GuiButtonSimple(0, this.left + 130, this.top + 37, 40, 20, "-10");
this.minusOneButton = new GuiButtonSimple(this.left + 90, this.top + 37, 40, 20, "-1", buttonWidget -> {});
this.minusTenButton = new GuiButtonSimple(this.left + 130, this.top + 37, 40, 20, "-10", buttonWidget -> {});
this.buttons.add(this.plusOneButton);
this.buttons.add(this.plusTenButton);
@ -71,7 +70,7 @@ public class GuiChunkLoader extends AbstractContainerScreen {
@Override
protected void drawBackground(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
this.drawDefaultBackground();
this.renderBackground();
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
minecraft.getTextureManager().bindTexture(GuiChunkLoader.texture);
final int k = (this.width - this.containerWidth) / 2;

View file

@ -24,11 +24,12 @@
package techreborn.client.gui;
import net.minecraft.client.gui.ContainerScreen;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.container.Container;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Identifier;
public class GuiDestructoPack extends AbstractContainerScreen {
@ -37,16 +38,16 @@ public class GuiDestructoPack extends AbstractContainerScreen {
"textures/gui/destructopack.png");
public GuiDestructoPack(Container container) {
super(container);
super(container, MinecraftClient.getInstance().player.inventory, new TextComponent("techreborn.destructopack"));
this.containerWidth = 176;
this.containerHeight = 166;
}
@Override
protected void drawBackground(float arg0, int arg1, int arg2) {
this.drawDefaultBackground();
this.renderBackground();
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
this.minecraft.getTextureManager().bindTexture(texture);
blit(left, top, 0, 0, 176, 166);
}

View file

@ -24,9 +24,9 @@
package techreborn.client.gui;
import net.minecraft.entity.player.PlayerEntity;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.guibuilder.GuiBuilder;
import techreborn.tiles.generator.advanced.TileDieselGenerator;

View file

@ -26,7 +26,6 @@ package techreborn.client.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
@ -38,20 +37,20 @@ import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent;
import reborncore.client.multiblock.MultiblockSet;
import techreborn.init.TRContent;
import techreborn.tiles.machine.multiblock.TileEnvTypeillationTower;
import techreborn.tiles.machine.multiblock.TileDistillationTower;
public class GuiEnvTypeillationTower extends GuiBase {
public class GuiDistillationTower extends GuiBase {
public TileEnvTypeillationTower tile;
public TileDistillationTower tile;
public GuiEnvTypeillationTower(final PlayerEntity player, final TileEnvTypeillationTower tile) {
public GuiDistillationTower(final PlayerEntity player, final TileDistillationTower tile) {
super(player, tile, tile.createContainer(player));
this.tile = tile;
}
@Override
public void initGui() {
super.initGui();
public void init() {
super.init();
ClientProxy.multiblockRenderEvent.setMultiblock(null);
}
@ -91,7 +90,7 @@ public class GuiEnvTypeillationTower extends GuiBase {
}
public void onClick(GuiButtonExtended button, Double x, Double y){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -100,7 +100,7 @@ public class GuiFluidReplicator extends GuiBase {
// GuiScreen
public void onClick(GuiButtonExtended button, Double x, Double y){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -25,6 +25,7 @@
package techreborn.client.gui;
import net.minecraft.block.BlockState;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import org.apache.commons.lang3.tuple.Pair;
@ -79,14 +80,14 @@ public class GuiFusionReactor extends GuiBase {
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer);
if (tile.getCoilStatus() > 0) {
addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
addHologramButton(6, 4, 212, layer).clickHandler(this::hologramToggle);
drawCentredString(tile.getStateString(), 20, Color.BLUE.darker().getRGB(), layer);
if(tile.state == 2){
drawCentredString( PowerSystem.getLocaliszedPowerFormatted((int) tile.getPowerChange()) + "/t", 30, Color.GREEN.darker().getRGB(), layer);
}
} else {
builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
addHologramButton(76, 56, 212, layer).clickHandler(this::hologramToggle);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
Optional<Pair<Integer, Integer>> stackSize = getCoilStackCount();
@ -103,31 +104,22 @@ public class GuiFusionReactor extends GuiBase {
drawString("Size: " + tile.size, 83, 81, 0xFFFFFF, layer);
drawString("" + tile.getPowerMultiplier() + "x", 10, 81, 0xFFFFFF, layer);
buttons.add(new GuiButtonUpDown(300, 121, 79, this, GuiBase.Layer.FOREGROUND));
buttons.add(new GuiButtonUpDown(301, 121 + 12, 79, this, GuiBase.Layer.FOREGROUND));
buttons.add(new GuiButtonUpDown(302, 121 + 24, 79, this, GuiBase.Layer.FOREGROUND));
buttons.add(new GuiButtonUpDown(303, 121 + 36, 79, this, GuiBase.Layer.FOREGROUND));
buttons.add(new GuiButtonUpDown(121, 79, this, GuiBase.Layer.FOREGROUND, (ButtonWidget buttonWidget) -> sendSizeChange(5)));
buttons.add(new GuiButtonUpDown(121 + 12, 79, this, GuiBase.Layer.FOREGROUND, (ButtonWidget buttonWidget) -> sendSizeChange(1)));
buttons.add(new GuiButtonUpDown(121 + 24, 79, this, GuiBase.Layer.FOREGROUND, (ButtonWidget buttonWidget) -> sendSizeChange(-5)));
buttons.add(new GuiButtonUpDown(121 + 36, 79, this, GuiBase.Layer.FOREGROUND, (ButtonWidget buttonWidget) -> sendSizeChange(-1)));
builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
public void onClick(GuiButtonExtended button, Double x, Double y){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
public void hologramToggle(GuiButtonExtended button, double x, double y){
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
updateMultiBlockRender();
} else {
ClientProxy.multiblockRenderEvent.setMultiblock(null);
}
}
if (button.id == 300){
sendSizeChange(5);
} else if (button.id == 301){
sendSizeChange(1);
} else if (button.id == 302){
sendSizeChange(-1);
} else if (button.id == 303){
sendSizeChange(-5);
}
}
private void sendSizeChange(int sizeDelta){

View file

@ -26,7 +26,6 @@ package techreborn.client.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import reborncore.ClientProxy;
@ -93,7 +92,7 @@ public class GuiImplosionCompressor extends GuiBase {
}
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -96,8 +96,8 @@ public class GuiIndustrialGrinder extends GuiBase {
builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
public void onClick(GuiButtonExtended button, double mouseX, double mouseY){
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -49,8 +49,8 @@ public class GuiIndustrialSawmill extends GuiBase {
}
@Override
public void initGui() {
super.initGui();
public void init() {
super.init();
ClientProxy.multiblockRenderEvent.setMultiblock(null);
}
@ -96,7 +96,7 @@ public class GuiIndustrialSawmill extends GuiBase {
}
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -25,7 +25,6 @@
package techreborn.client.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@ -50,7 +49,7 @@ public class GuiIronFurnace extends GuiBase {
@Override
protected void drawBackground(float partialTicks, int mouseX, int mouseY) {
drawDefaultBackground();
renderBackground();
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
builder.drawSlotTab(this, left - 24, top + 6, new ItemStack(TRContent.WRENCH));
minecraft.getTextureManager().bindTexture(GuiIronFurnace.texture);

View file

@ -25,7 +25,6 @@
package techreborn.client.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.powerSystem.PowerSystem;

View file

@ -24,18 +24,12 @@
package techreborn.client.gui;
import net.minecraft.client.gui.ingame.ConfirmChatLinkScreen;
import net.minecraft.client.gui.screen.ConfirmChatLinkScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Identifier;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.common.network.NetworkManager;
import techreborn.items.ItemManual;
import techreborn.packets.ServerboundPackets;
import java.awt.*;
public class GuiManual extends Screen {
@ -51,27 +45,23 @@ public class GuiManual extends Screen {
private static final String text3 = I18n.translate("techreborn.manual.refund");
public GuiManual(PlayerEntity player) {
super(new TextComponent("gui.manual"));
this.player = player;
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
@Override
public void init() {
int y = height / 4;
buttons.add(new GuiButtonExtended(1, (width / 2 - 30), y + 10, 60, 20, I18n.translate("techreborn.manual.wikibtn")));
buttons.add(new GuiButtonExtended(2, (width / 2 - 30), y + 60, 60, 20, I18n.translate("techreborn.manual.discordbtn")));
if(ItemManual.allowRefund){
buttons.add(new GuiButtonExtended(3, (width / 2 - 30), y + 110, 60, 20, I18n.translate("techreborn.manual.refundbtn")));
}
// buttons.add(new GuiButtonExtended((width / 2 - 30), y + 10, 60, 20, I18n.translate("techreborn.manual.wikibtn")));
// buttons.add(new GuiButtonExtended((width / 2 - 30), y + 60, 60, 20, I18n.translate("techreborn.manual.discordbtn")));
// if(ItemManual.allowRefund){
// buttons.add(new GuiButtonExtended((width / 2 - 30), y + 110, 60, 20, I18n.translate("techreborn.manual.refundbtn")));
// }
}
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
drawDefaultBackground();
renderBackground();
minecraft.getTextureManager().bindTexture(GuiManual.texture);
int centerX = (width / 2) - guiWidth / 2;
int centerY = (height / 2) - guiHeight / 2;
@ -79,54 +69,55 @@ public class GuiManual extends Screen {
int y = height / 4;
font.draw(text1, ((width / 2) - font.getStringWidth(text1) / 2), height / 2 - (guiHeight / 4), 4210752);
font.draw(text2, ((width / 2) - font.getStringWidth(text2) / 2), height / 2 + 5, 4210752);
if(ItemManual.allowRefund){
if (ItemManual.allowRefund) {
font.draw(text3, ((width / 2) - font.getStringWidth(text3) / 2), y + 100, 4210752);
}
super.render(mouseX, mouseY, partialTicks);
}
}
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
switch (button.id) {
case 1:
minecraft.openScreen(new ConfirmChatLinkScreen(this, "http://wiki.techreborn.ovh", 1, false));
break;
case 2:
this.minecraft.openScreen(new ConfirmChatLinkScreen(this, "https://discord.gg/teamreborn", 2, false));
break;
case 3:
minecraft.openScreen(null);
NetworkManager.sendToServer(ServerboundPackets.createRefundPacket());
break;
}
}
@Override
public void confirmResult(boolean result, int id) {
switch(id) {
case 1:
if(result == true) {
try {
Desktop.getDesktop().browse(new java.net.URI("http://wiki.techreborn.ovh"));
} catch (Exception e) {
System.err.print(e);
}
}else {
minecraft.openScreen(this);
}
break;
case 2:
if(result == true) {
try {
Desktop.getDesktop().browse(new java.net.URI("https://discord.gg/teamreborn"));
} catch (Exception e) {
System.err.print(e);
}
}else {
minecraft.openScreen(this);
}
break;
}
}
}
// public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
// switch (button.id) {
// case 1:
// minecraft.openScreen(new ConfirmChatLinkScreen(this, "http://wiki.techreborn.ovh", 1, false));
// break;
// case 2:
// this.minecraft.openScreen(new ConfirmChatLinkScreen(this, "https://discord.gg/teamreborn", 2, false));
// break;
// case 3:
// minecraft.openScreen(null);
// NetworkManager.sendToServer(ServerboundPackets.createRefundPacket());
// break;
// }
// }
//
// @Override
// public void confirmResult(boolean result, int id) {
// switch(id) {
// case 1:
// if(result == true) {
// try {
// Desktop.getDesktop().browse(new java.net.URI("http://wiki.techreborn.ovh"));
// } catch (Exception e) {
// System.err.print(e);
// }
// }else {
// minecraft.openScreen(this);
// }
// break;
// case 2:
// if(result == true) {
// try {
// Desktop.getDesktop().browse(new java.net.URI("https://discord.gg/teamreborn"));
// } catch (Exception e) {
// System.err.print(e);
// }
// }else {
// minecraft.openScreen(this);
// }
// break;
// }
// }
// }

View file

@ -24,9 +24,9 @@
package techreborn.client.gui;
import net.minecraft.entity.player.PlayerEntity;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.guibuilder.GuiBuilder;
import techreborn.tiles.generator.TilePlasmaGenerator;

View file

@ -25,8 +25,8 @@
package techreborn.client.gui;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.gui.builder.GuiBase;
import reborncore.fluid.FluidStack;
import techreborn.tiles.machine.tier3.TileQuantumTank;
public class GuiQuantumTank extends GuiBase {

View file

@ -88,7 +88,7 @@ public class GuiVacuumFreezer extends GuiBase {
}
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -1,35 +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.particle;
import net.minecraft.client.particle.FireSmokeLargeParticle;
import net.minecraft.world.World;
public class ParticleSmoke extends FireSmokeLargeParticle {
public ParticleSmoke(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1201_8_, double p_i1201_10_, double p_i1201_12_) {
super(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i1201_8_, p_i1201_10_, p_i1201_12_);
}
}

View file

@ -25,13 +25,13 @@
package techreborn.client.render;
import com.google.common.base.Charsets;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.model.json.JsonUnbakedModel;
import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.resource.Resource;
import net.minecraft.util.Identifier;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import techreborn.TechReborn;
import java.io.BufferedReader;

View file

@ -29,7 +29,6 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.block.BlockRenderManager;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.texture.SpriteAtlasTexture;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
@ -37,6 +36,8 @@ import techreborn.blocks.BlockNuke;
import techreborn.entities.EntityNukePrimed;
import techreborn.init.TRContent;
import javax.annotation.Nullable;
/**
* Created by Mark on 13/03/2016.
*/
@ -47,8 +48,14 @@ public class RenderNukePrimed extends EntityRenderer<EntityNukePrimed> {
this.field_4673 = 0.5F;
}
@Nullable
@Override
public void doRender(EntityNukePrimed entity, double x, double y, double z, float entityYaw, float partialTicks) {
protected Identifier getTexture(EntityNukePrimed entityNukePrimed) {
return SpriteAtlasTexture.BLOCK_ATLAS_TEX;
}
@Override
public void render(EntityNukePrimed entity, double x, double y, double z, float entityYaw, float partialTicks) {
BlockRenderManager blockrendererdispatcher = MinecraftClient.getInstance().getBlockRenderManager();
GlStateManager.pushMatrix();
GlStateManager.translatef((float) x, (float) y + 0.5F, (float) z);
@ -84,8 +91,4 @@ public class RenderNukePrimed extends EntityRenderer<EntityNukePrimed> {
super.render(entity, x, y, z, entityYaw, partialTicks);
}
@Override
protected Identifier getEntityTexture(EntityNukePrimed entity) {
return SpriteAtlasTexture.BLOCK_ATLAS_TEX;
}
}