Skip to content

Commit

Permalink
Add Red Sandstone
Browse files Browse the repository at this point in the history
  • Loading branch information
Creeperface01 committed Nov 26, 2016
1 parent 966d628 commit 5ba39bd
Show file tree
Hide file tree
Showing 12 changed files with 399 additions and 251 deletions.
26 changes: 12 additions & 14 deletions server/src/main/java/cn/nukkit/block/Block.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ public abstract class Block extends Position implements Metadatable, Cloneable {
public static final int GLASS = 20;
public static final int LAPIS_ORE = 21;
public static final int LAPIS_BLOCK = 22;

public static final int DISPENSER = 23;

public static final int SANDSTONE = 24;
public static final int NOTEBLOCK = 25;
public static final int BED_BLOCK = 26;
Expand All @@ -77,8 +75,10 @@ public abstract class Block extends Position implements Metadatable, Cloneable {
public static final int GOLD_BLOCK = 41;
public static final int IRON_BLOCK = 42;
public static final int DOUBLE_SLAB = 43;
public static final int DOUBLE_STONE_SLAB = 43;
public static final int DOUBLE_SLABS = 43;
public static final int SLAB = 44;
public static final int STONE_SLAB = 44;
public static final int SLABS = 44;
public static final int BRICKS = 45;
public static final int BRICKS_BLOCK = 45;
Expand Down Expand Up @@ -123,7 +123,7 @@ public abstract class Block extends Position implements Metadatable, Cloneable {
public static final int LIT_REDSTONE_ORE = 74;

public static final int REDSTONE_TORCH = 76;

public static final int STONE_BUTTON = 77;
public static final int SNOW = 78;
public static final int SNOW_LAYER = 78;
public static final int ICE = 79;
Expand All @@ -149,10 +149,8 @@ public abstract class Block extends Position implements Metadatable, Cloneable {

public static final int STONE_BRICKS = 98;
public static final int STONE_BRICK = 98;

public static final int BROWN_MUSHROOM_BLOCK = 99;
public static final int RED_MUSHROOM_BLOCK = 100;

public static final int IRON_BAR = 101;
public static final int IRON_BARS = 101;
public static final int GLASS_PANE = 102;
Expand Down Expand Up @@ -202,7 +200,6 @@ public abstract class Block extends Position implements Metadatable, Cloneable {
public static final int JUNGLE_WOODEN_STAIRS = 136;

public static final int BEACON = 138;

public static final int COBBLE_WALL = 139;
public static final int STONE_WALL = 139;
public static final int COBBLESTONE_WALL = 139;
Expand All @@ -220,7 +217,6 @@ public abstract class Block extends Position implements Metadatable, Cloneable {
public static final int DAYLIGHT_DETECTOR = 151;
public static final int REDSTONE_BLOCK = 152;
public static final int QUARTZ_ORE = 153;

public static final int HOPPER_BLOCK = 154;
public static final int QUARTZ_BLOCK = 155;
public static final int QUARTZ_STAIRS = 156;
Expand All @@ -244,14 +240,11 @@ public abstract class Block extends Position implements Metadatable, Cloneable {
public static final int ACACIA_WOODEN_STAIRS = 163;
public static final int DARK_OAK_WOOD_STAIRS = 164;
public static final int DARK_OAK_WOODEN_STAIRS = 164;

public static final int SLIME_BLOCK = 165;

public static final int IRON_TRAPDOOR = 167;

public static final int PRISMARINE = 168;
public static final int SEA_LANTERN = 169;

public static final int HAY_BALE = 170;
public static final int CARPET = 171;
public static final int HARDENED_CLAY = 172;
Expand All @@ -260,7 +253,10 @@ public abstract class Block extends Position implements Metadatable, Cloneable {
public static final int DOUBLE_PLANT = 175;

public static final int DAYLIGHT_DETECTOR_INVERTED = 178;

public static final int RED_SANDSTONE = 179;
public static final int RED_SANDSTONE_STAIRS = 180;
public static final int DOUBLE_RED_SANDSTONE_SLAB = 181;
public static final int RED_SANDSTONE_SLAB = 182;
public static final int FENCE_GATE_SPRUCE = 183;
public static final int FENCE_GATE_BIRCH = 184;
public static final int FENCE_GATE_JUNGLE = 185;
Expand All @@ -272,7 +268,6 @@ public abstract class Block extends Position implements Metadatable, Cloneable {
public static final int JUNGLE_DOOR_BLOCK = 195;
public static final int ACACIA_DOOR_BLOCK = 196;
public static final int DARK_OAK_DOOR_BLOCK = 197;

public static final int GRASS_PATH = 198;
public static final int ITEM_FRAME_BLOCK = 199;

Expand Down Expand Up @@ -346,7 +341,7 @@ public static void init() {
list[RED_MUSHROOM] = BlockMushroomRed.class;
list[GOLD_BLOCK] = BlockGold.class;
list[IRON_BLOCK] = BlockIron.class;
list[DOUBLE_SLAB] = BlockDoubleSlab.class;
list[DOUBLE_SLAB] = BlockDoubleSlabStone.class;
list[SLAB] = BlockSlab.class;
list[BRICKS_BLOCK] = BlockBricks.class;
list[TNT] = BlockTNT.class;
Expand Down Expand Up @@ -501,10 +496,13 @@ public static void init() {
list[REDSTONE_LAMP] = BlockRedstoneLamp.class;
list[STONE_PRESSURE_PLATE] = BlockPressurePlateStone.class;
list[WOODEN_PRESSURE_PLATE] = BlockPressurePlateWood.class;

list[SKULL_BLOCK] = BlockSkull.class;
list[CAULDRON_BLOCK] = BlockCauldron.class;
list[COCOA] = BlockCocoa.class;
list[RED_SANDSTONE] = BlockRedSandstone.class;
list[RED_SANDSTONE_SLAB] = BlockSlabRedSandstone.class;
list[RED_SANDSTONE_STAIRS] = BlockStairsRedSandstone.class;
list[DOUBLE_RED_SANDSTONE_SLAB] = BlockDoubleSlabRedSandstone.class;

for (int id = 0; id < 256; id++) {
Class c = list[id];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package cn.nukkit.block;

import cn.nukkit.item.Item;
import cn.nukkit.item.ItemTool;

/**
* Created by CreeperFace on 26. 11. 2016.
*/
public class BlockDoubleSlabRedSandstone extends BlockSolid {

public BlockDoubleSlabRedSandstone() {
this(0);
}

public BlockDoubleSlabRedSandstone(int meta) {
super(meta);
}

@Override
public int getId() {
return DOUBLE_SLAB;
}

@Override
public double getResistance() {
return 30;
}

@Override
public double getHardness() {
return 2;
}

@Override
public int getToolType() {
return ItemTool.TYPE_PICKAXE;
}

@Override
public String getName() {
return "Red Sandstone Double Slab";
}

@Override
public int[][] getDrops(Item item) {
if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) {
return new int[][]{
{Item.RED_SANDSTONE_SLAB, this.meta & 0x07, 2}
};
} else {
return new int[0][0];
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* author: MagicDroidX
* Nukkit Project
*/
public class BlockDoubleSlab extends BlockSolid {
public class BlockDoubleSlabStone extends BlockSolid {
public static final int STONE = 0;
public static final int SANDSTONE = 1;
public static final int WOODEN = 2;
Expand All @@ -18,11 +18,11 @@ public class BlockDoubleSlab extends BlockSolid {
public static final int QUARTZ = 6;
public static final int NETHER_BRICK = 7;

public BlockDoubleSlab() {
public BlockDoubleSlabStone() {
this(0);
}

public BlockDoubleSlab(int meta) {
public BlockDoubleSlabStone(int meta) {
super(meta);
}

Expand All @@ -31,7 +31,10 @@ public int getId() {
return DOUBLE_SLAB;
}

//todo hardness and residence
@Override
public double getResistance() {
return getToolType() > ItemTool.TIER_WOODEN ? 30 : 15;
}

@Override
public double getHardness() {
Expand Down Expand Up @@ -72,25 +75,25 @@ public int[][] getDrops(Item item) {
@Override
public BlockColor getColor() {
switch (this.meta & 0x07) {
case BlockDoubleSlab.STONE:
case BlockDoubleSlabStone.STONE:
return BlockColor.STONE_BLOCK_COLOR;
case BlockDoubleSlab.SANDSTONE:
case BlockDoubleSlabStone.SANDSTONE:
return BlockColor.SAND_BLOCK_COLOR;
case BlockDoubleSlab.WOODEN:
case BlockDoubleSlabStone.WOODEN:
return BlockColor.WOOD_BLOCK_COLOR;
case BlockDoubleSlab.COBBLESTONE:
case BlockDoubleSlabStone.COBBLESTONE:
return BlockColor.STONE_BLOCK_COLOR;
case BlockDoubleSlab.BRICK:
case BlockDoubleSlabStone.BRICK:
return BlockColor.STONE_BLOCK_COLOR;
case BlockDoubleSlab.STONE_BRICK:
case BlockDoubleSlabStone.STONE_BRICK:
return BlockColor.STONE_BLOCK_COLOR;
case BlockDoubleSlab.QUARTZ:
case BlockDoubleSlabStone.QUARTZ:
return BlockColor.QUARTZ_BLOCK_COLOR;
case BlockDoubleSlab.NETHER_BRICK:
case BlockDoubleSlabStone.NETHER_BRICK:
return BlockColor.NETHERRACK_BLOCK_COLOR;

default:
return BlockColor.STONE_BLOCK_COLOR; //unreachable
}
}
}
}
46 changes: 46 additions & 0 deletions server/src/main/java/cn/nukkit/block/BlockRedSandstone.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package cn.nukkit.block;

import cn.nukkit.item.Item;
import cn.nukkit.item.ItemTool;

/**
* Created by CreeperFace on 26. 11. 2016.
*/
public class BlockRedSandstone extends BlockSandstone {

public BlockRedSandstone() {
this(0);
}

public BlockRedSandstone(int meta) {
super(meta);
}

@Override
public int getId() {
return RED_SANDSTONE;
}

@Override
public String getName() {
String[] names = new String[]{
"Red Sandstone",
"Chiseled Red Sandstone",
"Smooth Red Sandstone",
""
};

return names[this.meta & 0x03];
}

@Override
public int[][] getDrops(Item item) {
if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_WOODEN) {
return new int[][]{
{Item.RED_SANDSTONE, this.meta & 0x03, 1}
};
} else {
return new int[0][0];
}
}
}
Loading

0 comments on commit 5ba39bd

Please sign in to comment.