improve cheat gui scrollbar
This commit is contained in:
parent
bf54705350
commit
1e104d5db8
5 changed files with 33 additions and 89 deletions
|
@ -44,52 +44,12 @@ public abstract class GuiContainer extends Gui
|
|||
private static final List<ItemStack> ITEM_LIST = Lists.<ItemStack>newArrayList();
|
||||
|
||||
private static CheatTab selectedTab = CheatTab.BLOCKS;
|
||||
// /** The location of the inventory background texture */
|
||||
// protected static final String inventoryBackground = "textures/gui/inventory.png";
|
||||
|
||||
protected RenderItem itemRender;
|
||||
// public int width;
|
||||
// public int height;
|
||||
|
||||
/** The X size of the inventory window in pixels. */
|
||||
protected int xSize = 176;
|
||||
|
||||
/** The Y size of the inventory window in pixels. */
|
||||
protected int ySize = 166;
|
||||
|
||||
/** A list of the players inventory slots */
|
||||
public Container inventorySlots;
|
||||
|
||||
// /**
|
||||
// * Starting X position for the Gui. Inconsistent use for Gui backgrounds.
|
||||
// */
|
||||
// protected int guiLeft;
|
||||
//
|
||||
// /**
|
||||
// * Starting Y position for the Gui. Inconsistent use for Gui backgrounds.
|
||||
// */
|
||||
// protected int guiTop;
|
||||
|
||||
/** holds the slot currently hovered */
|
||||
private Slot theSlot;
|
||||
|
||||
/** Used when touchscreen is enabled. */
|
||||
private Slot clickedSlot;
|
||||
|
||||
/** Used when touchscreen is enabled. */
|
||||
private boolean isRightMouseClick;
|
||||
|
||||
/** Used when touchscreen is enabled */
|
||||
private ItemStack draggedStack;
|
||||
private int touchUpX;
|
||||
private int touchUpY;
|
||||
private Slot returningStackDestSlot;
|
||||
private long returningStackTime;
|
||||
|
||||
/** Used when touchscreen is enabled */
|
||||
private ItemStack returningStack;
|
||||
private Slot currentDragTargetSlot;
|
||||
private long dragItemDropDelay;
|
||||
protected final Set<Slot> dragSplittingSlots = Sets.<Slot>newHashSet();
|
||||
protected final List<Overlay> drawnOverlays = Lists.<Overlay>newArrayList();
|
||||
protected boolean dragSplitting;
|
||||
|
@ -130,6 +90,10 @@ public abstract class GuiContainer extends Gui
|
|||
public void rect(int x, int y, int width, int height, int color) {
|
||||
Drawing.drawRect(this.container_x + x * 2, this.container_y + y * 2, width * 2, height * 2, 0xff000000 | color);
|
||||
}
|
||||
|
||||
public void grad(int x, int y, int width, int height, int top, int bottom, int topleft, int btmright) {
|
||||
Drawing.drawGradient(this.container_x + x * 2, this.container_y + y * 2, width * 2, height * 2, 0xff000000 | top, 0xff000000 | bottom, 0xff000000 | topleft, 0xff000000 | btmright);
|
||||
}
|
||||
|
||||
public InventoryButton button(int x, int y, int w, int h) {
|
||||
return this.add(new InventoryButton(this.container_x + x * 2, this.container_y + y * 2, w * 2, h * 2));
|
||||
|
@ -362,22 +326,17 @@ public abstract class GuiContainer extends Gui
|
|||
// this.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
ItemRenderer.enableGUIStandardItemLighting();
|
||||
InventoryPlayer inventoryplayer = this.gm.player.inventory;
|
||||
ItemStack itemstack = this.draggedStack == null ? inventoryplayer.getItemStack() : this.draggedStack;
|
||||
ItemStack itemstack = inventoryplayer.getItemStack();
|
||||
if(this.gm.itemCheat)
|
||||
itemstack = itemstack == null ? this.cheatStack : itemstack;
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
int j2 = 8;
|
||||
int k2 = this.draggedStack == null ? 8 : 16;
|
||||
int k2 = 8;
|
||||
String s = null;
|
||||
|
||||
if (this.draggedStack != null && this.isRightMouseClick)
|
||||
{
|
||||
itemstack = itemstack.copy();
|
||||
itemstack.size = ExtMath.ceilf((float)itemstack.size / 2.0F);
|
||||
}
|
||||
else if (this.dragSplitting && this.dragSplittingSlots.size() > 1)
|
||||
if (this.dragSplitting && this.dragSplittingSlots.size() > 1)
|
||||
{
|
||||
itemstack = itemstack.copy();
|
||||
itemstack.size = this.dragSplittingRemnant;
|
||||
|
@ -394,23 +353,6 @@ public abstract class GuiContainer extends Gui
|
|||
this.drawItemStack(itemstack, mouseX - j2, mouseY - k2, s);
|
||||
}
|
||||
|
||||
if (this.returningStack != null)
|
||||
{
|
||||
float f = (float)(System.currentTimeMillis() - this.returningStackTime) / 100.0F;
|
||||
|
||||
if (f >= 1.0F)
|
||||
{
|
||||
f = 1.0F;
|
||||
this.returningStack = null;
|
||||
}
|
||||
|
||||
int l2 = this.returningStackDestSlot.xDisplayPosition - this.touchUpX;
|
||||
int i3 = this.returningStackDestSlot.yDisplayPosition - this.touchUpY;
|
||||
int l1 = this.touchUpX + (int)((float)l2 * f);
|
||||
int i2 = this.touchUpY + (int)((float)i3 * f);
|
||||
this.drawItemStack(this.returningStack, l1, i2, (String)null);
|
||||
}
|
||||
|
||||
// SKC.glPopMatrix();
|
||||
|
||||
if (inventoryplayer.getItemStack() == null && this.cheatStack == null && this.theSlot != null && this.theSlot.getHasStack())
|
||||
|
@ -446,7 +388,7 @@ public abstract class GuiContainer extends Gui
|
|||
// this.zLevel = 200.0F;
|
||||
this.itemRender.zLevel = 200.0F;
|
||||
this.itemRender.renderItemAndEffectIntoGUI(stack, x, y);
|
||||
this.drawnOverlays.add(new Overlay(stack, x, y - (this.draggedStack == null ? 0 : 8), altText));
|
||||
this.drawnOverlays.add(new Overlay(stack, x, y, altText));
|
||||
// this.zLevel = 0.0F;
|
||||
this.itemRender.zLevel = 0.0F;
|
||||
}
|
||||
|
@ -476,12 +418,13 @@ public abstract class GuiContainer extends Gui
|
|||
public void draw() {
|
||||
super.draw();
|
||||
if(this.gm.itemCheat) {
|
||||
int i = this.xSize + 2 + 12 * 18 + 1;
|
||||
int j = 1;
|
||||
int k = j + 184;
|
||||
this.rect(i, j, 8, 182, this.needsScrollBars() ? 0x303030 : 0x202020);
|
||||
this.rect(i, j + (int)((float)(k - j - 17) * this.currentScroll), 8, 15, this.needsScrollBars() ? 0x808080 : 0x606060);
|
||||
// CheatTab tab = CheatTab.TABS[selectedTab];
|
||||
if(this.needsScrollBars()) {
|
||||
int i = this.xSize + 2 + 12 * 18 + 1;
|
||||
int j = 1;
|
||||
int k = j + 184;
|
||||
this.rect(i, j, 8, 182, 0x000000);
|
||||
this.grad(i, j + (int)((float)(k - j - 17) * this.currentScroll), 8, 15, this.gm.style.fill_top, this.gm.style.fill_btm, this.gm.style.brdr_top, this.gm.style.brdr_btm);
|
||||
}
|
||||
this.rect(this.xSize + 2 + 18 * selectedTab.getHorizontal(), 9 * 18 + 4 + 20 * selectedTab.getVertical() - 2, 18, 2, 0xffffff);
|
||||
}
|
||||
this.drawGuiContainerBackgroundLayer();
|
||||
|
@ -512,16 +455,10 @@ public abstract class GuiContainer extends Gui
|
|||
int j = slotIn.yDisplayPosition;
|
||||
ItemStack itemstack = slotIn.getStack();
|
||||
boolean flag = false;
|
||||
boolean flag1 = slotIn == this.clickedSlot && this.draggedStack != null && !this.isRightMouseClick;
|
||||
ItemStack itemstack1 = this.gm.player.inventory.getItemStack();
|
||||
String s = null;
|
||||
|
||||
if (slotIn == this.clickedSlot && this.draggedStack != null && this.isRightMouseClick && itemstack != null)
|
||||
{
|
||||
itemstack = itemstack.copy();
|
||||
itemstack.size /= 2;
|
||||
}
|
||||
else if (this.dragSplitting && this.dragSplittingSlots.contains(slotIn) && itemstack1 != null)
|
||||
if (this.dragSplitting && this.dragSplittingSlots.contains(slotIn) && itemstack1 != null)
|
||||
{
|
||||
if (this.dragSplittingSlots.size() == 1)
|
||||
{
|
||||
|
@ -571,18 +508,15 @@ public abstract class GuiContainer extends Gui
|
|||
// }
|
||||
// }
|
||||
|
||||
if (!flag1)
|
||||
{
|
||||
// if (flag)
|
||||
// {
|
||||
// drawRect(i, j, i + 16, j + 16, -2130706433);
|
||||
// SKC.highlight(i, j, 16, 16);
|
||||
// }
|
||||
|
||||
GlState.enableDepth();
|
||||
this.itemRender.renderItemAndEffectIntoGUI(itemstack, i, j);
|
||||
this.drawnOverlays.add(new Overlay(itemstack, i, j, s));
|
||||
}
|
||||
GlState.enableDepth();
|
||||
this.itemRender.renderItemAndEffectIntoGUI(itemstack, i, j);
|
||||
this.drawnOverlays.add(new Overlay(itemstack, i, j, s));
|
||||
|
||||
this.itemRender.zLevel = 0.0F;
|
||||
// this.zLevel = 0.0F;
|
||||
|
|
|
@ -41,11 +41,21 @@ public enum CheatTab {
|
|||
return Items.diamond_block;
|
||||
}
|
||||
},
|
||||
SPAWNERS("Mob & Itemspawner") {
|
||||
VEHICLES("Fahrzeuge und Fortbewegung") {
|
||||
protected Item getIconItem() {
|
||||
return Items.minecart;
|
||||
}
|
||||
},
|
||||
SPAWNERS("Mob & Itemspawner") {
|
||||
protected Item getIconItem() {
|
||||
return Items.wheat;
|
||||
}
|
||||
},
|
||||
NPCS("NPC- und Charakterspawner") {
|
||||
protected Item getIconItem() {
|
||||
return Items.book;
|
||||
}
|
||||
},
|
||||
TOOLS("Werkzeug") {
|
||||
protected Item getIconItem() {
|
||||
return Items.flint_and_steel;
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ItemBoat extends Item
|
|||
public ItemBoat()
|
||||
{
|
||||
this.setMaxAmount(1);
|
||||
this.setTab(CheatTab.SPAWNERS);
|
||||
this.setTab(CheatTab.VEHICLES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,7 @@ public class ItemMinecart extends Item
|
|||
{
|
||||
this.setMaxAmount(1);
|
||||
this.minecartType = type;
|
||||
this.setTab(CheatTab.SPAWNERS);
|
||||
this.setTab(CheatTab.VEHICLES);
|
||||
// if(type != EntityMinecart.EnumMinecartType.COMMAND_BLOCK)
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ public class ItemNpcSpawner extends Item
|
|||
public ItemNpcSpawner(CharacterInfo spawned)
|
||||
{
|
||||
// this.setHasSubtypes(true);
|
||||
this.setTab(CheatTab.SPAWNERS);
|
||||
this.setTab(CheatTab.NPCS);
|
||||
this.spawned = spawned;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue