Begin 1.11 (compiles, does not run yet)

This commit is contained in:
mezz committed 2017-02-08 00:52:37 -08:00
1 parent 5310003659
commit 424fdaaf48
164 files changed
+1396 -1312

No files matched your search

@@ -206,7 +206,7 @@ public class WindowFieldKit extends Window {
if (this.isServer()) {
final ItemStack kit = this.getPlayer().getHeldItemMainhand();
final int sheets = 64 - kit.getItemDamage();
final int size = (this.getWindowInventory().getStackInSlot(1) == null) ? 0 : this.getWindowInventory().getStackInSlot(1).stackSize;
final int size = (this.getWindowInventory().getStackInSlot(1) == null) ? 0 : this.getWindowInventory().getStackInSlot(1).getCount();
if (sheets != size) {
kit.setItemDamage(64 - size);
}
@@ -197,7 +197,7 @@ public class WindowGenesis extends Window {
public void recieveGuiNBT(final Side side, final EntityPlayer player, final String name, final NBTTagCompound action) {
super.recieveGuiNBT(side, player, name, action);
if (side == Side.SERVER && name.equals("genesis")) {
final ItemStack stack = ItemStack.loadItemStackFromNBT(action);
final ItemStack stack = new ItemStack(action);
final InventoryPlayer playerInv = player.inventory;
if (stack == null) {
return;
@@ -205,11 +205,11 @@ public class WindowGenesis extends Window {
if (playerInv.getItemStack() == null) {
playerInv.setItemStack(stack);
} else if (playerInv.getItemStack().isItemEqual(stack) && ItemStack.areItemStackTagsEqual(playerInv.getItemStack(), stack)) {
final int fit = stack.getMaxStackSize() - (stack.stackSize + playerInv.getItemStack().stackSize);
final int fit = stack.getMaxStackSize() - (stack.getCount() + playerInv.getItemStack().getCount());
if (fit >= 0) {
final ItemStack itemStack;
final ItemStack rec = itemStack = stack;
itemStack.stackSize += playerInv.getItemStack().stackSize;
itemStack.grow(playerInv.getItemStack().getCount());
playerInv.setItemStack(rec);
}
}
@@ -9,6 +9,8 @@ import binnie.craftgui.core.Widget;
import binnie.craftgui.core.geometry.IArea;
import binnie.craftgui.core.geometry.IPoint;
import binnie.craftgui.minecraft.Window;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -38,6 +40,7 @@ public class Control extends Widget implements ITooltipHelp, ITooltip {
}
@Override
@SideOnly(Side.CLIENT)
public void onUpdateClient() {
}
@@ -4,6 +4,8 @@ import binnie.craftgui.core.geometry.IArea;
import binnie.craftgui.core.geometry.IPoint;
import binnie.craftgui.events.Event;
import binnie.craftgui.events.EventHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.List;
@@ -54,6 +56,7 @@ public interface IWidget {
int getColour();
@SideOnly(Side.CLIENT)
void render(int guiWidth, int guiHeight);
void updateClient();
@@ -94,6 +97,7 @@ public interface IWidget {
void recieveEvent(final Event p0);
@SideOnly(Side.CLIENT)
void onUpdateClient();
void delete();
@@ -138,5 +142,6 @@ public interface IWidget {
int h();
@SideOnly(Side.CLIENT)
void onRender(final RenderStage stage, int guiWidth, int guiHeight);
}
@@ -5,6 +5,8 @@ import binnie.craftgui.core.geometry.IPoint;
import binnie.craftgui.events.Event;
import binnie.craftgui.events.EventHandler;
import binnie.craftgui.events.EventWidget;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.ArrayList;
@@ -278,6 +280,7 @@ public class Widget implements IWidget {
}
@Override
@SideOnly(Side.CLIENT)
public final void render(int guiWidth, int guiHeight) {
if (this.isVisible()) {
CraftGUI.render.preRender(this, guiWidth, guiHeight);
@@ -413,6 +416,7 @@ public class Widget implements IWidget {
}
@Override
@SideOnly(Side.CLIENT)
public void onRender(final RenderStage stage, int guiWidth, int guiHeight) {
if (stage == RenderStage.PreChildren) {
this.onRenderBackground(guiWidth, guiHeight);
@@ -425,16 +429,20 @@ public class Widget implements IWidget {
}
}
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
}
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
}
@SideOnly(Side.CLIENT)
public void onRenderOverlay() {
}
@Override
@SideOnly(Side.CLIENT)
public void onUpdateClient() {
}
@@ -63,7 +63,6 @@ public class ContainerCraftGUI extends Container {
this.window = window;
final IMachine machine = Machine.getMachine(window.getInventory());
if (this.getSide() == Side.SERVER) {
this.inventoryItemStacks = new ListMap<>();
this.inventorySlots = new ListMap<>();
if (machine != null) {
final GameProfile user = machine.getOwner();
@@ -42,7 +42,7 @@ public class CustomSlot extends Slot {
this.putStack(null);
} else {
stack = stack.copy();
stack.stackSize = 1;
stack.setCount(1);
this.putStack(stack);
}
}
@@ -57,7 +57,7 @@ public class GuiCraftGUI extends GuiContainer {
@Override
public void initGui() {
super.initGui();
this.mc.thePlayer.openContainer = this.inventorySlots;
this.mc.player.openContainer = this.inventorySlots;
this.guiLeft = (this.width - this.xSize) / 2;
this.guiTop = (this.height - this.ySize) / 2;
this.window.setSize(new IPoint(this.xSize, this.ySize));
@@ -86,9 +86,9 @@ public class GuiCraftGUI extends GuiContainer {
GlStateManager.pushMatrix();
GlStateManager.enableRescaleNormal();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0f, 240.0f);
final InventoryPlayer playerInventory = this.mc.thePlayer.inventory;
final InventoryPlayer playerInventory = this.mc.player.inventory;
this.draggedItem = playerInventory.getItemStack();
if (this.draggedItem != null) {
if (!this.draggedItem.isEmpty()) {
RenderUtil.drawItem(new IPoint(mouseX - 8, mouseY - 8), this.draggedItem, false);
}
RenderHelper.enableGUIStandardItemLighting();
@@ -177,7 +177,7 @@ public class GuiCraftGUI extends GuiContainer {
final String split = s2.split("~~~")[1];
try {
final NBTTagCompound nbt = JsonToNBT.getTagFromJson(split);
final ItemStack stack = ItemStack.loadItemStackFromNBT(nbt);
final ItemStack stack = new ItemStack(nbt);
GlStateManager.pushMatrix();
GlStateManager.translate(i1, j1 - 1.5f, 0.0f);
GlStateManager.scale(0.6f, 0.6f, 1.0f);
@@ -218,7 +218,7 @@ public class GuiCraftGUI extends GuiContainer {
@Override
protected void keyTyped(final char c, final int key) {
if (key == 1 || (key == this.mc.gameSettings.keyBindInventory.getKeyCode() && this.window.getFocusedWidget() == null)) {
this.mc.thePlayer.closeScreen();
this.mc.player.closeScreen();
}
final IWidget origin = (this.window.getFocusedWidget() == null) ? this.window : this.window.getFocusedWidget();
this.window.callEvent(new EventKey.Down(origin, c, key));
@@ -265,7 +265,7 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
}
public World getWorld() {
return this.getPlayer().worldObj;
return this.getPlayer().world;
}
public void onInventoryUpdate() {
@@ -41,36 +41,39 @@ public class WindowInventory implements IInventory {
}
@Override
@Nullable
public boolean isEmpty() {
return this.inventory.isEmpty();
}
@Override
public ItemStack getStackInSlot(final int var1) {
if (this.inventory.containsKey(var1)) {
return this.inventory.get(var1);
}
return null;
return ItemStack.EMPTY;
}
@Override
@Nullable
public ItemStack decrStackSize(final int index, int amount) {
if (this.inventory.containsKey(index)) {
final ItemStack item = this.inventory.get(index);
final ItemStack output = item.copy();
final int available = item.stackSize;
final int available = item.getCount();
if (amount > available) {
amount = available;
}
item.stackSize -= amount;
output.stackSize = amount;
if (item.stackSize == 0) {
this.setInventorySlotContents(index, null);
item.shrink(amount);
output.setCount(amount);
if (item.isEmpty()) {
this.setInventorySlotContents(index, ItemStack.EMPTY);
}
return output;
}
return null;
return ItemStack.EMPTY;
}
@Override
public void setInventorySlotContents(final int index, @Nullable final ItemStack stack) {
public void setInventorySlotContents(final int index, final ItemStack stack) {
this.inventory.put(index, stack);
this.markDirty();
}
@@ -87,7 +90,7 @@ public class WindowInventory implements IInventory {
}
@Override
public boolean isUseableByPlayer(final EntityPlayer var1) {
public boolean isUsableByPlayer(final EntityPlayer var1) {
return true;
}
@@ -25,6 +25,8 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.ArrayList;
@@ -70,6 +72,7 @@ public class ControlSlot extends ControlSlotBase {
this.slot = slot;
this.addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
@SideOnly(Side.CLIENT)
public void onEvent(final EventMouse.Down event) {
Window superParent = (Window) ControlSlot.this.getTopParent();
GuiCraftGUI superParentGui = superParent.getGui();
@@ -80,13 +83,14 @@ public class ControlSlot extends ControlSlotBase {
final int button = event.getButton();
Window.get(ControlSlot.this.getWidget()).getGui();
if (playerController != null) {
playerController.windowClick(windowId, slotNumber, button, GuiScreen.isShiftKeyDown() ? ClickType.QUICK_MOVE : ClickType.PICKUP, minecraft.thePlayer);
playerController.windowClick(windowId, slotNumber, button, GuiScreen.isShiftKeyDown() ? ClickType.QUICK_MOVE : ClickType.PICKUP, minecraft.player);
}
}
});
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(CraftGUITexture.Slot, IPoint.ZERO);
final InventorySlot islot = this.getInventorySlot();
@@ -146,6 +150,7 @@ public class ControlSlot extends ControlSlotBase {
}
@Override
@SideOnly(Side.CLIENT)
public void onUpdateClient() {
super.onUpdateClient();
if (this.isMouseOver() && GuiScreen.isShiftKeyDown()) {
@@ -13,6 +13,8 @@ import binnie.craftgui.events.EventWidget;
import binnie.craftgui.minecraft.Window;
import binnie.craftgui.resource.minecraft.CraftGUITexture;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
@@ -42,6 +44,7 @@ public abstract class ControlSlotBase extends Control implements ITooltip {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
final int size = this.getSize().x();
CraftGUI.render.texture(CraftGUITexture.Slot, this.getArea());
@@ -51,6 +54,7 @@ public abstract class ControlSlotBase extends Control implements ITooltip {
}
@Override
@SideOnly(Side.CLIENT)
public void onUpdateClient() {
super.onUpdateClient();
this.itemDisplay.setItemStack(this.getItemStack());