Gui fixes, 393

This commit is contained in:
modmuss50 2019-02-22 14:02:04 +00:00
parent 06632be822
commit d68c65641d
20 changed files with 189 additions and 452 deletions

View file

@ -27,10 +27,8 @@ package techreborn.blocks.cable;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.state.AbstractProperty; import net.minecraft.state.AbstractProperty;
import net.minecraft.state.BooleanProperty; import net.minecraft.state.BooleanProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
@ -40,11 +38,10 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ChunkCache;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.chunk.BlockStateContainer;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.CapabilityEnergy;
import reborncore.api.ToolManager; import reborncore.api.ToolManager;
@ -150,10 +147,6 @@ public class BlockCable extends BlockContainer {
return super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ); return super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ);
} }
@Override
public int damageDropped(IBlockState state) {
return getMetaFromState(state);
}
@Override @Override
public boolean isOpaqueCube(IBlockState state) { public boolean isOpaqueCube(IBlockState state) {
@ -166,7 +159,7 @@ public class BlockCable extends BlockContainer {
} }
@Override @Override
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { public boolean shouldSideBeRendered(IBlockState blockState, IWorld blockAccess, BlockPos pos, EnumFacing side) {
if (type == TRContent.Cables.GLASSFIBER) if (type == TRContent.Cables.GLASSFIBER)
return false; return false;
else else

View file

@ -24,30 +24,26 @@
package techreborn.blocks.fluid; package techreborn.blocks.fluid;
import net.minecraft.block.material.Material; import net.minecraft.block.BlockFlowingFluid;
import net.minecraft.util.math.BlockPos; import net.minecraft.fluid.FlowingFluid;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidClassic;
import net.minecraftforge.fluids.Fluid;
public class BlockFluidBase extends BlockFluidClassic { public class BlockFluidBase extends BlockFlowingFluid {
public BlockFluidBase(Fluid fluid, Material material) { public BlockFluidBase(FlowingFluid fluid, Properties properties) {
super(fluid, material); super(fluid, properties);
} }
@Override // @Override
public boolean canDisplace(IBlockAccess world, BlockPos pos) { // public boolean canDisplace(IBlockAccess world, BlockPos pos) {
if (world.getBlockState(pos).getMaterial().isLiquid()) // if (world.getBlockState(pos).getMaterial().isLiquid())
return false; // return false;
return super.canDisplace(world, pos); // return super.canDisplace(world, pos);
} // }
//
@Override // @Override
public boolean displaceIfPossible(World world, BlockPos pos) { // public boolean displaceIfPossible(World world, BlockPos pos) {
if (world.getBlockState(pos).getMaterial().isLiquid()) // if (world.getBlockState(pos).getMaterial().isLiquid())
return false; // return false;
return super.displaceIfPossible(world, pos); // return super.displaceIfPossible(world, pos);
} // }
} }

View file

@ -24,26 +24,20 @@
package techreborn.blocks.fluid; package techreborn.blocks.fluid;
import net.minecraft.block.material.Material; import net.minecraft.fluid.FlowingFluid;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fluids.Fluid;
public class BlockFluidTechReborn extends BlockFluidBase { public class BlockFluidTechReborn extends BlockFluidBase {
String name; String name;
public BlockFluidTechReborn(Fluid fluid, Material material, String name) { public BlockFluidTechReborn(FlowingFluid fluid, Properties properties, String name) {
super(fluid, material); super(fluid, properties);
setTranslationKey(name); //setTranslationKey(name);
this.name = name; this.name = name;
} }
//
@Override // @Override
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing side) { // public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing side) {
return BlockFaceShape.UNDEFINED; // return BlockFaceShape.UNDEFINED;
} // }
} }

View file

@ -33,6 +33,6 @@ public class TechRebornFluid extends Fluid {
super(fluidName, super(fluidName,
new ResourceLocation("techreborn:blocks/fluids/" + fluidName.replaceFirst("fluid", "") + "_flowing"), new ResourceLocation("techreborn:blocks/fluids/" + fluidName.replaceFirst("fluid", "") + "_flowing"),
new ResourceLocation("techreborn:blocks/fluids/" + fluidName.replaceFirst("fluid", "") + "_flowing")); new ResourceLocation("techreborn:blocks/fluids/" + fluidName.replaceFirst("fluid", "") + "_flowing"));
FluidRegistry.addBucketForFluid(this); //FluidRegistry.addBucketForFluid(this);
} }
} }

View file

@ -85,7 +85,8 @@ public enum EGui implements IMachineGuiHandler {
@Override @Override
public void open(EntityPlayer player, BlockPos pos, World world) { public void open(EntityPlayer player, BlockPos pos, World world) {
if(!world.isRemote){ if(!world.isRemote){
player.openGui(TechReborn.INSTANCE, this.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); throw new UnsupportedOperationException("fix opening guis");
//player.openGui(TechReborn.INSTANCE, this.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
} }
} }

View file

@ -28,6 +28,7 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.common.network.NetworkManager; import reborncore.common.network.NetworkManager;
import reborncore.common.powerSystem.PowerSystem; import reborncore.common.powerSystem.PowerSystem;
import reborncore.client.gui.builder.widget.GuiButtonUpDown; import reborncore.client.gui.builder.widget.GuiButtonUpDown;
@ -73,17 +74,15 @@ public class GuiAESU extends GuiBase {
builder.drawMultiEnergyBar(this, 81, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); builder.drawMultiEnergyBar(this, 81, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
buttons.add(new GuiButtonUpDown(300, 121, 79, this, layer)); buttons.add(new GuiButtonUpDown(300, 121, 79, this, layer).clickHandler(this::onClick));
buttons.add(new GuiButtonUpDown(301, 121 + 12, 79, this, layer)); buttons.add(new GuiButtonUpDown(301, 121 + 12, 79, this, layer).clickHandler(this::onClick));
buttons.add(new GuiButtonUpDown(302, 121 + 24, 79, this, layer)); buttons.add(new GuiButtonUpDown(302, 121 + 24, 79, this, layer).clickHandler(this::onClick));
buttons.add(new GuiButtonUpDown(303, 121 + 36, 79, this, layer)); buttons.add(new GuiButtonUpDown(303, 121 + 36, 79, this, layer).clickHandler(this::onClick));
} }
@Override public void onClick(GuiButtonExtended button, Double x, Double y){
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id >= 300 && button.id <= 303) { if (button.id >= 300 && button.id <= 303) {
NetworkManager.sendToServer(ServerboundPackets.createPacketAesu(button.id, tile)); NetworkManager.sendToServer(ServerboundPackets.createPacketAesu(button.id, tile));
} }
} }
} }

View file

@ -32,6 +32,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.network.NetworkManager; import reborncore.common.network.NetworkManager;
import techreborn.packets.ServerboundPackets; import techreborn.packets.ServerboundPackets;
@ -103,11 +104,11 @@ public class GuiAutoCrafting extends GuiBase {
} }
@Override @Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
if (isPointInRect(145, 4, 20, 12, mouseX, mouseY)) { if (isPointInRect(145, 4, 20, 12, mouseX, mouseY)) {
NetworkManager.sendToServer(ServerboundPackets.createPacketAutoCraftingTableLock(tileAutoCraftingTable, !tileAutoCraftingTable.locked)); NetworkManager.sendToServer(ServerboundPackets.createPacketAutoCraftingTableLock(tileAutoCraftingTable, !tileAutoCraftingTable.locked));
return; return true;
} }
super.mouseClicked(mouseX, mouseY, mouseButton); return super.mouseClicked(mouseX, mouseY, mouseButton);
} }
} }

View file

@ -32,6 +32,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import reborncore.ClientProxy; import reborncore.ClientProxy;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockRenderEvent;
@ -89,18 +90,16 @@ public class GuiBlastFurnace extends GuiBase {
builder.drawBigHeatBar(this, 31, 71, tile.getCachedHeat(), 3230, layer); builder.drawBigHeatBar(this, 31, 71, tile.getCachedHeat(), 3230, layer);
if (hasMultiBlock) { if (hasMultiBlock) {
addHologramButton(4, 4, 212, layer); addHologramButton(4, 4, 212, layer).clickHandler(this::onClick);
} else { } else {
builder.drawMultiblockMissingBar(this, layer); builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer); addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
} }
builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
} }
@Override public void onClick(GuiButtonExtended button, Double x, Double y){
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) { if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{ {

View file

@ -32,6 +32,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import reborncore.ClientProxy; import reborncore.ClientProxy;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockRenderEvent;
@ -81,20 +82,18 @@ public class GuiDistillationTower extends GuiBase {
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 55, 40, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 55, 40, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
if (tile.getMutliBlock()) { if (tile.getMutliBlock()) {
addHologramButton(6, 4, 212, layer); addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer); builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);
} else { } else {
builder.drawMultiblockMissingBar(this, layer); builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer); addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
} }
builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
} }
@Override public void onClick(GuiButtonExtended button, Double x, Double y){
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) { if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{ {

View file

@ -31,6 +31,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import reborncore.ClientProxy; import reborncore.ClientProxy;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockRenderEvent;
@ -93,19 +94,17 @@ public class GuiFluidReplicator extends GuiBase {
builder.drawTank(this, 99, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer); builder.drawTank(this, 99, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer);
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
if (tile.getMultiBlock()) { if (tile.getMultiBlock()) {
addHologramButton(6, 4, 212, layer); addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
} else { } else {
builder.drawMultiblockMissingBar(this, layer); builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer); addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
} }
builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
} }
// GuiScreen // GuiScreen
@Override public void onClick(GuiButtonExtended button, Double x, Double y){
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) { if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{ {

View file

@ -31,6 +31,7 @@ import net.minecraft.util.math.BlockPos;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import reborncore.ClientProxy; import reborncore.ClientProxy;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockRenderEvent;
@ -80,14 +81,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, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer); builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer);
if (tile.getCoilStatus() > 0) { if (tile.getCoilStatus() > 0) {
addHologramButton(6, 4, 212, layer); addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
drawCentredString(tile.getStateString(), 20, Color.BLUE.darker().getRGB(), layer); drawCentredString(tile.getStateString(), 20, Color.BLUE.darker().getRGB(), layer);
if(tile.state == 2){ if(tile.state == 2){
drawCentredString( PowerSystem.getLocaliszedPowerFormatted((int) tile.getPowerChange()) + "/t", 30, Color.GREEN.darker().getRGB(), layer); drawCentredString( PowerSystem.getLocaliszedPowerFormatted((int) tile.getPowerChange()) + "/t", 30, Color.GREEN.darker().getRGB(), layer);
} }
} else { } else {
builder.drawMultiblockMissingBar(this, layer); builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer); addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
Optional<Pair<Integer, Integer>> stackSize = getCoilStackCount(); Optional<Pair<Integer, Integer>> stackSize = getCoilStackCount();
@ -111,10 +112,8 @@ public class GuiFusionReactor extends GuiBase {
builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
} }
@Override public void onClick(GuiButtonExtended button, Double x, Double y){
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) { if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
updateMultiBlockRender(); updateMultiBlockRender();

View file

@ -31,6 +31,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import reborncore.ClientProxy; import reborncore.ClientProxy;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockRenderEvent;
@ -85,19 +86,17 @@ public class GuiImplosionCompressor extends GuiBase {
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
if (tile.getMutliBlock()) { if (tile.getMutliBlock()) {
addHologramButton(6, 4, 212, layer); addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
} else { } else {
builder.drawMultiblockMissingBar(this, layer); builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer); addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
} }
builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
} }
@Override public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) { if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{ {

View file

@ -32,6 +32,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import reborncore.ClientProxy; import reborncore.ClientProxy;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockRenderEvent;
@ -91,18 +92,16 @@ public class GuiIndustrialGrinder extends GuiBase {
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawTank(this, 53, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer); builder.drawTank(this, 53, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer);
if (tile.getMultiBlock()) { if (tile.getMultiBlock()) {
addHologramButton(6, 4, 212, layer); addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
} else { } else {
builder.drawMultiblockMissingBar(this, layer); builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer); addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
} }
builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
} }
@Override public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) { if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{ {

View file

@ -32,6 +32,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import reborncore.ClientProxy; import reborncore.ClientProxy;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockRenderEvent;
@ -89,18 +90,16 @@ public class GuiIndustrialSawmill extends GuiBase {
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawTank(this, 53, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer); builder.drawTank(this, 53, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer);
if (tile.getMutliBlock()) { if (tile.getMutliBlock()) {
addHologramButton(6, 4, 212, layer); addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
} else { } else {
builder.drawMultiblockMissingBar(this, layer); builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer); addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
} }
builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
} }
@Override public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) { if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{ {

View file

@ -30,6 +30,7 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import techreborn.items.ItemManual; import techreborn.items.ItemManual;
import java.awt.*; import java.awt.*;
@ -57,8 +58,8 @@ public class GuiManual extends GuiScreen {
@Override @Override
public void initGui() { public void initGui() {
buttons.add(new GuiButton(1, (width / 2 - 30), (height / 2 - (guiHeight / 4)) + 17, 60, 20, I18n.format("techreborn.manual.wikibtn"))); buttons.add(new GuiButtonExtended(1, (width / 2 - 30), (height / 2 - (guiHeight / 4)) + 17, 60, 20, I18n.format("techreborn.manual.wikibtn")).clickHandler(this::onClick));
buttons.add(new GuiButton(2, (width / 2 - 30), (height / 2) + 22, 60, 20, I18n.format("techreborn.manual.discordbtn"))); buttons.add(new GuiButtonExtended(2, (width / 2 - 30), (height / 2) + 22, 60, 20, I18n.format("techreborn.manual.discordbtn")).clickHandler(this::onClick));
} }
@Override @Override
@ -73,8 +74,7 @@ public class GuiManual extends GuiScreen {
super.render(mouseX, mouseY, partialTicks); super.render(mouseX, mouseY, partialTicks);
} }
@Override public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
protected void actionPerformed(GuiButton button) {
switch (button.id) { switch (button.id) {
case 1: case 1:
mc.displayGuiScreen(new GuiConfirmOpenLink(this, "http://wiki.techreborn.ovh", 1, false)); mc.displayGuiScreen(new GuiConfirmOpenLink(this, "http://wiki.techreborn.ovh", 1, false));
@ -86,7 +86,7 @@ public class GuiManual extends GuiScreen {
} }
@Override @Override
public void confirmClicked(boolean result, int id) { public void confirmResult(boolean result, int id) {
switch(id) { switch(id) {
case 1: case 1:
if(result == true) { if(result == true) {

View file

@ -75,11 +75,12 @@ public class GuiRollingMachine extends GuiBase {
} }
@Override @Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
if(isPointInRect(130, 4, 20, 12, mouseX, mouseY)){ if(isPointInRect(130, 4, 20, 12, mouseX, mouseY)){
NetworkManager.sendToServer(ServerboundPackets.createPacketRollingMachineLock(rollingMachine, !rollingMachine.locked)); NetworkManager.sendToServer(ServerboundPackets.createPacketRollingMachineLock(rollingMachine, !rollingMachine.locked));
return; return true;
} }
super.mouseClicked(mouseX, mouseY, mouseButton); return super.mouseClicked(mouseX, mouseY, mouseButton);
} }
} }

View file

@ -30,6 +30,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import reborncore.ClientProxy; import reborncore.ClientProxy;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockRenderEvent;
@ -81,18 +82,16 @@ public class GuiVacuumFreezer extends GuiBase {
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
if (tile.getMultiBlock()) { if (tile.getMultiBlock()) {
addHologramButton(6, 4, 212, layer); addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
} else { } else {
builder.drawMultiblockMissingBar(this, layer); builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer); addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
} }
builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
} }
@Override public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) { if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{ {

View file

@ -49,14 +49,13 @@ import techreborn.items.DynamicCell;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.awt.*; import java.awt.*;
import java.util.Collection; import java.util.*;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.function.Function; import java.util.function.Function;
//TODO 1.13 very broken, look at ModelDynBucket for help porting this fully
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class ModelDynamicCell implements IModel { public class ModelDynamicCell implements IUnbakedModel {
public static final ModelDynamicCell MODEL = new ModelDynamicCell( public static final ModelDynamicCell MODEL = new ModelDynamicCell(
new ResourceLocation("techreborn:items/cell_cover"), new ResourceLocation("techreborn:items/cell_cover"),
@ -69,8 +68,8 @@ public class ModelDynamicCell implements IModel {
private static final float SOUTH_Z_FLUID = 8.4f / 16f; private static final float SOUTH_Z_FLUID = 8.4f / 16f;
public static void init() { public static void init() {
ModelLoader.setCustomMeshDefinition(TRContent.CELL, stack -> MODEL_LOCATION); // ModelLoader.setCustomMeshDefinition(TRContent.CELL, stack -> MODEL_LOCATION);
ModelBakery.registerItemVariants(TRContent.CELL, MODEL_LOCATION); // ModelBakery.registerItemVariants(TRContent.CELL, MODEL_LOCATION);
ModelLoaderRegistry.registerLoader(new DynamicCellLoader()); ModelLoaderRegistry.registerLoader(new DynamicCellLoader());
} }
@ -94,22 +93,22 @@ public class ModelDynamicCell implements IModel {
} }
@Override @Override
public Collection<ResourceLocation> getTextures() { public Collection<ResourceLocation> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<String> missingTextureErrors) {
return ImmutableList.of(baseTexture, emptyTexture); return ImmutableList.of(baseTexture, emptyTexture);
} }
@Override @Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) { public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> spriteGetter, IModelState state, boolean uvlock, VertexFormat format) {
ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transformMap = PerspectiveMapWrapper.getTransforms(state); ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transformMap = PerspectiveMapWrapper.getTransforms(state);
TRSRTransformation transform = state.apply(Optional.empty()).orElse(TRSRTransformation.identity()); TRSRTransformation transform = state.apply(Optional.empty()).orElse(TRSRTransformation.identity());
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder(); ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
builder.addAll(new ItemLayerModel(ImmutableList.of(baseTexture)).bake(transform, format, bakedTextureGetter).getQuads(null, null, 0L)); builder.addAll(new ItemLayerModel(ImmutableList.of(baseTexture)).bake(modelGetter, spriteGetter, state, uvlock, format).getQuads(null, null, new Random()));
ResourceLocation sprite = fluid != null ? fluid.getStill() : emptyTexture; ResourceLocation sprite = fluid != null ? fluid.getStill() : emptyTexture;
int color = fluid != null ? fluid.getColor() : Color.WHITE.getRGB(); int color = fluid != null ? fluid.getColor() : Color.WHITE.getRGB();
TextureAtlasSprite fluidSprite = bakedTextureGetter.apply(sprite); TextureAtlasSprite fluidSprite = spriteGetter.apply(sprite);
if (fluid != null) { if (fluid != null) {
if (fluidSprite != null) { if (fluidSprite != null) {
builder.add(ItemTextureQuadConverter.genQuad(format, transform, 5, 2, 11, 14, NORTH_Z_FLUID, fluidSprite, EnumFacing.NORTH, color, -1)); builder.add(ItemTextureQuadConverter.genQuad(format, transform, 5, 2, 11, 14, NORTH_Z_FLUID, fluidSprite, EnumFacing.NORTH, color, -1));
@ -117,9 +116,10 @@ public class ModelDynamicCell implements IModel {
} }
} }
return new BakedDynamicCell(builder.build(), this, bakedTextureGetter.apply(baseTexture), format, transformMap); return new BakedDynamicCell(builder.build(), this, spriteGetter.apply(baseTexture), format, transformMap);
} }
@Override @Override
public IModelState getDefaultState() { public IModelState getDefaultState() {
return TRSRTransformation.identity(); return TRSRTransformation.identity();
@ -133,7 +133,7 @@ public class ModelDynamicCell implements IModel {
} }
@Override @Override
public IModel loadModel(ResourceLocation modelLocation) { public IUnbakedModel loadModel(ResourceLocation modelLocation) {
return MODEL; return MODEL;
} }
@ -142,7 +142,7 @@ public class ModelDynamicCell implements IModel {
} }
public static class BakedDynamicCell implements IBakedModel { public static class BakedDynamicCell extends BakedItemModel {
private final List<BakedQuad> quads; private final List<BakedQuad> quads;
private final ModelDynamicCell parent; private final ModelDynamicCell parent;
@ -150,11 +150,12 @@ public class ModelDynamicCell implements IModel {
private final VertexFormat format; private final VertexFormat format;
private final ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transformMap; private final ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transformMap;
public BakedDynamicCell(List<BakedQuad> quads, public BakedDynamicCell(ImmutableList<BakedQuad> quads,
ModelDynamicCell parent, ModelDynamicCell parent,
TextureAtlasSprite particle, TextureAtlasSprite particle,
VertexFormat format, VertexFormat format,
ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transformMap) { ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transformMap) {
super(quads, particle, transformMap, null /* TODO fix this */);
this.transformMap = transformMap; this.transformMap = transformMap;
this.quads = quads; this.quads = quads;
this.parent = parent; this.parent = parent;
@ -162,15 +163,6 @@ public class ModelDynamicCell implements IModel {
this.format = format; this.format = format;
} }
@Override
public List<BakedQuad> getQuads(
@Nullable
IBlockState state,
@Nullable
EnumFacing side, long rand) {
return quads;
}
@Override @Override
public boolean isAmbientOcclusion() { public boolean isAmbientOcclusion() {
return true; return true;
@ -209,28 +201,28 @@ public class ModelDynamicCell implements IModel {
private final HashMap<String, IBakedModel> modelCache = new HashMap<>(); private final HashMap<String, IBakedModel> modelCache = new HashMap<>();
private final Function<ResourceLocation, TextureAtlasSprite> textureGetter = location -> // private final Function<ResourceLocation, TextureAtlasSprite> textureGetter = location ->
Minecraft.getInstance().getTextureMapBlocks().getAtlasSprite(location.toString()); // Minecraft.getInstance().getTextureMapBlocks().getAtlasSprite(location.toString());
private OverrideHandler() { // private OverrideHandler() {
super(ImmutableList.of()); // super(ImmutableList.of());
} // }
@Override // @Override
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) { // public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) {
FluidStack fluidStack = DynamicCell.getFluidHandler(stack).getFluid(); // FluidStack fluidStack = DynamicCell.getFluidHandler(stack).getFluid();
if (fluidStack == null) { // if (fluidStack == null) {
//return default bucket // //return default bucket
return originalModel; // return originalModel;
} // }
String name = fluidStack.getFluid().getName(); // String name = fluidStack.getFluid().getName();
if (!modelCache.containsKey(name)) { // if (!modelCache.containsKey(name)) {
BakedDynamicCell bakedCell = (BakedDynamicCell) originalModel; // BakedDynamicCell bakedCell = (BakedDynamicCell) originalModel;
ModelDynamicCell model = new ModelDynamicCell(bakedCell.parent.baseTexture, bakedCell.parent.emptyTexture, fluidStack.getFluid()); // ModelDynamicCell model = new ModelDynamicCell(bakedCell.parent.baseTexture, bakedCell.parent.emptyTexture, fluidStack.getFluid());
modelCache.put(name, model.bake(new SimpleModelState(bakedCell.transformMap), bakedCell.format, textureGetter)); // modelCache.put(name, model.bake(new SimpleModelState(bakedCell.transformMap), bakedCell.format, textureGetter));
} // }
return modelCache.get(name); // return modelCache.get(name);
} // }
} }

View file

@ -24,297 +24,63 @@
package techreborn.init; package techreborn.init;
import net.minecraft.block.Block; import net.minecraft.util.ResourceLocation;
import net.minecraft.block.material.Material;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import reborncore.RebornRegistry;
import techreborn.TechReborn;
import techreborn.blocks.fluid.BlockFluidTechReborn; import techreborn.blocks.fluid.BlockFluidTechReborn;
import techreborn.blocks.fluid.TechRebornFluid; public enum ModFluids {
BERYLLIUM,
public class ModFluids { CALCIUM,
CALCIUM_CARBONATE,
public static Fluid BERYLLIUM = new TechRebornFluid("berylium"); CHLORITE,
public static BlockFluidTechReborn BLOCK_BERYLLIUM; DEUTERIUM,
GLYCERYL,
public static Fluid CALCIUM = new TechRebornFluid("calcium"); HELIUM,
public static BlockFluidTechReborn BLOCK_CALCIUM; HELIUM_3,
HELIUMPLASMA,
public static Fluid CALCIUM_CARBONATE = new TechRebornFluid("calciumcarbonate"); HYDROGEN,
public static BlockFluidTechReborn BLOCK_CALCIUM_CARBONATE; LITHIUM,
MERCURY,
public static Fluid CHLORITE = new TechRebornFluid("chlorite"); METHANE,
public static BlockFluidTechReborn BLOCK_CHLORITE; NITROCOAL_FUEL,
NITROFUEL,
public static Fluid DEUTERIUM = new TechRebornFluid("deuterium"); NITROGEN,
public static BlockFluidTechReborn BLOCK_DEUTERIUM; NITROGENDIOXIDE,
POTASSIUM,
public static Fluid GLYCERYL = new TechRebornFluid("glyceryl"); SILICON,
public static BlockFluidTechReborn BLOCK_GLYCERYL; SODIUM,
SODIUMPERSULFATE,
public static Fluid HELIUM = new TechRebornFluid("helium"); TRITIUM,
public static BlockFluidTechReborn BLOCK_HELIUM; WOLFRAMIUM,
CARBON,
public static Fluid HELIUM_3 = new TechRebornFluid("helium3"); CARBON_FIBER,
public static BlockFluidTechReborn BLOCK_HELIUM_3; NITRO_CARBON,
SULFUR,
public static Fluid HELIUMPLASMA = new TechRebornFluid("heliumplasma"); SODIUM_SULFIDE,
public static BlockFluidTechReborn BLOCK_HELIUMPLASMA; DIESEL,
NITRO_DIESEL,
public static Fluid HYDROGEN = new TechRebornFluid("hydrogen"); OIL,
public static BlockFluidTechReborn BLOCK_HYDROGEN; SULFURIC_ACID,
COMPRESSED_AIR,
public static Fluid LITHIUM = new TechRebornFluid("lithium"); ELECTROLYZED_WATER;
public static BlockFluidTechReborn BLOCK_LITHIUM;
public Fluid fluid;
public static Fluid MERCURY = new TechRebornFluid("mercury"); public BlockFluidTechReborn block;
public static BlockFluidTechReborn BLOCK_MERCURY; public String name;
public static Fluid METHANE = new TechRebornFluid("methane"); ModFluids() {
public static BlockFluidTechReborn BLOCK_METHANE; this.name = this.toString().replace("_", "").toLowerCase(); //Is this ok?
fluid = new Fluid(name, new ResourceLocation("techreborn", "fixme"), new ResourceLocation("techrebonr", "alsofixme"));
public static Fluid NITROCOAL_FUEL = new TechRebornFluid("nitrocoalfuel");
public static BlockFluidTechReborn BLOCK_NITROCOAL_FUEL;
public static Fluid NITROFUEL = new TechRebornFluid("nitrofuel");
public static BlockFluidTechReborn BLOCK_NITROFUEL;
public static Fluid NITROGEN = new TechRebornFluid("nitrogen");
public static BlockFluidTechReborn BLOCK_NITROGEN;
public static Fluid NITROGENDIOXIDE = new TechRebornFluid("nitrogendioxide");
public static BlockFluidTechReborn BLOCK_NITROGENDIOXIDE;
public static Fluid POTASSIUM = new TechRebornFluid("potassium");
public static BlockFluidTechReborn BLOCK_POTASSIUM;
public static Fluid SILICON = new TechRebornFluid("silicon");
public static BlockFluidTechReborn BLOCK_SILICON;
public static Fluid SODIUM = new TechRebornFluid("sodium");
public static BlockFluidTechReborn BLOCK_SODIUM;
public static Fluid SODIUMPERSULFATE = new TechRebornFluid("sodiumpersulfate");
public static BlockFluidTechReborn BLOCK_SODIUMPERSULFATE;
public static Fluid TRITIUM = new TechRebornFluid("tritium");
public static BlockFluidTechReborn BLOCK_TRITIUM;
public static Fluid WOLFRAMIUM = new TechRebornFluid("wolframium");
public static BlockFluidTechReborn BLOCK_WOLFRAMIUM;
public static Fluid CARBON = new TechRebornFluid("carbon");
public static BlockFluidTechReborn BLOCK_CARBON;
public static Fluid CARBON_FIBER = new TechRebornFluid("carbonfiber");
public static BlockFluidTechReborn BLOCK_CARBON_FIBER;
public static Fluid NITRO_CARBON = new TechRebornFluid("nitrocarbon");
public static BlockFluidTechReborn BLOCK_NITRO_CARBON;
public static Fluid SULFUR = new TechRebornFluid("Sulfur");
public static BlockFluidTechReborn BLOCK_SULFUR;
public static Fluid SODIUM_SULFIDE = new TechRebornFluid("sodiumSulfide");
public static BlockFluidTechReborn BLOCK_SODIUM_SULFIDE;
public static Fluid DIESEL = new TechRebornFluid("diesel");
public static BlockFluidTechReborn BLOCK_DIESEL;
public static Fluid NITRO_DIESEL = new TechRebornFluid("nitrodiesel");
public static BlockFluidTechReborn BLOCK_NITRO_DIESEL;
public static Fluid OIL = new TechRebornFluid("oil");
public static BlockFluidTechReborn BLOCK_OIL;
public static Fluid SULFURIC_ACID = new TechRebornFluid("sulfuricacid");
public static BlockFluidTechReborn BLOCK_SULFURIC_ACID;
public static Fluid COMPRESSED_AIR = new TechRebornFluid("compressedair");
public static BlockFluidTechReborn BLOCK_COMPRESSED_AIR;
public static Fluid ELECTROLYZED_WATER = new TechRebornFluid("electrolyzedwater");
public static BlockFluidTechReborn BLOCK_ELECTROLYZED_WATER;
public static void init() {
FluidRegistry.registerFluid(BERYLLIUM);
BLOCK_BERYLLIUM = new BlockFluidTechReborn(BERYLLIUM, Material.WATER, "techreborn.berylium");
registerBlock(BLOCK_BERYLLIUM, TechReborn.MOD_ID + "_" + BLOCK_BERYLLIUM.getTranslationKey().substring(5));
FluidRegistry.registerFluid(CALCIUM);
BLOCK_CALCIUM = new BlockFluidTechReborn(CALCIUM, Material.WATER, "techreborn.calcium");
registerBlock(BLOCK_CALCIUM,
TechReborn.MOD_ID + "_" + BLOCK_CALCIUM.getTranslationKey().substring(5));
FluidRegistry.registerFluid(CALCIUM_CARBONATE);
BLOCK_CALCIUM_CARBONATE = new BlockFluidTechReborn(CALCIUM_CARBONATE, Material.WATER,
"techreborn.calciumcarbonate");
registerBlock(BLOCK_CALCIUM_CARBONATE,
TechReborn.MOD_ID + "_" + BLOCK_CALCIUM_CARBONATE.getTranslationKey().substring(5));
FluidRegistry.registerFluid(CHLORITE);
BLOCK_CHLORITE = new BlockFluidTechReborn(CHLORITE, Material.WATER, "techreborn.chlorite");
registerBlock(BLOCK_CHLORITE,
TechReborn.MOD_ID + "_" + BLOCK_CHLORITE.getTranslationKey().substring(5));
FluidRegistry.registerFluid(DEUTERIUM);
BLOCK_DEUTERIUM = new BlockFluidTechReborn(DEUTERIUM, Material.WATER, "techreborn.deuterium");
registerBlock(BLOCK_DEUTERIUM,
TechReborn.MOD_ID + "_" + BLOCK_DEUTERIUM.getTranslationKey().substring(5));
FluidRegistry.registerFluid(GLYCERYL);
BLOCK_GLYCERYL = new BlockFluidTechReborn(GLYCERYL, Material.WATER, "techreborn.glyceryl");
registerBlock(BLOCK_GLYCERYL,
TechReborn.MOD_ID + "_" + BLOCK_GLYCERYL.getTranslationKey().substring(5));
FluidRegistry.registerFluid(HELIUM);
BLOCK_HELIUM = new BlockFluidTechReborn(HELIUM, Material.WATER, "techreborn.helium");
registerBlock(BLOCK_HELIUM,
TechReborn.MOD_ID + "_" + BLOCK_HELIUM.getTranslationKey().substring(5));
FluidRegistry.registerFluid(HELIUM_3);
BLOCK_HELIUM_3 = new BlockFluidTechReborn(HELIUM_3, Material.WATER, "techreborn.helium3");
registerBlock(BLOCK_HELIUM_3,
TechReborn.MOD_ID + "_" + BLOCK_HELIUM_3.getTranslationKey().substring(5));
FluidRegistry.registerFluid(HELIUMPLASMA);
BLOCK_HELIUMPLASMA = new BlockFluidTechReborn(HELIUMPLASMA, Material.WATER, "techreborn.heliumplasma");
registerBlock(BLOCK_HELIUMPLASMA,
TechReborn.MOD_ID + "_" + BLOCK_HELIUMPLASMA.getTranslationKey().substring(5));
FluidRegistry.registerFluid(HYDROGEN);
BLOCK_HYDROGEN = new BlockFluidTechReborn(HYDROGEN, Material.WATER, "techreborn.hydrogen");
registerBlock(BLOCK_HYDROGEN,
TechReborn.MOD_ID + "_" + BLOCK_HYDROGEN.getTranslationKey().substring(5));
FluidRegistry.registerFluid(LITHIUM);
BLOCK_LITHIUM = new BlockFluidTechReborn(LITHIUM, Material.WATER, "techreborn.lithium");
registerBlock(BLOCK_LITHIUM,
TechReborn.MOD_ID + "_" + BLOCK_LITHIUM.getTranslationKey().substring(5));
FluidRegistry.registerFluid(MERCURY);
BLOCK_MERCURY = new BlockFluidTechReborn(MERCURY, Material.WATER, "techreborn.mercury");
registerBlock(BLOCK_MERCURY,
TechReborn.MOD_ID + "_" + BLOCK_MERCURY.getTranslationKey().substring(5));
FluidRegistry.registerFluid(METHANE);
BLOCK_METHANE = new BlockFluidTechReborn(METHANE, Material.WATER, "techreborn.methane");
registerBlock(BLOCK_METHANE,
TechReborn.MOD_ID + "_" + BLOCK_METHANE.getTranslationKey().substring(5));
FluidRegistry.registerFluid(NITROCOAL_FUEL);
BLOCK_NITROCOAL_FUEL = new BlockFluidTechReborn(NITROCOAL_FUEL, Material.WATER,
"techreborn.nitrocoalfuel");
registerBlock(BLOCK_NITROCOAL_FUEL,
TechReborn.MOD_ID + "_" + BLOCK_NITROCOAL_FUEL.getTranslationKey().substring(5));
FluidRegistry.registerFluid(NITROFUEL);
BLOCK_NITROFUEL = new BlockFluidTechReborn(NITROFUEL, Material.WATER, "techreborn.nitrofuel");
registerBlock(BLOCK_NITROFUEL,
TechReborn.MOD_ID + "_" + BLOCK_NITROFUEL.getTranslationKey().substring(5));
FluidRegistry.registerFluid(NITROGEN);
BLOCK_NITROGEN = new BlockFluidTechReborn(NITROGEN, Material.WATER, "techreborn.nitrogen");
registerBlock(BLOCK_NITROGEN,
TechReborn.MOD_ID + "_" + BLOCK_NITROGEN.getTranslationKey().substring(5));
FluidRegistry.registerFluid(NITROGENDIOXIDE);
BLOCK_NITROGENDIOXIDE = new BlockFluidTechReborn(NITROGENDIOXIDE, Material.WATER,
"techreborn.nitrogendioxide");
registerBlock(BLOCK_NITROGENDIOXIDE,
TechReborn.MOD_ID + "_" + BLOCK_NITROGENDIOXIDE.getTranslationKey().substring(5));
FluidRegistry.registerFluid(POTASSIUM);
BLOCK_POTASSIUM = new BlockFluidTechReborn(POTASSIUM, Material.WATER, "techreborn.potassium");
registerBlock(BLOCK_POTASSIUM,
TechReborn.MOD_ID + "_" + BLOCK_POTASSIUM.getTranslationKey().substring(5));
FluidRegistry.registerFluid(SILICON);
BLOCK_SILICON = new BlockFluidTechReborn(SILICON, Material.WATER, "techreborn.silicon");
registerBlock(BLOCK_SILICON,
TechReborn.MOD_ID + "_" + BLOCK_SILICON.getTranslationKey().substring(5));
FluidRegistry.registerFluid(SODIUM);
BLOCK_SODIUM = new BlockFluidTechReborn(SODIUM, Material.WATER, "techreborn.sodium");
registerBlock(BLOCK_SODIUM,
TechReborn.MOD_ID + "_" + BLOCK_SODIUM.getTranslationKey().substring(5));
FluidRegistry.registerFluid(SODIUMPERSULFATE);
BLOCK_SODIUMPERSULFATE = new BlockFluidTechReborn(SODIUMPERSULFATE, Material.WATER,
"techreborn.sodiumpersulfate");
registerBlock(BLOCK_SODIUMPERSULFATE,
TechReborn.MOD_ID + "_" + BLOCK_SODIUMPERSULFATE.getTranslationKey().substring(5));
FluidRegistry.registerFluid(TRITIUM);
BLOCK_TRITIUM = new BlockFluidTechReborn(TRITIUM, Material.WATER, "techreborn.tritium");
registerBlock(BLOCK_TRITIUM,
TechReborn.MOD_ID + "_" + BLOCK_TRITIUM.getTranslationKey().substring(5));
FluidRegistry.registerFluid(WOLFRAMIUM);
BLOCK_WOLFRAMIUM = new BlockFluidTechReborn(WOLFRAMIUM, Material.WATER, "techreborn.wolframium");
registerBlock(BLOCK_WOLFRAMIUM,
TechReborn.MOD_ID + "_" + BLOCK_WOLFRAMIUM.getTranslationKey().substring(5));
FluidRegistry.registerFluid(CARBON);
BLOCK_CARBON = new BlockFluidTechReborn(CARBON, Material.WATER, "techreborn.carbon");
registerBlock(BLOCK_CARBON,
TechReborn.MOD_ID + "_" + BLOCK_CARBON.getTranslationKey().substring(5));
FluidRegistry.registerFluid(CARBON_FIBER);
BLOCK_CARBON_FIBER = new BlockFluidTechReborn(CARBON_FIBER, Material.WATER, "techreborn.carbonfiber");
registerBlock(BLOCK_CARBON_FIBER,
TechReborn.MOD_ID + "_" + BLOCK_CARBON_FIBER.getTranslationKey().substring(5));
FluidRegistry.registerFluid(NITRO_CARBON);
BLOCK_NITRO_CARBON = new BlockFluidTechReborn(NITRO_CARBON, Material.WATER, "techreborn.nitrocarbon");
registerBlock(BLOCK_NITRO_CARBON,
TechReborn.MOD_ID + "_" + BLOCK_NITRO_CARBON.getTranslationKey().substring(5));
FluidRegistry.registerFluid(SULFUR);
BLOCK_SULFUR = new BlockFluidTechReborn(SULFUR, Material.WATER, "techreborn.sulfur");
registerBlock(BLOCK_SULFUR,
TechReborn.MOD_ID + "_" + BLOCK_SULFUR.getTranslationKey().substring(5));
FluidRegistry.registerFluid(SODIUM_SULFIDE);
BLOCK_SODIUM_SULFIDE = new BlockFluidTechReborn(SODIUM_SULFIDE, Material.WATER, "techreborn.sodiumsulfide");
registerBlock(BLOCK_SODIUM_SULFIDE,
TechReborn.MOD_ID + "_" + BLOCK_SODIUM_SULFIDE.getTranslationKey().substring(5));
FluidRegistry.registerFluid(DIESEL);
BLOCK_DIESEL = new BlockFluidTechReborn(DIESEL, Material.WATER, "techreborn.diesel");
registerBlock(BLOCK_DIESEL,
TechReborn.MOD_ID + "_" + BLOCK_DIESEL.getTranslationKey().substring(5));
FluidRegistry.registerFluid(NITRO_DIESEL);
BLOCK_NITRO_DIESEL = new BlockFluidTechReborn(NITRO_DIESEL, Material.WATER, "techreborn.nitrodiesel");
registerBlock(BLOCK_NITRO_DIESEL,
TechReborn.MOD_ID + "_" + BLOCK_NITRO_DIESEL.getTranslationKey().substring(5));
FluidRegistry.registerFluid(OIL);
BLOCK_OIL = new BlockFluidTechReborn(OIL, Material.WATER, "techreborn.oil");
registerBlock(BLOCK_OIL,
TechReborn.MOD_ID + "_" + BLOCK_OIL.getTranslationKey().substring(5));
FluidRegistry.registerFluid(SULFURIC_ACID);
BLOCK_SULFURIC_ACID = new BlockFluidTechReborn(SULFURIC_ACID, Material.WATER, "techreborn.sulfuricacid");
registerBlock(BLOCK_SULFURIC_ACID,
TechReborn.MOD_ID + "_" + BLOCK_SULFURIC_ACID.getTranslationKey().substring(5));
FluidRegistry.registerFluid(COMPRESSED_AIR);
BLOCK_COMPRESSED_AIR = new BlockFluidTechReborn(COMPRESSED_AIR, Material.WATER, "techreborn.compressedair");
registerBlock(BLOCK_COMPRESSED_AIR,
TechReborn.MOD_ID + "_" + BLOCK_COMPRESSED_AIR.getTranslationKey().substring(5));
FluidRegistry.registerFluid(ELECTROLYZED_WATER);
BLOCK_ELECTROLYZED_WATER = new BlockFluidTechReborn(ELECTROLYZED_WATER, Material.WATER, "techreborn.electrolyzedwater");
registerBlock(BLOCK_ELECTROLYZED_WATER,
TechReborn.MOD_ID + "_" + BLOCK_ELECTROLYZED_WATER.getTranslationKey().substring(5));
} }
public static void registerBlock(Block block, String name) { public Fluid getFluid() {
RebornRegistry.registerBlock(block, name); return fluid;
}
public BlockFluidTechReborn getBlock() {
return block;
}
public String getName() {
return name;
} }
} }

View file

@ -24,6 +24,7 @@
package techreborn.init.recipes; package techreborn.init.recipes;
import net.minecraft.init.Fluids;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
import techreborn.api.generator.EFluidGenerator; import techreborn.api.generator.EFluidGenerator;
@ -35,21 +36,22 @@ import techreborn.init.ModFluids;
*/ */
public class FluidGeneratorRecipes extends RecipeMethods { public class FluidGeneratorRecipes extends RecipeMethods {
public static void init() { public static void init() {
register(EFluidGenerator.DIESEL, ModFluids.NITROFUEL, 24); register(EFluidGenerator.DIESEL, ModFluids.NITROFUEL.getFluid(), 24);
register(EFluidGenerator.DIESEL, ModFluids.NITROCOAL_FUEL, 48); register(EFluidGenerator.DIESEL, ModFluids.NITROCOAL_FUEL.getFluid(), 48);
register(EFluidGenerator.DIESEL, ModFluids.DIESEL, 128); register(EFluidGenerator.DIESEL, ModFluids.DIESEL.getFluid(), 128);
register(EFluidGenerator.DIESEL, ModFluids.NITRO_DIESEL, 400); register(EFluidGenerator.DIESEL, ModFluids.NITRO_DIESEL.getFluid(), 400);
register(EFluidGenerator.SEMIFLUID, ModFluids.SODIUM, 30); register(EFluidGenerator.SEMIFLUID, ModFluids.SODIUM.getFluid(), 30);
register(EFluidGenerator.SEMIFLUID, ModFluids.LITHIUM, 60); register(EFluidGenerator.SEMIFLUID, ModFluids.LITHIUM.getFluid(), 60);
register(EFluidGenerator.SEMIFLUID, ModFluids.OIL, 16); register(EFluidGenerator.SEMIFLUID, ModFluids.OIL.getFluid(), 16);
register(EFluidGenerator.THERMAL, FluidRegistry.LAVA, 60); //TODO 1.13 forge and mc fluids are 2 diffrent things, fix later
//register(EFluidGenerator.THERMAL, Fluids.LAVA, 60);
register(EFluidGenerator.GAS, ModFluids.HYDROGEN, 15); register(EFluidGenerator.GAS, ModFluids.HYDROGEN.getFluid(), 15);
register(EFluidGenerator.GAS, ModFluids.METHANE, 45); register(EFluidGenerator.GAS, ModFluids.METHANE.getFluid(), 45);
register(EFluidGenerator.PLASMA, ModFluids.HELIUMPLASMA, 8192); register(EFluidGenerator.PLASMA, ModFluids.HELIUMPLASMA.getFluid(), 8192);
} }
static void register(EFluidGenerator generator, Fluid fluid, int euPerMB) { static void register(EFluidGenerator generator, Fluid fluid, int euPerMB) {