3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 12:30:06 +01:00

SPIGOT-3114: Initialize custom SHULKER_BOX slots

Dieser Commit ist enthalten in:
md_5 2017-03-10 20:01:31 +11:00
Ursprung 4316a8c246
Commit d6aa73d16c

Datei anzeigen

@ -12,6 +12,7 @@ import net.minecraft.server.EntityHuman;
import net.minecraft.server.IInventory; import net.minecraft.server.IInventory;
import net.minecraft.server.PacketPlayOutOpenWindow; import net.minecraft.server.PacketPlayOutOpenWindow;
import net.minecraft.server.Slot; import net.minecraft.server.Slot;
import net.minecraft.server.SlotShulkerBox;
public class CraftContainer extends Container { public class CraftContainer extends Container {
@ -150,6 +151,9 @@ public class CraftContainer extends Container {
case BEACON: case BEACON:
setupBeacon(top, bottom); setupBeacon(top, bottom);
break; break;
case SHULKER_BOX:
setupShulkerBox(top, bottom);
break;
} }
} }
@ -346,6 +350,29 @@ public class CraftContainer extends Container {
// End copy from ContainerBeacon // End copy from ContainerBeacon
} }
private void setupShulkerBox(IInventory top, IInventory bottom) {
// This code is copied from ContainerShulkerBox
int i;
int j;
for (i = 0; i < 3; ++i) {
for (j = 0; j < 9; ++j) {
this.a((Slot) (new SlotShulkerBox(top, j + i * 9, 8 + j * 18, 18 + i * 18)));
}
}
for (i = 0; i < 3; ++i) {
for (j = 0; j < 9; ++j) {
this.a(new Slot(bottom, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.a(new Slot(bottom, i, 8 + i * 18, 142));
}
// End copy from ContainerShulkerBox
}
public boolean a(EntityHuman entity) { public boolean a(EntityHuman entity) {
return true; return true;
} }