Skip to content

Commit

Permalink
Prepare for 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCodedOne committed Aug 25, 2018
1 parent ca45b69 commit 03d6b47
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 129 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
import com.elytradev.teckle.common.network.messages.serverbound.ChangeQuarryBoundsMessage;
import com.elytradev.teckle.common.network.messages.serverbound.ToggleQuarryMessage;
import com.elytradev.teckle.common.tile.TileBeamQuarry;
import com.google.common.base.Predicate;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;

import java.io.IOException;
import java.util.function.Predicate;

public class GuiBeamQuarry extends GuiTeckle {

Expand Down Expand Up @@ -49,9 +49,9 @@ public void initGui() {
return false;
}
};
this.leftOffset.setValidator(fieldValidator);
this.forwardOffset.setValidator(fieldValidator);
this.rightOffset.setValidator(fieldValidator);
this.leftOffset.setValidator(fieldValidator::test);
this.forwardOffset.setValidator(fieldValidator::test);
this.rightOffset.setValidator(fieldValidator::test);
this.leftOffset.setMaxStringLength(2);
this.forwardOffset.setMaxStringLength(2);
this.rightOffset.setMaxStringLength(2);
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/com/elytradev/teckle/client/gui/GuiFabricator.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,13 @@ public class GuiFabricator extends GuiTeckle {

public GuiFabricator(TileFabricator tile, EntityPlayer player) {
super(new ContainerFabricator(tile, player));
this.xSize=176;
this.ySize=208;
this.fabricator = tile;
this.player = player;
}

@Override
public ResourceLocation getBackgroundTexture() {
return new ResourceLocation("teckle", "textures/gui/table.png");
return new ResourceLocation("teckle", "textures/gui/fabricator.png");
}

@Override
Expand All @@ -65,7 +63,7 @@ public void registerButtons() {
int y = (height - ySize) / 2;
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
templates[j + i * 3] = new Template(j + i * 3, x + 33 + j * 18, y + 15 + i * 18);
templates[j + i * 3] = new Template(j + i * 3, x + 7 + j * 18, y + 16 + i * 18);
addButton(templates[j + i * 3]);
}
}
Expand Down Expand Up @@ -93,7 +91,6 @@ public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks)
}

GlStateManager.pushMatrix();
GlStateManager.disableDepth();
GlStateManager.color(1, 1, 1, 1F / 3F);
Minecraft.getMinecraft().getTextureManager().bindTexture(getBackgroundTexture());
drawTexturedModalRect(x, y, 7, 16, this.width, this.height);
Expand All @@ -115,8 +112,7 @@ public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
public void performAction(int mouseX, int mouseY, int mouseButton) {
ItemStack mouseItem = getMouseItem();
mouseItem.setCount(1);
new FabricatorTemplateMessage(fabricator.getPos(), mouseItem.copy(), templateIndex).sendToServer();

new FabricatorTemplateMessage(fabricator.getPos(), mouseItem, templateIndex).sendToServer();
fabricator.setTemplateSlot(templateIndex, mouseItem);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.elytradev.teckle.common.container;

import com.elytradev.teckle.common.TeckleLog;
import com.elytradev.teckle.common.tile.TileFabricator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
Expand All @@ -38,10 +37,15 @@ public ContainerFabricator(TileFabricator tile, EntityPlayer player) {
this.fabricator = tile;
this.player = player;

this.addSlotToContainer(new SlotItemHandler(tile.blueprint, 0, 8, 34));
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new SlotItemHandler(tile.stackHandler, j + i * 9, 8 + j * 18, 79 + i * 18));
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
this.addSlotToContainer(new InaccessibleSlot(tile.craftingGrid, j + i * 3, 8 + j * 18, 17 + i * 18));
}
}

for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
this.addSlotToContainer(new SlotItemHandler(tile.stackHandler, j + i * 3, 116 + j * 18, 17 + i * 18));
}
}

Expand All @@ -52,12 +56,12 @@ public ContainerFabricator(TileFabricator tile, EntityPlayer player) {
protected void bindPlayerInventory(InventoryPlayer inventoryplayer) {
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) {
addSlotToContainer(new Slot(inventoryplayer, j + i * 9 + 9, 8 + j * 18, 126 + i * 18));
addSlotToContainer(new Slot(inventoryplayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}

for (int i = 0; i < 9; i++) {
addSlotToContainer(new Slot(inventoryplayer, i, 8 + i * 18, 184));
addSlotToContainer(new Slot(inventoryplayer, i, 8 + i * 18, 142));
}
}

Expand All @@ -79,11 +83,11 @@ public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();

if (index < 18) {
if (!this.mergeItemStack(itemstack1, 18, inventorySlots.size(), true)) {
if (index < 9) {
if (!this.mergeItemStack(itemstack1, 9, 45, true)) {
return ItemStack.EMPTY;
}
} else if (!this.mergeItemStack(itemstack1, 0, 18, false)) {
} else if (!this.mergeItemStack(itemstack1, 0, 9, false)) {
return ItemStack.EMPTY;
}

Expand Down
Loading

0 comments on commit 03d6b47

Please sign in to comment.