GUI TLC now!
This commit is contained in:
parent
bcbeb7bc51
commit
09db4c6f8c
7 changed files with 43 additions and 48 deletions
|
|
@ -29,9 +29,9 @@ public class ContainerScribe extends Container
|
|||
fuelTime = 0;
|
||||
lastFuelTime = 0;
|
||||
|
||||
this.addSlotToContainer(new Slot(scribe, 0, 68, 35)); // input
|
||||
this.addSlotToContainer(new Slot(scribe, 1, 34, 35)); // book
|
||||
this.addSlotToContainer(new MachineOutputSlot(player, scribe, 2, 122, 35));
|
||||
this.addSlotToContainer(new Slot(scribe, 0, 120, 47)); // input
|
||||
this.addSlotToContainer(new Slot(scribe, 1, 40, 47)); // book
|
||||
this.addSlotToContainer(new MachineOutputSlot(player, scribe, 2, 80, 25));
|
||||
this.addInventorySlots();
|
||||
}
|
||||
|
||||
|
|
@ -45,10 +45,10 @@ public class ContainerScribe extends Container
|
|||
this.scribe.processTime = timeType2;
|
||||
break;
|
||||
case 1:
|
||||
this.scribe.fuelTime = timeType2;
|
||||
this.scribe.bookTime = timeType2;
|
||||
break;
|
||||
case 2:
|
||||
this.scribe.currentFuelBuffer = timeType2;
|
||||
this.scribe.currentBookBuffer = timeType2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -58,8 +58,8 @@ public class ContainerScribe extends Container
|
|||
{
|
||||
super.onCraftGuiOpened(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 0, this.scribe.processTime);
|
||||
crafting.sendProgressBarUpdate(this, 1, this.scribe.fuelTime);
|
||||
crafting.sendProgressBarUpdate(this, 2, this.scribe.currentFuelBuffer);
|
||||
crafting.sendProgressBarUpdate(this, 1, this.scribe.bookTime);
|
||||
crafting.sendProgressBarUpdate(this, 2, this.scribe.currentBookBuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -72,14 +72,14 @@ public class ContainerScribe extends Container
|
|||
|
||||
if (this.lastUseTime != this.scribe.processTime)
|
||||
crafting.sendProgressBarUpdate(this, 0, this.scribe.processTime);
|
||||
if (this.fuelTime != this.scribe.fuelTime)
|
||||
crafting.sendProgressBarUpdate(this, 1, this.scribe.fuelTime);
|
||||
if (this.lastFuelTime != this.scribe.currentFuelBuffer)
|
||||
crafting.sendProgressBarUpdate(this, 2, this.scribe.currentFuelBuffer);
|
||||
if (this.fuelTime != this.scribe.bookTime)
|
||||
crafting.sendProgressBarUpdate(this, 1, this.scribe.bookTime);
|
||||
if (this.lastFuelTime != this.scribe.currentBookBuffer)
|
||||
crafting.sendProgressBarUpdate(this, 2, this.scribe.currentBookBuffer);
|
||||
}
|
||||
this.lastUseTime = this.scribe.processTime;
|
||||
this.fuelTime = this.scribe.fuelTime;
|
||||
this.lastFuelTime = this.scribe.currentFuelBuffer;
|
||||
this.fuelTime = this.scribe.bookTime;
|
||||
this.lastFuelTime = this.scribe.currentBookBuffer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import net.minecraft.util.StatCollector;
|
|||
|
||||
public class GUIScribe extends GuiContainer
|
||||
{
|
||||
public static final ResourceLocation backgroundTexture = new ResourceLocation(Lib.MODID.toLowerCase(), "textures/gui/scribe.png");
|
||||
public static final ResourceLocation texture = new ResourceLocation(Lib.MODID.toLowerCase(), "textures/gui/scribe.png");
|
||||
|
||||
private TileScribe scribe;
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ public class GUIScribe extends GuiContainer
|
|||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.scribe"), 68, 7, 4210752);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.scribe"), 72, 7, 4210752);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752);
|
||||
}
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ public class GUIScribe extends GuiContainer
|
|||
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(backgroundTexture);
|
||||
this.mc.renderEngine.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);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class JEIPluginManager implements IModPlugin
|
|||
registry.addRecipeClickArea(GUICropomator.class, 78, 32, 28, 23, Lib.CROPOMATOR_UID);
|
||||
registry.addRecipeClickArea(GUIElectroextractor.class, 78, 32, 28, 23, Lib.ELECTROEXTRACTOR_UID);
|
||||
registry.addRecipeClickArea(GUIWoodchipper.class, 78, 32, 28, 23, Lib.WOODCHIPPER_UID);
|
||||
registry.addRecipeClickArea(GUIScribe.class, 88, 32, 28, 23, Lib.SCRIBE_UID);
|
||||
registry.addRecipeClickArea(GUIScribe.class, 72, 0, 28, 16, Lib.SCRIBE_UID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -3,11 +3,9 @@ package com.oitsjustjose.criss_cross.jei;
|
|||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.oitsjustjose.criss_cross.gui.GUIScribe;
|
||||
import com.oitsjustjose.criss_cross.gui.GUIWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.lib.Lib;
|
||||
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
|
|
@ -26,16 +24,14 @@ public class ScribeCategory implements IRecipeCategory
|
|||
|
||||
private final IDrawableStatic progressDrawable;
|
||||
|
||||
private final IDrawableAnimated progress;
|
||||
private final IDrawable background;
|
||||
private final String localizedName;
|
||||
|
||||
public ScribeCategory()
|
||||
{
|
||||
super();
|
||||
progressDrawable = JEIPluginManager.jeiHelper.getGuiHelper().createDrawable(GUIWoodchipper.texture, 177, 14, 23, 16);
|
||||
progress = JEIPluginManager.jeiHelper.getGuiHelper().createAnimatedDrawable(progressDrawable, 700, IDrawableAnimated.StartDirection.LEFT, false);
|
||||
background = JEIPluginManager.jeiHelper.getGuiHelper().createDrawable(GUIScribe.backgroundTexture, 33, 30, 110, 34);
|
||||
progressDrawable = JEIPluginManager.jeiHelper.getGuiHelper().createDrawable(GUIScribe.texture, 177, 14, 23, 16);
|
||||
background = JEIPluginManager.jeiHelper.getGuiHelper().createDrawable(GUIScribe.texture, 39, 16, 98, 50);
|
||||
localizedName = StatCollector.translateToLocal("recipe.scribe");
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +65,6 @@ public class ScribeCategory implements IRecipeCategory
|
|||
@Override
|
||||
public void drawAnimations(Minecraft minecraft)
|
||||
{
|
||||
progress.draw(minecraft, 57, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -78,9 +73,9 @@ public class ScribeCategory implements IRecipeCategory
|
|||
{
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
guiItemStacks.init(INPUT_SLOT, true, 34, 4);
|
||||
guiItemStacks.init(OUTPUT_SLOT, false, 88, 4);
|
||||
guiItemStacks.init(FUEL_SLOT, true, 0, 4);
|
||||
guiItemStacks.init(INPUT_SLOT, true, 80, 30);
|
||||
guiItemStacks.init(OUTPUT_SLOT, false, 40, 8);
|
||||
guiItemStacks.init(FUEL_SLOT, true, 0, 30);
|
||||
|
||||
if (recipeWrapper instanceof ScribeRecipeJEI)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,13 +23,13 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
|
||||
public class TileScribe extends TileEntityLockable implements ITickable, ISidedInventory
|
||||
{
|
||||
private static int proTicks = 100;
|
||||
private static int proTicks = 1;
|
||||
private static String customName;
|
||||
private ItemStack[] ItemStacks = new ItemStack[3];
|
||||
public int fuelTime;
|
||||
public int bookTime;
|
||||
public int processTime;
|
||||
public int totalTime;
|
||||
public int currentFuelBuffer;
|
||||
public int currentBookBuffer;
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
|
|
@ -37,18 +37,18 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
|
|||
boolean isBurning = this.hasConsumedBook();
|
||||
boolean flag = false;
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
--this.fuelTime;
|
||||
if (this.bookTime > 0)
|
||||
--this.bookTime;
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||
if (this.bookTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||
{
|
||||
if (this.fuelTime == 0 && this.canProcess())
|
||||
if (this.bookTime == 0 && this.canProcess())
|
||||
{
|
||||
this.currentFuelBuffer = this.fuelTime = getBookUseTime(this.ItemStacks[1]);
|
||||
this.currentBookBuffer = this.bookTime = getBookUseTime(this.ItemStacks[1]);
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
if (this.bookTime > 0)
|
||||
flag = true;
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
|
|||
else if (!this.hasConsumedBook() && this.processTime > 0)
|
||||
this.processTime = MathHelper.clamp_int(this.processTime - 2, 0, this.totalTime);
|
||||
|
||||
if (isBurning != this.fuelTime > 0)
|
||||
if (isBurning != this.bookTime > 0)
|
||||
{
|
||||
flag = true;
|
||||
BlockScribe.updateBlockState(this.hasConsumedBook(), this.worldObj, this.pos);
|
||||
|
|
@ -173,10 +173,10 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
|
|||
this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||
}
|
||||
|
||||
this.fuelTime = tag.getShort("FuelTime");
|
||||
this.bookTime = tag.getShort("FuelTime");
|
||||
this.processTime = tag.getShort("WorkTime");
|
||||
this.totalTime = tag.getShort("WorkTimeTotal");
|
||||
this.currentFuelBuffer = getBookUseTime(this.ItemStacks[1]);
|
||||
this.currentBookBuffer = getBookUseTime(this.ItemStacks[1]);
|
||||
|
||||
if (tag.hasKey("CustomName", 8))
|
||||
this.customName = tag.getString("CustomName");
|
||||
|
|
@ -186,7 +186,7 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
|
|||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
tag.setShort("FuelTime", (short) this.fuelTime);
|
||||
tag.setShort("FuelTime", (short) this.bookTime);
|
||||
tag.setShort("WorkTime", (short) this.processTime);
|
||||
tag.setShort("WorkTimeTotal", (short) this.totalTime);
|
||||
|
||||
|
|
@ -222,15 +222,15 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
|
|||
@SideOnly(Side.CLIENT)
|
||||
public int getBurnTimeRemainingScaled(int par1)
|
||||
{
|
||||
if (this.currentFuelBuffer == 0)
|
||||
this.currentFuelBuffer = proTicks;
|
||||
if (this.currentBookBuffer == 0)
|
||||
this.currentBookBuffer = proTicks;
|
||||
|
||||
return this.fuelTime * par1 / this.currentFuelBuffer;
|
||||
return this.bookTime * par1 / this.currentBookBuffer;
|
||||
}
|
||||
|
||||
public boolean hasConsumedBook()
|
||||
{
|
||||
return this.fuelTime > 0;
|
||||
return this.bookTime > 0;
|
||||
}
|
||||
|
||||
private boolean canProcess()
|
||||
|
|
@ -315,9 +315,9 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
|
|||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
return this.fuelTime;
|
||||
return this.bookTime;
|
||||
case 1:
|
||||
return this.currentFuelBuffer;
|
||||
return this.currentBookBuffer;
|
||||
case 2:
|
||||
return this.processTime;
|
||||
case 3:
|
||||
|
|
@ -333,10 +333,10 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
|
|||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
this.fuelTime = value;
|
||||
this.bookTime = value;
|
||||
break;
|
||||
case 1:
|
||||
this.currentFuelBuffer = value;
|
||||
this.currentBookBuffer = value;
|
||||
break;
|
||||
case 2:
|
||||
this.processTime = value;
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 7.6 KiB |
Loading…
Reference in a new issue