block cleanup #7

This commit is contained in:
Sen 2025-06-21 18:58:35 +02:00
parent 7b25e6181e
commit 9de6017751
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
41 changed files with 514 additions and 977 deletions

View file

@ -1,21 +1,14 @@
package common.block.artificial;
import java.util.List;
import common.block.Block;
import common.block.Material;
import common.entity.types.EntityLiving;
import common.init.Blocks;
import common.init.ItemRegistry;
import common.item.CheatTab;
import common.item.Item;
import common.item.ItemStack;
import common.model.Model;
import common.model.ModelProvider;
import common.model.ModelRotation;
import common.properties.Property;
import common.properties.PropertyEnum;
import common.rng.Random;
import common.util.BlockPos;
import common.util.Facing;
import common.util.Identifyable;
@ -24,16 +17,30 @@ import common.world.World;
public class BlockQuartz extends Block
{
public static final PropertyEnum<Facing.Axis> AXIS = PropertyEnum.create("axis", Facing.Axis.class);
public static final BlockQuartz[] QUARTZ = new BlockQuartz[EnumType.values().length * 2];
private final EnumType type;
private final String prefix;
private final boolean dark;
public BlockQuartz(String prefix, EnumType type)
public static BlockQuartz getByType(boolean dark, EnumType type) {
return QUARTZ[(dark ? EnumType.values().length : 0) + type.ordinal()];
}
public BlockQuartz(boolean dark, EnumType type)
{
super(Material.SOLID);
this.type = type;
if(type == EnumType.PILLAR)
this.setDefaultState(this.getBaseState().withProperty(AXIS, Facing.Axis.Y));
this.setTab(CheatTab.BLOCKS);
this.prefix = prefix;
this.dark = dark;
QUARTZ[(dark ? EnumType.values().length : 0) + type.ordinal()] = this;
}
public boolean isDark() {
return this.dark;
}
public EnumType getType() {
@ -42,77 +49,87 @@ public class BlockQuartz extends Block
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
{
if (this.type == EnumType.LINES_Y)
return this.type != EnumType.PILLAR ? super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer) : this.getState().withProperty(AXIS, facing.getAxis());
}
public State getStateFromMeta(int meta)
{
if(this.type != EnumType.PILLAR)
return super.getStateFromMeta(meta);
State state = this.getState();
switch (meta & 3)
{
switch (facing.getAxis())
{
case Z:
return Blocks.quartz_block_z.getState();
case X:
return Blocks.quartz_block_x.getState();
case Y:
default:
return this.getState();
}
}
else
{
return this.getState();
default:
state = state.withProperty(AXIS, Facing.Axis.Y);
break;
case 1:
state = state.withProperty(AXIS, Facing.Axis.X);
break;
case 2:
state = state.withProperty(AXIS, Facing.Axis.Z);
break;
}
return state;
}
public Item getItemDropped(State state, Random rand, int fortune) {
return this.type != BlockQuartz.EnumType.LINES_X && this.type != BlockQuartz.EnumType.LINES_Z ? super.getItemDropped(state, rand, fortune) : ItemRegistry.getItemFromBlock(Blocks.quartz_block_y);
}
public ItemStack createStackedBlock(State state)
public int getMetaFromState(State state)
{
return this.type != BlockQuartz.EnumType.LINES_X && this.type != BlockQuartz.EnumType.LINES_Z ? super.createStackedBlock(state) : new ItemStack(Blocks.quartz_block_y);
if(this.type != EnumType.PILLAR)
return super.getMetaFromState(state);
int meta = 0;
switch (state.getValue(AXIS))
{
case X:
meta = 1;
break;
case Z:
meta = 2;
break;
}
return meta;
}
protected Property[] getProperties()
{
return this.type != EnumType.PILLAR ? super.getProperties() : new Property[] {AXIS};
}
public Model getModel(ModelProvider provider, String name, State state) {
String prefix = this.dark ? "black_" : "";
switch(this.type) {
case DEFAULT:
default:
return provider.getModel(this.prefix + "quartz_block_side").add().nswe().d(this.prefix + "quartz_block_bottom").u(this.prefix + "quartz_top");
return provider.getModel(prefix + "quartz_block_side").add().nswe().d(prefix + "quartz_block_bottom").u(prefix + "quartz_top");
case CHISELED:
return provider.getModel(this.prefix + "quartz_block_chiseled").add().nswe().du(this.prefix + "quartz_block_chiseled_top");
case LINES_X:
return provider.getModel(this.prefix + "quartz_block_lines").add().nswe().du(this.prefix + "quartz_block_lines_top").rotate(ModelRotation.X90_Y90);
case LINES_Y:
return provider.getModel(this.prefix + "quartz_block_lines").add().nswe().du(this.prefix + "quartz_block_lines_top");
case LINES_Z:
return provider.getModel(this.prefix + "quartz_block_lines").add().nswe().du(this.prefix + "quartz_block_lines_top").rotate(ModelRotation.X90_Y0);
return provider.getModel(prefix + "quartz_block_chiseled").add().nswe().du(prefix + "quartz_block_chiseled_top");
case PILLAR:
switch(state.getValue(AXIS)) {
case X:
return provider.getModel(prefix + "quartz_block_lines").add().nswe().du(prefix + "quartz_block_lines_top").rotate(ModelRotation.X90_Y90);
case Y:
default:
return provider.getModel(prefix + "quartz_block_lines").add().nswe().du(prefix + "quartz_block_lines_top");
case Z:
return provider.getModel(prefix + "quartz_block_lines").add().nswe().du(prefix + "quartz_block_lines_top").rotate(ModelRotation.X90_Y0);
}
}
}
public static enum EnumType implements Identifyable
{
DEFAULT(0, "default", "default", null),
CHISELED(1, "chiseled", "chiseled", null),
LINES_Y(2, "lines_y", "lines", Facing.Axis.Y),
LINES_X(3, "lines_x", "lines", Facing.Axis.X),
LINES_Z(4, "lines_z", "lines", Facing.Axis.Z);
DEFAULT("quartz_block", "Quarzblock", "Schwarzer Quarzblock"),
CHISELED("quartz_ornaments", "Gemeißelter Quarzblock", "Schwarzer gemeißelter Quarzblock"),
PILLAR("quartz_pillar", "Quarzsäule", "Schwarze Quarzsäule");
private static final BlockQuartz.EnumType[] META_LOOKUP = new BlockQuartz.EnumType[values().length];
private final int meta;
private final String name;
private final String unlocalizedName;
private final Facing.Axis axis;
private final String displayLight;
private final String displayDark;
private EnumType(int meta, String name, String unlocalizedName, Facing.Axis axis)
private EnumType(String name, String light, String dark)
{
this.meta = meta;
this.name = name;
this.unlocalizedName = unlocalizedName;
this.axis = axis;
}
public int getMetadata()
{
return this.meta;
this.displayLight = light;
this.displayDark = dark;
}
public String toString()
@ -120,31 +137,17 @@ public class BlockQuartz extends Block
return this.name;
}
public static BlockQuartz.EnumType byMetadata(int meta)
{
if (meta < 0 || meta >= META_LOOKUP.length)
{
meta = 0;
}
return META_LOOKUP[meta];
}
public String getName()
{
return this.name;
}
public Facing.Axis getAxis()
{
return this.axis;
public String getDisplayLight() {
return this.displayLight;
}
static {
for (BlockQuartz.EnumType blockquartz$enumtype : values())
{
META_LOOKUP[blockquartz$enumtype.getMetadata()] = blockquartz$enumtype;
}
public String getDisplayDark() {
return this.displayDark;
}
}
}

View file

@ -1,93 +0,0 @@
package common.block.artificial;
import common.block.Block;
import common.block.Material;
import common.item.CheatTab;
import common.model.Model;
import common.model.ModelProvider;
import common.util.Identifyable;
import common.world.State;
public class BlockStoneBrick extends Block
{
private final EnumType type;
public BlockStoneBrick(EnumType type)
{
super(Material.SOLID);
this.type = type;
this.setTab(CheatTab.BLOCKS);
}
public EnumType getType() {
return this.type;
}
public Model getModel(ModelProvider provider, String name, State state) {
return provider.getModel("stonebrick_" + this.type.getTexture()).add().all();
}
public static enum EnumType implements Identifyable
{
DEFAULT("default", 0, "stonebrick", "Steinziegel"),
MOSSY("mossy", 1, "mossy_stonebrick", "Bemooste Steinziegel"),
CRACKED("cracked", 2, "cracked_stonebrick", "Rissige Steinziegel"),
CHISELED("chiseled", 3, "chiseled_stonebrick", "Gemeißelte Steinziegel");
private static final BlockStoneBrick.EnumType[] META_LOOKUP = new BlockStoneBrick.EnumType[values().length];
private final int meta;
private final String texture;
private final String name;
private final String display;
private EnumType(String texture, int meta, String name, String display)
{
this.texture = texture;
this.meta = meta;
this.name = name;
this.display = display;
}
public int getMetadata()
{
return this.meta;
}
public String toString()
{
return this.name;
}
public static BlockStoneBrick.EnumType byMetadata(int meta)
{
if (meta < 0 || meta >= META_LOOKUP.length)
{
meta = 0;
}
return META_LOOKUP[meta];
}
public String getName()
{
return this.name;
}
public String getTexture()
{
return this.texture;
}
public String getDisplay()
{
return this.display;
}
static {
for (BlockStoneBrick.EnumType blockstonebrick$enumtype : values())
{
META_LOOKUP[blockstonebrick$enumtype.getMetadata()] = blockstonebrick$enumtype;
}
}
}
}

View file

@ -1,7 +1,10 @@
package common.block.artificial;
import java.util.List;
import common.block.Block;
import common.block.Material;
import common.collect.Lists;
import common.init.Blocks;
import common.item.CheatTab;
import common.model.Model;
@ -12,7 +15,6 @@ import common.properties.PropertyBool;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.Facing;
import common.util.Identifyable;
import common.world.IBlockAccess;
import common.world.IWorldAccess;
import common.world.State;
@ -25,22 +27,24 @@ public class BlockWall extends Block
public static final PropertyBool EAST = PropertyBool.create("east");
public static final PropertyBool SOUTH = PropertyBool.create("south");
public static final PropertyBool WEST = PropertyBool.create("west");
public static final List<BlockWall> WALLS = Lists.newArrayList();
private final EnumType type;
private final String texture;
public BlockWall(Block modelBlock, EnumType type)
public BlockWall(Block modelBlock, String texture)
{
super(modelBlock.getMaterial());
this.type = type;
this.texture = texture;
this.setDefaultState(this.getBaseState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)));
this.setHardness(modelBlock.getRawHardness());
this.setResistance(modelBlock.getRawResistance() / 3.0F);
this.setStepSound(modelBlock.sound);
this.setTab(CheatTab.BLOCKS);
WALLS.add(this);
}
public EnumType getType() {
return this.type;
public String getTexture() {
return this.texture;
}
public boolean isFullCube()
@ -142,7 +146,7 @@ public class BlockWall extends Block
}
public Model getModel(ModelProvider provider, String name, State state) {
String wall = this.type.getName();
String wall = this.texture;
boolean n = state.getValue(NORTH);
boolean s = state.getValue(SOUTH);
boolean w = state.getValue(WEST);
@ -285,59 +289,4 @@ public class BlockWall extends Block
.e().uv(5, 3, 11, 16)
.rotate(!w ? ModelRotation.X0_Y0 : (!e ? ModelRotation.X0_Y180 : (!s ? ModelRotation.X0_Y270 : ModelRotation.X0_Y90)));
}
public static enum EnumType implements Identifyable
{
NORMAL(0, "cobblestone", "Bruchsteinmauer"),
MOSSY(1, "mossy_cobblestone", "Bemooste Bruchsteinmauer");
private static final BlockWall.EnumType[] META_LOOKUP = new BlockWall.EnumType[values().length];
private final int meta;
private final String name;
private String display;
private EnumType(int meta, String name, String display)
{
this.meta = meta;
this.name = name;
this.display = display;
}
public int getMetadata()
{
return this.meta;
}
public String toString()
{
return this.name;
}
public static BlockWall.EnumType byMetadata(int meta)
{
if (meta < 0 || meta >= META_LOOKUP.length)
{
meta = 0;
}
return META_LOOKUP[meta];
}
public String getName()
{
return this.name;
}
public String getDisplay()
{
return this.display;
}
static {
for (BlockWall.EnumType blockwall$enumtype : values())
{
META_LOOKUP[blockwall$enumtype.getMetadata()] = blockwall$enumtype;
}
}
}
}

View file

@ -39,6 +39,10 @@ public class BlockDoublePlant extends BlockBush implements Rotatable, IGrowable
public static final BlockDoublePlant[] PLANTS = new BlockDoublePlant[EnumPlantType.values().length];
private final EnumPlantType type;
public static BlockDoublePlant getByType(EnumPlantType type) {
return PLANTS[type.ordinal()];
}
public BlockDoublePlant(EnumPlantType type)
{
@ -319,9 +323,9 @@ public class BlockDoublePlant extends BlockBush implements Rotatable, IGrowable
{
SUNFLOWER(0, "sunflower", "Sonnenblume"),
SYRINGA(1, "syringa", "Flieder"),
GRASS(2, "double_grass", "Hohes Gras"),
FERN(3, "double_fern", "Großer Farn"),
ROSE(4, "double_rose", "Rosenstrauch"),
GRASS(2, "large_tallgrass", "Hohes Gras"),
FERN(3, "large_fern", "Großer Farn"),
ROSE(4, "rose_bush", "Rosenstrauch"),
PAEONIA(5, "paeonia", "Pfingstrose");
private static final BlockDoublePlant.EnumPlantType[] META_LOOKUP = new BlockDoublePlant.EnumPlantType[values().length];

View file

@ -21,7 +21,7 @@ import common.vars.Vars;
import common.world.State;
import common.world.AWorldServer;
public abstract class BlockFlower extends BlockBush
public class BlockFlower extends BlockBush
{
public static final BlockFlower[] FLOWERS = new BlockFlower[EnumFlowerType.values().length];
@ -68,7 +68,7 @@ public abstract class BlockFlower extends BlockBush
ORANGE_TULIP("orange_tulip", "Orange Tulpe"),
WHITE_TULIP("white_tulip", "Weiße Tulpe"),
PINK_TULIP("pink_tulip", "Rosa Tulpe"),
OXEYE_DAISY("oxeye_daisy", "Margerite"),
OXEYE_DAISY("daisy", "Margerite"),
BLACK_LOTUS("black_lotus", "Schwarzer Lotus");
private final String name;

View file

@ -82,19 +82,19 @@ public class BlockLog extends BlockRotatedPillar
switch (meta & 3)
{
case 0:
default:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Y);
break;
case 4:
case 1:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.X);
break;
case 8:
case 2:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Z);
break;
default:
case 3:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.NONE);
}
@ -109,7 +109,6 @@ public class BlockLog extends BlockRotatedPillar
public int getMetaFromState(State state)
{
int i = 0;
// i = i | ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata();
switch ((BlockLog.EnumAxis)state.getValue(LOG_AXIS))
{

View file

@ -31,6 +31,10 @@ public class BlockTallGrass extends BlockBush implements IGrowable
public static final BlockTallGrass[] BUSHES = new BlockTallGrass[EnumType.values().length];
private final EnumType type;
public static BlockTallGrass getByType(EnumType type) {
return BUSHES[type.ordinal()];
}
public BlockTallGrass(EnumType type)
{
@ -151,18 +155,20 @@ public class BlockTallGrass extends BlockBush implements IGrowable
public static enum EnumType implements Identifyable
{
DEAD_BUSH(0, "dead_bush"),
GRASS(1, "tall_grass"),
FERN(2, "fern");
DEAD_BUSH(0, "dead_bush", "Busch"),
GRASS(1, "tallgrass", "Gras"),
FERN(2, "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 display;
private EnumType(int meta, String name)
private EnumType(int meta, String name, String display)
{
this.meta = meta;
this.name = name;
this.display = display;
}
public int getMeta()
@ -190,6 +196,11 @@ public class BlockTallGrass extends BlockBush implements IGrowable
return this.name;
}
public String getDisplay()
{
return this.display;
}
static {
for (BlockTallGrass.EnumType blocktallgrass$enumtype : values())
{

View file

@ -1,100 +0,0 @@
package common.block.natural;
import common.block.Block;
import common.block.Material;
import common.init.Blocks;
import common.init.Items;
import common.item.CheatTab;
import common.item.Item;
import common.model.Model;
import common.model.ModelProvider;
import common.properties.Property;
import common.properties.PropertyBool;
import common.rng.Random;
import common.util.BlockPos;
import common.util.Identifyable;
import common.world.IWorldAccess;
import common.world.State;
public class BlockDirt extends Block
{
public static final PropertyBool SNOWY = PropertyBool.create("snowy");
private final DirtType type;
public BlockDirt(DirtType type)
{
super(Material.LOOSE);
this.type = type;
this.setDefaultState(this.getBaseState().withProperty(SNOWY, Boolean.valueOf(false)));
this.setTab(CheatTab.NATURE);
}
public DirtType getType() {
return this.type;
}
public State getActualState(State state, IWorldAccess worldIn, BlockPos pos)
{
if (this.type == DirtType.PODZOL)
{
Block block = worldIn.getState(pos.up()).getBlock();
state = state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer));
}
return state;
}
protected Property[] getProperties()
{
return new Property[] {SNOWY};
}
public Item getItemDropped(State state, Random rand, int fortune) {
return this.type == DirtType.PODZOL ? Items.dirt : super.getItemDropped(state, rand, fortune);
}
public Model getModel(ModelProvider provider, String name, State state) {
switch(this.type) {
case DIRT:
default:
return provider.getModel("dirt").add().all();
case COARSE_DIRT:
return provider.getModel("coarse_dirt").add().all();
case PODZOL:
return state.getValue(SNOWY) ? provider.getModel("grass_side_snowed").add().nswe().d("dirt").u("grass_top") :
provider.getModel("dirt_podzol_side").add().nswe().d("dirt").u("dirt_podzol_top");
}
}
public static enum DirtType implements Identifyable
{
DIRT("dirt", "Erde"),
COARSE_DIRT("coarse_dirt", "Grobe Erde"),
PODZOL("podzol", "Podsol");
private final String name;
private final String display;
private DirtType(String name, String display)
{
this.name = name;
this.display = display;
}
public String getDisplay()
{
return this.display;
}
public String toString()
{
return this.name;
}
public String getName()
{
return this.name;
}
}
}

View file

@ -0,0 +1,44 @@
package common.block.natural;
import common.block.Block;
import common.block.Material;
import common.init.Blocks;
import common.init.Items;
import common.item.CheatTab;
import common.item.Item;
import common.model.Model;
import common.model.ModelProvider;
import common.properties.Property;
import common.properties.PropertyBool;
import common.rng.Random;
import common.util.BlockPos;
import common.world.IWorldAccess;
import common.world.State;
public class BlockPodzol extends Block {
public static final PropertyBool SNOWY = PropertyBool.create("snowy");
public BlockPodzol() {
super(Material.LOOSE);
this.setDefaultState(this.getBaseState().withProperty(SNOWY, Boolean.valueOf(false)));
this.setTab(CheatTab.NATURE);
}
public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) {
Block block = worldIn.getState(pos.up()).getBlock();
return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer));
}
protected Property[] getProperties() {
return new Property[] {SNOWY};
}
public Item getItemDropped(State state, Random rand, int fortune) {
return Items.dirt;
}
public Model getModel(ModelProvider provider, String name, State state) {
return state.getValue(SNOWY) ? provider.getModel("grass_side_snowed").add().nswe().d("dirt").u("grass_top")
: provider.getModel("dirt_podzol_side").add().nswe().d("dirt").u("dirt_podzol_top");
}
}

View file

@ -1,22 +0,0 @@
package common.block.natural;
import common.block.Block;
import common.block.Material;
import common.item.CheatTab;
import common.model.Model;
import common.model.ModelProvider;
import common.world.State;
public class BlockRock extends Block {
private final boolean smooth;
public BlockRock(boolean smooth) {
super(Material.SOLID);
this.smooth = smooth;
this.setTab(CheatTab.NATURE);
}
public Model getModel(ModelProvider provider, String name, State state) {
return provider.getModel(this.smooth ? "smooth_rock" : "rock").add().all();
}
}

View file

@ -1,84 +0,0 @@
package common.block.natural;
import common.block.BlockFalling;
import common.block.Material;
import common.item.CheatTab;
import common.model.Model;
import common.model.ModelProvider;
import common.util.Identifyable;
import common.world.State;
public class BlockSand extends BlockFalling
{
private final EnumType type;
public BlockSand(EnumType type)
{
super(Material.LOOSE);
this.type = type;
this.setTab(CheatTab.NATURE);
}
public EnumType getType() {
return this.type;
}
public Model getModel(ModelProvider provider, String name, State state) {
return provider.getModel(this.type.getName()).add().all();
}
public static enum EnumType implements Identifyable
{
SAND(0, "sand", "Sand"),
RED_SAND(1, "red_sand", "Roter Sand");
private static final BlockSand.EnumType[] META_LOOKUP = new BlockSand.EnumType[values().length];
private final int meta;
private final String name;
private final String display;
private EnumType(int meta, String name, String display)
{
this.meta = meta;
this.name = name;
this.display = display;
}
public int getMetadata()
{
return this.meta;
}
public String toString()
{
return this.name;
}
public static BlockSand.EnumType byMetadata(int meta)
{
if (meta < 0 || meta >= META_LOOKUP.length)
{
meta = 0;
}
return META_LOOKUP[meta];
}
public String getName()
{
return this.name;
}
public String getDisplay()
{
return this.display;
}
static {
for (BlockSand.EnumType blocksand$enumtype : values())
{
META_LOOKUP[blocksand$enumtype.getMetadata()] = blocksand$enumtype;
}
}
}
}

View file

@ -5,89 +5,18 @@ import common.block.Material;
import common.item.CheatTab;
import common.model.Model;
import common.model.ModelProvider;
import common.util.Identifyable;
import common.world.State;
public class BlockSandStone extends Block
{
private final EnumType type;
public class BlockSandStone extends Block {
private final String texture;
public BlockSandStone(EnumType type)
{
super(Material.SOLID);
this.type = type;
this.setTab(CheatTab.NATURE);
}
public EnumType getType() {
return this.type;
}
public BlockSandStone(String texture) {
super(Material.SOLID);
this.texture = texture;
this.setTab(CheatTab.NATURE);
}
public Model getModel(ModelProvider provider, String name, State state) {
switch(this.type) {
case DEFAULT:
default:
return provider.getModel("sandstone_normal").add().nswe().d("sandstone_bottom").u("sandstone_all");
case CHISELED:
return provider.getModel("sandstone_carved").add().nswe().d("sandstone_bottom").u("sandstone_all");
case SMOOTH:
return provider.getModel("sandstone_smooth").add().nswe().d("sandstone_bottom").u("sandstone_all");
}
}
public static enum EnumType implements Identifyable
{
DEFAULT(0, "sandstone", "Sandstein"),
CHISELED(1, "chiseled_sandstone", "Gemeißelter Sandstein"),
SMOOTH(2, "smooth_sandstone", "Glatter Sandstein");
private static final BlockSandStone.EnumType[] META_LOOKUP = new BlockSandStone.EnumType[values().length];
private final int metadata;
private final String name;
private final String display;
private EnumType(int meta, String name, String display)
{
this.metadata = meta;
this.name = name;
this.display = display;
}
public int getMetadata()
{
return this.metadata;
}
public String toString()
{
return this.name;
}
public static BlockSandStone.EnumType byMetadata(int meta)
{
if (meta < 0 || meta >= META_LOOKUP.length)
{
meta = 0;
}
return META_LOOKUP[meta];
}
public String getName()
{
return this.name;
}
public String getDisplay()
{
return this.display;
}
static {
for (BlockSandStone.EnumType blocksandstone$enumtype : values())
{
META_LOOKUP[blocksandstone$enumtype.getMetadata()] = blocksandstone$enumtype;
}
}
}
public Model getModel(ModelProvider provider, String name, State state) {
return provider.getModel("sandstone_" + this.texture).add().nswe().d("sandstone_bottom").u("sandstone_all");
}
}

View file

@ -17,6 +17,7 @@ import common.model.Transforms;
import common.properties.Property;
import common.tileentity.IInteractionObject;
import common.util.BlockPos;
import common.util.ExtMath;
import common.util.Facing;
import common.world.IWorldAccess;
import common.world.State;
@ -24,7 +25,13 @@ import common.world.World;
public class BlockAnvil extends BlockFalling implements Rotatable
{
public static final BlockAnvil[] ANVILS = new BlockAnvil[3];
private final int damage;
public static BlockAnvil getByDamage(int damage) {
return ANVILS[ExtMath.clampi(damage, 0, ANVILS.length - 1)];
}
public BlockAnvil(int damage)
{
@ -33,6 +40,7 @@ public class BlockAnvil extends BlockFalling implements Rotatable
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
this.setLightOpacity(0);
this.setTab(CheatTab.TECHNOLOGY);
ANVILS[damage] = this;
}
public int getAnvilDamage() {
@ -52,6 +60,10 @@ public class BlockAnvil extends BlockFalling implements Rotatable
return false;
}
public boolean isMagnetic() {
return true;
}
/**
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
* IBlockstate

View file

@ -16,6 +16,7 @@ import common.model.ModelProvider;
import common.properties.Property;
import common.properties.PropertyBool;
import common.util.BlockPos;
import common.util.ExtMath;
import common.util.Facing;
import common.world.Explosion;
import common.world.State;
@ -28,6 +29,10 @@ public class BlockTNT extends Block
public static final BlockTNT[] TNTS = new BlockTNT[8];
private final int power;
public static BlockTNT getByPower(int power) {
return TNTS[ExtMath.clampi(power, 0, TNTS.length - 1)];
}
public BlockTNT(int power)
{

View file

@ -7,22 +7,22 @@ import common.util.Identifyable;
public enum DyeColor implements Identifyable
{
WHITE(0, 15, "white", "Weiß", "Weißes", "Weißer", "Weiße", "Knochenmehl", 16777215, TextColor.WHITE),
ORANGE(1, 14, "orange", "Orange", "Oranges", "Oranger", "Orange", "Oranger Farbstoff", 14188339, TextColor.ORANGE),
MAGENTA(2, 13, "magenta", "Magenta", "Magenta", "Magenta", "Magenta", "Magenta Farbstoff", 11685080, TextColor.NEON),
LIGHT_BLUE(3, 12, "light_blue", "Hellblau", "Hellblaues", "Hellblauer", "Hellblaue", "Hellblauer Farbstoff", 6724056, TextColor.BLUE),
YELLOW(4, 11, "yellow", "Gelb", "Gelbes", "Gelber", "Gelbe", "Gelber Farbstoff", 15066419, TextColor.YELLOW),
LIME(5, 10, "lime", "Hellgrün", "Hellgrünes", "Hellgrüner", "Hellgrüne", "Hellgrüner Farbstoff", 8375321, TextColor.GREEN),
PINK(6, 9, "pink", "Rosa", "Rosa", "Rosa", "Rosa", "Rosa Farbstoff", 15892389, TextColor.MAGENTA),
GRAY(7, 8, "gray", "Grau", "Graues", "Grauer", "Graue", "Grauer Farbstoff", 5000268, TextColor.GRAY),
SILVER(8, 7, "silver", "Hellgrau", "Hellgraues", "Hellgrauer", "Hellgraue", "Hellgrauer Farbstoff", 10066329, TextColor.LGRAY),
CYAN(9, 6, "cyan", "Türkis", "Türkises", "Türkiser", "Türkise", "Türkiser Farbstoff", 5013401, TextColor.CYAN),
PURPLE(10, 5, "purple", "Violett", "Violettes", "Violetter", "Violette", "Violetter Farbstoff", 8339378, TextColor.DMAGENTA),
BLUE(11, 4, "blue", "Blau", "Blaues", "Blauer", "Blaue", "Lapislazuli", 3361970, TextColor.MIDNIGHT),
BROWN(12, 3, "brown", "Braun", "Braunes", "Brauner", "Braune", "Kakaobohnen", 6704179, TextColor.ORANGE),
GREEN(13, 2, "green", "Grün", "Grünes", "Grüner", "Grüne", "Kaktusgrün", 6717235, TextColor.DGREEN),
RED(14, 1, "red", "Rot", "Rotes", "Roter", "Rote", "Roter Farbstoff", 10040115, TextColor.DRED),
BLACK(15, 0, "black", "Schwarz", "Schwarzes", "Schwarzer", "Schwarze", "Tintenbeutel", 1644825, TextColor.BLACK);
WHITE(0, 15, "white", "Weiß", "Weißes", "Weißer", "Weiße", "bonemeal", "Knochenmehl", 16777215, TextColor.WHITE),
ORANGE(1, 14, "orange", "Orange", "Oranges", "Oranger", "Orange", null, "Oranger Farbstoff", 14188339, TextColor.ORANGE),
MAGENTA(2, 13, "magenta", "Magenta", "Magenta", "Magenta", "Magenta", null, "Magenta Farbstoff", 11685080, TextColor.NEON),
LIGHT_BLUE(3, 12, "light_blue", "Hellblau", "Hellblaues", "Hellblauer", "Hellblaue", null, "Hellblauer Farbstoff", 6724056, TextColor.BLUE),
YELLOW(4, 11, "yellow", "Gelb", "Gelbes", "Gelber", "Gelbe", null, "Gelber Farbstoff", 15066419, TextColor.YELLOW),
LIME(5, 10, "lime", "Hellgrün", "Hellgrünes", "Hellgrüner", "Hellgrüne", null, "Hellgrüner Farbstoff", 8375321, TextColor.GREEN),
PINK(6, 9, "pink", "Rosa", "Rosa", "Rosa", "Rosa", null, "Rosa Farbstoff", 15892389, TextColor.MAGENTA),
GRAY(7, 8, "gray", "Grau", "Graues", "Grauer", "Graue", null, "Grauer Farbstoff", 5000268, TextColor.GRAY),
SILVER(8, 7, "silver", "Hellgrau", "Hellgraues", "Hellgrauer", "Hellgraue", null, "Hellgrauer Farbstoff", 10066329, TextColor.LGRAY),
CYAN(9, 6, "cyan", "Türkis", "Türkises", "Türkiser", "Türkise", null, "Türkiser Farbstoff", 5013401, TextColor.CYAN),
PURPLE(10, 5, "purple", "Violett", "Violettes", "Violetter", "Violette", null, "Violetter Farbstoff", 8339378, TextColor.DMAGENTA),
BLUE(11, 4, "blue", "Blau", "Blaues", "Blauer", "Blaue", "lapis_lazuli", "Lapislazuli", 3361970, TextColor.MIDNIGHT),
BROWN(12, 3, "brown", "Braun", "Braunes", "Brauner", "Braune", "cocoa", "Kakaobohnen", 6704179, TextColor.ORANGE),
GREEN(13, 2, "green", "Grün", "Grünes", "Grüner", "Grüne", "cactus_green", "Kaktusgrün", 6717235, TextColor.DGREEN),
RED(14, 1, "red", "Rot", "Rotes", "Roter", "Rote", null, "Roter Farbstoff", 10040115, TextColor.DRED),
BLACK(15, 0, "black", "Schwarz", "Schwarzes", "Schwarzer", "Schwarze", "ink_sack", "Tintenbeutel", 1644825, TextColor.BLACK);
private static final Map<String, DyeColor> LOOKUP = Maps.newHashMap();
private static final DyeColor[] META_LOOKUP = new DyeColor[values().length];
@ -36,11 +36,12 @@ public enum DyeColor implements Identifyable
private final String msubject;
private final String fsubject;
private final String dye;
private final String dyeName;
private final int color;
private final TextColor chatColor;
private DyeColor(int meta, int dyeDamage, String name, String display, String subject, String msubject,
String fsubject, String dye, int colorIn, TextColor chatColor)
String fsubject, String dye, String dyeName, int colorIn, TextColor chatColor)
{
this.meta = meta;
this.dyeDamage = dyeDamage;
@ -50,6 +51,7 @@ public enum DyeColor implements Identifyable
this.msubject = msubject;
this.fsubject = fsubject;
this.dye = dye;
this.dyeName = dyeName == null ? name + "_dye" : dyeName;
this.color = colorIn;
this.chatColor = chatColor;
}
@ -135,6 +137,11 @@ public enum DyeColor implements Identifyable
return this.dye;
}
public String getDyeName()
{
return this.dye;
}
static {
for (DyeColor color : values())
{

View file

@ -185,13 +185,13 @@ public class EntityFalling extends Entity implements IObjectData
int j = anvil.getAnvilDamage();
++j;
if (j > 2)
if (j >= BlockAnvil.ANVILS.length)
{
this.canSetAsBlock = true;
}
else
{
this.fallTile = BlockRegistry.getRegisteredBlock("anvil_damaged_" + j).getState().withProperty(BlockAnvil.FACING, this.fallTile.getValue(BlockAnvil.FACING));
this.fallTile = BlockAnvil.getByDamage(j).getState().withProperty(BlockAnvil.FACING, this.fallTile.getValue(BlockAnvil.FACING));
}
}
}

View file

@ -117,25 +117,8 @@ public class EntityDie extends EntityThrowable implements IObjectData
return this.getValue() != 0;
}
public int getStackMeta() {
int meta = 1;
for(int z = 0; z < ItemDie.DIE_SIDES.length; z++) {
if(this.sides == ItemDie.DIE_SIDES[z])
meta = z;
}
return meta;
}
public boolean hasStackMeta() {
for(int z = 0; z < ItemDie.DIE_SIDES.length; z++) {
if(this.sides == ItemDie.DIE_SIDES[z])
return true;
}
return false;
}
public ItemStack getStack() {
return new ItemStack(this.hasStackMeta() ? ItemRegistry.getRegisteredItem("die_" + this.sides) : Items.die_6);
return new ItemStack(ItemDie.getBySides(this.sides));
}
public boolean interactFirst(EntityNPC player)
@ -169,6 +152,6 @@ public class EntityDie extends EntityThrowable implements IObjectData
{
if(this.getValue() == 0)
return null;
return ItemDie.DIE_COLORS[this.getStackMeta()] + "" + this.getValue();
return ItemDie.getBySides(this.sides).getDieColor() + "" + this.getValue();
}
}

View file

@ -24,7 +24,6 @@ import common.block.artificial.BlockSlab;
import common.block.artificial.BlockStainedGlass;
import common.block.artificial.BlockStainedGlassPane;
import common.block.artificial.BlockStairs;
import common.block.artificial.BlockStoneBrick;
import common.block.artificial.BlockTrapDoor;
import common.block.artificial.BlockWall;
import common.block.artificial.BlockWool;
@ -38,6 +37,7 @@ import common.block.foliage.BlockDeadBush;
import common.block.foliage.BlockDoublePlant;
import common.block.foliage.BlockDryLeaves;
import common.block.foliage.BlockFarmland;
import common.block.foliage.BlockFlower;
import common.block.foliage.BlockGrass;
import common.block.foliage.BlockHugeMushroom;
import common.block.foliage.BlockLeaves;
@ -55,6 +55,7 @@ import common.block.foliage.BlockTallGrass;
import common.block.foliage.BlockTianSoil;
import common.block.foliage.BlockVine;
import common.block.foliage.BlockWart;
import common.block.foliage.LeavesType;
import common.block.liquid.BlockDynamicLiquid;
import common.block.liquid.BlockStaticLiquid;
import common.block.natural.BlockBedrock;
@ -62,7 +63,6 @@ import common.block.natural.BlockBlackenedDirt;
import common.block.natural.BlockBlackenedStone;
import common.block.natural.BlockClay;
import common.block.natural.BlockColoredClay;
import common.block.natural.BlockDirt;
import common.block.natural.BlockFire;
import common.block.natural.BlockGlowstone;
import common.block.natural.BlockGravel;
@ -72,9 +72,8 @@ import common.block.natural.BlockIce;
import common.block.natural.BlockObsidian;
import common.block.natural.BlockOre;
import common.block.natural.BlockPackedIce;
import common.block.natural.BlockPodzol;
import common.block.natural.BlockRedstoneOre;
import common.block.natural.BlockRock;
import common.block.natural.BlockSand;
import common.block.natural.BlockSandStone;
import common.block.natural.BlockSlime;
import common.block.natural.BlockSnow;
@ -131,6 +130,7 @@ import common.init.FluidRegistry.LiquidType;
import common.item.CheatTab;
import common.util.ObjectIntIdentityMap;
import common.util.RegistryNamespacedDefaultedByKey;
import common.util.Util;
import common.world.State;
public abstract class BlockRegistry {
@ -236,7 +236,8 @@ public abstract class BlockRegistry {
registerBlock("stone", stone);
registerBlock("bedrock", (new BlockBedrock()).setHardness(1000.0F).setResistance(100000.0F).setStepSound(SoundType.STONE)
.setDisplay("Grundgestein").setTab(CheatTab.NATURE).setMiningLevel(6));
registerBlock("rock", (new BlockRock()).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.STONE).setDisplay("Felsen"));
registerBlock("rock", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.STONE).setDisplay("Felsen").setTab(CheatTab.NATURE));
registerBlock("smooth_rock", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.STONE).setDisplay("Glatter Felsen").setTab(CheatTab.NATURE));
registerBlock("hellrock", (new BlockHellRock()).setHardness(0.4F).setStepSound(SoundType.STONE).setDisplay("Höllenstein"));
registerBlock("cell_rock", (new Block(Material.LOOSE)).setHardness(1.0F).setResistance(3.0F)
.setStepSound(SoundType.SLIME).setDisplay("Zellstein").setTab(CheatTab.NATURE));
@ -245,19 +246,25 @@ public abstract class BlockRegistry {
Block cobblestone = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Bruchstein").setTab(CheatTab.NATURE);
registerBlock("cobblestone", cobblestone);
registerBlock("mossy_cobblestone", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Bemooster Bruchstein").setTab(CheatTab.NATURE));
Block sandstone = (new BlockSandStone()).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Sandstein");
Block mossyCobblestone = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Bemooster Bruchstein").setTab(CheatTab.NATURE);
registerBlock("mossy_cobblestone", mossyCobblestone);
Block sandstone = (new BlockSandStone("normal")).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Sandstein");
registerBlock("sandstone", sandstone);
registerBlock("smooth_sandstone", (new BlockSandStone("smooth")).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Glatter Sandstein"));
registerBlock("carved_sandstone", (new BlockSandStone("carved")).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Gemeißelter Sandstein"));
registerBlock("obsidian", (new BlockObsidian()).setHardness(50.0F).setResistance(2000.0F).setStepSound(SoundType.STONE)
.setDisplay("Obsidian").setMiningLevel(3));
registerBlock("clay", (new BlockClay()).setHardness(0.6F).setStepSound(SoundType.GRAVEL).setDisplay("Ton").setShovelHarvestable());
registerBlock("hardened_clay", (new BlockHardenedClay()).setHardness(1.25F).setResistance(7.0F).setStepSound(SoundType.STONE).setDisplay("Gebrannter Ton"));
registerBlock("stained_hardened_clay", (new BlockColoredClay()).setHardness(1.25F).setResistance(7.0F)
.setStepSound(SoundType.STONE).setDisplay("gefärbter Ton"));
for(DyeColor color : DyeColor.values()) {
registerBlock(color.getName() + "_clay", (new BlockColoredClay(color)).setHardness(1.25F).setResistance(7.0F)
.setStepSound(SoundType.STONE).setDisplay(color.getSubject(null) + " gefärbter Ton"));
}
registerBlock("coal_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F)
.setStepSound(SoundType.STONE).setDisplay("Kohleblock").setTab(CheatTab.NATURE));
registerBlock("sand", (new BlockSand()).setHardness(0.5F).setStepSound(SoundType.SAND).setDisplay("Sand").setShovelHarvestable());
registerBlock("sand", (new BlockFalling(Material.LOOSE)).setHardness(0.5F).setStepSound(SoundType.SAND).setDisplay("Sand").setShovelHarvestable().setTab(CheatTab.NATURE));
registerBlock("red_sand", (new BlockFalling(Material.LOOSE)).setHardness(0.5F).setStepSound(SoundType.SAND).setDisplay("Roter Sand").setShovelHarvestable().setTab(CheatTab.NATURE));
registerBlock("gravel", (new BlockGravel()).setHardness(0.6F).setStepSound(SoundType.GRAVEL).setDisplay("Kies").setShovelHarvestable());
registerBlock("ash", (new Block(Material.LOOSE)).setHardness(0.2F).setStepSound(SoundType.SAND).setDisplay("Asche")
.setTab(CheatTab.NATURE).setShovelHarvestable());
@ -316,8 +323,10 @@ public abstract class BlockRegistry {
registerBlock("dirt", (new BlockDirt()).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Erde").setShovelHarvestable());
registerBlock("dirt", (new Block(Material.LOOSE)).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Erde").setShovelHarvestable().setTab(CheatTab.NATURE));
registerBlock("grass", (new BlockGrass()).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Gras").setShovelHarvestable());
registerBlock("coarse_dirt", (new Block(Material.LOOSE)).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Grobe Erde").setShovelHarvestable().setTab(CheatTab.NATURE));
registerBlock("podzol", (new BlockPodzol()).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Podsol").setShovelHarvestable());
registerBlock("mycelium", (new BlockMycelium()).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Myzel").setShovelHarvestable());
registerBlock("tian", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.STONE)
.setDisplay("Tian").setTab(CheatTab.NATURE));
@ -332,11 +341,18 @@ public abstract class BlockRegistry {
registerBlock("tallgrass", (new BlockTallGrass()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Gras").setShearsEfficiency(0));
for(BlockTallGrass.EnumType type : BlockTallGrass.EnumType.values()) {
registerBlock(type.getName(), (new BlockTallGrass(type)).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay(type.getDisplay()).setShearsEfficiency(0));
}
registerBlock("deadbush", (new BlockDeadBush()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Toter Busch"));
registerBlock("flower", (new BlockBaseFlower()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Blume"));
registerBlock("double_plant", new BlockDoublePlant().setDisplay("Pflanze"));
registerBlock("cactus", (new BlockCactus()).setHardness(0.4F).setStepSound(SoundType.CLOTH).setDisplay("Kaktus"));
for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) {
registerBlock(type.getName(), (new BlockFlower(type)).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay(type.getDisplay()));
}
for(BlockDoublePlant.EnumPlantType type : BlockDoublePlant.EnumPlantType.values()) {
registerBlock(type.getName(), new BlockDoublePlant(type).setDisplay(type.getDisplay()));
}
Block cactus = (new BlockCactus()).setHardness(0.4F).setStepSound(SoundType.CLOTH).setDisplay("Kaktus");
registerBlock("cactus", cactus);
registerBlock("reeds", (new BlockReed()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Zuckerrohr"));
registerBlock("vine", (new BlockVine()).setHardness(0.2F).setStepSound(SoundType.GRASS).setDisplay("Ranken").setShearsEfficiency(0));
registerBlock("waterlily", (new BlockLilyPad()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Seerosenblatt"));
@ -367,7 +383,9 @@ public abstract class BlockRegistry {
registerBlock("dry_leaves", (new BlockDryLeaves()).setDisplay("Vertrocknetes Laub"));
for(WoodType wood : WoodType.values()) {
registerBlock(wood.getName() + "_log", (new BlockLog()).setDisplay(wood.getDisplay() + "holz"));
registerBlock(wood.getName() + "_leaves", (new BlockLeaves(wood)).setDisplay(wood.getDisplay() + "laub"));
for(LeavesType type : LeavesType.values()) {
registerBlock(wood.getName() + "_leaves_" + type.getName(), (new BlockLeaves(wood, type)).setDisplay(wood.getDisplay() + "laub (" + type.getDisplayName() + ")"));
}
registerBlock(wood.getName() + "_sapling", (new BlockSapling(wood)).setHardness(0.0F).setStepSound(SoundType.GRASS)
.setDisplay(wood.getDisplay() + "setzling"));
}
@ -387,15 +405,22 @@ public abstract class BlockRegistry {
.setStepSound(SoundType.STONE).setDisplay("Redstone-Block").setTab(CheatTab.TECHNOLOGY));
registerBlock("glass", (new BlockGlass()).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("Glas"));
registerBlock("stained_glass", (new BlockStainedGlass()).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("gefärbtes Glas"));
for(DyeColor color : DyeColor.values()) {
registerBlock(color.getName() + "_glass", (new BlockStainedGlass(color)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay(color.getSubject(null) + " gefärbtes Glas"));
}
registerBlock("glass_pane", (new BlockPane(Material.TRANSLUCENT, false)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("Glasscheibe"));
registerBlock("stained_glass_pane", (new BlockStainedGlassPane()).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("gefärbte Glasscheibe"));
for(DyeColor color : DyeColor.values()) {
registerBlock(color.getName() + "_glass_pane", (new BlockStainedGlassPane(color)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay(color.getSubject(null) + " gefärbte Glasscheibe"));
}
registerBlock("wool", (new BlockWool()).setHardness(0.8F).setStepSound(SoundType.CLOTH).setDisplay("Wolle")
for(DyeColor color : DyeColor.values()) {
registerBlock("wool", (new BlockWool(color)).setHardness(0.8F).setStepSound(SoundType.CLOTH).setDisplay(color.getSubject(-1) + " Wolle")
.setShearsEfficiency(1));
registerBlock("carpet", (new BlockCarpet()).setHardness(0.1F).setStepSound(SoundType.CLOTH).setDisplay("Teppich").setLightOpacity(0));
}
for(DyeColor color : DyeColor.values()) {
registerBlock("carpet", (new BlockCarpet(color)).setHardness(0.1F).setStepSound(SoundType.CLOTH).setDisplay(color.getSubject(1) + " Teppich").setLightOpacity(0));
}
for(DyeColor color : BlockBed.COLORS) {
registerBlock(color.getName() + "_bed", (new BlockBed(color)).setStepSound(SoundType.WOOD).setHardness(0.2F).setDisplay(color.getSubject(0) + " Bett"));
}
@ -408,7 +433,11 @@ public abstract class BlockRegistry {
registerBlock("cake", (new BlockCake()).setHardness(0.5F).setStepSound(SoundType.CLOTH).setDisplay("Kuchen"));
registerBlock("dragon_egg", (new BlockDragonEgg()).setHardness(3.0F).setResistance(15.0F).setStepSound(SoundType.STONE)
.setLightLevel(0.125F).setDisplay("Drachenei").setTab(CheatTab.DECORATION));
registerBlock("flower_pot", (new BlockFlowerPot()).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf"));
registerBlock("flowerpot", (new BlockFlowerPot(null)).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf"));
registerBlock("flowerpot_cactus", (new BlockFlowerPot(cactus)).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf mit " + cactus.getDisplay()));
for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) {
registerBlock("flowerpot_" + type.getName(), (new BlockFlowerPot(BlockFlower.getByType(type))).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf mit " + type.getDisplay()));
}
registerBlock("sponge", (new Block(Material.LOOSE)).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Schwamm")
.setTab(CheatTab.DECORATION));
registerBlock("skull", (new BlockSkull()).setHardness(1.0F).setStepSound(SoundType.STONE).setDisplay("Schädel").setTab(CheatTab.DECORATION));
@ -460,19 +489,25 @@ public abstract class BlockRegistry {
registerBlock("cobblestone_slab", (new BlockSlab(Material.SOLID, "cobblestone"))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Bruchsteinstufe"));
registerBlock("cobblestone_stairs", (new BlockStairs(cobblestone.getState())).setDisplay("Bruchsteintreppe"));
registerBlock("cobblestone_wall", (new BlockWall(cobblestone)).setDisplay("Bruchsteinmauer"));
registerBlock("cobblestone_wall", (new BlockWall(cobblestone, "cobblestone")).setDisplay("Bruchsteinmauer"));
registerBlock("mossy_cobblestone_wall", (new BlockWall(mossyCobblestone, "mossy_cobblestone")).setDisplay("Bemooste Bruchsteinmauer"));
registerBlock("sandstone_slab", (new BlockSlab(Material.SOLID, "sandstone_normal", "sandstone_bottom", "sandstone_all"))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Sandsteinstufe"));
registerBlock("sandstone_stairs", (new BlockStairs(sandstone.getState().withProperty(BlockSandStone.TYPE, BlockSandStone.EnumType.DEFAULT),
registerBlock("sandstone_stairs", (new BlockStairs(sandstone.getState(),
"sandstone_bottom", "sandstone_all")) // fix type
.setDisplay("Sandsteintreppe"));
Block quartz = (new BlockQuartz("")).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Quarzblock");
registerBlock("quartz_block", quartz);
Block quartz = null;
for(BlockQuartz.EnumType type : BlockQuartz.EnumType.values()) {
Block block = (new BlockQuartz(false, type)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay(type.getDisplayLight());
if(type == BlockQuartz.EnumType.DEFAULT)
quartz = block;
registerBlock(type.getName(), block);
}
registerBlock("quartz_slab", (new BlockSlab(Material.SOLID, "quartz_block_side", "quartz_block_bottom", "quartz_top"))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Quarzstufe"));
registerBlock("quartz_stairs", (new BlockStairs(quartz.getState().withProperty(BlockQuartz.VARIANT, BlockQuartz.EnumType.DEFAULT),
registerBlock("quartz_stairs", (new BlockStairs(quartz.getState(),
"quartz_block_bottom", "quartz_top"))
.setDisplay("Quarztreppe"));
@ -488,12 +523,18 @@ public abstract class BlockRegistry {
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Ziegelstufe"));
registerBlock("brick_stairs", (new BlockStairs(brick.getState())).setDisplay("Ziegeltreppe"));
Block stonebrick = (new BlockStoneBrick()).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Steinziegel");
Block stonebrick = (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Steinziegel").setTab(CheatTab.BLOCKS);
registerBlock("stonebrick", stonebrick);
registerBlock("stonebrick_slab", (new BlockSlab(Material.SOLID, "stonebrick_default"))
registerBlock("mossy_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Bemooste Steinziegel").setTab(CheatTab.BLOCKS));
registerBlock("cracked_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Rissige Steinziegel").setTab(CheatTab.BLOCKS));
registerBlock("carved_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Gemeißelte Steinziegel").setTab(CheatTab.BLOCKS));
registerBlock("stonebrick_slab", (new BlockSlab(Material.SOLID, "stonebrick"))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Steinziegelstufe"));
registerBlock("stonebrick_stairs", (new BlockStairs(stonebrick.getState().withProperty(BlockStoneBrick.VARIANT, BlockStoneBrick.EnumType.DEFAULT)))
registerBlock("stonebrick_stairs", (new BlockStairs(stonebrick.getState()))
.setDisplay("Steinziegeltreppe"));
@ -516,11 +557,16 @@ public abstract class BlockRegistry {
registerBlock("black_brick_fence", (new BlockFence(Material.SOLID, "black_brick")).setHardness(2.0F).setResistance(10.0F)
.setStepSound(SoundType.STONE).setDisplay("Schwarzer Ziegelzaun"));
Block bquartz = (new BlockQuartz("black_")).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Schwarzer Quarzblock");
registerBlock("black_quartz_block", bquartz);
Block bquartz = null;
for(BlockQuartz.EnumType type : BlockQuartz.EnumType.values()) {
Block block = (new BlockQuartz(true, type)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay(type.getDisplayDark());
if(type == BlockQuartz.EnumType.DEFAULT)
bquartz = block;
registerBlock("black_" + type.getName(), block);
}
registerBlock("black_quartz_slab", (new BlockSlab(Material.SOLID, "black_quartz_block_side", "black_quartz_block_bottom", "black_quartz_top"))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Schwarze Quarzstufe"));
registerBlock("black_quartz_stairs", (new BlockStairs(bquartz.getState().withProperty(BlockQuartz.VARIANT, BlockQuartz.EnumType.DEFAULT),
registerBlock("black_quartz_stairs", (new BlockStairs(bquartz.getState(),
"black_quartz_block_bottom", "black_quartz_top"))
.setDisplay("Schwarze Quarztreppe"));
@ -558,7 +604,9 @@ public abstract class BlockRegistry {
.setTab(CheatTab.TECHNOLOGY));
registerBlock("lit_furnace", (new BlockFurnace(true)).setHardness(3.5F).setStepSound(SoundType.STONE).setLightLevel(0.875F)
.setDisplay("Ofen (Gefeuert)").setTab(CheatTab.TECHNOLOGY));
registerBlock("anvil", (new BlockAnvil()).setHardness(5.0F).setStepSound(SoundType.ANVIL).setResistance(2000.0F).setDisplay("Amboss"));
for(int z = 0; z < BlockAnvil.ANVILS.length; z++) {
registerBlock("anvil" + (z == 0 ? "" : "_damaged_" + z), (new BlockAnvil(z)).setHardness(5.0F).setStepSound(SoundType.ANVIL).setResistance(2000.0F).setDisplay((z == 0 ? "" : (z == 1 ? "Leicht beschädigter " : "Stark beschädigter ")) + "Amboss"));
}
registerBlock("enchanting_table", (new BlockEnchantmentTable()).setHardness(5.0F).setResistance(2000.0F).setDisplay("Zaubertisch"));
registerBlock("brewing_stand", (new BlockBrewingStand()).setHardness(0.5F).setLightLevel(0.125F).setDisplay("Braustand"));
registerBlock("cauldron", (new BlockCauldron()).setHardness(2.0F).setDisplay("Kessel"));
@ -573,7 +621,9 @@ public abstract class BlockRegistry {
registerBlock("warp_chest", (new BlockWarpChest()).setHardness(22.5F).setResistance(1000.0F).setStepSound(SoundType.STONE)
.setDisplay("Warptruhe").setLightLevel(0.5F));
registerBlock("tnt", (new BlockTNT()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("TNT"));
for(int z = 0; z < BlockTNT.TNTS.length; z++) {
registerBlock("tnt" + (z == 0 ? "" : "_" + z), (new BlockTNT(z)).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("TNT" + Util.getTierSuffix(z)));
}
registerBlock("nuke", (new BlockNuke()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("T-17"));
registerBlock("piston", (new BlockPistonBase(false)).setDisplay("Kolben"));

View file

@ -147,7 +147,7 @@ public abstract class Blocks {
public static final BlockRailDetector detector_rail = get("detector_rail");
public static final Block diamond_block = get("diamond_block");
public static final BlockOre diamond_ore = get("diamond_ore");
public static final BlockDirt dirt = get("dirt");
public static final Block dirt = get("dirt");
public static final BlockDispenser dispenser = get("dispenser");
public static final BlockDoublePlant double_plant = get("double_plant");
public static final BlockDragonEgg dragon_egg = get("dragon_egg");
@ -311,10 +311,10 @@ public abstract class Blocks {
public static final BlockRedstoneTorch redstone_torch = get("redstone_torch");
public static final BlockReed reeds = get("reeds");
public static final BlockRedstoneRepeater repeater = get("repeater");
public static final BlockRock rock = get("rock");
public static final Block rock = get("rock");
public static final Block ruby_block = get("ruby_block");
public static final BlockOre ruby_ore = get("ruby_ore");
public static final BlockSand sand = get("sand");
public static final BlockFalling sand = get("sand");
public static final BlockSandStone sandstone = get("sandstone");
public static final BlockSlab sandstone_slab = get("sandstone_slab");
public static final BlockStairs sandstone_stairs = get("sandstone_stairs");
@ -354,7 +354,7 @@ public abstract class Blocks {
public static final BlockPressurePlate stone_pressure_plate = get("stone_pressure_plate");
public static final BlockSlab stone_slab = get("stone_slab");
public static final BlockStairs stone_stairs = get("stone_stairs");
public static final BlockStoneBrick stonebrick = get("stonebrick");
public static final Block stonebrick = get("stonebrick");
public static final BlockSlab stonebrick_slab = get("stonebrick_slab");
public static final BlockStairs stonebrick_stairs = get("stonebrick_stairs");
public static final BlockTripWire string = get("string");

View file

@ -12,14 +12,11 @@ import common.block.artificial.BlockCarpet;
import common.block.artificial.BlockQuartz;
import common.block.artificial.BlockStainedGlass;
import common.block.artificial.BlockStainedGlassPane;
import common.block.artificial.BlockStoneBrick;
import common.block.artificial.BlockWall;
import common.block.artificial.BlockWool;
import common.block.foliage.BlockDoublePlant;
import common.block.foliage.BlockFlower;
import common.block.natural.BlockColoredClay;
import common.block.natural.BlockDirt;
import common.block.natural.BlockSand;
import common.block.natural.BlockSandStone;
import common.collect.Lists;
import common.collect.Maps;
@ -1014,7 +1011,7 @@ public abstract class CraftingRegistry
{
if (itemstack2.getItem() instanceof ItemDye dye)
{
list.add(ItemDye.dyeColors[dye.getColor().getDyeDamage()]);
list.add(ItemDye.FIREWORK_COLORS[dye.getColor().getDyeDamage()]);
}
else if (itemstack2.getItem() == Items.glowstone_dust)
{
@ -1068,7 +1065,7 @@ public abstract class CraftingRegistry
{
if (itemstack1.getItem() instanceof ItemDye dye)
{
list1.add(ItemDye.dyeColors[dye.getColor().getDyeDamage()]);
list1.add(ItemDye.FIREWORK_COLORS[dye.getColor().getDyeDamage()]);
}
else if (itemstack1.getItem() == Items.firework_charge)
{

View file

@ -61,12 +61,12 @@ public abstract class DispenserRegistry {
return new EntityEgg(worldIn, position.getX(), position.getY(), position.getZ());
}
});
for(final int sides : ItemDie.DIE_SIDES) {
REGISTRY.putObject(ItemRegistry.getRegisteredItem("die_" + sides), new BehaviorProjectileDispense()
for(final ItemDie die : ItemDie.getDieItems()) {
REGISTRY.putObject(die, new BehaviorProjectileDispense()
{
protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item)
{
return new EntityDie(worldIn, position.getX(), position.getY(), position.getZ(), sides);
return new EntityDie(worldIn, position.getX(), position.getY(), position.getZ(), die.getSides());
}
protected float getInaccuracy()
{

View file

@ -2,25 +2,22 @@ package common.init;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import common.attributes.UsageSlot;
import common.block.Block;
import common.block.artificial.BlockBed;
import common.block.artificial.BlockDoor;
import common.block.artificial.BlockFence;
import common.block.artificial.BlockSlab;
import common.block.artificial.BlockStoneBrick;
import common.block.artificial.BlockStainedGlassPane;
import common.block.artificial.BlockWall;
import common.block.foliage.BlockDoublePlant;
import common.block.foliage.BlockFlower;
import common.block.foliage.BlockLeaves;
import common.block.foliage.BlockSapling;
import common.block.natural.BlockDirt;
import common.block.foliage.BlockTallGrass;
import common.block.natural.BlockOre;
import common.block.natural.BlockSand;
import common.block.natural.BlockSandStone;
import common.block.tech.BlockButton;
import common.block.tech.BlockTNT;
import common.collect.Maps;
import common.collect.Sets;
import common.color.DyeColor;
@ -31,7 +28,6 @@ import common.entity.npc.SpeciesInfo;
import common.item.CheatTab;
import common.item.Item;
import common.item.ItemAmmo;
import common.item.ItemAnvilBlock;
import common.item.ItemAppleGold;
import common.item.ItemArmor;
import common.item.ItemAxe;
@ -50,7 +46,6 @@ import common.item.ItemCamera;
import common.item.ItemCarrotOnAStick;
import common.item.ItemChargedOrb;
import common.item.ItemChest;
import common.item.ItemCloth;
import common.item.ItemColored;
import common.item.ItemDie;
import common.item.ItemDispenser;
@ -80,7 +75,6 @@ import common.item.ItemHugeMushroom;
import common.item.ItemInfoWand;
import common.item.ItemKey;
import common.item.ItemLead;
import common.item.ItemLeaves;
import common.item.ItemLightning;
import common.item.ItemLilyPad;
import common.item.ItemMagnet;
@ -89,7 +83,6 @@ import common.item.ItemMetal;
import common.item.ItemMetalBlock;
import common.item.ItemMinecart;
import common.item.ItemMonsterPlacer;
import common.item.ItemMultiTexture;
import common.item.ItemNameTag;
import common.item.ItemNpcSpawner;
import common.item.ItemNugget;
@ -116,13 +109,14 @@ import common.item.ItemShovel;
import common.item.ItemStack;
import common.item.ItemStick;
import common.item.ItemSword;
import common.item.ItemTNT;
import common.item.ItemTiny;
import common.item.ItemWall;
import common.item.ItemWeatherToken;
import common.potion.Potion;
import common.potion.PotionHelper;
import common.util.Pair;
import common.util.RegistryNamespaced;
import common.util.Util;
import common.world.Weather;
public abstract class ItemRegistry {
@ -198,7 +192,6 @@ public abstract class ItemRegistry {
}
private static void registerTools(ToolMaterial material, String name, String prefix) {
// String loc = name.substring(0, 1).toUpperCase() + name.substring(1);
if(material.hasTools()) {
registerItem(name + "_shovel", (new ItemShovel(material)).setDisplay(prefix + "schaufel"));
registerItem(name + "_pickaxe", (new ItemPickaxe(material)).setDisplay(prefix + "spitzhacke"));
@ -221,131 +214,36 @@ public abstract class ItemRegistry {
}
static void register() {
registerBlock(Blocks.grass, new ItemColored(Blocks.grass, false));
registerBlock(Blocks.dirt, (new ItemMultiTexture(Blocks.dirt, Blocks.dirt, new Function<ItemStack, String>() {
public String apply(ItemStack p_apply_1_) {
return BlockDirt.DirtType.byMetadata(p_apply_1_.getMetadata()).getDisplay();
}
})).setDisplay("Erde"));
// registerBlock(Blocks.planks, (new ItemMultiTexture(Blocks.planks, Blocks.planks, new Function<ItemStack, String>() {
// public String apply(ItemStack p_apply_1_) {
// return BlockPlanks.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName();
// }
// })).setUnlocalizedName("wood"));
// registerBlock(Blocks.sapling, (new ItemMultiTexture(Blocks.sapling, Blocks.sapling, true, new Function<ItemStack, String>() {
// public String apply(ItemStack p_apply_1_) {
// return BlockPlanks.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName();
// }
// })).setUnlocalizedName("sapling"));
registerBlock(Blocks.sand, (new ItemMultiTexture(Blocks.sand, Blocks.sand, new Function<ItemStack, String>() {
public String apply(ItemStack p_apply_1_) {
return BlockSand.EnumType.byMetadata(p_apply_1_.getMetadata()).getDisplay();
}
})).setDisplay("Sand"));
// registerBlock(Blocks.log, (new ItemMultiTexture(Blocks.log, Blocks.log, new Function<ItemStack, String>() {
// public String apply(ItemStack p_apply_1_) {
// return BlockPlanks.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName();
// }
// })).setUnlocalizedName("log"));
// registerBlock(Blocks.log2, (new ItemMultiTexture(Blocks.log2, Blocks.log2, new Function<ItemStack, String>() {
// public String apply(ItemStack p_apply_1_) {
// return BlockPlanks.EnumType.byMetadata(p_apply_1_.getMetadata() + 4).getUnlocalizedName();
// }
// })).setUnlocalizedName("log"));
registerBlock(Blocks.grass, new ItemColored(Blocks.grass));
registerBlock(Blocks.dispenser, new ItemDispenser(Blocks.dispenser));
registerBlock(Blocks.sandstone, (new ItemMultiTexture(Blocks.sandstone, Blocks.sandstone, new Function<ItemStack, String>() {
public String apply(ItemStack p_apply_1_) {
return BlockSandStone.EnumType.byMetadata(p_apply_1_.getMetadata()).getDisplay();
}
})).setDisplay("Sandstein"));
registerFlat(Blocks.golden_rail);
registerFlat(Blocks.detector_rail);
registerBlock(Blocks.dropper, new ItemDispenser(Blocks.dropper));
registerBlock(Blocks.sticky_piston, new ItemPiston(Blocks.sticky_piston));
registerFlat(Blocks.web);
registerBlock(Blocks.tallgrass, (new ItemColored(Blocks.tallgrass, true, "")).setSubtypeNames(new String[] {"Busch", "Gras", "Farn"}));
registerFlat(Blocks.deadbush);
registerBlock(Blocks.piston, new ItemPiston(Blocks.piston));
registerBlock(Blocks.wool, (new ItemCloth(Blocks.wool, -1)).setDisplay("Wolle"));
registerBlock(Blocks.flower, (new ItemMultiTexture(Blocks.flower, Blocks.flower, true, new Function<ItemStack, String>() {
public String apply(ItemStack stack) {
return BlockFlower.EnumFlowerType.getType(BlockFlower.EnumFlowerColor.BASE, stack.getMetadata()).getDisplay();
}
})).setDisplay("Blume"));
registerFlat(Blocks.brown_mushroom);
registerFlat(Blocks.red_mushroom);
registerBlock(Blocks.tnt, new ItemTNT(Blocks.tnt));
registerBlock(Blocks.nuke, new ItemBlock(Blocks.nuke).setColor(TextColor.RED));
registerFlat(Blocks.torch);
registerBlock(Blocks.chest, new ItemChest(Blocks.chest));
registerFlat(Blocks.ladder);
registerFlat(Blocks.rail);
registerFlat(Blocks.lever, "lever");
registerBlock(Blocks.stone_pressure_plate, new ItemPressurePlate(Blocks.stone_pressure_plate));
registerBlock(Blocks.wooden_pressure_plate, new ItemPressurePlate(Blocks.wooden_pressure_plate));
registerFlat(Blocks.redstone_torch);
// registerBlock(Blocks.stone_button, new ItemButton(Blocks.stone_button));
registerBlock(Blocks.snow_layer, new ItemSnow(Blocks.snow_layer));
// registerBlock(Blocks.oak_fence, new ItemFence(Blocks.oak_fence));
// registerBlock(Blocks.spruce_fence, new ItemFence(Blocks.spruce_fence));
// registerBlock(Blocks.birch_fence, new ItemFence(Blocks.birch_fence));
// registerBlock(Blocks.jungle_fence, new ItemFence(Blocks.jungle_fence));
// registerBlock(Blocks.dark_oak_fence, new ItemFence(Blocks.dark_oak_fence));
// registerBlock(Blocks.acacia_fence, new ItemFence(Blocks.acacia_fence));
registerBlock(Blocks.stonebrick, (new ItemMultiTexture(Blocks.stonebrick, Blocks.stonebrick, new Function<ItemStack, String>() {
public String apply(ItemStack p_apply_1_) {
return BlockStoneBrick.EnumType.byMetadata(p_apply_1_.getMetadata()).getDisplay();
}
})).setDisplay("Steinziegel"));
registerBlock(Blocks.brown_mushroom_block, new ItemHugeMushroom(Blocks.brown_mushroom_block));
registerBlock(Blocks.red_mushroom_block, new ItemHugeMushroom(Blocks.red_mushroom_block));
registerFlat(Blocks.iron_bars);
registerFlat(Blocks.glass_pane, "glass");
registerBlock(Blocks.vine, new ItemColored(Blocks.vine, false, ""));
registerBlock(Blocks.vine, new ItemColored(Blocks.vine, ""));
registerBlock(Blocks.waterlily, new ItemLilyPad(Blocks.waterlily));
// registerBlock(Blocks.blood_brick_fence, new ItemFence(Blocks.blood_brick_fence));
// registerBlock(Blocks.black_brick_fence, new ItemFence(Blocks.black_brick_fence));
registerFlat(Blocks.tripwire_hook, "tripwire_hook");
registerBlock(Blocks.cobblestone_wall,
(new ItemWall(Blocks.cobblestone_wall, Blocks.cobblestone_wall, new Function<ItemStack, String>() {
public String apply(ItemStack p_apply_1_) {
return BlockWall.EnumType.byMetadata(p_apply_1_.getMetadata()).getDisplay();
}
})).setDisplay("Bruchsteinmauer"));
// registerBlock(Blocks.wooden_button, new ItemButton(Blocks.wooden_button));
registerBlock(Blocks.anvil, (new ItemAnvilBlock(Blocks.anvil)).setDisplay("Amboss")); // ; , new String[] {"Amboss", "Leicht beschädigter Amboss", "Stark beschädigter Amboss"});
registerBlock(Blocks.trapped_chest, new ItemChest(Blocks.trapped_chest));
registerBlock(Blocks.light_weighted_pressure_plate, new ItemPressurePlate(Blocks.light_weighted_pressure_plate));
registerBlock(Blocks.heavy_weighted_pressure_plate, new ItemPressurePlate(Blocks.heavy_weighted_pressure_plate));
registerFlat(Blocks.hopper, "items/hopper");
registerBlock(Blocks.quartz_block,
(new ItemMultiTexture(Blocks.quartz_block, Blocks.quartz_block, new String[] {"Quarzblock", "Gemeißelter Quarzblock", "Quarzsäule"}))
.setDisplay("Quarzblock"));
registerBlock(Blocks.black_quartz_block,
(new ItemMultiTexture(Blocks.black_quartz_block, Blocks.black_quartz_block, new String[] {"Schwarzer Quarzblock", "Schwarzer gemeißelter Quarzblock", "Schwarze Quarzsäule"}))
.setDisplay("Schwarzer Quarzblock"));
registerFlat(Blocks.activator_rail);
registerBlock(Blocks.dropper, new ItemDispenser(Blocks.dropper));
registerBlock(Blocks.stained_hardened_clay, (new ItemCloth(Blocks.stained_hardened_clay, null)).setDisplay("gefärbter Ton"));
registerBlock(Blocks.carpet, (new ItemCloth(Blocks.carpet, 1)).setDisplay("Teppich"));
registerBlock(Blocks.double_plant, (new ItemDoublePlant(Blocks.double_plant, Blocks.double_plant, new Function<ItemStack, String>() {
public String apply(ItemStack p_apply_1_) {
return BlockDoublePlant.EnumPlantType.byMetadata(p_apply_1_.getMetadata()).getDisplay();
}
})).setDisplay("Pflanze"));
registerBlock(Blocks.stained_glass, (new ItemCloth(Blocks.stained_glass, null)).setDisplay("Glas"));
registerBlock(Blocks.stained_glass_pane, (new ItemCloth(Blocks.stained_glass_pane, null, "glass")).setDisplay("Glasscheibe"));
// registerBlock(Blocks.cherry_fence, new ItemFence(Blocks.cherry_fence));
// registerBlock(Blocks.maple_fence, new ItemFence(Blocks.maple_fence));
registerFlat(Blocks.blue_mushroom);
// registerBlock(Blocks.red_button, new ItemButton(Blocks.red_button));
registerBlock(Blocks.rock, (new ItemMultiTexture(Blocks.rock, Blocks.rock, new Function<ItemStack, String>() {
public String apply(ItemStack stack) {
return stack.getMetadata() == 1 ? "Glatter Felsen" : "Felsen";
}
})).setDisplay("Felsen"));
for(BlockTallGrass.EnumType type : BlockTallGrass.EnumType.values()) {
registerBlock(BlockTallGrass.getByType(type), (new ItemColored(Blocks.tallgrass, "")));
}
for(BlockDoublePlant.EnumPlantType type : BlockDoublePlant.EnumPlantType.values()) {
registerBlock(BlockDoublePlant.getByType(type), new ItemDoublePlant(BlockDoublePlant.getByType(type), type));
}
for(BlockWall wall : BlockWall.WALLS) {
registerBlock(wall, new ItemWall(wall));
}
for(BlockLeaves leaves : BlockLeaves.LEAVES) {
registerBlock(leaves, new ItemLeaves(leaves)); // .setDisplay(BlockRegistry.getNameFromBlock(leaves)));
registerBlock(leaves, new ItemColored(leaves, 8));
}
for(BlockSlab slab : BlockSlab.SLABS) {
registerBlock(slab, new ItemSlab(slab));
@ -356,9 +254,36 @@ public abstract class ItemRegistry {
for(BlockButton button : BlockButton.BUTTONS) {
registerBlock(button, new ItemButton(button));
}
for(int z = 0; z < BlockTNT.TNTS.length; z++) {
registerBlock(BlockTNT.getByPower(z), new ItemBlock(BlockTNT.getByPower(z)).setColor(TextColor.RED));
}
for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) {
registerFlat(BlockFlower.getByType(type));
}
for(BlockStainedGlassPane pane : BlockStainedGlassPane.PANES) {
registerFlat(pane);
}
for(BlockSapling sapling : BlockSapling.SAPLINGS) {
registerFlat(sapling);
}
registerFlat(Blocks.golden_rail);
registerFlat(Blocks.detector_rail);
registerFlat(Blocks.web);
registerFlat(Blocks.deadbush);
registerFlat(Blocks.brown_mushroom);
registerFlat(Blocks.red_mushroom);
registerFlat(Blocks.torch);
registerFlat(Blocks.ladder);
registerFlat(Blocks.rail);
registerFlat(Blocks.redstone_torch);
registerFlat(Blocks.iron_bars);
registerFlat(Blocks.activator_rail);
registerFlat(Blocks.blue_mushroom);
registerFlat(Blocks.lever, "lever");
registerFlat(Blocks.glass_pane, "glass");
registerFlat(Blocks.tripwire_hook, "tripwire_hook");
registerFlat(Blocks.hopper, "items/hopper");
Item bucket = (new ItemBucket(null, false)).setDisplay("Eimer");
@ -375,8 +300,6 @@ public abstract class ItemRegistry {
}
registerItem("milk_bucket", (new ItemBucketMilk()).setDisplay("Milch").setContainerItem(bucket));
// registerItem("painting", (new ItemHangingEntity(EntityPainting.class)).setDisplay("Gemälde"));
// registerItem("item_frame", (new ItemHangingEntity(EntityFrame.class)).setDisplay("Rahmen"));
registerItem("boat", (new ItemBoat()).setDisplay("Boot"));
registerItem("minecart", (new ItemMinecart(EntityCart.EnumMinecartType.RIDEABLE)).setDisplay("Lore"));
registerItem("chest_minecart", (new ItemMinecart(EntityCart.EnumMinecartType.CHEST)).setDisplay("Güterlore"));
@ -400,7 +323,9 @@ public abstract class ItemRegistry {
registerItem("lightning_wand", (new ItemLightning()).setDisplay("Geladenes Zepter"));
registerItem("banhammer", (new ItemBanHammer()).setDisplay("Hammer der Verbannung").setTab(CheatTab.TOOLS));
registerItem("key", (new ItemKey()).setDisplay("Schlüssel").setTab(CheatTab.TOOLS).setMaxAmount(128));
registerItem("die", (new ItemDie()).setDisplay("Würfel").setMaxAmount(128));
for(Pair<Integer, TextColor> sides : ItemDie.DIE_SIDES) {
registerItem("die_" + sides.first(), (new ItemDie(sides.first(), sides.second())).setDisplay("Würfel").setMaxAmount(128));
}
registerItem("chick_magnet", (new ItemMagnet(true)).setDisplay("Kükenmagnet"));
registerItem("magnet", (new ItemMagnet(false)).setDisplay("Magnet"));
registerItem("camera", (new ItemCamera()).setDisplay("Kamera").setTab(CheatTab.TOOLS));
@ -435,11 +360,7 @@ public abstract class ItemRegistry {
registerItem("golden_apple", (new ItemAppleGold(4, false)).setPotionEffect(Potion.REGENERATION, 5, 1, 1.0F)
.setDisplay("Goldener Apfel"));
registerItem((new ItemSign()).setDisplay("Schild"));
// registerItem("oak_door", (new ItemDoor(Blocks.oak_door)).setUnlocalizedName("doorOak"));
// registerItem("water_bucket", (new ItemBucket(Blocks.flowing_water)).setUnlocalizedName("bucketWater").setContainerItem(bucket));
// registerItem("lava_bucket", (new ItemBucket(Blocks.flowing_lava)).setUnlocalizedName("bucketLava").setContainerItem(bucket));
registerItem("saddle", (new ItemSaddle()).setDisplay("Sattel"));
// registerItem("iron_door", (new ItemDoor(Blocks.iron_door)).setUnlocalizedName("doorIron"));
registerItem((new ItemRedstone()).setDisplay("Redstone").setPotionEffect(PotionHelper.redstoneEffect).setMaxAmount(256));
registerItem("snowball", (new ItemSnowball()).setDisplay("Schneeball").setMaxAmount(128));
registerItem("leather", (new Item()).setDisplay("Leder").setTab(CheatTab.MATERIALS));
@ -455,10 +376,18 @@ public abstract class ItemRegistry {
registerItem("fishing_rod", (new ItemFishingRod()).setDisplay("Angel"));
registerItem("glowstone_dust", (new Item()).setDisplay("Glowstonestaub").setPotionEffect(PotionHelper.glowstoneEffect)
.setTab(CheatTab.MATERIALS).setMaxAmount(256));
registerItem("fish", (new ItemFishFood(false)).setDisplay("Fisch"));
registerItem("cooked_fish", (new ItemFishFood(true)).setDisplay("Fisch"));
Item dye = (new ItemDye()).setDisplay("Farbstoff").setMaxAmount(512);
registerItem("dye", dye);
for(ItemFishFood.FishType type : ItemFishFood.FishType.values()) {
registerItem(type.getName(), (new ItemFishFood(false, type)).setDisplay("Fisch"));
if(type.canCook())
registerItem("cooked_" + type.getName(), (new ItemFishFood(true, type)).setDisplay("Fisch"));
}
Item lapis = null;
for(DyeColor color : DyeColor.values()) {
Item dye = (new ItemDye(color)).setDisplay(color.getDyeName()).setMaxAmount(512);
if(color == DyeColor.BLUE)
lapis = dye;
registerItem(color.getDye(), dye);
}
registerItem("bone", (new ItemStick()).setDisplay("Knochen").setTab(CheatTab.MATERIALS).setMaxAmount(128));
registerItem("sugar", (new Item()).setDisplay("Zucker").setPotionEffect(PotionHelper.sugarEffect).setTab(CheatTab.MATERIALS).setMaxAmount(512));
registerItem((new ItemSmallBlock(Blocks.cake)).setMaxAmount(1).setDisplay("Kuchen").setTab(CheatTab.DECORATION));
@ -477,7 +406,10 @@ public abstract class ItemRegistry {
registerItem("ghast_tear", (new ItemTiny()).setDisplay("Ghastträne").setPotionEffect(PotionHelper.ghastTearEffect).setTab(CheatTab.MATERIALS).setMaxAmount(256));
registerItem("gold_nugget", (new ItemNugget()).setDisplay("Goldnugget").setTab(CheatTab.METALS).setMaxAmount(256));
registerItem((new ItemSeeds(Blocks.soul_wart, Blocks.soul_sand)).setDisplay("Seelenwarze").setPotionEffect("+4").setMaxAmount(128));
registerItem("potion", (new ItemPotion()).setDisplay("Trank"));
for(int data : ItemPotion.getValidDataValues()) {
ItemPotion potion = new ItemPotion(data);
registerItem(ItemPotion.getPotionName(potion), potion.setDisplay("Trank"));
}
registerItem("glass_bottle", (new ItemGlassBottle()).setDisplay("Glasflasche"));
registerItem("spider_eye", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 1.0F).setDisplay("Spinnenauge")
.setPotionEffect(PotionHelper.spiderEyeEffect).setMaxAmount(128));
@ -521,37 +453,19 @@ public abstract class ItemRegistry {
registerItem("lead", (new ItemLead()).setDisplay("Leine").setMaxAmount(128));
registerItem("name_tag", (new ItemNameTag()).setDisplay("Namensschild"));
registerItem((new ItemBanner()).setDisplay("Banner"));
// registerItem("spruce_door", (new ItemDoor(Blocks.spruce_door)).setUnlocalizedName("doorSpruce"));
// registerItem("birch_door", (new ItemDoor(Blocks.birch_door)).setUnlocalizedName("doorBirch"));
// registerItem("jungle_door", (new ItemDoor(Blocks.jungle_door)).setUnlocalizedName("doorJungle"));
// registerItem("acacia_door", (new ItemDoor(Blocks.acacia_door)).setUnlocalizedName("doorAcacia"));
// registerItem("dark_oak_door", (new ItemDoor(Blocks.dark_oak_door)).setUnlocalizedName("doorDarkOak"));
for(int z = 0; z < 8; z++) {
registerItem("dynamite", (new ItemDynamite(z)).setDisplay("Dynamit").setColor(TextColor.RED));
for(int z = 0; z < ItemDynamite.DYNAMITE.length; z++) {
registerItem("dynamite" + (z == 0 ? "" : ("_" + z)), (new ItemDynamite(z)).setDisplay("Dynamit" + Util.getTierSuffix(z)).setColor(TextColor.RED));
}
// registerItem("cherry_door", (new ItemDoor(Blocks.cherry_door)).setUnlocalizedName("doorCherry"));
// registerItem("maple_door", (new ItemDoor(Blocks.maple_door)).setUnlocalizedName("doorMaple"));
registerItem("chain", (new ItemMagnetic()).setDisplay("Kette").setTab(CheatTab.MATERIALS));
for(OreType ore : OreType.values()) {
// String loc = ore.name.substring(0, 1).toUpperCase() + ore.name.substring(1);
// registerItemBlock(BlockRegistry.getRegisteredBlock(ore.name + "_ore"));
// registerItemBlock(BlockRegistry.getRegisteredBlock(ore.name + "_block"));
// if(ore.gem != null) {
Item itm = (new Item()).setDisplay(ore.itemDisplay).setTab(CheatTab.METALS);
registerItem(ore.item, itm);
((BlockOre)BlockRegistry.getRegisteredBlock(ore.name + "_ore")).setDropItem(new ItemStack(itm, ore.dropQuantity),
ore.bonusChance, ore.experience);
// }
// else {
// Item itm = (new Item()).setUnlocalizedName("ingot" + loc).setCreativeTab(CreativeTab.tabMaterialsFood);
// registerItem(ore.name + "_ingot", itm);
// ((BlockOre)BlockRegistry.getRegisteredBlock(ore.name + "_ore")).setSmeltItem(new ItemStack(itm));
// }
registerTools(ore.material, ore.name, ore.display);
}
for(MetalType metal : MetalType.values()) {
// String loc = metal.name.substring(0, 1).toUpperCase() + metal.name.substring(1);
Block oreBlock = BlockRegistry.getRegisteredBlock(metal.name + "_ore");
ItemBlock ore = new ItemMetalBlock(oreBlock, metal, true);
registerBlock(oreBlock, ore);
@ -575,7 +489,7 @@ public abstract class ItemRegistry {
registerTools(tool.material, tool.name, tool.display);
}
for(BlockDoor door : BlockDoor.DOORS) {
registerItem(new ItemDoor(door)); // .setDisplay(door.getDisplay()));
registerItem(new ItemDoor(door));
}
for(DyeColor color : BlockBed.COLORS) {
registerItem(new ItemBed((BlockBed)BlockRegistry.getRegisteredBlock(color.getName() + "_bed")).setMaxAmount(1).setDisplay(color.getSubject(0) + " Bett"));
@ -607,54 +521,21 @@ public abstract class ItemRegistry {
registerSpecial(FluidRegistry.getFluidBlock(z));
registerSpecial(FluidRegistry.getStaticBlock(z));
}
// for(EnumDyeColor color : BlockBed.COLORS) {
// registerSpecial(BlockRegistry.getRegisteredBlock(color.getName() + "_bed"));
// }
// for(BlockDoor door : BlockDoor.DOORS) {
// registerSpecial(door);
// }
registerSpecial(Blocks.air);
// registerSpecial(Blocks.flowing_water);
// registerSpecial(Blocks.water);
// registerSpecial(Blocks.flowing_lava);
// registerSpecial(Blocks.lava);
// registerSpecial(Blocks.wheat);
// registerSpecial(Blocks.carrots);
// registerSpecial(Blocks.potatoes);
// registerSpecial(Blocks.soul_wart);
// registerSpecial(Blocks.pumpkin_stem);
// registerSpecial(Blocks.melon_stem);
registerSpecial(Blocks.cocoa);
// registerSpecial(Blocks.reeds);
registerSpecial(Blocks.fire);
registerSpecial(Blocks.soul_fire);
registerSpecial(Blocks.black_fire);
registerSpecial(Blocks.portal);
registerSpecial(Blocks.floor_portal);
// registerSpecial(Blocks.standing_sign);
registerSpecial(Blocks.wall_sign);
// registerSpecial(Blocks.standing_banner);
registerSpecial(Blocks.wall_banner);
// registerSpecial(Blocks.cake);
// registerSpecial(Blocks.brewing_stand);
// registerSpecial(Blocks.cauldron);
// registerSpecial(Blocks.flower_pot);
// registerSpecial(Blocks.skull);
// registerSpecial(Blocks.tripwire);
registerSpecial(Blocks.piston_head);
registerSpecial(Blocks.piston_extension);
registerSpecial(Blocks.lit_redstone_ore);
registerSpecial(Blocks.lit_redstone_lamp);
// registerSpecial(Blocks.redstone_wire);
registerSpecial(Blocks.unlit_redstone_torch);
// registerSpecial(Blocks.unpowered_repeater);
registerSpecial(Blocks.powered_repeater);
// registerSpecial(Blocks.unpowered_comparator);
registerSpecial(Blocks.powered_comparator);
registerSpecial(Blocks.daylight_detector_inverted);

View file

@ -18,7 +18,7 @@ public abstract class Items {
public static final ItemDoor acacia_door = get("acacia_door");
public static final ItemFence acacia_fence = get("acacia_fence");
public static final ItemBlock acacia_fence_gate = get("acacia_fence_gate");
public static final ItemLeaves acacia_leaves = get("acacia_leaves");
public static final ItemColored acacia_leaves = get("acacia_leaves");
public static final ItemBlock acacia_log = get("acacia_log");
public static final ItemBlock acacia_planks = get("acacia_planks");
public static final ItemBlock acacia_sapling = get("acacia_sapling");
@ -33,7 +33,7 @@ public abstract class Items {
public static final ItemMetalBlock antimony_block = get("antimony_block");
public static final ItemMetalBlock antimony_ore = get("antimony_ore");
public static final ItemMetal antimony_powder = get("antimony_powder");
public static final ItemAnvilBlock anvil = get("anvil");
public static final ItemBlock anvil = get("anvil");
public static final ItemFood apple = get("apple");
public static final ItemBlock ardite_block = get("ardite_block");
public static final ItemArmor ardite_boots = get("ardite_boots");
@ -57,7 +57,7 @@ public abstract class Items {
public static final ItemDoor birch_door = get("birch_door");
public static final ItemFence birch_fence = get("birch_fence");
public static final ItemBlock birch_fence_gate = get("birch_fence_gate");
public static final ItemLeaves birch_leaves = get("birch_leaves");
public static final ItemColored birch_leaves = get("birch_leaves");
public static final ItemBlock birch_log = get("birch_log");
public static final ItemBlock birch_planks = get("birch_planks");
public static final ItemBlock birch_sapling = get("birch_sapling");
@ -87,7 +87,7 @@ public abstract class Items {
public static final ItemDoor blackwood_door = get("blackwood_door");
public static final ItemFence blackwood_fence = get("blackwood_fence");
public static final ItemBlock blackwood_fence_gate = get("blackwood_fence_gate");
public static final ItemLeaves blackwood_leaves = get("blackwood_leaves");
public static final ItemColored blackwood_leaves = get("blackwood_leaves");
public static final ItemBlock blackwood_log = get("blackwood_log");
public static final ItemBlock blackwood_planks = get("blackwood_planks");
public static final ItemBlock blackwood_sapling = get("blackwood_sapling");
@ -141,7 +141,7 @@ public abstract class Items {
public static final ItemDoor cherry_door = get("cherry_door");
public static final ItemFence cherry_fence = get("cherry_fence");
public static final ItemBlock cherry_fence_gate = get("cherry_fence_gate");
public static final ItemLeaves cherry_leaves = get("cherry_leaves");
public static final ItemColored cherry_leaves = get("cherry_leaves");
public static final ItemBlock cherry_log = get("cherry_log");
public static final ItemBlock cherry_planks = get("cherry_planks");
public static final ItemBlock cherry_sapling = get("cherry_sapling");
@ -188,7 +188,7 @@ public abstract class Items {
public static final ItemDoor dark_oak_door = get("dark_oak_door");
public static final ItemFence dark_oak_fence = get("dark_oak_fence");
public static final ItemBlock dark_oak_fence_gate = get("dark_oak_fence_gate");
public static final ItemLeaves dark_oak_leaves = get("dark_oak_leaves");
public static final ItemColored dark_oak_leaves = get("dark_oak_leaves");
public static final ItemBlock dark_oak_log = get("dark_oak_log");
public static final ItemBlock dark_oak_planks = get("dark_oak_planks");
public static final ItemBlock dark_oak_sapling = get("dark_oak_sapling");
@ -312,7 +312,7 @@ public abstract class Items {
public static final ItemDoor jungle_door = get("jungle_door");
public static final ItemFence jungle_fence = get("jungle_fence");
public static final ItemBlock jungle_fence_gate = get("jungle_fence_gate");
public static final ItemLeaves jungle_leaves = get("jungle_leaves");
public static final ItemColored jungle_leaves = get("jungle_leaves");
public static final ItemBlock jungle_log = get("jungle_log");
public static final ItemBlock jungle_planks = get("jungle_planks");
public static final ItemBlock jungle_sapling = get("jungle_sapling");
@ -353,7 +353,7 @@ public abstract class Items {
public static final ItemDoor maple_door = get("maple_door");
public static final ItemFence maple_fence = get("maple_fence");
public static final ItemBlock maple_fence_gate = get("maple_fence_gate");
public static final ItemLeaves maple_leaves = get("maple_leaves");
public static final ItemColored maple_leaves = get("maple_leaves");
public static final ItemBlock maple_log = get("maple_log");
public static final ItemBlock maple_planks = get("maple_planks");
public static final ItemBlock maple_sapling = get("maple_sapling");
@ -400,7 +400,7 @@ public abstract class Items {
public static final ItemDoor oak_door = get("oak_door");
public static final ItemFence oak_fence = get("oak_fence");
public static final ItemBlock oak_fence_gate = get("oak_fence_gate");
public static final ItemLeaves oak_leaves = get("oak_leaves");
public static final ItemColored oak_leaves = get("oak_leaves");
public static final ItemBlock oak_log = get("oak_log");
public static final ItemBlock oak_planks = get("oak_planks");
public static final ItemBlock oak_sapling = get("oak_sapling");
@ -522,7 +522,7 @@ public abstract class Items {
public static final ItemDoor spruce_door = get("spruce_door");
public static final ItemFence spruce_fence = get("spruce_fence");
public static final ItemBlock spruce_fence_gate = get("spruce_fence_gate");
public static final ItemLeaves spruce_leaves = get("spruce_leaves");
public static final ItemColored spruce_leaves = get("spruce_leaves");
public static final ItemBlock spruce_log = get("spruce_log");
public static final ItemBlock spruce_planks = get("spruce_planks");
public static final ItemBlock spruce_sapling = get("spruce_sapling");
@ -568,7 +568,7 @@ public abstract class Items {
public static final ItemDoor tian_door = get("tian_door");
public static final ItemFence tian_fence = get("tian_fence");
public static final ItemBlock tian_fence_gate = get("tian_fence_gate");
public static final ItemLeaves tian_leaves = get("tian_leaves");
public static final ItemColored tian_leaves = get("tian_leaves");
public static final ItemBlock tian_log = get("tian_log");
public static final ItemBlock tian_planks = get("tian_planks");
public static final ItemBlock tian_reactor = get("tian_reactor");
@ -582,7 +582,7 @@ public abstract class Items {
public static final ItemMetalBlock titanium_block = get("titanium_block");
public static final ItemMetal titanium_ingot = get("titanium_ingot");
public static final ItemMetalBlock titanium_ore = get("titanium_ore");
public static final ItemTNT tnt = get("tnt");
public static final ItemBlock tnt = get("tnt");
public static final ItemMinecart tnt_minecart = get("tnt_minecart");
public static final ItemBlock torch = get("torch");
public static final ItemBlock trapdoor = get("trapdoor");

View file

@ -106,14 +106,14 @@ public class ContainerRepair extends Container
int l = anvil.getAnvilDamage();
++l;
if (l > 2)
if (l >= BlockAnvil.ANVILS.length)
{
worldIn.setBlockToAir(blockPosIn);
worldIn.playAuxSFX(1020, blockPosIn, 0);
}
else
{
worldIn.setState(blockPosIn, BlockRegistry.getRegisteredBlock("anvil_damaged_" + l).getState().withProperty(BlockAnvil.FACING, iblockstate.getValue(BlockAnvil.FACING)), 2);
worldIn.setState(blockPosIn, BlockAnvil.getByDamage(l).getState().withProperty(BlockAnvil.FACING, iblockstate.getValue(BlockAnvil.FACING)), 2);
worldIn.playAuxSFX(1021, blockPosIn, 0);
}
}

View file

@ -1,15 +0,0 @@
package common.item;
import common.block.Block;
public class ItemAnvilBlock extends ItemBlock
{
public ItemAnvilBlock(Block block)
{
super(block);
}
public boolean isMagnetic() {
return true;
}
}

View file

@ -1,7 +1,5 @@
package common.item;
import java.util.List;
import common.block.Block;
import common.color.TextColor;
import common.entity.Entity;
@ -22,16 +20,28 @@ public class ItemBlock extends Item
{
protected final Block block;
protected final String flatTexture;
protected final int fixedMeta;
public ItemBlock(Block block, String flatTexture)
public ItemBlock(Block block, String flatTexture, int fixedMeta)
{
this.block = block;
this.flatTexture = flatTexture;
this.fixedMeta = fixedMeta;
}
public ItemBlock(Block block, int fixedMeta)
{
this(block, null, fixedMeta);
}
public ItemBlock(Block block, String flatTexture)
{
this(block, flatTexture, 0);
}
public ItemBlock(Block block)
{
this(block, null);
this(block, null, 0);
}
public ItemBlock setDisplay(String unlocalizedName)
@ -182,6 +192,11 @@ public class ItemBlock extends Item
{
return this.block;
}
public int getMetadata()
{
return this.fixedMeta;
}
// public Set<String> getValidTags() {
// return Sets.newHashSet("BlockEntityTag");

View file

@ -7,24 +7,17 @@ import common.model.ModelProvider;
public class ItemCloth extends ItemBlock
{
private final Integer display;
private final DyeColor color;
public ItemCloth(Block block, Integer display, String flatTexture, DyeColor color)
public ItemCloth(Block block, String flatTexture, DyeColor color)
{
super(block, flatTexture);
this.color = color;
this.display = display;
}
public ItemCloth(Block block, Integer display, DyeColor color)
public ItemCloth(Block block, DyeColor color)
{
this(block, display, null, color);
}
public String getDisplay(ItemStack stack)
{
return this.color.getSubject(this.display) + " " + super.getDisplay(stack);
this(block, null, color);
}
public Model getModel(ModelProvider provider, String name) {

View file

@ -4,21 +4,23 @@ import common.block.Block;
public class ItemColored extends ItemBlock
{
private final Block coloredBlock;
public ItemColored(Block block, String flatTexture)
{
super(block, flatTexture);
this.coloredBlock = block;
}
public ItemColored(Block block, int fixedMeta)
{
super(block, fixedMeta);
}
public ItemColored(Block block)
{
this(block, null);
super(block);
}
public int getColorFromItemStack(ItemStack stack, int renderPass)
{
return this.coloredBlock.getRenderColor(this.coloredBlock.getState());
return this.block.getRenderColor(this.block.getState());
}
}

View file

@ -1,5 +1,9 @@
package common.item;
import java.util.Collection;
import java.util.Map;
import common.collect.Maps;
import common.color.TextColor;
import common.entity.npc.EntityNPC;
import common.entity.projectile.EntityDie;
@ -7,20 +11,47 @@ import common.init.SoundEvent;
import common.model.Model;
import common.model.ModelProvider;
import common.model.Transforms;
import common.util.Pair;
import common.world.World;
public class ItemDie extends Item
{
public static final int[] DIE_SIDES = new int[] {4, 6, 8, 10, 12, 20};
public static final TextColor[] DIE_COLORS = new TextColor[] {TextColor.DGREEN, TextColor.NEON, TextColor.DMAGENTA,
TextColor.MAGENTA, TextColor.DRED, TextColor.ORANGE};
public static final Pair<Integer, TextColor>[] DIE_SIDES = new Pair[] {
new Pair(4, TextColor.DGREEN),
new Pair(6, TextColor.NEON),
new Pair(8, TextColor.DMAGENTA),
new Pair(10, TextColor.MAGENTA),
new Pair(12, TextColor.DRED),
new Pair(20, TextColor.ORANGE)
};
public static final Map<Integer, ItemDie> DICE = Maps.newTreeMap();
private final int sides;
private final TextColor color;
public ItemDie(int sides)
public static final ItemDie getBySides(int sides) {
ItemDie die = DICE.get(sides);
return die == null ? DICE.get(6) : die;
}
public static Collection<ItemDie> getDieItems() {
return DICE.values();
}
public ItemDie(int sides, TextColor color)
{
this.sides = sides;
this.color = color;
this.setTab(CheatTab.TOOLS);
DICE.put(sides, this);
}
public int getSides() {
return this.sides;
}
public TextColor getDieColor() {
return this.color;
}
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)

View file

@ -22,7 +22,7 @@ import common.world.AWorldServer;
public class ItemDye extends Item
{
public static final int[] dyeColors = new int[] {1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320};
public static final int[] FIREWORK_COLORS = new int[] {1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320};
private static final ItemDye[] DIES = new ItemDye[DyeColor.values().length];
private final DyeColor color;
@ -42,11 +42,6 @@ public class ItemDye extends Item
return this.color;
}
public String getDisplay(ItemStack stack)
{
return this.color.getDye();
}
/**
* Called when a Block is right-clicked with this Item
*/

View file

@ -1,54 +1,36 @@
package common.item;
import java.util.List;
import common.entity.npc.EntityNPC;
import common.entity.projectile.EntityDynamite;
import common.init.SoundEvent;
import common.model.Model;
import common.model.ModelProvider;
import common.util.ExtMath;
import common.world.World;
public class ItemDynamite extends Item
{
private static final String[] TIERS = new String[] {"II", "III", "IV", "V", "VI", "VII", "VIII"};
public class ItemDynamite extends Item {
public static final ItemDynamite[] DYNAMITE = new ItemDynamite[8];
private final int power;
public ItemDynamite(int power)
{
this.power = power;
this.setMaxAmount(32);
this.setTab(CheatTab.TOOLS);
}
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
{
// if (!playerIn.creative)
// {
--itemStackIn.size;
// }
public static ItemDynamite getByPower(int power) {
return DYNAMITE[ExtMath.clampi(power, 0, DYNAMITE.length - 1)];
}
worldIn.playSoundAtEntity(playerIn, SoundEvent.THROW, 0.5F);
public ItemDynamite(int power) {
this.power = power;
this.setMaxAmount(32);
this.setTab(CheatTab.TOOLS);
DYNAMITE[power] = this;
}
if (!worldIn.client)
{
worldIn.spawnEntityInWorld(new EntityDynamite(worldIn, playerIn, this.power));
}
public int getExplosionPower() {
return this.power;
}
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
return itemStackIn;
}
public String getDisplay(ItemStack stack)
{
return super.getDisplay(stack) + (this.power == 0 ? "" : " " + TIERS[this.power-1]);
}
public Model getModel(ModelProvider provider, String name) {
return provider.getModel(this.getTransform(), "dynamite" + (this.power == 0 ? "" : ("_" + this.power)));
}
public ItemStack onItemRightClick(ItemStack stack, World world, EntityNPC player) {
--stack.size;
world.playSoundAtEntity(player, SoundEvent.THROW, 0.5F);
if(!world.client)
world.spawnEntityInWorld(new EntityDynamite(world, player, this.power));
return stack;
}
}

View file

@ -104,9 +104,9 @@ public class ItemFireworkCharge extends Item
flag = false;
boolean flag1 = false;
for (int j = 0; j < ItemDye.dyeColors.length; ++j)
for (int j = 0; j < ItemDye.FIREWORK_COLORS.length; ++j)
{
if (i == ItemDye.dyeColors[j])
if (i == ItemDye.FIREWORK_COLORS[j])
{
flag1 = true;
s = s + DyeColor.byDyeDamage(j).getDisplay();
@ -142,7 +142,7 @@ public class ItemFireworkCharge extends Item
for (int k = 0; k < 16; ++k)
{
if (l == ItemDye.dyeColors[k])
if (l == ItemDye.FIREWORK_COLORS[k])
{
flag5 = true;
s1 = s1 + DyeColor.byDyeDamage(k).getDisplay();

View file

@ -1,7 +1,6 @@
package common.item;
import common.block.Block;
import common.block.natural.BlockDirt;
import common.entity.npc.EntityNPC;
import common.init.Blocks;
import common.init.ToolMaterial;

View file

@ -1,29 +0,0 @@
package common.item;
import common.block.foliage.BlockLeaves;
public class ItemLeaves extends ItemBlock
{
protected final BlockLeaves leaves;
public ItemLeaves(BlockLeaves block)
{
super(block);
this.leaves = block;
}
public int getMetadata()
{
return 8;
}
public int getColorFromItemStack(ItemStack stack, int renderPass)
{
return this.leaves.getRenderColor(this.leaves.getState());
}
public String getDisplay(ItemStack stack)
{
return this.block.getDisplay() + " (" + this.leaves.getType().getDisplayName() + ")";
}
}

View file

@ -270,6 +270,16 @@ public class ItemPotion extends Item
List<PotionEffect> list = this.getEffects();
return list != null && !list.isEmpty();
}
public static String getPotionName(ItemPotion potion) { //TODO: fix potion names
if((potion.getPotionData() & 16383) == 0)
return potion.isSplashPotion() ? "splash_potion" : "potion";
List<PotionEffect> list = potion.getEffects();
if(list == null || list.isEmpty())
return (potion.isSplashPotion() ? "splash_potion_" : "potion_") + PotionHelper.getPotionPrefixIndex(potion.getPotionData());
PotionEffect effect = list.get(0);
return (potion.isSplashPotion() ? "splash_potion_" : "potion_") + effect.getPotion().getName() + (effect.getAmplifier() == 0 ? "" : "_" + (effect.getAmplifier() + 1)) + (effect.getPotion().isInstant() ? "" : "_" + effect.getDuration());
}
public static List<Integer> getValidDataValues()
{

View file

@ -1,23 +0,0 @@
package common.item;
import common.block.tech.BlockTNT;
import common.color.TextColor;
public class ItemTNT extends ItemBlock
{
private static final String[] TIERS = new String[] {"II", "III", "IV", "V", "VI", "VII", "VIII"};
private final int power;
public ItemTNT(BlockTNT block)
{
super(block);
this.power = block.getExplosionPower();
this.setColor(TextColor.RED);
}
public String getDisplay(ItemStack stack)
{
return super.getDisplay(stack) + (this.power == 0 ? "" : " " + TIERS[this.power-1]);
}
}

View file

@ -1,21 +1,20 @@
package common.item;
import common.block.Block;
import common.block.artificial.BlockWall;
import common.model.Model;
import common.model.ModelProvider;
public class ItemWall extends ItemBlock {
private final BlockWall.EnumType type;
private final BlockWall wallBlock;
public ItemWall(Block block, BlockWall.EnumType type) {
public ItemWall(BlockWall block) {
super(block);
this.type = type;
this.wallBlock = block;
}
public Model getModel(ModelProvider provider, String name) {
return provider.getModel(
provider.getModel(this.type.getName())
provider.getModel(this.wallBlock.getTexture())
.add(4, 0, 4, 12, 16, 12)
.d().uv(4, 4, 12, 12)
.u().uv(4, 4, 12, 12).noCull()

View file

@ -33,6 +33,8 @@ public abstract class Util {
public static final int PROTOCOL = Version.MAJOR << 16 | Version.MINOR << 8 | Version.PATCH;
public static final String VERSION = "v" + Version.MAJOR + "." + Version.MINOR + "." + Version.PATCH + Version.RELEASE;
private static final String[] TIERS = new String[] {"II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"};
private static boolean crashed;
public static String strip(String str, int offset, int len, char newl, char tab, char unk) {
@ -532,4 +534,8 @@ public abstract class Util {
public static void throwUnchecked(Throwable t) {
throw t instanceof RuntimeException ? (RuntimeException)t : new RuntimeException(t);
}
public static String getTierSuffix(int tier) {
return tier <= 0 ? "" : " " + (tier > TIERS.length ? (tier + 1) : TIERS[tier - 1]);
}
}