Skip to content

Commit 6887fbe

Browse files
Small changes for 7.3
1 parent e5fe714 commit 6887fbe

46 files changed

Lines changed: 982 additions & 918 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
package useless.moonsteel;
22

33
import net.minecraft.core.InventoryAction;
4-
import net.minecraft.core.entity.player.EntityPlayer;
5-
import net.minecraft.core.player.inventory.Container;
4+
import net.minecraft.core.entity.player.Player;
5+
import net.minecraft.core.player.inventory.menu.MenuAbstract;
66
import net.minecraft.core.player.inventory.slot.Slot;
77
import useless.moonsteel.interfaces.IStarBackpack;
88

99
import java.util.List;
1010

11-
public class ContainerStarBackpack extends Container {
11+
public class ContainerStarBackpack extends MenuAbstract {
1212
public StarBackpackInventory backpackInventory;
13-
public ContainerStarBackpack(EntityPlayer player) {
14-
backpackInventory = ((IStarBackpack)player).moonsteel$getStarBackpackInventory();
15-
int slotsNum = this.backpackInventory.getSizeInventory();
16-
int rows = (int)Math.ceil((double)slotsNum / 9.0);
13+
public ContainerStarBackpack(final Player player) {
14+
this.backpackInventory = ((IStarBackpack)player).moonsteel$getStarBackpackInventory();
15+
final int slotsNum = this.backpackInventory.getContainerSize();
16+
final int rows = (int)Math.ceil((double)slotsNum / 9.0);
1717

1818
for(int i = 0; i < rows; ++i) {
1919
int width = 9;
@@ -37,34 +37,37 @@ public ContainerStarBackpack(EntityPlayer player) {
3737
}
3838
}
3939

40-
public List<Integer> getMoveSlots(InventoryAction inventoryAction, Slot slot, int i, EntityPlayer entityPlayer) {
41-
int chestSize = this.backpackInventory.getSizeInventory();
42-
if (slot.id >= 0 && slot.id < chestSize) {
40+
@Override
41+
public List<Integer> getMoveSlots(final InventoryAction inventoryAction, final Slot slot, final int i, final Player entityPlayer) {
42+
final int chestSize = this.backpackInventory.getContainerSize();
43+
if (slot.index >= 0 && slot.index < chestSize) {
4344
return this.getSlots(0, chestSize, false);
4445
} else {
4546
if (inventoryAction == InventoryAction.MOVE_ALL) {
46-
if (slot.id >= chestSize && slot.id < chestSize + 27) {
47+
if (slot.index >= chestSize && slot.index < chestSize + 27) {
4748
return this.getSlots(chestSize, 27, false);
4849
}
4950

50-
if (slot.id >= chestSize + 27 && slot.id < chestSize + 36) {
51+
if (slot.index >= chestSize + 27 && slot.index < chestSize + 36) {
5152
return this.getSlots(chestSize + 27, 9, false);
5253
}
53-
} else if (slot.id >= chestSize && slot.id < chestSize + 36) {
54+
} else if (slot.index >= chestSize && slot.index < chestSize + 36) {
5455
return this.getSlots(chestSize, 36, false);
5556
}
5657

5758
return null;
5859
}
5960
}
6061

61-
public List<Integer> getTargetSlots(InventoryAction inventoryAction, Slot slot, int i, EntityPlayer entityPlayer) {
62-
int chestSize = this.backpackInventory.getSizeInventory();
63-
return slot.id < chestSize ? this.getSlots(chestSize, 36, true) : this.getSlots(0, chestSize, false);
62+
@Override
63+
public List<Integer> getTargetSlots(final InventoryAction inventoryAction, final Slot slot, final int i, final Player entityPlayer) {
64+
final int chestSize = this.backpackInventory.getContainerSize();
65+
return slot.index < chestSize ? this.getSlots(chestSize, 36, true) : this.getSlots(0, chestSize, false);
6466
}
6567

66-
public boolean isUsableByPlayer(EntityPlayer entityPlayer) {
67-
return this.backpackInventory.canInteractWith(entityPlayer);
68+
@Override
69+
public boolean stillValid(final Player entityPlayer) {
70+
return this.backpackInventory.stillValid(entityPlayer);
6871
}
6972

7073
}

src/main/java/useless/moonsteel/GuiStarBackpack.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
11
package useless.moonsteel;
22

3-
import net.minecraft.client.gui.GuiContainer;
4-
import net.minecraft.core.entity.player.EntityPlayer;
3+
import net.minecraft.client.gui.container.ScreenContainerAbstract;
4+
import net.minecraft.core.entity.player.Player;
5+
import net.minecraft.core.lang.I18n;
56
import org.lwjgl.opengl.GL11;
67
import tosutosu.betterwithbackpacks.BetterWithBackpacks;
78

8-
public class GuiStarBackpack extends GuiContainer {
9+
public class GuiStarBackpack extends ScreenContainerAbstract {
910
private int GUIx;
1011
private int GUIy;
1112
private int rows;
1213
private int slotsNum;
1314
private final ContainerStarBackpack backpack;
14-
public GuiStarBackpack(EntityPlayer player) {
15+
public GuiStarBackpack(Player player) {
1516
super(new ContainerStarBackpack(player));
1617
backpack = (ContainerStarBackpack) inventorySlots;
1718
}
1819

1920
public void init() {
2021
this.GUIx = (this.width - this.xSize) / 2;
2122
this.GUIy = (this.height - this.ySize) / 2;
22-
this.slotsNum = this.backpack.backpackInventory.getSizeInventory();
23+
this.slotsNum = this.backpack.backpackInventory.getContainerSize();
2324
this.rows = (int)Math.ceil((double)this.slotsNum / 9.0);
2425
super.init();
2526
}
2627

2728
protected void drawGuiContainerForegroundLayer() {
28-
this.fontRenderer.drawString(this.backpack.backpackInventory.getInvName(), 8, 6, BetterWithBackpacks.GUI_LABEL_COLOR);
29-
this.fontRenderer.drawString("Inventory", 8, this.ySize - 96 + 2, BetterWithBackpacks.GUI_LABEL_COLOR);
29+
this.font.drawString(I18n.getInstance().translateKey(this.backpack.backpackInventory.getNameTranslationKey()), 8, 6, BetterWithBackpacks.GUI_LABEL_COLOR);
30+
this.font.drawString("Inventory", 8, this.ySize - 96 + 2, BetterWithBackpacks.GUI_LABEL_COLOR);
3031
}
3132

3233
protected void drawGuiContainerBackgroundLayer(float f) {
3334
GL11.glColor3d(1.0, 1.0, 1.0);
34-
this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture("/assets/betterwithbackpacks/gui/backpack.png"));
35+
this.mc.textureManager.loadTexture("/assets/betterwithbackpacks/gui/backpack.png").bind();
3536
this.drawTexturedModalRect(this.GUIx, this.GUIy, 0, 0, this.xSize, this.ySize);
3637

3738
for(int i = 0; i < this.rows; ++i) {

src/main/java/useless/moonsteel/IHateJava.java

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)