Multiblock work, and industrial grinder gui
This commit is contained in:
parent
8b24fdf765
commit
38525a5bb0
9 changed files with 235 additions and 99 deletions
|
@ -31,11 +31,13 @@ public class GuiBlastFurnace extends GuiBase {
|
|||
public void initGui() {
|
||||
super.initGui();
|
||||
this.hasMultiBlock = this.tile.getCachedHeat() != 0;
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
|
||||
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
this.hasMultiBlock = this.tile.getCachedHeat() != 0;
|
||||
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
final GuiBase.Layer layer = Layer.BACKGROUND;
|
||||
|
@ -51,13 +53,20 @@ public class GuiBlastFurnace extends GuiBase {
|
|||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
this.hasMultiBlock = this.tile.getCachedHeat() != 0;
|
||||
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
|
||||
|
||||
this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
|
||||
this.builder.drawMultiEnergyBar(this, 9, 18, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
|
||||
this.builder.drawBigHeatBar(this, 31, 71, tile.getCachedHeat(), 3230, layer);
|
||||
addHologramButton(6, 4, 212, layer);
|
||||
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);
|
||||
if (hasMultiBlock) {
|
||||
addHologramButton(6, 4, 212, layer);
|
||||
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);
|
||||
} else {
|
||||
builder.drawMultiblockMissingBar(this, layer);
|
||||
addHologramButton(76, 56, 212, layer);
|
||||
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
|
||||
}
|
||||
}
|
||||
|
||||
public void addHologramButton(int x, int y, int id, Layer layer) {
|
||||
|
|
|
@ -1,96 +1,140 @@
|
|||
package techreborn.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import reborncore.client.multiblock.Multiblock;
|
||||
import reborncore.client.multiblock.MultiblockRenderEvent;
|
||||
import reborncore.client.multiblock.MultiblockSet;
|
||||
import reborncore.common.misc.Location;
|
||||
import techreborn.client.gui.widget.GuiButtonHologram;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.proxies.ClientProxy;
|
||||
import techreborn.tiles.multiblock.TileIndustrialGrinder;
|
||||
|
||||
public class GuiIndustrialGrinder extends GuiContainer {
|
||||
import java.io.IOException;
|
||||
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn",
|
||||
"textures/gui/industrial_grinder.png");
|
||||
public class GuiIndustrialGrinder extends GuiBase {
|
||||
|
||||
TileIndustrialGrinder grinder;
|
||||
TileIndustrialGrinder tile;
|
||||
|
||||
public GuiIndustrialGrinder(final EntityPlayer player, final TileIndustrialGrinder grinder) {
|
||||
super(grinder.createContainer(player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
this.grinder = grinder;
|
||||
public GuiIndustrialGrinder(final EntityPlayer player, final TileIndustrialGrinder tile) {
|
||||
super(player, tile, tile.createContainer(player));
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
final int k = (this.width - this.xSize) / 2;
|
||||
final int l = (this.height - this.ySize) / 2;
|
||||
super.initGui();
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
this.mc.getTextureManager().bindTexture(GuiIndustrialGrinder.texture);
|
||||
final int k = (this.width - this.xSize) / 2;
|
||||
final int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
|
||||
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
final Layer layer = Layer.BACKGROUND;
|
||||
|
||||
final int progress = this.grinder.getProgressScaled(24);
|
||||
if (progress > 0) {
|
||||
this.drawTexturedModalRect(k + 50, l + 35, 176, 14, progress + 1, 16);
|
||||
}
|
||||
|
||||
final int energy = (int) (this.grinder.getEnergy() * 12f / this.grinder.getMaxPower());
|
||||
if (energy > 0) {
|
||||
this.drawTexturedModalRect(k + 132, l + 63 + 12 - energy, 176, 12 - energy, 14, energy + 2);
|
||||
}
|
||||
|
||||
if (!this.grinder.tank.isEmpty()) {
|
||||
this.drawFluid(this.grinder.tank.getFluid(), k + 11, l + 66, 12, 47, this.grinder.tank.getCapacity());
|
||||
|
||||
this.mc.renderEngine.bindTexture(GuiIndustrialGrinder.texture);
|
||||
this.drawTexturedModalRect(k + 14, l + 24, 179, 88, 9, 37);
|
||||
}
|
||||
|
||||
if (!this.grinder.getMutliBlock()) {
|
||||
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void drawFluid(final FluidStack fluid, final int x, final int y, final int width, final int height, final int maxCapacity) {
|
||||
this.mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
final ResourceLocation still = fluid.getFluid().getStill(fluid);
|
||||
final TextureAtlasSprite sprite = this.mc.getTextureMapBlocks().getAtlasSprite(still.toString());
|
||||
|
||||
final int drawHeight = (int) (fluid.amount / (maxCapacity * 1F) * height);
|
||||
final int iconHeight = sprite.getIconHeight();
|
||||
int offsetHeight = drawHeight;
|
||||
|
||||
int iteration = 0;
|
||||
while (offsetHeight != 0) {
|
||||
final int curHeight = offsetHeight < iconHeight ? offsetHeight : iconHeight;
|
||||
this.drawTexturedModalRect(x, y - offsetHeight, sprite, width, curHeight);
|
||||
offsetHeight -= curHeight;
|
||||
iteration++;
|
||||
if (iteration > 50)
|
||||
break;
|
||||
}
|
||||
drawSlot(34, 35, layer);
|
||||
drawSlot(34, 55, layer);
|
||||
drawSlot(84, 43, layer);
|
||||
drawSlot(126, 18, layer);
|
||||
drawSlot(126, 36, layer);
|
||||
drawSlot(126, 54, layer);
|
||||
drawSlot(126, 72, layer);
|
||||
|
||||
this.builder.drawJEIButton(this, 150, 4, layer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
|
||||
final String name = I18n.translateToLocal("tile.techreborn.industrialgrinder.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
|
||||
4210752);
|
||||
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
final Layer layer = Layer.FOREGROUND;
|
||||
|
||||
this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
|
||||
this.builder.drawTank(this, 53, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer);
|
||||
this.builder.drawMultiEnergyBar(this, 9, 18, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
|
||||
if (tile.getMutliBlock()) {
|
||||
addHologramButton(6, 4, 212, layer);
|
||||
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);
|
||||
} else {
|
||||
builder.drawMultiblockMissingBar(this, layer);
|
||||
addHologramButton(76, 56, 212, layer);
|
||||
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
|
||||
}
|
||||
}
|
||||
|
||||
public void addHologramButton(int x, int y, int id, Layer layer) {
|
||||
if (id == 0)
|
||||
buttonList.clear();
|
||||
int factorX = 0;
|
||||
int factorY = 0;
|
||||
if (layer == Layer.BACKGROUND) {
|
||||
factorX = guiLeft;
|
||||
factorY = guiTop;
|
||||
}
|
||||
buttonList.add(new GuiButtonHologram(id, x + factorX, y + factorY, this, layer));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final GuiButton button) throws IOException {
|
||||
super.actionPerformed(button);
|
||||
if (button.id == 212) {
|
||||
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
|
||||
{
|
||||
// This code here makes a basic multiblock and then sets to the selected one.
|
||||
final Multiblock multiblock = new Multiblock();
|
||||
this.addComponent(0, -1, 0, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
this.addComponent(1, -1, 0, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
this.addComponent(0, -1, 1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
this.addComponent(-1, -1, 0, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
this.addComponent(0, -1, -1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
this.addComponent(-1, -1, -1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
this.addComponent(-1, -1, 1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
this.addComponent(1, -1, -1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
this.addComponent(1, -1, 1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
|
||||
this.addComponent(0, 0, 0, Blocks.WATER.getDefaultState(), multiblock);
|
||||
this.addComponent(1, 0, 0, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock);
|
||||
this.addComponent(0, 0, 1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock);
|
||||
this.addComponent(-1, 0, 0, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock);
|
||||
this.addComponent(0, 0, -1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock);
|
||||
this.addComponent(-1, 0, -1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock);
|
||||
this.addComponent(-1, 0, 1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock);
|
||||
this.addComponent(1, 0, -1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock);
|
||||
this.addComponent(1, 0, 1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock);
|
||||
|
||||
this.addComponent(0, 1, 0, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
this.addComponent(0, 1, 0, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
this.addComponent(1, 1, 0, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
this.addComponent(0, 1, 1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
this.addComponent(-1, 1, 0, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
this.addComponent(0, 1, -1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
this.addComponent(-1, 1, -1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
this.addComponent(-1, 1, 1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
this.addComponent(1, 1, -1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
this.addComponent(1, 1, 1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock);
|
||||
|
||||
final MultiblockSet set = new MultiblockSet(multiblock);
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(set);
|
||||
ClientProxy.multiblockRenderEvent.parent = new Location(this.tile.getPos().getX(),
|
||||
this.tile.getPos().getY(), this.tile.getPos().getZ(), this.tile.getWorld());
|
||||
MultiblockRenderEvent.anchor = new BlockPos(
|
||||
this.tile.getPos().getX()
|
||||
- EnumFacing.getFront(this.tile.getFacingInt()).getFrontOffsetX() * 2,
|
||||
this.tile.getPos().getY() - 1, this.tile.getPos().getZ()
|
||||
- EnumFacing.getFront(this.tile.getFacingInt()).getFrontOffsetZ() * 2);
|
||||
}
|
||||
} else {
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,9 +3,12 @@ package techreborn.client.gui;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import reborncore.client.guibuilder.GuiBuilder;
|
||||
|
@ -101,6 +104,64 @@ public class TRBuilder extends GuiBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
public void drawTank(GuiBase gui, int x, int y, int mouseX, int mouseY, FluidStack fluid, int maxCapacity, boolean isTankEmpty, GuiBase.Layer layer) {
|
||||
if (layer == GuiBase.Layer.BACKGROUND) {
|
||||
x += gui.getGuiLeft();
|
||||
y += gui.getGuiTop();
|
||||
}
|
||||
if (layer == GuiBase.Layer.FOREGROUND) {
|
||||
mouseX -= gui.getGuiLeft();
|
||||
mouseY -= gui.getGuiTop();
|
||||
}
|
||||
int percentage = 0;
|
||||
int amount = 0;
|
||||
boolean empty = true;
|
||||
if (!isTankEmpty) {
|
||||
amount = fluid.amount;
|
||||
percentage = percentage(maxCapacity, amount);
|
||||
empty = false;
|
||||
}
|
||||
gui.mc.getTextureManager().bindTexture(GUI_SHEET);
|
||||
gui.drawTexturedModalRect(x, y, 228, 18, 22, 56);
|
||||
if (!empty)
|
||||
drawFluid(gui, fluid, x + 4, y + 4, 14, 48, maxCapacity);
|
||||
gui.drawTexturedModalRect(x + 3, y + 3, 231, 74, 16, 50);
|
||||
|
||||
if (isInRect(x, y, 22, 56, mouseX, mouseY)) {
|
||||
List<String> list = new ArrayList<>();
|
||||
if (empty)
|
||||
list.add(TextFormatting.GOLD + "Empty Tank");
|
||||
else
|
||||
list.add(TextFormatting.GOLD + "" + amount + "mB/" + maxCapacity + "mB " + fluid.getLocalizedName());
|
||||
list.add(getPercentageColour(percentage) + "" + percentage + "%" + TextFormatting.GRAY + " Full");
|
||||
net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(list, mouseX, mouseY, gui.width, gui.height, -1, gui.mc.fontRendererObj);
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawFluid(GuiBase gui, FluidStack fluid, int x, int y, int width, int height, int maxCapacity) {
|
||||
gui.mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
y += height;
|
||||
final ResourceLocation still = fluid.getFluid().getStill(fluid);
|
||||
final TextureAtlasSprite sprite = gui.mc.getTextureMapBlocks().getAtlasSprite(still.toString());
|
||||
|
||||
final int drawHeight = (int) (fluid.amount / (maxCapacity * 1F) * height);
|
||||
final int iconHeight = sprite.getIconHeight();
|
||||
int offsetHeight = drawHeight;
|
||||
|
||||
int iteration = 0;
|
||||
while (offsetHeight != 0) {
|
||||
final int curHeight = offsetHeight < iconHeight ? offsetHeight : iconHeight;
|
||||
gui.drawTexturedModalRect(x, y - offsetHeight, sprite, width, curHeight);
|
||||
offsetHeight -= curHeight;
|
||||
iteration++;
|
||||
if (iteration > 50)
|
||||
break;
|
||||
}
|
||||
gui.mc.getTextureManager().bindTexture(GUI_SHEET);
|
||||
}
|
||||
|
||||
public void drawJEIButton(GuiBase gui, int x, int y, GuiBase.Layer layer) {
|
||||
if (Loader.isModLoaded("jei")) {
|
||||
if (layer == GuiBase.Layer.BACKGROUND) {
|
||||
|
@ -182,11 +243,28 @@ public class TRBuilder extends GuiBuilder {
|
|||
gui.drawTexturedModalRect(x + 4, y + 4, 0, 246, j, 10);
|
||||
gui.drawCentredString(value + " Heat", y + 5, 0xFFFFFF, layer);
|
||||
|
||||
} else {
|
||||
gui.drawCentredString(I18n.translateToLocal("techreborn.message.missingmultiblock"), y + 5, 0xC60000, layer);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawMultiblockMissingBar(GuiBase gui, GuiBase.Layer layer) {
|
||||
int x = 0;
|
||||
int y = 4;
|
||||
if (layer == GuiBase.Layer.BACKGROUND) {
|
||||
x += gui.getGuiLeft();
|
||||
y += gui.getGuiTop();
|
||||
}
|
||||
gui.mc.getTextureManager().bindTexture(GUI_SHEET);
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.colorMask(true, true, true, false);
|
||||
GuiUtils.drawGradientRect(0, x, y, x + 176, y + 20, 0x000000, 0xC0000000);
|
||||
GuiUtils.drawGradientRect(0, x, y + 20, x + 176, y + 20 + 48, 0xC0000000, 0xC0000000);
|
||||
GuiUtils.drawGradientRect(0, x, y + 68, x + 176, y + 70 + 20, 0xC0000000, 0x00000000);
|
||||
GlStateManager.colorMask(true, true, true, true);
|
||||
GlStateManager.enableDepth();
|
||||
gui.drawCentredString(I18n.translateToLocal("techreborn.message.missingmultiblock"), 43, 0xFFFFFF, layer);
|
||||
}
|
||||
|
||||
public void drawBigBlueBar(GuiBase gui, int x, int y, int value, int max, int mouseX, int mouseY, GuiBase.Layer layer) {
|
||||
drawBigBlueBar(gui, x, y, value, max, mouseX, mouseY, "", layer);
|
||||
}
|
||||
|
|
|
@ -212,6 +212,7 @@ public class TechRebornJeiPlugin extends BlankModPlugin {
|
|||
registry.addRecipeClickArea(GuiVacuumFreezer.class, 150, 4, 20, 12, RecipeCategoryUids.VACUUM_FREEZER);
|
||||
registry.addRecipeClickArea(GuiBlastFurnace.class, 150, 4, 20, 12, RecipeCategoryUids.BLAST_FURNACE);
|
||||
registry.addRecipeClickArea(GuiChemicalReactor.class, 150, 4, 20, 12, RecipeCategoryUids.CHEMICAL_REACTOR);
|
||||
registry.addRecipeClickArea(GuiIndustrialGrinder.class, 150, 4, 20, 12, RecipeCategoryUids.INDUSTRIAL_GRINDER);
|
||||
|
||||
//OLD ONES
|
||||
registry.addRecipeClickArea(GuiAlloyFurnace.class, 80, 35, 26, 20, RecipeCategoryUids.ALLOY_SMELTER,
|
||||
|
@ -219,7 +220,6 @@ public class TechRebornJeiPlugin extends BlankModPlugin {
|
|||
registry.addRecipeClickArea(GuiAlloySmelter.class, 80, 35, 26, 20, RecipeCategoryUids.ALLOY_SMELTER);
|
||||
registry.addRecipeClickArea(GuiAssemblingMachine.class, 85, 34, 24, 20, RecipeCategoryUids.ASSEMBLING_MACHINE);
|
||||
registry.addRecipeClickArea(GuiFusionReactor.class, 111, 34, 27, 19, RecipeCategoryUids.FUSION_REACTOR);
|
||||
registry.addRecipeClickArea(GuiIndustrialGrinder.class, 50, 35, 25, 16, RecipeCategoryUids.INDUSTRIAL_GRINDER);
|
||||
registry.addRecipeClickArea(GuiImplosionCompressor.class, 60, 37, 24, 15,
|
||||
RecipeCategoryUids.IMPLOSION_COMPRESSOR);
|
||||
registry.addRecipeClickArea(GuiIndustrialElectrolyzer.class, 72, 37, 33, 14,
|
||||
|
|
|
@ -8,6 +8,7 @@ import mezz.jei.api.gui.IRecipeLayout;
|
|||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeCategory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import techreborn.client.gui.GuiIndustrialGrinder;
|
||||
import techreborn.compat.jei.RecipeCategoryUids;
|
||||
|
@ -17,10 +18,12 @@ import techreborn.tiles.multiblock.TileIndustrialGrinder;
|
|||
import javax.annotation.Nonnull;
|
||||
|
||||
public class IndustrialGrinderRecipeCategory extends BlankRecipeCategory<IndustrialGrinderRecipeWrapper> {
|
||||
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn",
|
||||
"textures/gui/industrial_grinder.png");
|
||||
private static final int[] INPUT_SLOTS = { 0, 1 };
|
||||
private static final int[] OUTPUT_SLOTS = { 2, 3, 4, 5 };
|
||||
private static final int[] INPUT_TANKS = { 0 };
|
||||
|
||||
private final IDrawable background;
|
||||
private final IDrawable blankArea; // for covering the lightning power
|
||||
// symbol
|
||||
|
@ -28,9 +31,9 @@ public class IndustrialGrinderRecipeCategory extends BlankRecipeCategory<Industr
|
|||
private final String title;
|
||||
|
||||
public IndustrialGrinderRecipeCategory(IGuiHelper guiHelper) {
|
||||
background = guiHelper.createDrawable(GuiIndustrialGrinder.texture, 7, 15, 141, 55);
|
||||
blankArea = guiHelper.createDrawable(GuiIndustrialGrinder.texture, 50, 45, 6, 6);
|
||||
tankOverlay = guiHelper.createDrawable(GuiIndustrialGrinder.texture, 176, 86, 12, 47);
|
||||
background = guiHelper.createDrawable(texture, 7, 15, 141, 55);
|
||||
blankArea = guiHelper.createDrawable(texture, 50, 45, 6, 6);
|
||||
tankOverlay = guiHelper.createDrawable(texture, 176, 86, 12, 47);
|
||||
title = I18n.translateToLocal("tile.techreborn.industrialgrinder.name");
|
||||
}
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ import mezz.jei.api.gui.IDrawableAnimated;
|
|||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import techreborn.api.recipe.machines.IndustrialGrinderRecipe;
|
||||
import techreborn.client.gui.GuiIndustrialGrinder;
|
||||
import techreborn.compat.jei.BaseRecipeWrapper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
@ -16,6 +16,8 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
|
||||
public class IndustrialGrinderRecipeWrapper extends BaseRecipeWrapper<IndustrialGrinderRecipe> {
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn",
|
||||
"textures/gui/industrial_grinder.png");
|
||||
private final IDrawableAnimated progress;
|
||||
|
||||
public IndustrialGrinderRecipeWrapper(
|
||||
|
@ -25,15 +27,17 @@ public class IndustrialGrinderRecipeWrapper extends BaseRecipeWrapper<Industrial
|
|||
IndustrialGrinderRecipe baseRecipe) {
|
||||
super(baseRecipe);
|
||||
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
|
||||
IDrawableStatic progressStatic = guiHelper.createDrawable(GuiIndustrialGrinder.texture, 176, 14, 24, 17);
|
||||
IDrawableStatic progressStatic = guiHelper.createDrawable(texture, 176, 14, 24, 17);
|
||||
|
||||
int ticksPerCycle = baseRecipe.tickTime();
|
||||
this.progress = guiHelper.createAnimatedDrawable(progressStatic, ticksPerCycle,
|
||||
IDrawableAnimated.StartDirection.LEFT, false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull final IIngredients ingredients) {
|
||||
public void getIngredients(
|
||||
@Nonnull
|
||||
final IIngredients ingredients) {
|
||||
ingredients.setInput(FluidStack.class, this.baseRecipe.fluidStack);
|
||||
super.getIngredients(ingredients);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
|
@ -21,7 +20,6 @@ import reborncore.common.recipes.RecipeCrafter;
|
|||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.Tank;
|
||||
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.ITileRecipeHandler;
|
||||
import techreborn.api.recipe.machines.IndustrialGrinderRecipe;
|
||||
|
@ -32,10 +30,10 @@ import techreborn.config.ConfigTechReborn;
|
|||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileIndustrialGrinder extends TilePowerAcceptor implements IWrenchable, IInventoryProvider,
|
||||
ITileRecipeHandler<IndustrialGrinderRecipe>, IRecipeCrafterProvider, IContainerProvider {
|
||||
ITileRecipeHandler<IndustrialGrinderRecipe>, IRecipeCrafterProvider, IContainerProvider {
|
||||
public static final int TANK_CAPACITY = 16000;
|
||||
|
||||
public Inventory inventory = new Inventory(6, "TileGrinder", 64, this);
|
||||
public Inventory inventory = new Inventory(7, "TileGrinder", 64, this);
|
||||
public Tank tank = new Tank("TileGrinder", TileIndustrialGrinder.TANK_CAPACITY, this);
|
||||
public RecipeCrafter crafter;
|
||||
public MultiblockChecker multiblockChecker;
|
||||
|
@ -53,7 +51,7 @@ ITileRecipeHandler<IndustrialGrinderRecipe>, IRecipeCrafterProvider, IContainerP
|
|||
outputs[2] = 4;
|
||||
outputs[3] = 5;
|
||||
this.crafter = new RecipeCrafter(Reference.industrialGrinderRecipe, this, 1, 4, this.inventory, inputs,
|
||||
outputs);
|
||||
outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -83,11 +81,11 @@ ITileRecipeHandler<IndustrialGrinderRecipe>, IRecipeCrafterProvider, IContainerP
|
|||
|
||||
public boolean getMutliBlock() {
|
||||
final boolean down = this.multiblockChecker.checkRectY(1, 1, MultiblockChecker.CASING_NORMAL,
|
||||
MultiblockChecker.ZERO_OFFSET);
|
||||
MultiblockChecker.ZERO_OFFSET);
|
||||
final boolean up = this.multiblockChecker.checkRectY(1, 1, MultiblockChecker.CASING_NORMAL,
|
||||
new BlockPos(0, 2, 0));
|
||||
new BlockPos(0, 2, 0));
|
||||
final boolean blade = this.multiblockChecker.checkRingY(1, 1, MultiblockChecker.CASING_REINFORCED,
|
||||
new BlockPos(0, 1, 0));
|
||||
new BlockPos(0, 1, 0));
|
||||
final IBlockState centerBlock = this.multiblockChecker.getBlock(0, 1, 0);
|
||||
final boolean center = centerBlock.getBlock() == Blocks.WATER;
|
||||
return down && center && blade && up;
|
||||
|
@ -105,7 +103,7 @@ ITileRecipeHandler<IndustrialGrinderRecipe>, IRecipeCrafterProvider, IContainerP
|
|||
if (this.getMutliBlock()) {
|
||||
this.crafter.updateEntity();
|
||||
}
|
||||
FluidUtils.drainContainers(this.tank, this.inventory, 1, 5);
|
||||
FluidUtils.drainContainers(this.tank, this.inventory, 1, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -164,7 +162,7 @@ ITileRecipeHandler<IndustrialGrinderRecipe>, IRecipeCrafterProvider, IContainerP
|
|||
|
||||
@Override
|
||||
public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
|
||||
return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5;
|
||||
return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5 || slotIndex == 6;
|
||||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
|
@ -256,10 +254,10 @@ ITileRecipeHandler<IndustrialGrinderRecipe>, IRecipeCrafterProvider, IContainerP
|
|||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("industrialgrinder").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 32, 26).slot(1, 32, 44).outputSlot(2, 77, 35).outputSlot(3, 95, 35)
|
||||
.outputSlot(4, 113, 35).outputSlot(5, 131, 35).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create();
|
||||
return new ContainerBuilder("industrialgrinder").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this).slot(1, 34, 35).slot(0, 84, 43).outputSlot(2, 126, 18).outputSlot(3, 126, 36)
|
||||
.outputSlot(4, 126, 54).outputSlot(5, 126, 72).outputSlot(6, 34, 55).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 13 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.2 KiB |
Loading…
Reference in a new issue