remove remaining metadata from enums
This commit is contained in:
parent
c376d92790
commit
454e38d1ab
15 changed files with 87 additions and 259 deletions
|
@ -1435,7 +1435,8 @@ public class ClientPlayer implements IClientPlayer
|
||||||
// this.gameController.controller.setCheat(packetIn.getInt() == 1);
|
// this.gameController.controller.setCheat(packetIn.getInt() == 1);
|
||||||
// break;
|
// break;
|
||||||
case SET_WEATHER:
|
case SET_WEATHER:
|
||||||
this.world.setWeather(Weather.getByID(packetIn.getInt()));
|
int id = packetIn.getInt();
|
||||||
|
this.world.setWeather(id >= 0 && id < Weather.values().length ? Weather.values()[id] : Weather.CLEAR);
|
||||||
break;
|
break;
|
||||||
case RAIN_STRENGTH:
|
case RAIN_STRENGTH:
|
||||||
this.world.setRainStrength(packetIn.getFloat(true));
|
this.world.setRainStrength(packetIn.getFloat(true));
|
||||||
|
|
|
@ -300,50 +300,27 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
||||||
|
|
||||||
public static enum EnumPlantType implements Identifyable
|
public static enum EnumPlantType implements Identifyable
|
||||||
{
|
{
|
||||||
SUNFLOWER(0, "sunflower", "Sonnenblume"),
|
SUNFLOWER("sunflower", "Sonnenblume"),
|
||||||
SYRINGA(1, "syringa", "Flieder"),
|
SYRINGA("syringa", "Flieder"),
|
||||||
GRASS(2, "large_tallgrass", "Hohes Gras"),
|
GRASS("large_tallgrass", "Hohes Gras"),
|
||||||
FERN(3, "large_fern", "Großer Farn"),
|
FERN("large_fern", "Großer Farn"),
|
||||||
ROSE(4, "rose_bush", "Rosenstrauch"),
|
ROSE("rose_bush", "Rosenstrauch"),
|
||||||
PAEONIA(5, "paeonia", "Pfingstrose");
|
PAEONIA("paeonia", "Pfingstrose");
|
||||||
|
|
||||||
private static final BlockDoublePlant.EnumPlantType[] META_LOOKUP = new BlockDoublePlant.EnumPlantType[values().length];
|
|
||||||
private final int meta;
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String display;
|
private final String display;
|
||||||
|
|
||||||
// private EnumPlantType(int meta, String name)
|
private EnumPlantType(String name, String display)
|
||||||
// {
|
|
||||||
// this(meta, name, name);
|
|
||||||
// }
|
|
||||||
|
|
||||||
private EnumPlantType(int meta, String name, String display)
|
|
||||||
{
|
{
|
||||||
this.meta = meta;
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.display = display;
|
this.display = display;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMeta()
|
|
||||||
{
|
|
||||||
return this.meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockDoublePlant.EnumPlantType byMetadata(int meta)
|
|
||||||
{
|
|
||||||
if (meta < 0 || meta >= META_LOOKUP.length)
|
|
||||||
{
|
|
||||||
meta = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return META_LOOKUP[meta];
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return this.name;
|
return this.name;
|
||||||
|
@ -353,12 +330,5 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
||||||
{
|
{
|
||||||
return this.display;
|
return this.display;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
for (BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype : values())
|
|
||||||
{
|
|
||||||
META_LOOKUP[blockdoubleplant$enumplanttype.getMeta()] = blockdoubleplant$enumplanttype;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,61 +127,35 @@ public class BlockHugeMushroom extends Block
|
||||||
|
|
||||||
public static enum EnumType implements Identifyable
|
public static enum EnumType implements Identifyable
|
||||||
{
|
{
|
||||||
NORTH_WEST(1, "north_west"),
|
NORTH_WEST("north_west"),
|
||||||
NORTH(2, "north"),
|
NORTH("north"),
|
||||||
NORTH_EAST(3, "north_east"),
|
NORTH_EAST("north_east"),
|
||||||
WEST(4, "west"),
|
WEST("west"),
|
||||||
CENTER(5, "center"),
|
CENTER("center"),
|
||||||
EAST(6, "east"),
|
EAST("east"),
|
||||||
SOUTH_WEST(7, "south_west"),
|
SOUTH_WEST("south_west"),
|
||||||
SOUTH(8, "south"),
|
SOUTH("south"),
|
||||||
SOUTH_EAST(9, "south_east"),
|
SOUTH_EAST("south_east"),
|
||||||
STEM(10, "stem"),
|
STEM("stem"),
|
||||||
ALL_INSIDE(0, "all_inside"),
|
ALL_INSIDE("all_inside"),
|
||||||
ALL_OUTSIDE(14, "all_outside"),
|
ALL_OUTSIDE("all_outside"),
|
||||||
ALL_STEM(15, "all_stem");
|
ALL_STEM("all_stem");
|
||||||
|
|
||||||
private static final BlockHugeMushroom.EnumType[] META_LOOKUP = new BlockHugeMushroom.EnumType[16];
|
|
||||||
private final int meta;
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
private EnumType(int meta, String name)
|
private EnumType(String name)
|
||||||
{
|
{
|
||||||
this.meta = meta;
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMetadata()
|
|
||||||
{
|
|
||||||
return this.meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockHugeMushroom.EnumType byMetadata(int meta)
|
|
||||||
{
|
|
||||||
if (meta < 0 || meta >= META_LOOKUP.length)
|
|
||||||
{
|
|
||||||
meta = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockHugeMushroom.EnumType blockhugemushroom$enumtype = META_LOOKUP[meta];
|
|
||||||
return blockhugemushroom$enumtype == null ? META_LOOKUP[0] : blockhugemushroom$enumtype;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
for (BlockHugeMushroom.EnumType blockhugemushroom$enumtype : values())
|
|
||||||
{
|
|
||||||
META_LOOKUP[blockhugemushroom$enumtype.getMetadata()] = blockhugemushroom$enumtype;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,42 +155,24 @@ public class BlockTallGrass extends BlockBush implements IGrowable
|
||||||
|
|
||||||
public static enum EnumType implements Identifyable
|
public static enum EnumType implements Identifyable
|
||||||
{
|
{
|
||||||
DEAD_BUSH(0, "dead_bush", "Busch"),
|
DEAD_BUSH("dead_bush", "Busch"),
|
||||||
GRASS(1, "tallgrass", "Gras"),
|
GRASS("tallgrass", "Gras"),
|
||||||
FERN(2, "fern", "Farn");
|
FERN("fern", "Farn");
|
||||||
|
|
||||||
private static final BlockTallGrass.EnumType[] META_LOOKUP = new BlockTallGrass.EnumType[values().length];
|
|
||||||
private final int meta;
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String display;
|
private final String display;
|
||||||
|
|
||||||
private EnumType(int meta, String name, String display)
|
private EnumType(String name, String display)
|
||||||
{
|
{
|
||||||
this.meta = meta;
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.display = display;
|
this.display = display;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMeta()
|
|
||||||
{
|
|
||||||
return this.meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockTallGrass.EnumType byMetadata(int meta)
|
|
||||||
{
|
|
||||||
if (meta < 0 || meta >= META_LOOKUP.length)
|
|
||||||
{
|
|
||||||
meta = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return META_LOOKUP[meta];
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return this.name;
|
return this.name;
|
||||||
|
@ -200,12 +182,5 @@ public class BlockTallGrass extends BlockBush implements IGrowable
|
||||||
{
|
{
|
||||||
return this.display;
|
return this.display;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
for (BlockTallGrass.EnumType blocktallgrass$enumtype : values())
|
|
||||||
{
|
|
||||||
META_LOOKUP[blocktallgrass$enumtype.getMeta()] = blocktallgrass$enumtype;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,19 +3,17 @@ package common.block.foliage;
|
||||||
import common.util.Identifyable;
|
import common.util.Identifyable;
|
||||||
|
|
||||||
public enum LeavesType implements Identifyable {
|
public enum LeavesType implements Identifyable {
|
||||||
SPRING(0, "spring", true, "Frühling"),
|
SPRING("spring", true, "Frühling"),
|
||||||
SUMMER(1, "summer", true, "Sommer"),
|
SUMMER("summer", true, "Sommer"),
|
||||||
AUTUMN(2, "autumn", false, "Herbst"),
|
AUTUMN("autumn", false, "Herbst"),
|
||||||
WINTER(3, "winter", false, "Winter"),
|
WINTER("winter", false, "Winter"),
|
||||||
SNOWY(4, "snowy", false, "Beschneit");
|
SNOWY("snowy", false, "Beschneit");
|
||||||
|
|
||||||
private final int index;
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final boolean tint;
|
private final boolean tint;
|
||||||
private final String display;
|
private final String display;
|
||||||
|
|
||||||
private LeavesType(int index, String name, boolean tint, String display) {
|
private LeavesType(String name, boolean tint, String display) {
|
||||||
this.index = index;
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.tint = tint;
|
this.tint = tint;
|
||||||
this.display = display;
|
this.display = display;
|
||||||
|
@ -29,23 +27,14 @@ public enum LeavesType implements Identifyable {
|
||||||
return this.display;
|
return this.display;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIndex() {
|
|
||||||
return this.index;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isTinted() {
|
public boolean isTinted() {
|
||||||
return this.tint;
|
return this.tint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LeavesType getById(int id) {
|
|
||||||
return LeavesType.values()[id % values().length];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LeavesType getByName(String name) {
|
public static LeavesType getByName(String name) {
|
||||||
for(LeavesType type : values()) {
|
for(LeavesType type : values()) {
|
||||||
if(("" + type.getIndex()).equals(name) || type.getName().equalsIgnoreCase(name)) {
|
if(type.getName().equalsIgnoreCase(name))
|
||||||
return type;
|
return type;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,32 +301,24 @@ public class BlockLever extends Block
|
||||||
|
|
||||||
public static enum EnumOrientation implements Identifyable, DirectionVec<EnumOrientation>
|
public static enum EnumOrientation implements Identifyable, DirectionVec<EnumOrientation>
|
||||||
{
|
{
|
||||||
DOWN_X(0, "down_x", Facing.DOWN),
|
DOWN_X("down_x", Facing.DOWN),
|
||||||
EAST(1, "east", Facing.EAST),
|
EAST("east", Facing.EAST),
|
||||||
WEST(2, "west", Facing.WEST),
|
WEST("west", Facing.WEST),
|
||||||
SOUTH(3, "south", Facing.SOUTH),
|
SOUTH("south", Facing.SOUTH),
|
||||||
NORTH(4, "north", Facing.NORTH),
|
NORTH("north", Facing.NORTH),
|
||||||
UP_Z(5, "up_z", Facing.UP),
|
UP_Z("up_z", Facing.UP),
|
||||||
UP_X(6, "up_x", Facing.UP),
|
UP_X("up_x", Facing.UP),
|
||||||
DOWN_Z(7, "down_z", Facing.DOWN);
|
DOWN_Z("down_z", Facing.DOWN);
|
||||||
|
|
||||||
private static final BlockLever.EnumOrientation[] META_LOOKUP = new BlockLever.EnumOrientation[values().length];
|
|
||||||
private final int meta;
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final Facing facing;
|
private final Facing facing;
|
||||||
|
|
||||||
private EnumOrientation(int meta, String name, Facing facing)
|
private EnumOrientation(String name, Facing facing)
|
||||||
{
|
{
|
||||||
this.meta = meta;
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.facing = facing;
|
this.facing = facing;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMetadata()
|
|
||||||
{
|
|
||||||
return this.meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Facing getFacing()
|
public Facing getFacing()
|
||||||
{
|
{
|
||||||
return this.facing;
|
return this.facing;
|
||||||
|
@ -337,16 +329,6 @@ public class BlockLever extends Block
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockLever.EnumOrientation byMetadata(int meta)
|
|
||||||
{
|
|
||||||
if (meta < 0 || meta >= META_LOOKUP.length)
|
|
||||||
{
|
|
||||||
meta = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return META_LOOKUP[meta];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BlockLever.EnumOrientation forFacings(Facing clickedSide, Facing entityFacing)
|
public static BlockLever.EnumOrientation forFacings(Facing clickedSide, Facing entityFacing)
|
||||||
{
|
{
|
||||||
switch (clickedSide)
|
switch (clickedSide)
|
||||||
|
@ -410,12 +392,5 @@ public class BlockLever extends Block
|
||||||
public boolean canApply(EnumOrientation dir) {
|
public boolean canApply(EnumOrientation dir) {
|
||||||
return this.facing.getAxis().isVertical() == dir.facing.getAxis().isVertical();
|
return this.facing.getAxis().isVertical() == dir.facing.getAxis().isVertical();
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
for (BlockLever.EnumOrientation blocklever$enumorientation : values())
|
|
||||||
{
|
|
||||||
META_LOOKUP[blocklever$enumorientation.getMetadata()] = blocklever$enumorientation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,21 +285,21 @@ public class BlockPistonHead extends Block implements Directional
|
||||||
DEFAULT("normal"),
|
DEFAULT("normal"),
|
||||||
STICKY("sticky");
|
STICKY("sticky");
|
||||||
|
|
||||||
private final String VARIANT;
|
private final String name;
|
||||||
|
|
||||||
private EnumPistonType(String name)
|
private EnumPistonType(String name)
|
||||||
{
|
{
|
||||||
this.VARIANT = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return this.VARIANT;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return this.VARIANT;
|
return this.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,36 +237,28 @@ public abstract class BlockRailBase extends Block
|
||||||
|
|
||||||
public static enum EnumRailDirection implements Identifyable, DirectionVec<EnumRailDirection>
|
public static enum EnumRailDirection implements Identifyable, DirectionVec<EnumRailDirection>
|
||||||
{
|
{
|
||||||
NORTH_SOUTH(0, "north_south", Facing.SOUTH, BaseShape.STRAIGHT),
|
NORTH_SOUTH("north_south", Facing.SOUTH, BaseShape.STRAIGHT),
|
||||||
EAST_WEST(1, "east_west", Facing.EAST, BaseShape.STRAIGHT),
|
EAST_WEST("east_west", Facing.EAST, BaseShape.STRAIGHT),
|
||||||
ASCENDING_EAST(2, "ascending_east", Facing.EAST, BaseShape.ASCENDING),
|
ASCENDING_EAST("ascending_east", Facing.EAST, BaseShape.ASCENDING),
|
||||||
ASCENDING_WEST(3, "ascending_west", Facing.WEST, BaseShape.ASCENDING),
|
ASCENDING_WEST("ascending_west", Facing.WEST, BaseShape.ASCENDING),
|
||||||
ASCENDING_NORTH(4, "ascending_north", Facing.NORTH, BaseShape.ASCENDING),
|
ASCENDING_NORTH("ascending_north", Facing.NORTH, BaseShape.ASCENDING),
|
||||||
ASCENDING_SOUTH(5, "ascending_south", Facing.DOWN, BaseShape.ASCENDING),
|
ASCENDING_SOUTH("ascending_south", Facing.DOWN, BaseShape.ASCENDING),
|
||||||
SOUTH_EAST(6, "south_east", Facing.EAST, BaseShape.TURNED),
|
SOUTH_EAST("south_east", Facing.EAST, BaseShape.TURNED),
|
||||||
SOUTH_WEST(7, "south_west", Facing.SOUTH, BaseShape.TURNED),
|
SOUTH_WEST("south_west", Facing.SOUTH, BaseShape.TURNED),
|
||||||
NORTH_WEST(8, "north_west", Facing.NORTH, BaseShape.TURNED),
|
NORTH_WEST("north_west", Facing.NORTH, BaseShape.TURNED),
|
||||||
NORTH_EAST(9, "north_east", Facing.WEST, BaseShape.TURNED);
|
NORTH_EAST("north_east", Facing.WEST, BaseShape.TURNED);
|
||||||
|
|
||||||
private static final BlockRailBase.EnumRailDirection[] META_LOOKUP = new BlockRailBase.EnumRailDirection[values().length];
|
|
||||||
private final int meta;
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final Facing facing;
|
private final Facing facing;
|
||||||
private final BaseShape shape;
|
private final BaseShape shape;
|
||||||
|
|
||||||
private EnumRailDirection(int meta, String name, Facing facing, BaseShape shape)
|
private EnumRailDirection(String name, Facing facing, BaseShape shape)
|
||||||
{
|
{
|
||||||
this.meta = meta;
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.facing = facing;
|
this.facing = facing;
|
||||||
this.shape = shape;
|
this.shape = shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMetadata()
|
|
||||||
{
|
|
||||||
return this.meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return this.name;
|
return this.name;
|
||||||
|
@ -277,16 +269,6 @@ public abstract class BlockRailBase extends Block
|
||||||
return this == ASCENDING_NORTH || this == ASCENDING_EAST || this == ASCENDING_SOUTH || this == ASCENDING_WEST;
|
return this == ASCENDING_NORTH || this == ASCENDING_EAST || this == ASCENDING_SOUTH || this == ASCENDING_WEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockRailBase.EnumRailDirection byMetadata(int meta)
|
|
||||||
{
|
|
||||||
if (meta < 0 || meta >= META_LOOKUP.length)
|
|
||||||
{
|
|
||||||
meta = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return META_LOOKUP[meta];
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return this.name;
|
return this.name;
|
||||||
|
@ -308,13 +290,6 @@ public abstract class BlockRailBase extends Block
|
||||||
public boolean canApply(EnumRailDirection dir) {
|
public boolean canApply(EnumRailDirection dir) {
|
||||||
return this.shape == dir.shape;
|
return this.shape == dir.shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
for (BlockRailBase.EnumRailDirection blockrailbase$enumraildirection : values())
|
|
||||||
{
|
|
||||||
META_LOOKUP[blockrailbase$enumraildirection.getMetadata()] = blockrailbase$enumraildirection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Rail
|
public class Rail
|
||||||
|
|
|
@ -428,7 +428,7 @@ public abstract class EntityCart extends Entity implements IWorldNameable
|
||||||
++this.posY;
|
++this.posY;
|
||||||
}
|
}
|
||||||
|
|
||||||
int[][] aint = matrix[blockrailbase$enumraildirection.getMetadata()];
|
int[][] aint = matrix[blockrailbase$enumraildirection.ordinal()];
|
||||||
double d1 = (double)(aint[1][0] - aint[0][0]);
|
double d1 = (double)(aint[1][0] - aint[0][0]);
|
||||||
double d2 = (double)(aint[1][2] - aint[0][2]);
|
double d2 = (double)(aint[1][2] - aint[0][2]);
|
||||||
double d3 = Math.sqrt(d1 * d1 + d2 * d2);
|
double d3 = Math.sqrt(d1 * d1 + d2 * d2);
|
||||||
|
@ -652,7 +652,7 @@ public abstract class EntityCart extends Entity implements IWorldNameable
|
||||||
p_70495_3_ = (double)(j + 1);
|
p_70495_3_ = (double)(j + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int[][] aint = matrix[blockrailbase$enumraildirection.getMetadata()];
|
int[][] aint = matrix[blockrailbase$enumraildirection.ordinal()];
|
||||||
double d0 = (double)(aint[1][0] - aint[0][0]);
|
double d0 = (double)(aint[1][0] - aint[0][0]);
|
||||||
double d1 = (double)(aint[1][2] - aint[0][2]);
|
double d1 = (double)(aint[1][2] - aint[0][2]);
|
||||||
double d2 = Math.sqrt(d0 * d0 + d1 * d1);
|
double d2 = Math.sqrt(d0 * d0 + d1 * d1);
|
||||||
|
@ -694,7 +694,7 @@ public abstract class EntityCart extends Entity implements IWorldNameable
|
||||||
if (BlockRailBase.isRailBlock(iblockstate))
|
if (BlockRailBase.isRailBlock(iblockstate))
|
||||||
{
|
{
|
||||||
BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty());
|
BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty());
|
||||||
int[][] aint = matrix[blockrailbase$enumraildirection.getMetadata()];
|
int[][] aint = matrix[blockrailbase$enumraildirection.ordinal()];
|
||||||
double d0 = 0.0D;
|
double d0 = 0.0D;
|
||||||
double d1 = (double)i + 0.5D + (double)aint[0][0] * 0.5D;
|
double d1 = (double)i + 0.5D + (double)aint[0][0] * 0.5D;
|
||||||
double d2 = (double)j + 0.0625D + (double)aint[0][1] * 0.5D;
|
double d2 = (double)j + 0.0625D + (double)aint[0][1] * 0.5D;
|
||||||
|
|
|
@ -54,43 +54,35 @@ public class ItemFishFood extends ItemFood
|
||||||
|
|
||||||
public static enum FishType
|
public static enum FishType
|
||||||
{
|
{
|
||||||
COD("cod", 0, "Kabeljau", 2, 5),
|
COD("cod", "Kabeljau", 2, 5),
|
||||||
SALMON("salmon", 1, "Lachs", 2, 6),
|
SALMON("salmon", "Lachs", 2, 6),
|
||||||
CLOWNFISH("clownfish", 2, "Clownfisch", 1),
|
CLOWNFISH("clownfish", "Clownfisch", 1),
|
||||||
PUFFERFISH("pufferfish", 3, "Kugelfisch", 1);
|
PUFFERFISH("pufferfish", "Kugelfisch", 1);
|
||||||
|
|
||||||
private final int meta;
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String display;
|
private final String display;
|
||||||
private final int uncookedHealAmount;
|
private final int uncookedHealAmount;
|
||||||
private final int cookedHealAmount;
|
private final int cookedHealAmount;
|
||||||
private boolean cookable = false;
|
private boolean cookable = false;
|
||||||
|
|
||||||
private FishType(String name, int meta, String display, int uncookedHeal, int cookedHeal)
|
private FishType(String name, String display, int uncookedHeal, int cookedHeal)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.meta = meta;
|
|
||||||
this.display = display;
|
this.display = display;
|
||||||
this.uncookedHealAmount = uncookedHeal;
|
this.uncookedHealAmount = uncookedHeal;
|
||||||
this.cookedHealAmount = cookedHeal;
|
this.cookedHealAmount = cookedHeal;
|
||||||
this.cookable = true;
|
this.cookable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private FishType(String name, int meta, String display, int uncookedHeal)
|
private FishType(String name, String display, int uncookedHeal)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.meta = meta;
|
|
||||||
this.display = display;
|
this.display = display;
|
||||||
this.uncookedHealAmount = uncookedHeal;
|
this.uncookedHealAmount = uncookedHeal;
|
||||||
this.cookedHealAmount = 0;
|
this.cookedHealAmount = 0;
|
||||||
this.cookable = false;
|
this.cookable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMetadata()
|
|
||||||
{
|
|
||||||
return this.meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDisplay()
|
public String getDisplay()
|
||||||
{
|
{
|
||||||
return this.display;
|
return this.display;
|
||||||
|
|
|
@ -110,10 +110,6 @@ public abstract class Util {
|
||||||
public static <T extends Enum> T parseEnum(Class<T> clazz, String str) {
|
public static <T extends Enum> T parseEnum(Class<T> clazz, String str) {
|
||||||
boolean name = Identifyable.class.isAssignableFrom(clazz);
|
boolean name = Identifyable.class.isAssignableFrom(clazz);
|
||||||
T[] values = clazz.getEnumConstants();
|
T[] values = clazz.getEnumConstants();
|
||||||
Integer value;
|
|
||||||
if((value = parseInt(str, 0)) != null && (value >= 0) && (value < values.length)) {
|
|
||||||
return values[value];
|
|
||||||
}
|
|
||||||
int comp;
|
int comp;
|
||||||
int max = 0;
|
int max = 0;
|
||||||
T best = null;
|
T best = null;
|
||||||
|
|
|
@ -74,10 +74,6 @@ public enum Weather {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getID() {
|
|
||||||
return this.ordinal();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
@ -114,22 +110,8 @@ public enum Weather {
|
||||||
return this.fog;
|
return this.fog;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Weather getByID(int id) {
|
|
||||||
if(id >= 0 && id < values().length)
|
|
||||||
return values()[id];
|
|
||||||
return CLEAR;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Weather getByName(String name) {
|
public static Weather getByName(String name) {
|
||||||
return LOOKUP.get(name.toLowerCase());
|
return LOOKUP.get(name.toLowerCase());
|
||||||
// return type == null ? CLEAR : type;
|
|
||||||
// for(Weather weather : values()) {
|
|
||||||
// if(("" + weather.getID()).equals(name) || weather.getName().equalsIgnoreCase(name)) {
|
|
||||||
//// || weather.getName().substring(0, 1).equalsIgnoreCase(name)) {
|
|
||||||
// return weather;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -1008,7 +1008,7 @@ public final class Server implements IThreadListener, Executor {
|
||||||
|
|
||||||
private void updateTimeAndWeatherForPlayer(Player conn, WorldServer world) {
|
private void updateTimeAndWeatherForPlayer(Player conn, WorldServer world) {
|
||||||
conn.sendPacket(new SPacketTimeUpdate(world.getDayTime(), this.getInfo()));
|
conn.sendPacket(new SPacketTimeUpdate(world.getDayTime(), this.getInfo()));
|
||||||
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.SET_WEATHER, world.getWeather().getID()));
|
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.SET_WEATHER, world.getWeather().ordinal()));
|
||||||
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.RAIN_STRENGTH, world.getRainStrength()));
|
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.RAIN_STRENGTH, world.getRainStrength()));
|
||||||
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.DARKNESS, world.getDarkness()));
|
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.DARKNESS, world.getDarkness()));
|
||||||
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.FOG_STRENGTH, world.getFogStrength()));
|
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.FOG_STRENGTH, world.getFogStrength()));
|
||||||
|
|
|
@ -1184,7 +1184,7 @@ public final class WorldServer extends AWorldServer {
|
||||||
this.weather = weather;
|
this.weather = weather;
|
||||||
// this.dataModified = true;
|
// this.dataModified = true;
|
||||||
this.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.SET_WEATHER,
|
this.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.SET_WEATHER,
|
||||||
weather.getID()));
|
weather.ordinal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateWeather(boolean force) {
|
protected void updateWeather(boolean force) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package server.worldgen.foliage;
|
||||||
import common.block.Block;
|
import common.block.Block;
|
||||||
import common.block.Material;
|
import common.block.Material;
|
||||||
import common.block.foliage.BlockHugeMushroom;
|
import common.block.foliage.BlockHugeMushroom;
|
||||||
|
import common.block.foliage.BlockHugeMushroom.EnumType;
|
||||||
import common.init.Blocks;
|
import common.init.Blocks;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.BlockPos;
|
||||||
|
@ -113,28 +114,26 @@ public class WorldGenBigMushroom extends FeatureGenerator
|
||||||
{
|
{
|
||||||
for (int i2 = j1; i2 <= k1; ++i2)
|
for (int i2 = j1; i2 <= k1; ++i2)
|
||||||
{
|
{
|
||||||
int j2 = 5;
|
EnumType dir = EnumType.CENTER;
|
||||||
|
|
||||||
if (l1 == k3)
|
if (l1 == k3)
|
||||||
{
|
{
|
||||||
--j2;
|
dir = EnumType.WEST;
|
||||||
}
|
}
|
||||||
else if (l1 == l3)
|
else if (l1 == l3)
|
||||||
{
|
{
|
||||||
++j2;
|
dir = EnumType.EAST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i2 == j1)
|
if (i2 == j1)
|
||||||
{
|
{
|
||||||
j2 -= 3;
|
dir = dir == EnumType.WEST ? EnumType.NORTH_WEST : (dir == EnumType.EAST ? EnumType.NORTH_EAST : EnumType.NORTH);
|
||||||
}
|
}
|
||||||
else if (i2 == k1)
|
else if (i2 == k1)
|
||||||
{
|
{
|
||||||
j2 += 3;
|
dir = dir == EnumType.WEST ? EnumType.SOUTH_WEST : (dir == EnumType.EAST ? EnumType.SOUTH_EAST : EnumType.SOUTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockHugeMushroom.EnumType blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.byMetadata(j2);
|
|
||||||
|
|
||||||
if (this.mushroomType == Blocks.brown_mushroom_block || l2 < position.getY() + i)
|
if (this.mushroomType == Blocks.brown_mushroom_block || l2 < position.getY() + i)
|
||||||
{
|
{
|
||||||
if ((l1 == k3 || l1 == l3) && (i2 == j1 || i2 == k1))
|
if ((l1 == k3 || l1 == l3) && (i2 == j1 || i2 == k1))
|
||||||
|
@ -144,57 +143,57 @@ public class WorldGenBigMushroom extends FeatureGenerator
|
||||||
|
|
||||||
if (l1 == position.getX() - (j3 - 1) && i2 == j1)
|
if (l1 == position.getX() - (j3 - 1) && i2 == j1)
|
||||||
{
|
{
|
||||||
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.NORTH_WEST;
|
dir = BlockHugeMushroom.EnumType.NORTH_WEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l1 == k3 && i2 == position.getZ() - (j3 - 1))
|
if (l1 == k3 && i2 == position.getZ() - (j3 - 1))
|
||||||
{
|
{
|
||||||
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.NORTH_WEST;
|
dir = BlockHugeMushroom.EnumType.NORTH_WEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l1 == position.getX() + (j3 - 1) && i2 == j1)
|
if (l1 == position.getX() + (j3 - 1) && i2 == j1)
|
||||||
{
|
{
|
||||||
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.NORTH_EAST;
|
dir = BlockHugeMushroom.EnumType.NORTH_EAST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l1 == l3 && i2 == position.getZ() - (j3 - 1))
|
if (l1 == l3 && i2 == position.getZ() - (j3 - 1))
|
||||||
{
|
{
|
||||||
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.NORTH_EAST;
|
dir = BlockHugeMushroom.EnumType.NORTH_EAST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l1 == position.getX() - (j3 - 1) && i2 == k1)
|
if (l1 == position.getX() - (j3 - 1) && i2 == k1)
|
||||||
{
|
{
|
||||||
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.SOUTH_WEST;
|
dir = BlockHugeMushroom.EnumType.SOUTH_WEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l1 == k3 && i2 == position.getZ() + (j3 - 1))
|
if (l1 == k3 && i2 == position.getZ() + (j3 - 1))
|
||||||
{
|
{
|
||||||
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.SOUTH_WEST;
|
dir = BlockHugeMushroom.EnumType.SOUTH_WEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l1 == position.getX() + (j3 - 1) && i2 == k1)
|
if (l1 == position.getX() + (j3 - 1) && i2 == k1)
|
||||||
{
|
{
|
||||||
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.SOUTH_EAST;
|
dir = BlockHugeMushroom.EnumType.SOUTH_EAST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l1 == l3 && i2 == position.getZ() + (j3 - 1))
|
if (l1 == l3 && i2 == position.getZ() + (j3 - 1))
|
||||||
{
|
{
|
||||||
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.SOUTH_EAST;
|
dir = BlockHugeMushroom.EnumType.SOUTH_EAST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockhugemushroom$enumtype == BlockHugeMushroom.EnumType.CENTER && l2 < position.getY() + i)
|
if (dir == BlockHugeMushroom.EnumType.CENTER && l2 < position.getY() + i)
|
||||||
{
|
{
|
||||||
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.ALL_INSIDE;
|
dir = BlockHugeMushroom.EnumType.ALL_INSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (position.getY() >= position.getY() + i - 1 || blockhugemushroom$enumtype != BlockHugeMushroom.EnumType.ALL_INSIDE)
|
if (position.getY() >= position.getY() + i - 1 || dir != BlockHugeMushroom.EnumType.ALL_INSIDE)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = new BlockPos(l1, l2, i2);
|
BlockPos blockpos = new BlockPos(l1, l2, i2);
|
||||||
|
|
||||||
if (!worldIn.getState(blockpos).getBlock().isFullBlock())
|
if (!worldIn.getState(blockpos).getBlock().isFullBlock())
|
||||||
{
|
{
|
||||||
this.setBlockAndNotifyAdequately(worldIn, blockpos, this.mushroomType.getState().withProperty(BlockHugeMushroom.VARIANT, blockhugemushroom$enumtype));
|
this.setBlockAndNotifyAdequately(worldIn, blockpos, this.mushroomType.getState().withProperty(BlockHugeMushroom.VARIANT, dir));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue