Convert BlastFurnace
This commit is contained in:
parent
665b5f7569
commit
ea98e4a8a0
4 changed files with 147 additions and 200 deletions
|
@ -106,7 +106,12 @@ public class GuiHandler implements IGuiHandler {
|
||||||
((TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z)))::setBurnTime)
|
((TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z)))::setBurnTime)
|
||||||
.addInventory().create();
|
.addInventory().create();
|
||||||
} else if (ID == GuiHandler.blastFurnaceID) {
|
} else if (ID == GuiHandler.blastFurnaceID) {
|
||||||
return new ContainerBlastFurnace((TileBlastFurnace) world.getTileEntity(new BlockPos(x, y, z)), player);
|
return new ContainerBuilder("blastfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||||
|
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 40, 25)
|
||||||
|
.slot(1, 40, 43).outputSlot(2, 100, 35).outputSlot(3, 118, 35).syncEnergyValue().syncCrafterValue()
|
||||||
|
.syncIntegerValue(((TileBlastFurnace) world.getTileEntity(new BlockPos(x, y, z)))::getHeat,
|
||||||
|
((TileBlastFurnace) world.getTileEntity(new BlockPos(x, y, z)))::setHeat)
|
||||||
|
.addInventory().create();
|
||||||
} else if (ID == GuiHandler.alloySmelterID) {
|
} else if (ID == GuiHandler.alloySmelterID) {
|
||||||
return new ContainerBuilder("alloysmelter").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
return new ContainerBuilder("alloysmelter").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||||
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z)))
|
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z)))
|
||||||
|
|
|
@ -1,74 +0,0 @@
|
||||||
package techreborn.client.container;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.inventory.IContainerListener;
|
|
||||||
import reborncore.client.gui.slots.BaseSlot;
|
|
||||||
import reborncore.client.gui.slots.SlotOutput;
|
|
||||||
import techreborn.tiles.multiblock.TileBlastFurnace;
|
|
||||||
|
|
||||||
public class ContainerBlastFurnace extends ContainerCrafting {
|
|
||||||
|
|
||||||
public int heat;
|
|
||||||
public int tickTime;
|
|
||||||
EntityPlayer player;
|
|
||||||
TileBlastFurnace tile;
|
|
||||||
|
|
||||||
public ContainerBlastFurnace(TileBlastFurnace tileblastfurnace, EntityPlayer player) {
|
|
||||||
super(tileblastfurnace.crafter);
|
|
||||||
tile = tileblastfurnace;
|
|
||||||
this.player = player;
|
|
||||||
|
|
||||||
// input
|
|
||||||
this.addSlotToContainer(new BaseSlot(tileblastfurnace.inventory, 0, 40, 25));// Input
|
|
||||||
// 1
|
|
||||||
this.addSlotToContainer(new BaseSlot(tileblastfurnace.inventory, 1, 40, 43));// Input
|
|
||||||
// 2
|
|
||||||
// outputs
|
|
||||||
this.addSlotToContainer(new SlotOutput(tileblastfurnace.inventory, 2, 100, 35));// Output
|
|
||||||
// 1
|
|
||||||
this.addSlotToContainer(new SlotOutput(tileblastfurnace.inventory, 3, 118, 35));// Output
|
|
||||||
// 2
|
|
||||||
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < 3; ++i) {
|
|
||||||
for (int j = 0; j < 9; ++j) {
|
|
||||||
this.addSlotToContainer(new BaseSlot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < 9; ++i) {
|
|
||||||
this.addSlotToContainer(new BaseSlot(player.inventory, i, 8 + i * 18, 142));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInteractWith(EntityPlayer player) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void detectAndSendChanges() {
|
|
||||||
super.detectAndSendChanges();
|
|
||||||
for (int i = 0; i < this.listeners.size(); i++) {
|
|
||||||
IContainerListener IContainerListener = this.listeners.get(i);
|
|
||||||
if (this.heat != tile.getHeat()) {
|
|
||||||
IContainerListener.sendProgressBarUpdate(this, 10, tile.getHeat());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addListener(IContainerListener crafting) {
|
|
||||||
super.addListener(crafting);
|
|
||||||
crafting.sendProgressBarUpdate(this, 10, tile.getHeat());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateProgressBar(int id, int value) {
|
|
||||||
if (id == 10) {
|
|
||||||
this.heat = value;
|
|
||||||
}
|
|
||||||
super.updateProgressBar(id, value);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -9,13 +9,15 @@ import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.text.translation.I18n;
|
import net.minecraft.util.text.translation.I18n;
|
||||||
|
|
||||||
import reborncore.client.gui.GuiUtil;
|
import reborncore.client.gui.GuiUtil;
|
||||||
import reborncore.client.multiblock.Multiblock;
|
import reborncore.client.multiblock.Multiblock;
|
||||||
import reborncore.client.multiblock.MultiblockRenderEvent;
|
import reborncore.client.multiblock.MultiblockRenderEvent;
|
||||||
import reborncore.client.multiblock.MultiblockSet;
|
import reborncore.client.multiblock.MultiblockSet;
|
||||||
import reborncore.common.misc.Location;
|
import reborncore.common.misc.Location;
|
||||||
import reborncore.common.multiblock.CoordTriplet;
|
import reborncore.common.multiblock.CoordTriplet;
|
||||||
import techreborn.client.container.ContainerBlastFurnace;
|
|
||||||
|
import techreborn.client.container.builder.ContainerBuilder;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.proxies.ClientProxy;
|
import techreborn.proxies.ClientProxy;
|
||||||
import techreborn.tiles.multiblock.TileBlastFurnace;
|
import techreborn.tiles.multiblock.TileBlastFurnace;
|
||||||
|
@ -29,31 +31,32 @@ public class GuiBlastFurnace extends GuiContainer {
|
||||||
|
|
||||||
TileBlastFurnace blastfurnace;
|
TileBlastFurnace blastfurnace;
|
||||||
|
|
||||||
ContainerBlastFurnace containerBlastFurnace;
|
|
||||||
boolean hasMultiBlock;
|
boolean hasMultiBlock;
|
||||||
|
|
||||||
public GuiBlastFurnace(EntityPlayer player, TileBlastFurnace tileblastfurnace) {
|
public GuiBlastFurnace(final EntityPlayer player, final TileBlastFurnace tileblastfurnace) {
|
||||||
super(new ContainerBlastFurnace(tileblastfurnace, player));
|
super(new ContainerBuilder("blastfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||||
|
.addInventory().tile(tileblastfurnace).slot(0, 40, 25).slot(1, 40, 43).outputSlot(2, 100, 35)
|
||||||
|
.outputSlot(3, 118, 35).syncEnergyValue().syncCrafterValue()
|
||||||
|
.syncIntegerValue(tileblastfurnace::getHeat, tileblastfurnace::setHeat).addInventory().create());
|
||||||
this.xSize = 176;
|
this.xSize = 176;
|
||||||
this.ySize = 167;
|
this.ySize = 167;
|
||||||
blastfurnace = tileblastfurnace;
|
this.blastfurnace = tileblastfurnace;
|
||||||
this.containerBlastFurnace = (ContainerBlastFurnace) this.inventorySlots;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
|
|
||||||
hasMultiBlock = containerBlastFurnace.heat != 0;
|
this.hasMultiBlock = this.blastfurnace.getCachedHeat() != 0;
|
||||||
int k = (this.width - this.xSize) / 2;
|
final int k = (this.width - this.xSize) / 2;
|
||||||
int l = (this.height - this.ySize) / 2;
|
final int l = (this.height - this.ySize) / 2;
|
||||||
GuiButton button = new GuiButton(212, k + 4, l + 6, 20, 20, "");
|
final GuiButton button = new GuiButton(212, k + 4, l + 6, 20, 20, "");
|
||||||
buttonList.add(button);
|
this.buttonList.add(button);
|
||||||
super.initGui();
|
super.initGui();
|
||||||
CoordTriplet coordinates = new CoordTriplet(
|
final CoordTriplet coordinates = new CoordTriplet(
|
||||||
blastfurnace.getPos().getX() - (EnumFacing.getFront(blastfurnace.getFacingInt()).getFrontOffsetX() * 2),
|
this.blastfurnace.getPos().getX() - EnumFacing.getFront(this.blastfurnace.getFacingInt()).getFrontOffsetX() * 2,
|
||||||
blastfurnace.getPos().getY() - 1, blastfurnace.getPos().getZ()
|
this.blastfurnace.getPos().getY() - 1, this.blastfurnace.getPos().getZ()
|
||||||
- (EnumFacing.getFront(blastfurnace.getFacingInt()).getFrontOffsetZ() * 2));
|
- EnumFacing.getFront(this.blastfurnace.getFacingInt()).getFrontOffsetZ() * 2);
|
||||||
if (coordinates.equals(ClientProxy.multiblockRenderEvent.anchor) && blastfurnace.getHeat() != 0) {
|
if (coordinates.equals(MultiblockRenderEvent.anchor) && this.blastfurnace.getHeat() != 0) {
|
||||||
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
||||||
button.displayString = "B";
|
button.displayString = "B";
|
||||||
} else {
|
} else {
|
||||||
|
@ -62,100 +65,101 @@ public class GuiBlastFurnace extends GuiContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
this.mc.getTextureManager().bindTexture(texture);
|
this.mc.getTextureManager().bindTexture(GuiBlastFurnace.texture);
|
||||||
int k = (this.width - this.xSize) / 2;
|
final int k = (this.width - this.xSize) / 2;
|
||||||
int l = (this.height - this.ySize) / 2;
|
final int l = (this.height - this.ySize) / 2;
|
||||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||||
|
|
||||||
if (containerBlastFurnace.heat == 0) {
|
if (this.blastfurnace.getCachedHeat() == 0) {
|
||||||
GuiUtil.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
|
GuiUtil.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
|
||||||
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38,
|
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38,
|
||||||
l + 52 + 12 - 0, -1);
|
l + 52 + 12 - 0, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
this.mc.getTextureManager().bindTexture(texture);
|
this.mc.getTextureManager().bindTexture(GuiBlastFurnace.texture);
|
||||||
j = blastfurnace.getProgressScaled(24);
|
j = this.blastfurnace.getProgressScaled(24);
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
this.drawTexturedModalRect(k + 64, l + 37, 176, 14, j + 1, 16);
|
this.drawTexturedModalRect(k + 64, l + 37, 176, 14, j + 1, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = blastfurnace.getEnergyScaled(12);
|
j = this.blastfurnace.getEnergyScaled(12);
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
this.drawTexturedModalRect(k + 9, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 9, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
@Override
|
||||||
|
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
|
||||||
super.drawGuiContainerForegroundLayer(p_146979_1_, p_146979_2_);
|
super.drawGuiContainerForegroundLayer(p_146979_1_, p_146979_2_);
|
||||||
String name = I18n.translateToLocal("tile.techreborn.blastfurnace.name");
|
final String name = I18n.translateToLocal("tile.techreborn.blastfurnace.name");
|
||||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
|
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
|
||||||
4210752);
|
4210752);
|
||||||
if (containerBlastFurnace.heat != 0) {
|
if (this.blastfurnace.getCachedHeat() != 0) {
|
||||||
this.fontRendererObj.drawString("Current Heat: " + containerBlastFurnace.heat, 40, 60, 4210752);
|
this.fontRendererObj.drawString("Current Heat: " + this.blastfurnace.getCachedHeat(), 40, 60, 4210752);
|
||||||
}
|
}
|
||||||
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
||||||
this.ySize - 96 + 2, 4210752);
|
this.ySize - 96 + 2, 4210752);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(GuiButton button) throws IOException {
|
public void actionPerformed(final GuiButton button) throws IOException {
|
||||||
super.actionPerformed(button);
|
super.actionPerformed(button);
|
||||||
if (button.id == 212) {
|
if (button.id == 212) {
|
||||||
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
|
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
|
||||||
{// This code here makes a basic multiblock and then sets to the
|
{// This code here makes a basic multiblock and then sets to the
|
||||||
// selected one.
|
// selected one.
|
||||||
Multiblock multiblock = new Multiblock();
|
final Multiblock multiblock = new Multiblock();
|
||||||
addComponent(0, 0, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(0, 0, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(1, 0, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(1, 0, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(0, 0, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(0, 0, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(-1, 0, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(-1, 0, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(0, 0, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(0, 0, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(-1, 0, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(-1, 0, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(-1, 0, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(-1, 0, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(1, 0, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(1, 0, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(1, 0, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(1, 0, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
|
|
||||||
addComponent(1, 1, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(1, 1, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(0, 1, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(0, 1, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(-1, 1, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(-1, 1, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(0, 1, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(0, 1, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(-1, 1, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(-1, 1, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(-1, 1, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(-1, 1, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(1, 1, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(1, 1, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(1, 1, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(1, 1, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
|
|
||||||
addComponent(1, 2, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(1, 2, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(0, 2, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(0, 2, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(-1, 2, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(-1, 2, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(0, 2, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(0, 2, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(-1, 2, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(-1, 2, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(-1, 2, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(-1, 2, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(1, 2, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(1, 2, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(1, 2, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(1, 2, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
|
|
||||||
addComponent(0, 3, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(0, 3, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(1, 3, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(1, 3, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(0, 3, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(0, 3, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(-1, 3, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(-1, 3, 0, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(0, 3, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(0, 3, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(-1, 3, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(-1, 3, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(-1, 3, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(-1, 3, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(1, 3, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(1, 3, -1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
addComponent(1, 3, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
this.addComponent(1, 3, 1, ModBlocks.MACHINE_CASINGS.getDefaultState(), multiblock);
|
||||||
|
|
||||||
MultiblockSet set = new MultiblockSet(multiblock);
|
final MultiblockSet set = new MultiblockSet(multiblock);
|
||||||
ClientProxy.multiblockRenderEvent.setMultiblock(set);
|
ClientProxy.multiblockRenderEvent.setMultiblock(set);
|
||||||
ClientProxy.multiblockRenderEvent.parent = new Location(blastfurnace.getPos().getX(),
|
ClientProxy.multiblockRenderEvent.parent = new Location(this.blastfurnace.getPos().getX(),
|
||||||
blastfurnace.getPos().getY(), blastfurnace.getPos().getZ(), blastfurnace.getWorld());
|
this.blastfurnace.getPos().getY(), this.blastfurnace.getPos().getZ(), this.blastfurnace.getWorld());
|
||||||
MultiblockRenderEvent.anchor = new BlockPos(
|
MultiblockRenderEvent.anchor = new BlockPos(
|
||||||
blastfurnace.getPos().getX()
|
this.blastfurnace.getPos().getX()
|
||||||
- (EnumFacing.getFront(blastfurnace.getFacingInt()).getFrontOffsetX() * 2),
|
- EnumFacing.getFront(this.blastfurnace.getFacingInt()).getFrontOffsetX() * 2,
|
||||||
blastfurnace.getPos().getY() - 1, blastfurnace.getPos().getZ()
|
this.blastfurnace.getPos().getY() - 1, this.blastfurnace.getPos().getZ()
|
||||||
- (EnumFacing.getFront(blastfurnace.getFacingInt()).getFrontOffsetZ() * 2));
|
- EnumFacing.getFront(this.blastfurnace.getFacingInt()).getFrontOffsetZ() * 2);
|
||||||
}
|
}
|
||||||
button.displayString = "A";
|
button.displayString = "A";
|
||||||
} else {
|
} else {
|
||||||
|
@ -165,7 +169,7 @@ public class GuiBlastFurnace extends GuiContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addComponent(int x, int y, int z, IBlockState blockState, Multiblock multiblock) {
|
public void addComponent(final int x, final int y, final int z, final IBlockState blockState, final Multiblock multiblock) {
|
||||||
multiblock.addComponent(new BlockPos(x, y, z), blockState);
|
multiblock.addComponent(new BlockPos(x, y, z), blockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
|
@ -18,6 +19,7 @@ import reborncore.common.multiblock.IMultiblockPart;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
|
|
||||||
import techreborn.api.Reference;
|
import techreborn.api.Reference;
|
||||||
import techreborn.api.recipe.ITileRecipeHandler;
|
import techreborn.api.recipe.ITileRecipeHandler;
|
||||||
import techreborn.api.recipe.machines.BlastFurnaceRecipe;
|
import techreborn.api.recipe.machines.BlastFurnaceRecipe;
|
||||||
|
@ -35,36 +37,38 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
|
||||||
public RecipeCrafter crafter;
|
public RecipeCrafter crafter;
|
||||||
public int capacity = 1000;
|
public int capacity = 1000;
|
||||||
|
|
||||||
|
private int cachedHeat;
|
||||||
|
|
||||||
public TileBlastFurnace() {
|
public TileBlastFurnace() {
|
||||||
super(ConfigTechReborn.CentrifugeTier);
|
super(ConfigTechReborn.CentrifugeTier);
|
||||||
// TODO configs
|
// TODO configs
|
||||||
int[] inputs = new int[2];
|
final int[] inputs = new int[2];
|
||||||
inputs[0] = 0;
|
inputs[0] = 0;
|
||||||
inputs[1] = 1;
|
inputs[1] = 1;
|
||||||
int[] outputs = new int[2];
|
final int[] outputs = new int[2];
|
||||||
outputs[0] = 2;
|
outputs[0] = 2;
|
||||||
outputs[1] = 3;
|
outputs[1] = 3;
|
||||||
crafter = new RecipeCrafter(Reference.blastFurnaceRecipe, this, 2, 2, inventory, inputs, outputs);
|
this.crafter = new RecipeCrafter(Reference.blastFurnaceRecipe, this, 2, 2, this.inventory, inputs, outputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
crafter.updateEntity();
|
this.crafter.updateEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing() {
|
public EnumFacing getFacing() {
|
||||||
return getFacingEnum();
|
return this.getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,37 +78,37 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||||
return new ItemStack(ModBlocks.INDUSTRIAL_BLAST_FURNACE, 1);
|
return new ItemStack(ModBlocks.INDUSTRIAL_BLAST_FURNACE, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHeat() {
|
public int getHeat() {
|
||||||
for (EnumFacing direction : EnumFacing.values()) {
|
for (final EnumFacing direction : EnumFacing.values()) {
|
||||||
TileEntity tileEntity = world.getTileEntity(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
|
final TileEntity tileEntity = this.world.getTileEntity(new BlockPos(this.getPos().getX() + direction.getFrontOffsetX(),
|
||||||
getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()));
|
this.getPos().getY() + direction.getFrontOffsetY(), this.getPos().getZ() + direction.getFrontOffsetZ()));
|
||||||
if (tileEntity instanceof TileMachineCasing) {
|
if (tileEntity instanceof TileMachineCasing) {
|
||||||
if (((TileMachineCasing) tileEntity).isConnected()
|
if (((TileMachineCasing) tileEntity).isConnected()
|
||||||
&& ((TileMachineCasing) tileEntity).getMultiblockController().isAssembled()) {
|
&& ((TileMachineCasing) tileEntity).getMultiblockController().isAssembled()) {
|
||||||
MultiBlockCasing casing = ((TileMachineCasing) tileEntity).getMultiblockController();
|
final MultiBlockCasing casing = ((TileMachineCasing) tileEntity).getMultiblockController();
|
||||||
Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
|
final Location location = new Location(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), direction);
|
||||||
location.modifyPositionFromSide(direction, 1);
|
location.modifyPositionFromSide(direction, 1);
|
||||||
int heat = 0;
|
int heat = 0;
|
||||||
if (world.getBlockState(new BlockPos(location.getX(), location.getY() - 1, location.getZ()))
|
if (this.world.getBlockState(new BlockPos(location.getX(), location.getY() - 1, location.getZ()))
|
||||||
.getBlock() == tileEntity.getBlockType()) {
|
.getBlock() == tileEntity.getBlockType()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IMultiblockPart part : casing.connectedParts) {
|
for (final IMultiblockPart part : casing.connectedParts) {
|
||||||
BlockMachineCasing casing1 = (BlockMachineCasing) world.getBlockState(part.getPos())
|
final BlockMachineCasing casing1 = (BlockMachineCasing) this.world.getBlockState(part.getPos())
|
||||||
.getBlock();
|
.getBlock();
|
||||||
heat += casing1
|
heat += casing1
|
||||||
.getHeatFromState(part.getWorld().getBlockState(part.getWorldLocation().toBlockPos()));
|
.getHeatFromState(part.getWorld().getBlockState(part.getWorldLocation().toBlockPos()));
|
||||||
// TODO meta fix
|
// TODO meta fix
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.getBlockState(new BlockPos(location.getX(), location.getY(), location.getZ()))
|
if (this.world.getBlockState(new BlockPos(location.getX(), location.getY(), location.getZ()))
|
||||||
.getBlock().getUnlocalizedName().equals("tile.lava")
|
.getBlock().getUnlocalizedName().equals("tile.lava")
|
||||||
&& world
|
&& this.world
|
||||||
.getBlockState(new BlockPos(location.getX(), location.getY() + 1, location.getZ()))
|
.getBlockState(new BlockPos(location.getX(), location.getY() + 1, location.getZ()))
|
||||||
.getBlock().getUnlocalizedName().equals("tile.lava")) {
|
.getBlock().getUnlocalizedName().equals("tile.lava")) {
|
||||||
heat += 500;
|
heat += 500;
|
||||||
|
@ -117,50 +121,50 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
public void onDataPacket(final NetworkManager net, final SPacketUpdateTileEntity packet) {
|
||||||
world.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
this.world.markBlockRangeForRenderUpdate(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getPos().getX(),
|
||||||
getPos().getY(), getPos().getZ());
|
this.getPos().getY(), this.getPos().getZ());
|
||||||
readFromNBT(packet.getNbtCompound());
|
this.readFromNBT(packet.getNbtCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
tickTime = tagCompound.getInteger("tickTime");
|
this.tickTime = tagCompound.getInteger("tickTime");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
writeUpdateToNBT(tagCompound);
|
this.writeUpdateToNBT(tagCompound);
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeUpdateToNBT(NBTTagCompound tagCompound) {
|
public void writeUpdateToNBT(final NBTTagCompound tagCompound) {
|
||||||
tagCompound.setInteger("tickTime", tickTime);
|
tagCompound.setInteger("tickTime", this.tickTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ISidedInventory
|
// ISidedInventory
|
||||||
@Override
|
@Override
|
||||||
public int[] getSlotsForFace(EnumFacing side) {
|
public int[] getSlotsForFace(final EnumFacing side) {
|
||||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3 } : new int[] { 0, 1, 2, 3 };
|
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3 } : new int[] { 0, 1, 2, 3 };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
|
||||||
if (slotIndex >= 2)
|
if (slotIndex >= 2)
|
||||||
return false;
|
return false;
|
||||||
return isItemValidForSlot(slotIndex, itemStack);
|
return this.isItemValidForSlot(slotIndex, itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
|
||||||
return slotIndex == 2 || slotIndex == 3;
|
return slotIndex == 2 || slotIndex == 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getProgressScaled(int scale) {
|
public int getProgressScaled(final int scale) {
|
||||||
if (crafter.currentTickTime != 0) {
|
if (this.crafter.currentTickTime != 0) {
|
||||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -171,12 +175,12 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvideEnergy(EnumFacing direction) {
|
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,26 +200,34 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canCraft(TileEntity tile, BlastFurnaceRecipe recipe) {
|
public boolean canCraft(final TileEntity tile, final BlastFurnaceRecipe recipe) {
|
||||||
if (tile instanceof TileBlastFurnace) {
|
if (tile instanceof TileBlastFurnace) {
|
||||||
TileBlastFurnace blastFurnace = (TileBlastFurnace) tile;
|
final TileBlastFurnace blastFurnace = (TileBlastFurnace) tile;
|
||||||
return blastFurnace.getHeat() >= recipe.neededHeat;
|
return blastFurnace.getHeat() >= recipe.neededHeat;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCraft(TileEntity tile, BlastFurnaceRecipe recipe) {
|
public boolean onCraft(final TileEntity tile, final BlastFurnaceRecipe recipe) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory() {
|
||||||
return inventory;
|
return this.inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RecipeCrafter getRecipeCrafter() {
|
public RecipeCrafter getRecipeCrafter() {
|
||||||
return crafter;
|
return this.crafter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeat(final int heat) {
|
||||||
|
this.cachedHeat = heat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCachedHeat() {
|
||||||
|
return this.cachedHeat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue