Added basic Grinder
This commit is contained in:
parent
f8ca41a9ce
commit
8ad4a45716
26 changed files with 929 additions and 481 deletions
|
@ -11,6 +11,7 @@ import techreborn.tiles.*;
|
|||
import techreborn.tiles.fusionReactor.TileEntityFusionController;
|
||||
import techreborn.tiles.idsu.TileIDSU;
|
||||
import techreborn.tiles.lesu.TileLesu;
|
||||
import techreborn.tiles.teir1.TileGrinder;
|
||||
|
||||
public class GuiHandler implements IGuiHandler {
|
||||
|
||||
|
@ -21,7 +22,7 @@ public class GuiHandler implements IGuiHandler {
|
|||
public static final int rollingMachineID = 4;
|
||||
public static final int blastFurnaceID = 5;
|
||||
public static final int alloySmelterID = 6;
|
||||
public static final int grinderID = 7;
|
||||
public static final int industrialGrinderID = 7;
|
||||
public static final int compresserID = 8;
|
||||
public static final int matterfabID = 9;
|
||||
public static final int pdaID = 10;
|
||||
|
@ -42,10 +43,10 @@ public class GuiHandler implements IGuiHandler {
|
|||
public static final int chargeBench = 28;
|
||||
public static final int fusionID = 29;
|
||||
public static final int vacuumFreezerID = 30;
|
||||
public static final int grinderID = 31;
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
|
||||
int x, int y, int z) {
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
if (ID == thermalGeneratorID) {
|
||||
return new ContainerThermalGenerator(
|
||||
(TileThermalGenerator) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||
|
@ -76,9 +77,9 @@ public class GuiHandler implements IGuiHandler {
|
|||
} else if (ID == alloySmelterID) {
|
||||
return new ContainerAlloySmelter(
|
||||
(TileAlloySmelter) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||
} else if (ID == grinderID) {
|
||||
return new ContainerGrinder(
|
||||
(TileGrinder) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||
} else if (ID == industrialGrinderID) {
|
||||
return new ContainerIndustrialGrinder(
|
||||
(TileIndustrialGrinder) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||
} else if (ID == compresserID) {
|
||||
return new ContainerImplosionCompressor(
|
||||
(TileImplosionCompressor) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||
|
@ -123,7 +124,9 @@ public class GuiHandler implements IGuiHandler {
|
|||
return new ContainerFusionReactor((TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||
}else if (ID == vacuumFreezerID) {
|
||||
return new ContainerVacuumFreezer((TileVacuumFreezer) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||
}
|
||||
}else if (ID == grinderID) {
|
||||
return new ContainerGrinder((TileGrinder) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
|
@ -162,9 +165,9 @@ public class GuiHandler implements IGuiHandler {
|
|||
} else if (ID == alloySmelterID) {
|
||||
return new GuiAlloySmelter(player,
|
||||
(TileAlloySmelter) world.getTileEntity(new BlockPos(x, y, z)));
|
||||
} else if (ID == grinderID) {
|
||||
return new GuiGrinder(player,
|
||||
(TileGrinder) world.getTileEntity(new BlockPos(x, y, z)));
|
||||
} else if (ID == industrialGrinderID) {
|
||||
return new GuiIndustrialGrinder(player,
|
||||
(TileIndustrialGrinder) world.getTileEntity(new BlockPos(x, y, z)));
|
||||
} else if (ID == compresserID) {
|
||||
return new GuiImplosionCompressor(player,
|
||||
(TileImplosionCompressor) world.getTileEntity(new BlockPos(x, y, z)));
|
||||
|
@ -209,6 +212,8 @@ public class GuiHandler implements IGuiHandler {
|
|||
return new GuiFusionReactor(player, (TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)));
|
||||
}else if (ID == vacuumFreezerID) {
|
||||
return new GuiVacuumFreezer(player, (TileVacuumFreezer) world.getTileEntity(new BlockPos(x, y, z)));
|
||||
}else if (ID == grinderID) {
|
||||
return new GuiGrinder(player, (TileGrinder) world.getTileEntity(new BlockPos(x, y, z)));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ import net.minecraft.inventory.Slot;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import techreborn.tiles.TileGrinder;
|
||||
import techreborn.tiles.TileIndustrialGrinder;
|
||||
import techreborn.tiles.teir1.TileGrinder;
|
||||
|
||||
public class ContainerGrinder extends ContainerCrafting {
|
||||
|
||||
|
@ -16,22 +17,21 @@ public class ContainerGrinder extends ContainerCrafting {
|
|||
|
||||
public int connectionStatus;
|
||||
|
||||
public ContainerGrinder(TileGrinder tileGrinder,
|
||||
EntityPlayer player) {
|
||||
public ContainerGrinder(TileGrinder tileGrinder, EntityPlayer player) {
|
||||
super(tileGrinder.crafter);
|
||||
tile = tileGrinder;
|
||||
this.player = player;
|
||||
|
||||
// input
|
||||
this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 32, 26));
|
||||
this.addSlotToContainer(new Slot(tileGrinder.inventory, 1, 32, 44));
|
||||
this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 56, 34));
|
||||
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 1, 116, 34));
|
||||
|
||||
|
||||
// outputs
|
||||
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 2, 77, 35));
|
||||
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 3, 95, 35));
|
||||
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 4, 113, 35));
|
||||
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 5, 131, 35));
|
||||
// upgrades
|
||||
this.addSlotToContainer(new Slot(tileGrinder.inventory, 2, 152, 8));
|
||||
this.addSlotToContainer(new Slot(tileGrinder.inventory, 3, 152, 26));
|
||||
this.addSlotToContainer(new Slot(tileGrinder.inventory, 4, 152, 44));
|
||||
this.addSlotToContainer(new Slot(tileGrinder.inventory, 5, 152, 62));
|
||||
|
||||
int i;
|
||||
|
||||
|
@ -53,23 +53,6 @@ public class ContainerGrinder extends ContainerCrafting {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.crafters.size(); i++) {
|
||||
ICrafting icrafting = (ICrafting) this.crafters.get(i);
|
||||
if (this.connectionStatus != tile.connectionStatus) {
|
||||
icrafting.sendProgressBarUpdate(this, 10, tile.connectionStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftGuiOpened(ICrafting crafting) {
|
||||
super.onCraftGuiOpened(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 10, tile.connectionStatus);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void updateProgressBar(int id, int value) {
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
package techreborn.client.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import techreborn.tiles.TileIndustrialGrinder;
|
||||
|
||||
public class ContainerIndustrialGrinder extends ContainerCrafting {
|
||||
|
||||
EntityPlayer player;
|
||||
|
||||
TileIndustrialGrinder tile;
|
||||
|
||||
public int connectionStatus;
|
||||
|
||||
public ContainerIndustrialGrinder(TileIndustrialGrinder tileGrinder,
|
||||
EntityPlayer player) {
|
||||
super(tileGrinder.crafter);
|
||||
tile = tileGrinder;
|
||||
this.player = player;
|
||||
|
||||
// input
|
||||
this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 32, 26));
|
||||
this.addSlotToContainer(new Slot(tileGrinder.inventory, 1, 32, 44));
|
||||
|
||||
|
||||
// outputs
|
||||
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 2, 77, 35));
|
||||
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 3, 95, 35));
|
||||
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 4, 113, 35));
|
||||
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 5, 131, 35));
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
|
||||
+ 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
|
||||
142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer p_75145_1_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.crafters.size(); i++) {
|
||||
ICrafting icrafting = (ICrafting) this.crafters.get(i);
|
||||
if (this.connectionStatus != tile.connectionStatus) {
|
||||
icrafting.sendProgressBarUpdate(this, 10, tile.connectionStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftGuiOpened(ICrafting crafting) {
|
||||
super.onCraftGuiOpened(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 10, tile.connectionStatus);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void updateProgressBar(int id, int value) {
|
||||
if (id == 10) {
|
||||
this.connectionStatus = value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -6,11 +6,13 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import techreborn.client.container.ContainerGrinder;
|
||||
import techreborn.tiles.TileGrinder;
|
||||
import techreborn.client.container.ContainerIndustrialGrinder;
|
||||
import techreborn.tiles.TileIndustrialGrinder;
|
||||
import techreborn.tiles.teir1.TileGrinder;
|
||||
|
||||
public class GuiGrinder extends GuiContainer {
|
||||
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/industrial_grinder.png");
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/grinder.png");
|
||||
|
||||
TileGrinder grinder;
|
||||
ContainerGrinder containerGrinder;
|
||||
|
@ -39,33 +41,8 @@ public class GuiGrinder extends GuiContainer {
|
|||
|
||||
j = grinder.getEnergyScaled(12);
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 132, l + 63 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||
}
|
||||
|
||||
if (containerGrinder.connectionStatus != 1) {
|
||||
// GuiDraw.drawTooltipBox(k + 30, l + 50 + 12 - j, 114, 10);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12 - j, -1);
|
||||
}
|
||||
|
||||
//TODO 1.8 nope
|
||||
// if (grinder.tank.getFluidAmount() != 0) {
|
||||
// IIcon fluidIcon = grinder.tank.getFluid().getFluid().getIcon();
|
||||
// if (fluidIcon != null) {
|
||||
// this.mc.renderEngine.bindTexture(texture);
|
||||
// drawTexturedModalRect(k + 7, l + 15, 176, 31, 20, 55);
|
||||
//
|
||||
// this.mc.renderEngine
|
||||
// .bindTexture(TextureMap.locationBlocksTexture);
|
||||
// int liquidHeight = grinder.tank.getFluidAmount() * 47
|
||||
// / grinder.tank.getCapacity();
|
||||
// GuiUtil.drawRepeated(fluidIcon, k + 11, l + 19 + 47
|
||||
// - liquidHeight, 12.0D, liquidHeight, this.zLevel);
|
||||
//
|
||||
// this.mc.renderEngine.bindTexture(texture);
|
||||
//
|
||||
// drawTexturedModalRect(k + 11, l + 19, 176, 86, 12, 47);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
package techreborn.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import techreborn.client.container.ContainerIndustrialGrinder;
|
||||
import techreborn.tiles.TileIndustrialGrinder;
|
||||
|
||||
public class GuiIndustrialGrinder extends GuiContainer {
|
||||
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/industrial_grinder.png");
|
||||
|
||||
TileIndustrialGrinder grinder;
|
||||
ContainerIndustrialGrinder containerGrinder;
|
||||
|
||||
public GuiIndustrialGrinder(EntityPlayer player, TileIndustrialGrinder tilegrinder) {
|
||||
super(new ContainerIndustrialGrinder(tilegrinder, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
grinder = tilegrinder;
|
||||
containerGrinder = (ContainerIndustrialGrinder) this.inventorySlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
int j = 0;
|
||||
|
||||
j = grinder.getProgressScaled(24);
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 50, l + 36, 176, 14, j + 1, 16);
|
||||
}
|
||||
|
||||
j = grinder.getEnergyScaled(12);
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 132, l + 63 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||
}
|
||||
|
||||
if (containerGrinder.connectionStatus != 1) {
|
||||
// GuiDraw.drawTooltipBox(k + 30, l + 50 + 12 - j, 114, 10);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12 - j, -1);
|
||||
}
|
||||
|
||||
//TODO 1.8 nope
|
||||
// if (grinder.tank.getFluidAmount() != 0) {
|
||||
// IIcon fluidIcon = grinder.tank.getFluid().getFluid().getIcon();
|
||||
// if (fluidIcon != null) {
|
||||
// this.mc.renderEngine.bindTexture(texture);
|
||||
// drawTexturedModalRect(k + 7, l + 15, 176, 31, 20, 55);
|
||||
//
|
||||
// this.mc.renderEngine
|
||||
// .bindTexture(TextureMap.locationBlocksTexture);
|
||||
// int liquidHeight = grinder.tank.getFluidAmount() * 47
|
||||
// / grinder.tank.getCapacity();
|
||||
// GuiUtil.drawRepeated(fluidIcon, k + 11, l + 19 + 47
|
||||
// - liquidHeight, 12.0D, liquidHeight, this.zLevel);
|
||||
//
|
||||
// this.mc.renderEngine.bindTexture(texture);
|
||||
//
|
||||
// drawTexturedModalRect(k + 11, l + 19, 176, 86, 12, 47);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
String name = StatCollector.translateToLocal("tile.techreborn.industrialgrinder.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue