block data fixes
This commit is contained in:
parent
cde7bf84c1
commit
eb815a8e21
54 changed files with 167 additions and 207 deletions
|
@ -1930,7 +1930,7 @@ public class Client implements IThreadListener {
|
||||||
String.format("Position: %d %d %d", pos.getX(), pos.getY(), pos.getZ())
|
String.format("Position: %d %d %d", pos.getX(), pos.getY(), pos.getZ())
|
||||||
);
|
);
|
||||||
for(Entry<Property, Comparable> entry : block.getProperties().entrySet()) {
|
for(Entry<Property, Comparable> entry : block.getProperties().entrySet()) {
|
||||||
str.append("\n" + entry.getKey().getName() + ": " + entry.getValue().toString());
|
str.append("\n" + (block.getSavedProperties().contains(entry.getKey()) ? TextColor.NEON : TextColor.LGRAY) + entry.getKey().getName() + TextColor.RESET + ": " + (entry.getValue() instanceof Boolean bool ? (bool ? TextColor.GREEN : TextColor.RED) + "" + entry.getValue() + TextColor.RESET : entry.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return str.toString();
|
return str.toString();
|
||||||
|
|
|
@ -774,8 +774,8 @@ public class Block {
|
||||||
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn) {
|
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer) {
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) {
|
||||||
return this.getStateFromMeta(meta);
|
return this.getState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onBlockClicked(World worldIn, BlockPos pos, EntityNPC playerIn) {
|
public void onBlockClicked(World worldIn, BlockPos pos, EntityNPC playerIn) {
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class BlockFenceGate extends Block implements Rotatable
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing()).withProperty(OPEN, Boolean.valueOf(false)).withProperty(POWERED, Boolean.valueOf(false)).withProperty(IN_WALL, Boolean.valueOf(false));
|
return this.getState().withProperty(FACING, placer.getHorizontalFacing()).withProperty(OPEN, Boolean.valueOf(false)).withProperty(POWERED, Boolean.valueOf(false)).withProperty(IN_WALL, Boolean.valueOf(false));
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,8 +75,8 @@ public class BlockHay extends BlockRotatedPillar
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(AXIS, facing.getAxis());
|
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, placer).withProperty(AXIS, facing.getAxis());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class BlockLadder extends Block implements Rotatable
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
if (facing.getAxis().isHorizontal() && this.canBlockStay(worldIn, pos, facing))
|
if (facing.getAxis().isHorizontal() && this.canBlockStay(worldIn, pos, facing))
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,7 +20,11 @@ public class BlockMetalBlock extends Block {
|
||||||
this.setTab(CheatTab.GEMS);
|
this.setTab(CheatTab.GEMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MetalType getMetal() {
|
||||||
|
return this.metal;
|
||||||
|
}
|
||||||
|
|
||||||
protected Item getItemToRegister() {
|
protected Item getItemToRegister() {
|
||||||
return new ItemMetalBlock(this, this.metal, false);
|
return new ItemMetalBlock(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ public class BlockPortalFrame extends Block implements Rotatable
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(ORB, Boolean.valueOf(false));
|
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(ORB, Boolean.valueOf(false));
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class BlockQuartzPillar extends BlockRotatedPillar
|
||||||
return this.dark;
|
return this.dark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return this.getState().withProperty(AXIS, facing.getAxis());
|
return this.getState().withProperty(AXIS, facing.getAxis());
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class BlockSkull extends Block implements Rotatable {
|
||||||
return world.getState(pos).getBlock().getMaterial().isReplaceable() && world.isBlockSolid(pos.down());
|
return world.getState(pos).getBlock().getMaterial().isReplaceable() && world.isBlockSolid(pos.down());
|
||||||
}
|
}
|
||||||
|
|
||||||
public State onBlockPlaced(World world, BlockPos pos, Facing face, float hitX, float hitY, float hitZ, int meta, EntityLiving placer) {
|
public State onBlockPlaced(World world, BlockPos pos, Facing face, float hitX, float hitY, float hitZ, EntityLiving placer) {
|
||||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class BlockSlab extends Block implements Directional
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
State iblockstate = this.getState().withProperty(FACING, Facing.DOWN);
|
State iblockstate = this.getState().withProperty(FACING, Facing.DOWN);
|
||||||
return facing != Facing.DOWN && (facing == Facing.UP || (double)hitY <= 0.5D) ? iblockstate :
|
return facing != Facing.DOWN && (facing == Facing.UP || (double)hitY <= 0.5D) ? iblockstate :
|
||||||
|
|
|
@ -682,9 +682,9 @@ public class BlockStairs extends Block implements Rotatable
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
State iblockstate = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
|
State iblockstate = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, placer);
|
||||||
iblockstate = iblockstate.withProperty(FACING, placer.getHorizontalFacing()).withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT);
|
iblockstate = iblockstate.withProperty(FACING, placer.getHorizontalFacing()).withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT);
|
||||||
return facing != Facing.DOWN && (facing == Facing.UP || (double)hitY <= 0.5D) ? iblockstate.withProperty(HALF, BlockStairs.EnumHalf.BOTTOM) : iblockstate.withProperty(HALF, BlockStairs.EnumHalf.TOP);
|
return facing != Facing.DOWN && (facing == Facing.UP || (double)hitY <= 0.5D) ? iblockstate.withProperty(HALF, BlockStairs.EnumHalf.BOTTOM) : iblockstate.withProperty(HALF, BlockStairs.EnumHalf.TOP);
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ public class BlockTrapDoor extends Block implements Rotatable
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
State iblockstate = this.getState();
|
State iblockstate = this.getState();
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class BlockCocoa extends Block implements Rotatable, IGrowable
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
if (!facing.getAxis().isHorizontal())
|
if (!facing.getAxis().isHorizontal())
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,6 @@ import common.block.Block;
|
||||||
import common.block.Material;
|
import common.block.Material;
|
||||||
import common.entity.types.EntityLiving;
|
import common.entity.types.EntityLiving;
|
||||||
import common.item.Item;
|
import common.item.Item;
|
||||||
import common.item.block.ItemBlock;
|
|
||||||
import common.model.Model;
|
import common.model.Model;
|
||||||
import common.model.ModelProvider;
|
import common.model.ModelProvider;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
|
@ -75,7 +74,7 @@ public class BlockHugeMushroom extends Block
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return this.getState();
|
return this.getState();
|
||||||
}
|
}
|
||||||
|
@ -142,10 +141,6 @@ public class BlockHugeMushroom extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Item getItemToRegister() {
|
|
||||||
return new ItemBlock(this, 14);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static enum EnumType implements Identifyable
|
public static enum EnumType implements Identifyable
|
||||||
{
|
{
|
||||||
NORTH_WEST(1, "north_west"),
|
NORTH_WEST(1, "north_west"),
|
||||||
|
|
|
@ -8,6 +8,7 @@ import common.block.SoundType;
|
||||||
import common.collect.Lists;
|
import common.collect.Lists;
|
||||||
import common.color.Colorizer;
|
import common.color.Colorizer;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
|
import common.entity.types.EntityLiving;
|
||||||
import common.init.Blocks;
|
import common.init.Blocks;
|
||||||
import common.init.ItemRegistry;
|
import common.init.ItemRegistry;
|
||||||
import common.init.WoodType;
|
import common.init.WoodType;
|
||||||
|
@ -24,6 +25,7 @@ import common.properties.PropertyBool;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.tileentity.TileEntity;
|
import common.tileentity.TileEntity;
|
||||||
import common.util.BlockPos;
|
import common.util.BlockPos;
|
||||||
|
import common.util.Facing;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
import common.world.IWorldAccess;
|
import common.world.IWorldAccess;
|
||||||
import common.world.AWorldClient;
|
import common.world.AWorldClient;
|
||||||
|
@ -327,6 +329,10 @@ public class BlockLeaves extends BlockLeavesBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) {
|
||||||
|
return this.getState().withProperty(DECAY, false);
|
||||||
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, State state) {
|
public Model getModel(ModelProvider provider, String name, State state) {
|
||||||
return this.subType.isTinted() ? provider.getModel(name).add().all().tint() :
|
return this.subType.isTinted() ? provider.getModel(name).add().all().tint() :
|
||||||
provider.getModel(name).add().all();
|
provider.getModel(name).add().all();
|
||||||
|
@ -337,6 +343,6 @@ public class BlockLeaves extends BlockLeavesBase
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Item getItemToRegister() {
|
protected Item getItemToRegister() {
|
||||||
return new ItemColored(this, 8);
|
return new ItemColored(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class BlockLilyPad extends BlockBush implements Rotatable
|
||||||
return new Property[] {FACING};
|
return new Property[] {FACING};
|
||||||
}
|
}
|
||||||
|
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,9 +54,9 @@ public class BlockLog extends BlockRotatedPillar
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(LOG_AXIS, BlockLog.EnumAxis.fromFacingAxis(facing.getAxis()));
|
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, placer).withProperty(LOG_AXIS, BlockLog.EnumAxis.fromFacingAxis(facing.getAxis()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, State state) {
|
public Model getModel(ModelProvider provider, String name, State state) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class BlockPumpkin extends Block implements Rotatable {
|
||||||
return world.getState(pos).getBlock().getMaterial().isReplaceable() && world.isBlockSolid(pos.down());
|
return world.getState(pos).getBlock().getMaterial().isReplaceable() && world.isBlockSolid(pos.down());
|
||||||
}
|
}
|
||||||
|
|
||||||
public State onBlockPlaced(World world, BlockPos pos, Facing face, float hitX, float hitY, float hitZ, int meta, EntityLiving placer) {
|
public State onBlockPlaced(World world, BlockPos pos, Facing face, float hitX, float hitY, float hitZ, EntityLiving placer) {
|
||||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -401,7 +401,7 @@ public class BlockVine extends Block
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
State iblockstate = this.getState().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));
|
State iblockstate = this.getState().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));
|
||||||
return facing.getAxis().isHorizontal() ? iblockstate.withProperty(getPropertyFor(facing.getOpposite()), Boolean.valueOf(true)) : iblockstate;
|
return facing.getAxis().isHorizontal() ? iblockstate.withProperty(getPropertyFor(facing.getOpposite()), Boolean.valueOf(true)) : iblockstate;
|
||||||
|
|
|
@ -15,7 +15,11 @@ public class BlockMetalOre extends BlockOre {
|
||||||
this.setRadiation(metal.radioactivity * 0.5f);
|
this.setRadiation(metal.radioactivity * 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MetalType getMetal() {
|
||||||
|
return this.metal;
|
||||||
|
}
|
||||||
|
|
||||||
protected Item getItemToRegister() {
|
protected Item getItemToRegister() {
|
||||||
return new ItemMetalBlock(this, this.metal, true);
|
return new ItemMetalBlock(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,10 +68,10 @@ public class BlockAnvil extends BlockFalling implements Rotatable
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
Facing enumfacing = placer.getHorizontalFacing().rotateY();
|
Facing enumfacing = placer.getHorizontalFacing().rotateY();
|
||||||
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(FACING, enumfacing);
|
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, placer).withProperty(FACING, enumfacing);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class BlockButton extends Block implements Directional
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return canPlaceButtonOn(worldIn, pos, facing.getOpposite()) ? this.getState().withProperty(FACING, facing).withProperty(POWERED, Boolean.valueOf(false)) : this.getState().withProperty(FACING, Facing.DOWN).withProperty(POWERED, Boolean.valueOf(false));
|
return canPlaceButtonOn(worldIn, pos, facing.getOpposite()) ? this.getState().withProperty(FACING, facing).withProperty(POWERED, Boolean.valueOf(false)) : this.getState().withProperty(FACING, Facing.DOWN).withProperty(POWERED, Boolean.valueOf(false));
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class BlockChest extends BlockContainer implements Rotatable
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing());
|
return this.getState().withProperty(FACING, placer.getHorizontalFacing());
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,7 @@ import common.entity.types.EntityLiving;
|
||||||
import common.inventory.Container;
|
import common.inventory.Container;
|
||||||
import common.inventory.InventoryHelper;
|
import common.inventory.InventoryHelper;
|
||||||
import common.item.CheatTab;
|
import common.item.CheatTab;
|
||||||
import common.item.Item;
|
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.item.block.ItemBlock;
|
|
||||||
import common.model.Model;
|
import common.model.Model;
|
||||||
import common.model.ModelProvider;
|
import common.model.ModelProvider;
|
||||||
import common.model.ModelRotation;
|
import common.model.ModelRotation;
|
||||||
|
@ -201,7 +199,7 @@ public class BlockDispenser extends BlockContainer implements Directional
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return this.getState().withProperty(FACING, BlockPistonBase.getFacingFromEntity(worldIn, pos, placer)).withProperty(TRIGGERED, Boolean.valueOf(false));
|
return this.getState().withProperty(FACING, BlockPistonBase.getFacingFromEntity(worldIn, pos, placer)).withProperty(TRIGGERED, Boolean.valueOf(false));
|
||||||
}
|
}
|
||||||
|
@ -321,8 +319,4 @@ public class BlockDispenser extends BlockContainer implements Directional
|
||||||
public Property<?>[] getIgnoredProperties() {
|
public Property<?>[] getIgnoredProperties() {
|
||||||
return new Property[] {TRIGGERED};
|
return new Property[] {TRIGGERED};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Item getItemToRegister() {
|
|
||||||
return new ItemBlock(this, 2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class BlockFurnace extends BlockContainer implements Rotatable
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class BlockHopper extends BlockContainer implements DirectionalDown
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
Facing enumfacing = facing.getOpposite();
|
Facing enumfacing = facing.getOpposite();
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class BlockLever extends Block
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
State iblockstate = this.getState().withProperty(POWERED, Boolean.valueOf(false));
|
State iblockstate = this.getState().withProperty(POWERED, Boolean.valueOf(false));
|
||||||
|
|
||||||
|
|
|
@ -81,8 +81,7 @@ public abstract class BlockMachine extends Block implements Rotatable, ITileEnti
|
||||||
return tileentity == null ? false : tileentity.receiveClientEvent(eventID, eventParam);
|
return tileentity == null ? false : tileentity.receiveClientEvent(eventID, eventParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta,
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) {
|
||||||
EntityLiving placer) {
|
|
||||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing());
|
return this.getState().withProperty(FACING, placer.getHorizontalFacing());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -307,7 +307,7 @@ public class BlockPistonBase extends Block implements Directional
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return this.getState().withProperty(FACING, getFacingFromEntity(worldIn, pos, placer)).withProperty(EXTENDED, Boolean.valueOf(false));
|
return this.getState().withProperty(FACING, getFacingFromEntity(worldIn, pos, placer)).withProperty(EXTENDED, Boolean.valueOf(false));
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,7 +312,7 @@ public class BlockRedstoneComparator extends BlockRedstoneDiode implements ITile
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(POWERED, Boolean.valueOf(false)).withProperty(MODE, BlockRedstoneComparator.Mode.COMPARE);
|
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(POWERED, Boolean.valueOf(false)).withProperty(MODE, BlockRedstoneComparator.Mode.COMPARE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ public abstract class BlockRedstoneDiode extends Block implements Rotatable
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class BlockTorch extends Block implements DirectionalUp
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
if (this.canPlaceAt(worldIn, pos, facing))
|
if (this.canPlaceAt(worldIn, pos, facing))
|
||||||
{
|
{
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class BlockTripWireHook extends Block implements Rotatable
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
State iblockstate = this.getState().withProperty(POWERED, Boolean.valueOf(false)).withProperty(ATTACHED, Boolean.valueOf(false)).withProperty(SUSPENDED, Boolean.valueOf(false));
|
State iblockstate = this.getState().withProperty(POWERED, Boolean.valueOf(false)).withProperty(ATTACHED, Boolean.valueOf(false)).withProperty(SUSPENDED, Boolean.valueOf(false));
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class BlockWarpChest extends Block implements Rotatable
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
||||||
}
|
}
|
||||||
|
|
|
@ -652,6 +652,7 @@ public abstract class BlockRegistry {
|
||||||
for(Block block : REGISTRY) {
|
for(Block block : REGISTRY) {
|
||||||
for(State state : block.getValidStates()) {
|
for(State state : block.getValidStates()) {
|
||||||
STATEMAP.put(state, REGISTRY.getId(block) << 4 | block.getMetaFromState(state));
|
STATEMAP.put(state, REGISTRY.getId(block) << 4 | block.getMetaFromState(state));
|
||||||
|
state.buildSaved();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package common.item.block;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import common.block.Block;
|
import common.block.Block;
|
||||||
import common.block.tile.BlockBanner;
|
import common.block.tile.BlockBannerStanding;
|
||||||
import common.block.tile.BlockStandingSign;
|
import common.block.tile.BlockStandingSign;
|
||||||
import common.block.tile.BlockWallSign;
|
import common.block.tile.BlockWallSign;
|
||||||
import common.color.DyeColor;
|
import common.color.DyeColor;
|
||||||
|
@ -26,9 +26,9 @@ import common.world.World;
|
||||||
|
|
||||||
public class ItemBanner extends Item
|
public class ItemBanner extends Item
|
||||||
{
|
{
|
||||||
private final BlockBanner block;
|
private final BlockBannerStanding block;
|
||||||
|
|
||||||
public ItemBanner(BlockBanner block)
|
public ItemBanner(BlockBannerStanding block)
|
||||||
{
|
{
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.setTab(CheatTab.DECORATION);
|
this.setTab(CheatTab.DECORATION);
|
||||||
|
|
|
@ -23,33 +23,21 @@ public class ItemBlock extends Item
|
||||||
{
|
{
|
||||||
protected final Block block;
|
protected final Block block;
|
||||||
protected final String flatTexture;
|
protected final String flatTexture;
|
||||||
protected final int fixedMeta;
|
|
||||||
|
|
||||||
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)
|
public ItemBlock(Block block, String flatTexture)
|
||||||
{
|
{
|
||||||
this(block, flatTexture, 0);
|
this.block = block;
|
||||||
|
this.flatTexture = flatTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBlock(Block block, String flatTexture, boolean item)
|
public ItemBlock(Block block, String flatTexture, boolean item)
|
||||||
{
|
{
|
||||||
this(block, (item ? "items" : "blocks") + "/" + flatTexture, 0);
|
this(block, (item ? "items" : "blocks") + "/" + flatTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBlock(Block block)
|
public ItemBlock(Block block)
|
||||||
{
|
{
|
||||||
this(block, null, 0);
|
this(block, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBlock setDisplay(String unlocalizedName)
|
public ItemBlock setDisplay(String unlocalizedName)
|
||||||
|
@ -87,7 +75,7 @@ public class ItemBlock extends Item
|
||||||
}
|
}
|
||||||
else if (worldIn.canBlockBePlaced(this.block, pos, false, side, (Entity)null, stack))
|
else if (worldIn.canBlockBePlaced(this.block, pos, false, side, (Entity)null, stack))
|
||||||
{
|
{
|
||||||
State iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, this.fixedMeta, playerIn);
|
State iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, playerIn);
|
||||||
|
|
||||||
if (worldIn.setState(pos, iblockstate1, 3))
|
if (worldIn.setState(pos, iblockstate1, 3))
|
||||||
{
|
{
|
||||||
|
@ -224,8 +212,8 @@ public class ItemBlock extends Item
|
||||||
public Model getModel(ModelProvider provider, String name) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return this.flatTexture != null ? provider.getModel(this.getTransform(), !this.flatTexture.isEmpty() ? this.flatTexture :
|
return this.flatTexture != null ? provider.getModel(this.getTransform(), !this.flatTexture.isEmpty() ? this.flatTexture :
|
||||||
this.block.getModel(provider,
|
this.block.getModel(provider,
|
||||||
BlockRegistry.getNameFromBlock(this.block).toString(), this.block.getStateFromMeta(this.fixedMeta)).getPrimary() /* "blocks/" + name */) :
|
BlockRegistry.getNameFromBlock(this.block).toString(), this.block.getState()).getPrimary() /* "blocks/" + name */) :
|
||||||
provider.getModel(this.block.getModel(provider,
|
provider.getModel(this.block.getModel(provider,
|
||||||
BlockRegistry.getNameFromBlock(this.block).toString(), this.block.getStateFromMeta(this.fixedMeta)), this.getTransform());
|
BlockRegistry.getNameFromBlock(this.block).toString(), this.block.getState()), this.getTransform());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package common.item.block;
|
package common.item.block;
|
||||||
|
|
||||||
import common.block.Block;
|
import common.block.tech.BlockChest;
|
||||||
import common.model.Model;
|
import common.model.Model;
|
||||||
import common.model.ModelProvider;
|
import common.model.ModelProvider;
|
||||||
import common.model.Transforms;
|
import common.model.Transforms;
|
||||||
|
|
||||||
public class ItemChest extends ItemBlock {
|
public class ItemChest extends ItemBlock {
|
||||||
public ItemChest(Block block) {
|
public ItemChest(BlockChest block) {
|
||||||
super(block);
|
super(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
package common.item.block;
|
|
||||||
|
|
||||||
import common.block.Block;
|
|
||||||
import common.color.DyeColor;
|
|
||||||
import common.model.Model;
|
|
||||||
import common.model.ModelProvider;
|
|
||||||
|
|
||||||
public class ItemCloth extends ItemBlock
|
|
||||||
{
|
|
||||||
private final DyeColor color;
|
|
||||||
|
|
||||||
public ItemCloth(Block block, String flatTexture, DyeColor color)
|
|
||||||
{
|
|
||||||
super(block, flatTexture);
|
|
||||||
this.color = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemCloth(Block block, DyeColor color)
|
|
||||||
{
|
|
||||||
this(block, null, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name) {
|
|
||||||
return this.flatTexture != null ? provider.getModel(this.getTransform(), "blocks/" + this.color.getName() + "_" +
|
|
||||||
this.flatTexture) : super.getModel(provider, name);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -10,11 +10,6 @@ public class ItemColored extends ItemBlock
|
||||||
super(block, flatTexture);
|
super(block, flatTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemColored(Block block, int fixedMeta)
|
|
||||||
{
|
|
||||||
super(block, fixedMeta);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemColored(Block block)
|
public ItemColored(Block block)
|
||||||
{
|
{
|
||||||
super(block);
|
super(block);
|
||||||
|
|
|
@ -15,9 +15,9 @@ import common.world.World;
|
||||||
|
|
||||||
public class ItemDoor extends Item
|
public class ItemDoor extends Item
|
||||||
{
|
{
|
||||||
private Block block;
|
private final BlockDoor block;
|
||||||
|
|
||||||
public ItemDoor(Block block)
|
public ItemDoor(BlockDoor block)
|
||||||
{
|
{
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.setTab(block.getMaterial() == Material.WOOD ? CheatTab.WOOD : CheatTab.TECHNOLOGY);
|
this.setTab(block.getMaterial() == Material.WOOD ? CheatTab.WOOD : CheatTab.TECHNOLOGY);
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
package common.item.block;
|
package common.item.block;
|
||||||
|
|
||||||
import common.block.Block;
|
|
||||||
import common.block.artificial.BlockFence;
|
import common.block.artificial.BlockFence;
|
||||||
import common.model.Model;
|
import common.model.Model;
|
||||||
import common.model.ModelProvider;
|
import common.model.ModelProvider;
|
||||||
|
|
||||||
public class ItemFence extends ItemBlock {
|
public class ItemFence extends ItemBlock {
|
||||||
public ItemFence(Block block) {
|
public ItemFence(BlockFence block) {
|
||||||
super(block);
|
super(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package common.item.block;
|
package common.item.block;
|
||||||
|
|
||||||
import common.block.Block;
|
|
||||||
import common.block.foliage.BlockLilyPad;
|
import common.block.foliage.BlockLilyPad;
|
||||||
import common.block.liquid.BlockLiquid;
|
import common.block.liquid.BlockLiquid;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
|
@ -13,7 +12,7 @@ import common.world.World;
|
||||||
|
|
||||||
public class ItemLilyPad extends ItemColored
|
public class ItemLilyPad extends ItemColored
|
||||||
{
|
{
|
||||||
public ItemLilyPad(Block block)
|
public ItemLilyPad(BlockLilyPad block)
|
||||||
{
|
{
|
||||||
super(block, "");
|
super(block, "");
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ import java.util.Map;
|
||||||
import common.attributes.Attribute;
|
import common.attributes.Attribute;
|
||||||
import common.attributes.UsageSlot;
|
import common.attributes.UsageSlot;
|
||||||
import common.block.Block;
|
import common.block.Block;
|
||||||
|
import common.block.artificial.BlockMetalBlock;
|
||||||
|
import common.block.natural.BlockMetalOre;
|
||||||
import common.color.TextColor;
|
import common.color.TextColor;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
import common.init.MetalType;
|
import common.init.MetalType;
|
||||||
|
@ -14,7 +16,7 @@ public class ItemMetalBlock extends ItemBlock {
|
||||||
private final MetalType metal;
|
private final MetalType metal;
|
||||||
private final boolean ore;
|
private final boolean ore;
|
||||||
|
|
||||||
public ItemMetalBlock(Block block, MetalType metal, boolean ore) {
|
private ItemMetalBlock(Block block, MetalType metal, boolean ore) {
|
||||||
super(block);
|
super(block);
|
||||||
this.metal = metal;
|
this.metal = metal;
|
||||||
this.ore = ore;
|
this.ore = ore;
|
||||||
|
@ -22,6 +24,14 @@ public class ItemMetalBlock extends ItemBlock {
|
||||||
this.setColor(TextColor.GREEN);
|
this.setColor(TextColor.GREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemMetalBlock(BlockMetalBlock block) {
|
||||||
|
this(block, block.getMetal(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemMetalBlock(BlockMetalOre block) {
|
||||||
|
this(block, block.getMetal(), true);
|
||||||
|
}
|
||||||
|
|
||||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
||||||
{
|
{
|
||||||
tooltip.add(this.metal.formatSymbol());
|
tooltip.add(this.metal.formatSymbol());
|
||||||
|
@ -31,11 +41,6 @@ public class ItemMetalBlock extends ItemBlock {
|
||||||
tooltip.add(this.metal.formatRarity());
|
tooltip.add(this.metal.formatRarity());
|
||||||
}
|
}
|
||||||
|
|
||||||
// public ChatFormat getColor(ItemStack stack)
|
|
||||||
// {
|
|
||||||
// return this.metal.radioactivity > 0.0f ? ChatFormat.GREEN : super.getColor(stack);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void getModifiers(Map<Attribute, Float> map, UsageSlot slot)
|
public void getModifiers(Map<Attribute, Float> map, UsageSlot slot)
|
||||||
{
|
{
|
||||||
if((slot == null || slot == UsageSlot.INVENTORY) && this.metal.radioactivity > 0.0f)
|
if((slot == null || slot == UsageSlot.INVENTORY) && this.metal.radioactivity > 0.0f)
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
package common.item.block;
|
package common.item.block;
|
||||||
|
|
||||||
import common.block.Block;
|
import common.block.tech.BlockPistonBase;
|
||||||
import common.init.Blocks;
|
import common.init.Blocks;
|
||||||
import common.model.Model;
|
import common.model.Model;
|
||||||
import common.model.ModelProvider;
|
import common.model.ModelProvider;
|
||||||
|
|
||||||
public class ItemPiston extends ItemBlock
|
public class ItemPiston extends ItemBlock
|
||||||
{
|
{
|
||||||
public ItemPiston(Block block)
|
public ItemPiston(BlockPistonBase block)
|
||||||
{
|
{
|
||||||
super(block, 7);
|
super(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMagnetic() {
|
public boolean isMagnetic() {
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
package common.item.block;
|
package common.item.block;
|
||||||
|
|
||||||
import common.block.Block;
|
|
||||||
import common.block.tech.BlockBasePressurePlate;
|
import common.block.tech.BlockBasePressurePlate;
|
||||||
import common.model.Model;
|
import common.model.Model;
|
||||||
import common.model.ModelProvider;
|
import common.model.ModelProvider;
|
||||||
|
|
||||||
public class ItemPressurePlate extends ItemBlock {
|
public class ItemPressurePlate extends ItemBlock {
|
||||||
public ItemPressurePlate(Block block) {
|
public ItemPressurePlate(BlockBasePressurePlate block) {
|
||||||
super(block);
|
super(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package common.item.block;
|
package common.item.block;
|
||||||
|
|
||||||
import common.block.Block;
|
import common.block.Block;
|
||||||
|
import common.block.foliage.BlockCrops;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
import common.item.CheatTab;
|
import common.item.CheatTab;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
|
@ -11,16 +12,14 @@ import common.world.World;
|
||||||
|
|
||||||
public class ItemSeedFood extends ItemFood
|
public class ItemSeedFood extends ItemFood
|
||||||
{
|
{
|
||||||
private Block crops;
|
private BlockCrops crops;
|
||||||
|
private Block soil;
|
||||||
|
|
||||||
/** Block ID of the soil this seed food should be planted on. */
|
public ItemSeedFood(int healAmount, BlockCrops crops, Block soil)
|
||||||
private Block soilId;
|
|
||||||
|
|
||||||
public ItemSeedFood(int healAmount, Block crops, Block soil)
|
|
||||||
{
|
{
|
||||||
super(healAmount, false);
|
super(healAmount, false);
|
||||||
this.crops = crops;
|
this.crops = crops;
|
||||||
this.soilId = soil;
|
this.soil = soil;
|
||||||
this.setTab(CheatTab.PLANTS);
|
this.setTab(CheatTab.PLANTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +41,7 @@ public class ItemSeedFood extends ItemFood
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (worldIn.getState(pos).getBlock() == this.soilId && worldIn.isAirBlock(pos.up()))
|
else if (worldIn.getState(pos).getBlock() == this.soil && worldIn.isAirBlock(pos.up()))
|
||||||
{
|
{
|
||||||
worldIn.setState(pos.up(), this.crops.getState());
|
worldIn.setState(pos.up(), this.crops.getState());
|
||||||
--stack.size;
|
--stack.size;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package common.item.block;
|
package common.item.block;
|
||||||
|
|
||||||
import common.block.Block;
|
import common.block.Block;
|
||||||
|
import common.block.foliage.BlockBush;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
import common.item.CheatTab;
|
import common.item.CheatTab;
|
||||||
import common.item.Item;
|
import common.item.Item;
|
||||||
|
@ -12,15 +13,13 @@ import common.world.World;
|
||||||
|
|
||||||
public class ItemSeeds extends Item
|
public class ItemSeeds extends Item
|
||||||
{
|
{
|
||||||
private Block crops;
|
private BlockBush crops;
|
||||||
|
private Block soil;
|
||||||
|
|
||||||
/** BlockID of the block the seeds can be planted on. */
|
public ItemSeeds(BlockBush crops, Block soil)
|
||||||
private Block soilBlockID;
|
|
||||||
|
|
||||||
public ItemSeeds(Block crops, Block soil)
|
|
||||||
{
|
{
|
||||||
this.crops = crops;
|
this.crops = crops;
|
||||||
this.soilBlockID = soil;
|
this.soil = soil;
|
||||||
this.setTab(CheatTab.PLANTS);
|
this.setTab(CheatTab.PLANTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +41,7 @@ public class ItemSeeds extends Item
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (worldIn.getState(pos).getBlock() == this.soilBlockID && worldIn.isAirBlock(pos.up()))
|
else if (worldIn.getState(pos).getBlock() == this.soil && worldIn.isAirBlock(pos.up()))
|
||||||
{
|
{
|
||||||
worldIn.setState(pos.up(), this.crops.getState());
|
worldIn.setState(pos.up(), this.crops.getState());
|
||||||
--stack.size;
|
--stack.size;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package common.item.block;
|
package common.item.block;
|
||||||
|
|
||||||
import common.block.Block;
|
import common.block.Block;
|
||||||
import common.block.tile.BlockSign;
|
|
||||||
import common.block.tile.BlockStandingSign;
|
import common.block.tile.BlockStandingSign;
|
||||||
import common.block.tile.BlockWallSign;
|
import common.block.tile.BlockWallSign;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
|
@ -18,9 +17,9 @@ import common.world.World;
|
||||||
|
|
||||||
public class ItemSign extends Item
|
public class ItemSign extends Item
|
||||||
{
|
{
|
||||||
private final BlockSign block;
|
private final BlockStandingSign block;
|
||||||
|
|
||||||
public ItemSign(BlockSign block)
|
public ItemSign(BlockStandingSign block)
|
||||||
{
|
{
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.setTab(CheatTab.DECORATION);
|
this.setTab(CheatTab.DECORATION);
|
||||||
|
@ -84,17 +83,4 @@ public class ItemSign extends Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// public Set<String> getValidTags() {
|
|
||||||
// return Sets.newHashSet("BlockEntityTag");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// protected boolean validateNbt(NBTTagCompound tag) {
|
|
||||||
// if(tag.hasKey("BlockEntityTag")) {
|
|
||||||
// if(!tag.hasTag("BlockEntityTag")) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class ItemSmallBlock extends Item {
|
||||||
if(!player.canPlayerEdit(pos, side, stack) || stack.size == 0)
|
if(!player.canPlayerEdit(pos, side, stack) || stack.size == 0)
|
||||||
return false;
|
return false;
|
||||||
if(world.canBlockBePlaced(this.block, pos, false, side, null, stack)) {
|
if(world.canBlockBePlaced(this.block, pos, false, side, null, stack)) {
|
||||||
State newState = this.block.onBlockPlaced(world, pos, side, hitX, hitY, hitZ, 0, player);
|
State newState = this.block.onBlockPlaced(world, pos, side, hitX, hitY, hitZ, player);
|
||||||
|
|
||||||
if(world.setState(pos, newState, 3)) {
|
if(world.setState(pos, newState, 3)) {
|
||||||
newState = world.getState(pos);
|
newState = world.getState(pos);
|
||||||
|
|
|
@ -12,7 +12,7 @@ import common.world.World;
|
||||||
|
|
||||||
public class ItemSnow extends ItemBlock
|
public class ItemSnow extends ItemBlock
|
||||||
{
|
{
|
||||||
public ItemSnow(Block block)
|
public ItemSnow(BlockSnow block)
|
||||||
{
|
{
|
||||||
super(block);
|
super(block);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class ItemDye extends Item
|
||||||
|
|
||||||
if (worldIn.isAirBlock(pos))
|
if (worldIn.isAirBlock(pos))
|
||||||
{
|
{
|
||||||
State iblockstate1 = Blocks.cocoa.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, 0, playerIn);
|
State iblockstate1 = Blocks.cocoa.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, playerIn);
|
||||||
worldIn.setState(pos, iblockstate1, 2);
|
worldIn.setState(pos, iblockstate1, 2);
|
||||||
|
|
||||||
// if (!playerIn.creative)
|
// if (!playerIn.creative)
|
||||||
|
|
|
@ -4,14 +4,17 @@ import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import common.block.Block;
|
import common.block.Block;
|
||||||
import common.collect.ImmutableMap;
|
import common.collect.ImmutableMap;
|
||||||
|
import common.collect.ImmutableSet;
|
||||||
import common.collect.ImmutableTable;
|
import common.collect.ImmutableTable;
|
||||||
import common.collect.Iterables;
|
import common.collect.Iterables;
|
||||||
import common.collect.Maps;
|
import common.collect.Maps;
|
||||||
|
import common.collect.Sets;
|
||||||
import common.collect.StandardTable;
|
import common.collect.StandardTable;
|
||||||
import common.collect.Table;
|
import common.collect.Table;
|
||||||
import common.init.BlockRegistry;
|
import common.init.BlockRegistry;
|
||||||
|
@ -35,6 +38,43 @@ public class State {
|
||||||
private final Block block;
|
private final Block block;
|
||||||
private final ImmutableMap<Property, Comparable> properties;
|
private final ImmutableMap<Property, Comparable> properties;
|
||||||
private ImmutableTable<Property, Comparable, State> map;
|
private ImmutableTable<Property, Comparable, State> map;
|
||||||
|
private ImmutableSet<Property> saved;
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private static Set<Property> getSavedProperties(Block block) {
|
||||||
|
Set<Property> stored = Sets.newHashSet();
|
||||||
|
Map<Property, Comparable> map = Maps.newHashMap();
|
||||||
|
for(int z = 0; z < 16; z++) {
|
||||||
|
State sub = block.getStateFromMeta(z);
|
||||||
|
for(Entry<Property, Comparable> entry : sub.getProperties().entrySet()) {
|
||||||
|
if(map.containsKey(entry.getKey())) {
|
||||||
|
if(!map.get(entry.getKey()).equals(entry.getValue()))
|
||||||
|
stored.add(entry.getKey());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
map.put(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(int z = 0; z < 16; z++) {
|
||||||
|
State sub = block.getStateFromMeta(z);
|
||||||
|
Map<Property, Comparable> smap = sub.getProperties();
|
||||||
|
for(Property prop : map.keySet()) {
|
||||||
|
if(!smap.containsKey(prop))
|
||||||
|
stored.add(prop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stored;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String filterProperties(State state, Set<Property> stored) {
|
||||||
|
StringBuilder sb = new StringBuilder(BlockRegistry.getNameFromBlock(state.getBlock()));
|
||||||
|
for(Entry<Property, Comparable> entry : state.getProperties().entrySet()) {
|
||||||
|
if(stored.contains(entry.getKey()))
|
||||||
|
sb.append(',').append(entry.getKey().getName()).append('=').append(entry.getKey().getName(entry.getValue()));
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
public State(Block block, ImmutableMap<Property, Comparable> properties) {
|
public State(Block block, ImmutableMap<Property, Comparable> properties) {
|
||||||
this.block = block;
|
this.block = block;
|
||||||
|
@ -59,6 +99,14 @@ public class State {
|
||||||
return Collections.<Property>unmodifiableCollection(this.properties.keySet());
|
return Collections.<Property>unmodifiableCollection(this.properties.keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Collection<Property> getSavedProperties() {
|
||||||
|
return this.saved;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
public <T extends Comparable<T>> T getValue(Property<T> property) {
|
public <T extends Comparable<T>> T getValue(Property<T> property) {
|
||||||
if(!this.properties.containsKey(property)) {
|
if(!this.properties.containsKey(property)) {
|
||||||
throw new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.block);
|
throw new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.block);
|
||||||
|
@ -118,10 +166,8 @@ public class State {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildTable(Map<Map<Property, Comparable>, State> map) {
|
public void buildTable(Map<Map<Property, Comparable>, State> map) {
|
||||||
if(this.map != null) {
|
if(this.map != null)
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
|
||||||
else {
|
|
||||||
Table<Property, Comparable, State> table = new StandardTable<Property, Comparable, State>();
|
Table<Property, Comparable, State> table = new StandardTable<Property, Comparable, State>();
|
||||||
for(Property<? extends Comparable> prop : this.properties.keySet()) {
|
for(Property<? extends Comparable> prop : this.properties.keySet()) {
|
||||||
for(Comparable value : prop.getStates()) {
|
for(Comparable value : prop.getStates()) {
|
||||||
|
@ -134,5 +180,11 @@ public class State {
|
||||||
}
|
}
|
||||||
this.map = ImmutableTable.<Property, Comparable, State>copyOf(table);
|
this.map = ImmutableTable.<Property, Comparable, State>copyOf(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void buildSaved() {
|
||||||
|
if(this.saved != null)
|
||||||
|
throw new IllegalStateException();
|
||||||
|
this.saved = ImmutableSet.copyOf(getSavedProperties(this.block));
|
||||||
|
this.id = filterProperties(this, this.saved);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ import common.init.BlockRegistry;
|
||||||
import common.init.Blocks;
|
import common.init.Blocks;
|
||||||
import common.init.EntityRegistry;
|
import common.init.EntityRegistry;
|
||||||
import common.log.Log;
|
import common.log.Log;
|
||||||
import common.properties.Property;
|
|
||||||
import common.tags.TagObject;
|
import common.tags.TagObject;
|
||||||
import common.tileentity.TileEntity;
|
import common.tileentity.TileEntity;
|
||||||
import common.util.BlockPos;
|
import common.util.BlockPos;
|
||||||
|
@ -38,41 +37,6 @@ import common.world.BlockArray;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
|
||||||
public class Region {
|
public class Region {
|
||||||
private static Set<Property> getSavedProperties(Block block) {
|
|
||||||
Set<Property> stored = Sets.newHashSet();
|
|
||||||
Map<Property, Comparable> map = Maps.newHashMap();
|
|
||||||
for(int z = 0; z < 16; z++) {
|
|
||||||
State sub = block.getStateFromMeta(z);
|
|
||||||
for(Entry<Property, Comparable> entry : sub.getProperties().entrySet()) {
|
|
||||||
if(map.containsKey(entry.getKey())) {
|
|
||||||
if(!map.get(entry.getKey()).equals(entry.getValue()))
|
|
||||||
stored.add(entry.getKey());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
map.put(entry.getKey(), entry.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(int z = 0; z < 16; z++) {
|
|
||||||
State sub = block.getStateFromMeta(z);
|
|
||||||
Map<Property, Comparable> smap = sub.getProperties();
|
|
||||||
for(Property prop : map.keySet()) {
|
|
||||||
if(!smap.containsKey(prop))
|
|
||||||
stored.add(prop);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return stored;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String filterProperties(State state, Set<Property> stored) {
|
|
||||||
StringBuilder sb = new StringBuilder(BlockRegistry.getNameFromBlock(state.getBlock()));
|
|
||||||
for(Entry<Property, Comparable> entry : state.getProperties().entrySet()) {
|
|
||||||
if(stored.contains(entry.getKey()))
|
|
||||||
sb.append(',').append(entry.getKey().getName()).append('=').append(entry.getKey().getName(entry.getValue()));
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean makeMap(TagObject tag) {
|
private static boolean makeMap(TagObject tag) {
|
||||||
Set<String> removed = Sets.newHashSet();
|
Set<String> removed = Sets.newHashSet();
|
||||||
for(String id : tag.keySet()) {
|
for(String id : tag.keySet()) {
|
||||||
|
@ -86,10 +50,9 @@ public class Region {
|
||||||
for(int z = 0; z < 4096; z++) {
|
for(int z = 0; z < 4096; z++) {
|
||||||
Block block = BlockRegistry.getBlockById(z);
|
Block block = BlockRegistry.getBlockById(z);
|
||||||
if(block != Blocks.air) {
|
if(block != Blocks.air) {
|
||||||
Set<Property> stored = getSavedProperties(block);
|
|
||||||
for(int n = 0; n < 16; n++) {
|
for(int n = 0; n < 16; n++) {
|
||||||
State state = block.getStateFromMeta(n);
|
State state = block.getStateFromMeta(n);
|
||||||
String id = filterProperties(state, stored);
|
String id = state.getId();
|
||||||
List<Character> ids = current.get(id);
|
List<Character> ids = current.get(id);
|
||||||
char mid = (char)BlockRegistry.STATEMAP.get(state);
|
char mid = (char)BlockRegistry.STATEMAP.get(state);
|
||||||
if(ids == null) {
|
if(ids == null) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue