renderer = new GameRenderer(this, 480,
480 * ((float) GameScreen.getHeight() / GameScreen.getWidth()));
}
- maxCreativeScroll = Items.items.size() / 8;
+ maxCreativeScroll = GameItems.getItemsSize() / 8;
GameSaver.save(this);
}
private boolean isAutoselectable(int x, int y) {
return (world.getForeMap(x, y) > 0 &&
- Items.blocks.getValueAt(world.getForeMap(x, y)).coll);
+ GameItems.getBlock(world.getForeMap(x, y)).coll);
}
private void moveCursor() {
}
private void updateFluids(int x, int y) {
- if (Items.isWater(world.getForeMap(x, y)) && world.getForeMap(x, y) != 8) {
+ if (GameItems.isWater(world.getForeMap(x, y)) && world.getForeMap(x, y) != 8) {
if (world.getForeMap(x, y) == 60) {
- if (!Items.isWater(world.getForeMap(x, y - 1)))
+ if (!GameItems.isWater(world.getForeMap(x, y - 1)))
world.setForeMap(x, y, world.getForeMap(x, y) + 1);
- } else if ((!Items.isWater(world.getForeMap(x - 1, y)) ||
- (Items.isWater(world.getForeMap(x, y)) && world.getForeMap(x - 1, y) >= world.getForeMap(x, y))) &&
- (!Items.isWater(world.getForeMap(x + 1, y)) ||
- (Items.isWater(world.getForeMap(x, y)) && world.getForeMap(x + 1, y) >= world.getForeMap(x, y)))) {
+ } else if ((!GameItems.isWater(world.getForeMap(x - 1, y)) ||
+ (GameItems.isWater(world.getForeMap(x, y)) && world.getForeMap(x - 1, y) >= world.getForeMap(x, y))) &&
+ (!GameItems.isWater(world.getForeMap(x + 1, y)) ||
+ (GameItems.isWater(world.getForeMap(x, y)) && world.getForeMap(x + 1, y) >= world.getForeMap(x, y)))) {
world.setForeMap(x, y, world.getForeMap(x, y) + 1);
}
if (world.getForeMap(x, y) > 63) world.setForeMap(x, y, 0);
if (world.getForeMap(x, y) == 8 || world.getForeMap(x, y) == 60) {
if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 61 && world.getForeMap(x, y + 1) <= 63) ||
- (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) {
+ (!GameItems.getBlock(world.getForeMap(x, y + 1)).coll && !GameItems.isFluid(world.getForeMap(x, y + 1)))) {
world.setForeMap(x, y + 1, 60);
updateBlock(x, y + 2);
- } else if (Items.isLava(world.getForeMap(x, y + 1))) {
+ } else if (GameItems.isLava(world.getForeMap(x, y + 1))) {
if (world.getForeMap(x, y + 1) > 9) world.setForeMap(x, y + 1, 4);
else world.setForeMap(x, y + 1, 68);
- } else if (Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) {
+ } else if (GameItems.getBlock(world.getForeMap(x, y + 1)).coll) {
if (world.getForeMap(x + 1, y) == 0 ||
- (!Items.blocks.getValueAt(world.getForeMap(x + 1, y)).coll && !Items.isFluid(world.getForeMap(x + 1, y))) ||
- (Items.isWater(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 61)) {
+ (!GameItems.getBlock(world.getForeMap(x + 1, y)).coll && !GameItems.isFluid(world.getForeMap(x + 1, y))) ||
+ (GameItems.isWater(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 61)) {
world.setForeMap(x + 1, y, 61);
updateBlock(x + 1, y + 1);
- } else if (Items.isLava(world.getForeMap(x + 1, y))) {
+ } else if (GameItems.isLava(world.getForeMap(x + 1, y))) {
if (world.getForeMap(x + 1, y) > 9) world.setForeMap(x + 1, y, 4);
else world.setForeMap(x + 1, y, 68);
} else if (world.getForeMap(x + 1, y) == 61 && (world.getForeMap(x + 2, y) == 8 || world.getForeMap(x + 2, y) == 60))
world.setForeMap(x + 1, y, 8);
if (world.getForeMap(x - 1, y) == 0 ||
- (!Items.blocks.getValueAt(world.getForeMap(x - 1, y)).coll && !Items.isFluid(world.getForeMap(x - 1, y))) ||
- (Items.isWater(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 61)) {
+ (!GameItems.getBlock(world.getForeMap(x - 1, y)).coll && !GameItems.isFluid(world.getForeMap(x - 1, y))) ||
+ (GameItems.isWater(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 61)) {
world.setForeMap(x - 1, y, 61);
updateBlock(x - 1, y + 1);
- } else if (Items.isLava(world.getForeMap(x - 1, y))) {
+ } else if (GameItems.isLava(world.getForeMap(x - 1, y))) {
if (world.getForeMap(x - 1, y) > 9) world.setForeMap(x - 1, y, 4);
else world.setForeMap(x - 1, y, 68);
} else if (world.getForeMap(x - 1, y) == 61 && (world.getForeMap(x - 2, y) == 8 || world.getForeMap(x - 2, y) == 60))
}
if (world.getForeMap(x, y) == 61) {
if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 61 && world.getForeMap(x, y + 1) <= 63) ||
- (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) {
+ (!GameItems.getBlock(world.getForeMap(x, y + 1)).coll && !GameItems.isFluid(world.getForeMap(x, y + 1)))) {
world.setForeMap(x, y + 1, 60);
updateBlock(x, y + 2);
- } else if (Items.isLava(world.getForeMap(x, y + 1))) {
+ } else if (GameItems.isLava(world.getForeMap(x, y + 1))) {
if (world.getForeMap(x, y + 1) > 9) world.setForeMap(x, y + 1, 4);
else world.setForeMap(x, y + 1, 68);
- } else if (Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) {
+ } else if (GameItems.getBlock(world.getForeMap(x, y + 1)).coll) {
if (world.getForeMap(x + 1, y) == 0 ||
- (!Items.blocks.getValueAt(world.getForeMap(x + 1, y)).coll && !Items.isFluid(world.getForeMap(x + 1, y))) ||
- (Items.isWater(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 62)) {
+ (!GameItems.getBlock(world.getForeMap(x + 1, y)).coll && !GameItems.isFluid(world.getForeMap(x + 1, y))) ||
+ (GameItems.isWater(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 62)) {
world.setForeMap(x + 1, y, 62);
updateBlock(x + 1, y + 1);
- } else if (Items.isLava(world.getForeMap(x + 1, y))) {
+ } else if (GameItems.isLava(world.getForeMap(x + 1, y))) {
if (world.getForeMap(x + 1, y) > 9) world.setForeMap(x + 1, y, 4);
else world.setForeMap(x + 1, y, 68);
}
if (world.getForeMap(x - 1, y) == 0 ||
- (!Items.blocks.getValueAt(world.getForeMap(x - 1, y)).coll && !Items.isFluid(world.getForeMap(x - 1, y))) ||
- (Items.isWater(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 62)) {
+ (!GameItems.getBlock(world.getForeMap(x - 1, y)).coll && !GameItems.isFluid(world.getForeMap(x - 1, y))) ||
+ (GameItems.isWater(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 62)) {
world.setForeMap(x - 1, y, 62);
updateBlock(x - 1, y + 1);
- } else if (Items.isLava(world.getForeMap(x - 1, y))) {
+ } else if (GameItems.isLava(world.getForeMap(x - 1, y))) {
if (world.getForeMap(x - 1, y) > 9) world.setForeMap(x - 1, y, 4);
else world.setForeMap(x - 1, y, 68);
}
}
if (world.getForeMap(x, y) == 62) {
if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 61 && world.getForeMap(x, y + 1) <= 63) ||
- (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) {
+ (!GameItems.getBlock(world.getForeMap(x, y + 1)).coll && !GameItems.isFluid(world.getForeMap(x, y + 1)))) {
world.setForeMap(x, y + 1, 60);
updateBlock(x, y + 2);
- } else if (Items.isLava(world.getForeMap(x, y + 1))) {
+ } else if (GameItems.isLava(world.getForeMap(x, y + 1))) {
if (world.getForeMap(x, y + 1) > 9) world.setForeMap(x, y + 1, 4);
else world.setForeMap(x, y + 1, 68);
- } else if (Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) {
+ } else if (GameItems.getBlock(world.getForeMap(x, y + 1)).coll) {
if (world.getForeMap(x + 1, y) == 0 ||
- (!Items.blocks.getValueAt(world.getForeMap(x + 1, y)).coll && !Items.isFluid(world.getForeMap(x + 1, y)))) {
+ (!GameItems.getBlock(world.getForeMap(x + 1, y)).coll && !GameItems.isFluid(world.getForeMap(x + 1, y)))) {
world.setForeMap(x + 1, y, 63);
updateBlock(x + 1, y + 1);
- } else if (Items.isLava(world.getForeMap(x + 1, y))) {
+ } else if (GameItems.isLava(world.getForeMap(x + 1, y))) {
if (world.getForeMap(x + 1, y) > 9) world.setForeMap(x + 1, y, 4);
else world.setForeMap(x + 1, y, 68);
}
if (world.getForeMap(x - 1, y) == 0 ||
- (!Items.blocks.getValueAt(world.getForeMap(x - 1, y)).coll && !Items.isFluid(world.getForeMap(x - 1, y)))) {
+ (!GameItems.getBlock(world.getForeMap(x - 1, y)).coll && !GameItems.isFluid(world.getForeMap(x - 1, y)))) {
world.setForeMap(x - 1, y, 63);
updateBlock(x - 1, y + 1);
- } else if (Items.isLava(world.getForeMap(x - 1, y))) {
+ } else if (GameItems.isLava(world.getForeMap(x - 1, y))) {
if (world.getForeMap(x - 1, y) > 9) world.setForeMap(x - 1, y, 4);
else world.setForeMap(x - 1, y, 68);
}
}
if (world.getForeMap(x, y) == 63) {
if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 61 && world.getForeMap(x, y + 1) <= 63) ||
- (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) {
+ (!GameItems.getBlock(world.getForeMap(x, y + 1)).coll && !GameItems.isFluid(world.getForeMap(x, y + 1)))) {
world.setForeMap(x, y + 1, 60);
updateBlock(x, y + 2);
- } else if (Items.isLava(world.getForeMap(x, y + 1))) {
+ } else if (GameItems.isLava(world.getForeMap(x, y + 1))) {
if (world.getForeMap(x, y + 1) > 9) world.setForeMap(x, y + 1, 4);
else world.setForeMap(x, y + 1, 68);
}
return;
}
- if (Items.isLava(world.getForeMap(x, y)) && world.getForeMap(x, y) != 9) {
+ if (GameItems.isLava(world.getForeMap(x, y)) && world.getForeMap(x, y) != 9) {
if (world.getForeMap(x, y) == 64) {
- if (!Items.isLava(world.getForeMap(x, y - 1)))
+ if (!GameItems.isLava(world.getForeMap(x, y - 1)))
world.setForeMap(x, y, world.getForeMap(x, y) + 1);
- } else if ((!Items.isLava(world.getForeMap(x, y - 1))) &&
- (!Items.isLava(world.getForeMap(x - 1, y)) ||
- (Items.isLava(world.getForeMap(x, y)) && world.getForeMap(x - 1, y) >= world.getForeMap(x, y))) &&
- (!Items.isLava(world.getForeMap(x + 1, y)) ||
- (Items.isLava(world.getForeMap(x, y)) && world.getForeMap(x + 1, y) >= world.getForeMap(x, y)))) {
+ } else if ((!GameItems.isLava(world.getForeMap(x, y - 1))) &&
+ (!GameItems.isLava(world.getForeMap(x - 1, y)) ||
+ (GameItems.isLava(world.getForeMap(x, y)) && world.getForeMap(x - 1, y) >= world.getForeMap(x, y))) &&
+ (!GameItems.isLava(world.getForeMap(x + 1, y)) ||
+ (GameItems.isLava(world.getForeMap(x, y)) && world.getForeMap(x + 1, y) >= world.getForeMap(x, y)))) {
world.setForeMap(x, y, world.getForeMap(x, y) + 1);
}
if (world.getForeMap(x, y) > 67) world.setForeMap(x, y, 0);
if (world.getForeMap(x, y) == 9 || world.getForeMap(x, y) == 64) {
if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 65 && world.getForeMap(x, y + 1) <= 67) ||
- (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) {
+ (!GameItems.getBlock(world.getForeMap(x, y + 1)).coll && !GameItems.isFluid(world.getForeMap(x, y + 1)))) {
world.setForeMap(x, y + 1, 64);
updateBlock(x, y + 2);
- } else if (Items.isWater(world.getForeMap(x, y + 1))) {
+ } else if (GameItems.isWater(world.getForeMap(x, y + 1))) {
world.setForeMap(x, y + 1, 1);
- } else if (Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) {
+ } else if (GameItems.getBlock(world.getForeMap(x, y + 1)).coll) {
if (world.getForeMap(x + 1, y) == 0 ||
- (!Items.blocks.getValueAt(world.getForeMap(x + 1, y)).coll && !Items.isFluid(world.getForeMap(x + 1, y))) ||
- (Items.isLava(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 65)) {
+ (!GameItems.getBlock(world.getForeMap(x + 1, y)).coll && !GameItems.isFluid(world.getForeMap(x + 1, y))) ||
+ (GameItems.isLava(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 65)) {
world.setForeMap(x + 1, y, 65);
updateBlock(x + 1, y + 1);
- } else if (Items.isWater(world.getForeMap(x + 1, y))) {
+ } else if (GameItems.isWater(world.getForeMap(x + 1, y))) {
world.setForeMap(x + 1, y, 1);
}
if (world.getForeMap(x - 1, y) == 0 ||
- (!Items.blocks.getValueAt(world.getForeMap(x - 1, y)).coll && !Items.isFluid(world.getForeMap(x - 1, y))) ||
- (Items.isLava(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 65)) {
+ (!GameItems.getBlock(world.getForeMap(x - 1, y)).coll && !GameItems.isFluid(world.getForeMap(x - 1, y))) ||
+ (GameItems.isLava(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 65)) {
world.setForeMap(x - 1, y, 65);
updateBlock(x - 1, y + 1);
- } else if (Items.isWater(world.getForeMap(x - 1, y))) {
+ } else if (GameItems.isWater(world.getForeMap(x - 1, y))) {
world.setForeMap(x - 1, y, 1);
}
}
}
if (world.getForeMap(x, y) == 65) {
if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 65 && world.getForeMap(x, y + 1) <= 67) ||
- (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) {
+ (!GameItems.getBlock(world.getForeMap(x, y + 1)).coll && !GameItems.isFluid(world.getForeMap(x, y + 1)))) {
world.setForeMap(x, y + 1, 64);
updateBlock(x, y + 2);
- } else if (Items.isWater(world.getForeMap(x, y + 1))) {
+ } else if (GameItems.isWater(world.getForeMap(x, y + 1))) {
world.setForeMap(x, y + 1, 1);
- } else if (Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) {
+ } else if (GameItems.getBlock(world.getForeMap(x, y + 1)).coll) {
if (world.getForeMap(x + 1, y) == 0 ||
- (!Items.blocks.getValueAt(world.getForeMap(x + 1, y)).coll && !Items.isFluid(world.getForeMap(x + 1, y))) ||
- (Items.isLava(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 66)) {
+ (!GameItems.getBlock(world.getForeMap(x + 1, y)).coll && !GameItems.isFluid(world.getForeMap(x + 1, y))) ||
+ (GameItems.isLava(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 66)) {
world.setForeMap(x + 1, y, 66);
updateBlock(x + 1, y + 1);
- } else if (Items.isWater(world.getForeMap(x + 1, y))) {
+ } else if (GameItems.isWater(world.getForeMap(x + 1, y))) {
world.setForeMap(x + 1, y, 1);
}
if (world.getForeMap(x - 1, y) == 0 ||
- (!Items.blocks.getValueAt(world.getForeMap(x - 1, y)).coll && !Items.isFluid(world.getForeMap(x - 1, y))) ||
- (Items.isLava(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 66)) {
+ (!GameItems.getBlock(world.getForeMap(x - 1, y)).coll && !GameItems.isFluid(world.getForeMap(x - 1, y))) ||
+ (GameItems.isLava(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 66)) {
world.setForeMap(x - 1, y, 66);
updateBlock(x - 1, y + 1);
- } else if (Items.isWater(world.getForeMap(x - 1, y))) {
+ } else if (GameItems.isWater(world.getForeMap(x - 1, y))) {
world.setForeMap(x - 1, y, 1);
}
}
}
if (world.getForeMap(x, y) == 66) {
if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 65 && world.getForeMap(x, y + 1) <= 67) ||
- (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) {
+ (!GameItems.getBlock(world.getForeMap(x, y + 1)).coll && !GameItems.isFluid(world.getForeMap(x, y + 1)))) {
world.setForeMap(x, y + 1, 64);
updateBlock(x, y + 2);
- } else if (Items.isWater(world.getForeMap(x, y + 1))) {
+ } else if (GameItems.isWater(world.getForeMap(x, y + 1))) {
world.setForeMap(x, y + 1, 1);
- } else if (Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) {
+ } else if (GameItems.getBlock(world.getForeMap(x, y + 1)).coll) {
if (world.getForeMap(x + 1, y) == 0 ||
- (!Items.blocks.getValueAt(world.getForeMap(x + 1, y)).coll && !Items.isFluid(world.getForeMap(x + 1, y)))) {
+ (!GameItems.getBlock(world.getForeMap(x + 1, y)).coll && !GameItems.isFluid(world.getForeMap(x + 1, y)))) {
world.setForeMap(x + 1, y, 67);
updateBlock(x + 1, y + 1);
- } else if (Items.isWater(world.getForeMap(x + 1, y))) {
+ } else if (GameItems.isWater(world.getForeMap(x + 1, y))) {
world.setForeMap(x + 1, y, 1);
}
if (world.getForeMap(x - 1, y) == 0 ||
- (!Items.blocks.getValueAt(world.getForeMap(x - 1, y)).coll && !Items.isFluid(world.getForeMap(x - 1, y)))) {
+ (!GameItems.getBlock(world.getForeMap(x - 1, y)).coll && !GameItems.isFluid(world.getForeMap(x - 1, y)))) {
world.setForeMap(x - 1, y, 67);
updateBlock(x - 1, y + 1);
- } else if (Items.isWater(world.getForeMap(x - 1, y))) {
+ } else if (GameItems.isWater(world.getForeMap(x - 1, y))) {
world.setForeMap(x - 1, y, 1);
}
}
}
if (world.getForeMap(x, y) == 67) {
if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 65 && world.getForeMap(x, y + 1) <= 67) ||
- (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) {
+ (!GameItems.getBlock(world.getForeMap(x, y + 1)).coll && !GameItems.isFluid(world.getForeMap(x, y + 1)))) {
world.setForeMap(x, y + 1, 64);
updateBlock(x, y + 2);
- } else if (Items.isWater(world.getForeMap(x, y + 1))) {
+ } else if (GameItems.isWater(world.getForeMap(x, y + 1))) {
world.setForeMap(x, y + 1, 1);
}
return;
private void updateBlock(int x, int y) {
if (world.getForeMap(x, y) == 10) {
- if (world.getForeMap(x, y + 1) == 0 || !Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) {
+ if (world.getForeMap(x, y + 1) == 0 || !GameItems.getBlock(world.getForeMap(x, y + 1)).coll) {
world.setForeMap(x, y, 0);
mobs.add(new FallingSand(x * 16, y * 16));
updateBlock(x, y - 1);
}
if (world.getForeMap(x, y) == 11) {
- if (world.getForeMap(x, y + 1) == 0 || !Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) {
+ if (world.getForeMap(x, y + 1) == 0 || !GameItems.getBlock(world.getForeMap(x, y + 1)).coll) {
world.setForeMap(x, y, 0);
mobs.add(new FallingGravel(x * 16, y * 16));
updateBlock(x, y - 1);
}
if (world.getForeMap(x, y) == 59) {
- if (world.getForeMap(x, y + 1) == 0 || !Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) {
+ if (world.getForeMap(x, y + 1) == 0 || !GameItems.getBlock(world.getForeMap(x, y + 1)).coll) {
world.setForeMap(x, y, 0);
updateBlock(x, y - 1);
}
}
if (world.getForeMap(x, y) == 2) {
- if (world.getForeMap(x, y - 1) > 0 && (Items.blocks.getValueAt(world.getForeMap(x, y - 1)).coll ||
- Items.isFluid(world.getForeMap(x, y - 1)))) {
+ if (world.getForeMap(x, y - 1) > 0 && (GameItems.getBlock(world.getForeMap(x, y - 1)).coll ||
+ GameItems.isFluid(world.getForeMap(x, y - 1)))) {
world.setForeMap(x, y, 3);
}
}
}
public void useItem(int x, int y, int id, boolean bg) {
- if (id > 0 && Items.items.get(id).getType() == 0) {
- if (!bg) world.placeToForeground(x, y, Items.items.get(id).getBlock());
- else world.placeToBackground(x, y, Items.items.get(id).getBlock());
+ if (id > 0 && GameItems.getItem(id).getType() == 0) {
+ if (!bg) world.placeToForeground(x, y, GameItems.getItem(id).getBlock());
+ else world.placeToBackground(x, y, GameItems.getItem(id).getBlock());
}
}
if (isTouchDown && touchDownBtn == Input.Buttons.LEFT) {
if (world.getForeMap(curX, curY) > 0 &&
- Items.blocks.getValueAt(world.getForeMap(curX, curY)).getHp() >= 0) {// || world.getBackMap(curX, curY) > 0) {
+ GameItems.getBlock(world.getForeMap(curX, curY)).getHp() >= 0) {// || world.getBackMap(curX, curY) > 0) {
blockDmg++;
- if (blockDmg >= Items.blocks.getValueAt(world.getForeMap(curX, curY)).getHp()) {
- if (Items.blocks.getValueAt(world.getForeMap(curX, curY)).getDrop() > 0)
- drops.add(new Drop(curX * 16 + 4, curY * 16 + 4, Items.blocks.getValueAt(world.getForeMap(curX, curY)).getDrop()));
+ if (blockDmg >= GameItems.getBlock(world.getForeMap(curX, curY)).getHp()) {
+ if (GameItems.getBlock(world.getForeMap(curX, curY)).getDrop() > 0)
+ drops.add(new Drop(curX * 16 + 4, curY * 16 + 4, GameItems.getBlock(world.getForeMap(curX, curY)).getDrop()));
world.placeToForeground(curX, curY, 0);
blockDmg = 0;
}
if (gp.blockDmg > 0) {
spriter.draw(Assets.wreck[
10 * gp.blockDmg /
- Items.blocks.getValueAt(gp.world.getForeMap(gp.curX, gp.curY)).getHp()],
+ GameItems.getBlock(gp.world.getForeMap(gp.curX, gp.curY)).getHp()],
gp.curX * 16 - getCamX(),
gp.curY * 16 - getCamY());
}
if (maxY > gp.world.getHeight()) maxY = gp.world.getHeight();
for (int y = minY; y < maxY; y++) {
for (int x = minX; x < maxX; x++) {
- if ((gp.world.getForeMap(x, y) == 0 || Items.blocks.getValueAt(gp.world.getForeMap(x, y)).tp)
+ if ((gp.world.getForeMap(x, y) == 0 || GameItems.getBlock(gp.world.getForeMap(x, y)).tp)
&& gp.world.getBackMap(x, y) > 0) {
spriter.draw(
- Assets.blockTex[Items.blocks.getValueAt(gp.world.getBackMap(x, y)).getTex()],
+ Assets.blockTex[GameItems.getBlock(gp.world.getBackMap(x, y)).getTex()],
drawX(x), drawY(y));
if (gp.world.getForeMap(x, y) == 0) drawWreck();
Assets.shade.setPosition(drawX(x), drawY(y));
Assets.shade.draw(spriter);
}
- if (gp.world.getForeMap(x, y) > 0 && Items.blocks.getValueAt(gp.world.getForeMap(x, y)).bg) {
+ if (gp.world.getForeMap(x, y) > 0 && GameItems.getBlock(gp.world.getForeMap(x, y)).bg) {
spriter.draw(
- Assets.blockTex[Items.blocks.getValueAt(gp.world.getForeMap(x, y)).getTex()],
+ Assets.blockTex[GameItems.getBlock(gp.world.getForeMap(x, y)).getTex()],
drawX(x), drawY(y));
drawWreck();
}
if (maxY > gp.world.getHeight()) maxY = gp.world.getHeight();
for (int y = minY; y < maxY; y++) {
for (int x = minX; x < maxX; x++) {
- if (gp.world.getForeMap(x, y) > 0 && !Items.blocks.getValueAt(gp.world.getForeMap(x, y)).bg) {
+ if (gp.world.getForeMap(x, y) > 0 && !GameItems.getBlock(gp.world.getForeMap(x, y)).bg) {
spriter.draw(
- Assets.blockTex[Items.blocks.getValueAt(gp.world.getForeMap(x, y)).getTex()],
+ Assets.blockTex[GameItems.getBlock(gp.world.getForeMap(x, y)).getTex()],
drawX(x), drawY(y));
drawWreck();
}
}
private void drawDrop(Drop drop) {
- switch (Items.items.get(drop.getId()).getType()) {
+ switch (GameItems.getItem(drop.getId()).getType()) {
case 0:
- Assets.blockTex[Items.items.get(drop.getId()).getTex()].setPosition(drop.position.x - getCamX() - gp.world.getWidth() * 16, drop.position.y - getCamY());
- Assets.blockTex[Items.items.get(drop.getId()).getTex()].draw(spriter);
- Assets.blockTex[Items.items.get(drop.getId()).getTex()].setPosition(drop.position.x - getCamX(), drop.position.y - getCamY());
- Assets.blockTex[Items.items.get(drop.getId()).getTex()].draw(spriter);
- Assets.blockTex[Items.items.get(drop.getId()).getTex()].setPosition(drop.position.x - getCamX() + gp.world.getWidth() * 16, drop.position.y - getCamY());
- Assets.blockTex[Items.items.get(drop.getId()).getTex()].draw(spriter);
+ Assets.blockTex[GameItems.getItem(drop.getId()).getTex()].setPosition(drop.position.x - getCamX() - gp.world.getWidth() * 16, drop.position.y - getCamY());
+ Assets.blockTex[GameItems.getItem(drop.getId()).getTex()].draw(spriter);
+ Assets.blockTex[GameItems.getItem(drop.getId()).getTex()].setPosition(drop.position.x - getCamX(), drop.position.y - getCamY());
+ Assets.blockTex[GameItems.getItem(drop.getId()).getTex()].draw(spriter);
+ Assets.blockTex[GameItems.getItem(drop.getId()).getTex()].setPosition(drop.position.x - getCamX() + gp.world.getWidth() * 16, drop.position.y - getCamY());
+ Assets.blockTex[GameItems.getItem(drop.getId()).getTex()].draw(spriter);
}
}
pl.position.x - getCamX() - 2, pl.position.y - getCamY() + 8);
//item in hand
if (pl.inventory[gp.invSlot] > 0)
- switch (Items.items.get(pl.inventory[gp.invSlot]).getType()) {
+ switch (GameItems.getItem(pl.inventory[gp.invSlot]).getType()) {
case 0:
- Assets.blockTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].setPosition(
+ Assets.blockTex[GameItems.getItem(pl.inventory[gp.invSlot]).getTex()].setPosition(
pl.position.x - getCamX() - 8 * MathUtils.sin(MathUtils.degRad * Assets.plSprite[0][2].getRotation()),
pl.position.y - getCamY() + 6 + 8 * MathUtils.cos(MathUtils.degRad * Assets.plSprite[0][2].getRotation()));
- Assets.blockTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].draw(spriter);
+ Assets.blockTex[GameItems.getItem(pl.inventory[gp.invSlot]).getTex()].draw(spriter);
break;
default:
- Assets.itemTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].flip((pl.dir == 0), false);
- Assets.itemTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].setRotation(
+ Assets.itemTex[GameItems.getItem(pl.inventory[gp.invSlot]).getTex()].flip((pl.dir == 0), false);
+ Assets.itemTex[GameItems.getItem(pl.inventory[gp.invSlot]).getTex()].setRotation(
-45 + pl.dir * 90 + Assets.plSprite[0][2].getRotation());
- Assets.itemTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].setPosition(
+ Assets.itemTex[GameItems.getItem(pl.inventory[gp.invSlot]).getTex()].setPosition(
pl.position.x - getCamX() - 10 + (12 * pl.dir) - 8 * MathUtils.sin(MathUtils.degRad * Assets.plSprite[0][2].getRotation()),
pl.position.y - getCamY() + 2 + 8 * MathUtils.cos(MathUtils.degRad * Assets.plSprite[0][2].getRotation()));
- Assets.itemTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].draw(spriter);
- Assets.itemTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].flip((pl.dir == 0), false);
+ Assets.itemTex[GameItems.getItem(pl.inventory[gp.invSlot]).getTex()].draw(spriter);
+ Assets.itemTex[GameItems.getItem(pl.inventory[gp.invSlot]).getTex()].flip((pl.dir == 0), false);
break;
}
//front hand
spriter.draw(Assets.creativeScr, x + 156,
y + 18 + (gp.creativeScroll * (72 / gp.maxCreativeScroll)));
for (int i = gp.creativeScroll * 8; i < gp.creativeScroll * 8 + 40; i++) {
- if (i > 0 && i < Items.items.size())
- switch (Items.items.get(i).getType()) {
+ if (i > 0 && i < GameItems.getItemsSize())
+ switch (GameItems.getItem(i).getType()) {
case 0:
- spriter.draw(Assets.blockTex[Items.items.get(i).getTex()],
+ spriter.draw(Assets.blockTex[GameItems.getItem(i).getTex()],
x + 8 + ((i - gp.creativeScroll * 8) % 8) * 18,
y + 18 + ((i - gp.creativeScroll * 8) / 8) * 18);
break;
case 1:
- spriter.draw(Assets.itemTex[Items.items.get(i).getTex()],
+ spriter.draw(Assets.itemTex[GameItems.getItem(i).getTex()],
x + 8 + ((i - gp.creativeScroll * 8) % 8) * 18,
y + 18 + ((i - gp.creativeScroll * 8) / 8) * 18);
break;
}
for (int i = 0; i < 9; i++) {
if (gp.player.inventory[i] > 0)
- switch (Items.items.get(gp.player.inventory[i]).getType()) {
+ switch (GameItems.getItem(gp.player.inventory[i]).getType()) {
case 0:
- spriter.draw(Assets.blockTex[Items.items.get(gp.player.inventory[i]).getTex()],
+ spriter.draw(Assets.blockTex[GameItems.getItem(gp.player.inventory[i]).getTex()],
x + 8 + i * 18, y + Assets.creativeInv.getRegionHeight() - 24);
break;
case 1:
- spriter.draw(Assets.itemTex[Items.items.get(gp.player.inventory[i]).getTex()],
+ spriter.draw(Assets.itemTex[GameItems.getItem(gp.player.inventory[i]).getTex()],
x + 8 + i * 18, y + Assets.creativeInv.getRegionHeight() - 24);
break;
}
spriter.draw(Assets.invBar, getWidth() / 2 - Assets.invBar.getRegionWidth() / 2, 0);
for (int i = 0; i < 9; i++) {
if (gp.player.inventory[i] > 0) {
- switch (Items.items.get(gp.player.inventory[i]).getType()) {
+ switch (GameItems.getItem(gp.player.inventory[i]).getType()) {
case 0:
- spriter.draw(Assets.blockTex[Items.items.get(gp.player.inventory[i]).getTex()],
+ spriter.draw(Assets.blockTex[GameItems.getItem(gp.player.inventory[i]).getTex()],
getWidth() / 2 - Assets.invBar.getRegionWidth() / 2 + 3 + i * 20,
3);
break;
case 1:
- spriter.draw(Assets.itemTex[Items.items.get(gp.player.inventory[i]).getTex()],
+ spriter.draw(Assets.itemTex[GameItems.getItem(gp.player.inventory[i]).getTex()],
getWidth() / 2 - Assets.invBar.getRegionWidth() / 2 + 3 + i * 20,
3);
break;
drawString("Y: " + (int) (gp.player.position.y / 16), 0, 20);
drawString("Mobs: " + gp.mobs.size(), 0, 30);
drawString("Drops: " + gp.drops.size(), 0, 40);
- drawString("Block: " + Items.blocks.getKeyAt(gp.world.getForeMap(gp.curX, gp.curY)), 0, 50);
+ drawString("Block: " + GameItems.getBlockKey(gp.world.getForeMap(gp.curX, gp.curY)), 0, 50);
}
spriter.end();