Compare commits
2 commits
cde7bf84c1
...
ea76cecba3
Author | SHA1 | Date | |
---|---|---|---|
ea76cecba3 | |||
eb815a8e21 |
74 changed files with 281 additions and 448 deletions
|
@ -1930,7 +1930,7 @@ public class Client implements IThreadListener {
|
|||
String.format("Position: %d %d %d", pos.getX(), pos.getY(), pos.getZ())
|
||||
);
|
||||
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();
|
||||
|
|
|
@ -774,8 +774,8 @@ public class Block {
|
|||
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) {
|
||||
return this.getStateFromMeta(meta);
|
||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) {
|
||||
return this.getState();
|
||||
}
|
||||
|
||||
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
|
||||
* 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));
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* 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
|
||||
* 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))
|
||||
{
|
||||
|
|
|
@ -19,8 +19,12 @@ public class BlockMetalBlock extends Block {
|
|||
this.setRadiation(metal.radioactivity * 2.0f);
|
||||
this.setTab(CheatTab.GEMS);
|
||||
}
|
||||
|
||||
public MetalType getMetal() {
|
||||
return this.metal;
|
||||
}
|
||||
|
||||
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
|
||||
* 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));
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class BlockQuartzPillar extends BlockRotatedPillar
|
|||
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());
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class BlockSkull extends Block implements Rotatable {
|
|||
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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
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
|
||||
* 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);
|
||||
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
|
||||
* 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();
|
||||
|
||||
|
|
|
@ -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
|
||||
* 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())
|
||||
{
|
||||
|
|
|
@ -4,7 +4,6 @@ import common.block.Block;
|
|||
import common.block.Material;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
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
|
||||
* 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();
|
||||
}
|
||||
|
@ -141,10 +140,6 @@ public class BlockHugeMushroom extends Block
|
|||
.w(name + "_cap").e(name + "_inside");
|
||||
}
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemBlock(this, 14);
|
||||
}
|
||||
|
||||
public static enum EnumType implements Identifyable
|
||||
{
|
||||
|
|
|
@ -8,6 +8,7 @@ import common.block.SoundType;
|
|||
import common.collect.Lists;
|
||||
import common.color.Colorizer;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
import common.init.ItemRegistry;
|
||||
import common.init.WoodType;
|
||||
|
@ -24,6 +25,7 @@ import common.properties.PropertyBool;
|
|||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.vars.Vars;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.AWorldClient;
|
||||
|
@ -326,6 +328,10 @@ public class BlockLeaves extends BlockLeavesBase
|
|||
super.harvestBlock(worldIn, player, pos, state, te);
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
return this.subType.isTinted() ? provider.getModel(name).add().all().tint() :
|
||||
|
@ -337,6 +343,6 @@ public class BlockLeaves extends BlockLeavesBase
|
|||
}
|
||||
|
||||
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};
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* 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) {
|
||||
|
|
|
@ -25,7 +25,7 @@ public class BlockPumpkin extends Block implements Rotatable {
|
|||
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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
* 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));
|
||||
return facing.getAxis().isHorizontal() ? iblockstate.withProperty(getPropertyFor(facing.getOpposite()), Boolean.valueOf(true)) : iblockstate;
|
||||
|
|
|
@ -14,8 +14,12 @@ public class BlockMetalOre extends BlockOre {
|
|||
this.setLightLevel(metal.radioactivity > 0.0F ? 0.25F : 0.0F);
|
||||
this.setRadiation(metal.radioactivity * 0.5f);
|
||||
}
|
||||
|
||||
public MetalType getMetal() {
|
||||
return this.metal;
|
||||
}
|
||||
|
||||
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
|
||||
* 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();
|
||||
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)
|
||||
|
|
|
@ -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
|
||||
* 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));
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* 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());
|
||||
}
|
||||
|
|
|
@ -10,9 +10,7 @@ import common.entity.types.EntityLiving;
|
|||
import common.inventory.Container;
|
||||
import common.inventory.InventoryHelper;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
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
|
||||
* 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));
|
||||
}
|
||||
|
@ -321,8 +319,4 @@ public class BlockDispenser extends BlockContainer implements Directional
|
|||
public Property<?>[] getIgnoredProperties() {
|
||||
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
|
||||
* 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());
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* 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();
|
||||
|
||||
|
|
|
@ -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
|
||||
* 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));
|
||||
|
||||
|
|
|
@ -81,8 +81,7 @@ public abstract class BlockMachine extends Block implements Rotatable, ITileEnti
|
|||
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,
|
||||
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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
* 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));
|
||||
}
|
||||
|
@ -632,7 +632,6 @@ public class BlockPistonBase extends Block implements Directional
|
|||
BlockPos blockpos2 = (BlockPos)list.get(k);
|
||||
State iblockstate = worldIn.getState(blockpos2);
|
||||
Block block1 = iblockstate.getBlock();
|
||||
block1.getMetaFromState(iblockstate);
|
||||
worldIn.setBlockToAir(blockpos2);
|
||||
blockpos2 = blockpos2.offset(enumfacing);
|
||||
worldIn.setState(blockpos2, Blocks.piston_extension.getState().withProperty(FACING, direction), 4);
|
||||
|
|
|
@ -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
|
||||
* 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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* 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());
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* 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))
|
||||
{
|
||||
|
|
|
@ -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
|
||||
* 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));
|
||||
|
||||
|
|
|
@ -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
|
||||
* 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());
|
||||
}
|
||||
|
|
|
@ -222,39 +222,21 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
|
||||
private long seed = 0L;
|
||||
|
||||
public static void writeState(TagObject tag, String name, String dname, State state) {
|
||||
if(state == null)
|
||||
return;
|
||||
tag.setString(name, BlockRegistry.getNameFromBlock(state.getBlock()));
|
||||
if(state != state.getBlock().getState())
|
||||
tag.setByte(dname, (byte)state.getBlock().getMetaFromState(state));
|
||||
}
|
||||
|
||||
public static void writeState(TagObject tag, String name, State state) {
|
||||
writeState(tag, name, name + "Data", state);
|
||||
if(state != null)
|
||||
tag.setString(name, state.getId());
|
||||
}
|
||||
|
||||
public static void writeState(TagObject tag, State state) {
|
||||
writeState(tag, "Block", "Data", state);
|
||||
}
|
||||
|
||||
public static State readState(TagObject tag, String name, String dname, State def) {
|
||||
if(!tag.hasString(name))
|
||||
return def;
|
||||
Block block = BlockRegistry.getRegisteredBlock(tag.getString(name));
|
||||
if(tag.hasByte(dname)) {
|
||||
byte data = tag.getByte(dname);
|
||||
return data < 0 || data >= 16 ? block.getState() : block.getStateFromMeta(data);
|
||||
}
|
||||
return block.getState();
|
||||
writeState(tag, "Block", state);
|
||||
}
|
||||
|
||||
public static State readState(TagObject tag, String name, State def) {
|
||||
return readState(tag, name, name + "Data", def);
|
||||
return tag.hasString(name) ? State.getState(tag.getString(name), def) : def;
|
||||
}
|
||||
|
||||
public static State readState(TagObject tag, State def) {
|
||||
return readState(tag, "Block", "Data", def);
|
||||
return readState(tag, "Block", def);
|
||||
}
|
||||
|
||||
public Dimension(int id, String name) {
|
||||
|
@ -956,12 +938,9 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.caveFiller = readState(tag, "CaveFillBlock", Blocks.lava.getState());
|
||||
if(tag.hasStringArray("Layers")) {
|
||||
String[] list = tag.getStringArray("Layers");
|
||||
byte[] data = tag.hasByteArray("LayerData") ? tag.getByteArray("LayerData") : null;
|
||||
data = data != null && data.length != list.length ? null : data;
|
||||
this.layers = new State[list.length];
|
||||
for(int z = 0; z < this.layers.length; z++) {
|
||||
Block block = BlockRegistry.getRegisteredBlock(list[z]);
|
||||
this.layers[z] = data == null ? block.getState() : block.getStateFromMeta(data[z]);
|
||||
this.layers[z] = State.getState(list[z], Blocks.air.getState());
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -1197,18 +1176,11 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
writeState(tag, "AltBlock2", this.alt2);
|
||||
writeState(tag, "CaveFillBlock", this.caveFiller);
|
||||
if(this.layers != null) {
|
||||
boolean dataUsed = false;
|
||||
String[] list = new String[this.layers.length];
|
||||
byte[] data = new byte[this.layers.length];
|
||||
for(int z = 0; z < this.layers.length; z++) {
|
||||
State state = this.layers[z];
|
||||
list[z] = BlockRegistry.getNameFromBlock(state.getBlock());
|
||||
data[z] = (byte)state.getBlock().getMetaFromState(state);
|
||||
dataUsed |= state.getBlock().getState() != state;
|
||||
list[z] = this.layers[z].getId();
|
||||
}
|
||||
tag.setStringArray("Layers", list);
|
||||
if(dataUsed)
|
||||
tag.setByteArray("LayerData", data);
|
||||
}
|
||||
if(this.addBiomes != null) {
|
||||
String[] list = new String[this.addBiomes.length];
|
||||
|
|
|
@ -1061,7 +1061,7 @@ public abstract class Entity
|
|||
|
||||
if (block.getMaterial().isColdLiquid())
|
||||
{
|
||||
float f = BlockLiquid.getLiquidHeightPercent(iblockstate.getBlock().getMetaFromState(iblockstate)) - 0.11111111F;
|
||||
float f = BlockLiquid.getLiquidHeightPercent(iblockstate.getValue(BlockLiquid.LEVEL)) - 0.11111111F;
|
||||
float f1 = (float)(blockpos.getY() + 1) - f;
|
||||
boolean flag = d0 < (double)f1;
|
||||
return !flag && this.isPlayer() ? false : flag;
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package common.entity.item;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.tech.BlockRailBase;
|
||||
import common.block.tech.BlockRailPowered;
|
||||
import common.entity.DamageSource;
|
||||
import common.entity.Entity;
|
||||
import common.entity.EntityType;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.item.Item;
|
||||
|
@ -89,9 +87,6 @@ public abstract class EntityCart extends Entity implements IWorldNameable
|
|||
this.dataWatcher.addObject(17, 0);
|
||||
this.dataWatcher.addObject(18, 1);
|
||||
this.dataWatcher.addObject(19, 0);
|
||||
this.dataWatcher.addObject(20, 0);
|
||||
this.dataWatcher.addObject(21, 6);
|
||||
this.dataWatcher.addObject(22, Byte.valueOf((byte)0));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -755,24 +750,6 @@ public abstract class EntityCart extends Entity implements IWorldNameable
|
|||
*/
|
||||
protected void readEntity(TagObject tagCompund)
|
||||
{
|
||||
if (tagCompund.getBool("CustomDisplayTile"))
|
||||
{
|
||||
int i = tagCompund.getInt("DisplayData");
|
||||
|
||||
if (tagCompund.hasString("DisplayTile"))
|
||||
{
|
||||
Block block = BlockRegistry.getRegisteredBlock(tagCompund.getString("DisplayTile"));
|
||||
|
||||
this.func_174899_a(block.getStateFromMeta(i));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.func_174899_a(Blocks.air.getState());
|
||||
}
|
||||
|
||||
this.setDisplayTileOffset(tagCompund.getInt("DisplayOffset"));
|
||||
}
|
||||
|
||||
if (tagCompund.hasString("CustomName") && tagCompund.getString("CustomName").length() > 0)
|
||||
{
|
||||
this.entityName = tagCompund.getString("CustomName");
|
||||
|
@ -784,16 +761,6 @@ public abstract class EntityCart extends Entity implements IWorldNameable
|
|||
*/
|
||||
protected void writeEntity(TagObject tagCompound)
|
||||
{
|
||||
if (this.hasDisplayTile())
|
||||
{
|
||||
tagCompound.setBool("CustomDisplayTile", true);
|
||||
State iblockstate = this.getDisplayTile();
|
||||
String resourcelocation = BlockRegistry.getNameFromBlock(iblockstate.getBlock());
|
||||
tagCompound.setString("DisplayTile", resourcelocation == null ? "" : resourcelocation);
|
||||
tagCompound.setInt("DisplayData", iblockstate.getBlock().getMetaFromState(iblockstate));
|
||||
tagCompound.setInt("DisplayOffset", this.getDisplayTileOffset());
|
||||
}
|
||||
|
||||
if (this.entityName != null && this.entityName.length() > 0)
|
||||
{
|
||||
tagCompound.setString("CustomName", this.entityName);
|
||||
|
@ -972,47 +939,15 @@ public abstract class EntityCart extends Entity implements IWorldNameable
|
|||
public abstract EntityCart.EnumMinecartType getMinecartType();
|
||||
|
||||
public State getDisplayTile()
|
||||
{
|
||||
return !this.hasDisplayTile() ? this.getDefaultDisplayTile() : BlockRegistry.getStateById(this.getDataWatcher().getWatchableObjectInt(20));
|
||||
}
|
||||
|
||||
public State getDefaultDisplayTile()
|
||||
{
|
||||
return Blocks.air.getState();
|
||||
}
|
||||
|
||||
public int getDisplayTileOffset()
|
||||
{
|
||||
return !this.hasDisplayTile() ? this.getDefaultDisplayTileOffset() : this.getDataWatcher().getWatchableObjectInt(21);
|
||||
}
|
||||
|
||||
public int getDefaultDisplayTileOffset()
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
public void func_174899_a(State p_174899_1_)
|
||||
{
|
||||
this.getDataWatcher().updateObject(20, Integer.valueOf(BlockRegistry.getStateId(p_174899_1_)));
|
||||
this.setHasDisplayTile(true);
|
||||
}
|
||||
|
||||
public void setDisplayTileOffset(int p_94086_1_)
|
||||
{
|
||||
this.getDataWatcher().updateObject(21, Integer.valueOf(p_94086_1_));
|
||||
this.setHasDisplayTile(true);
|
||||
}
|
||||
|
||||
public boolean hasDisplayTile()
|
||||
{
|
||||
return this.getDataWatcher().getWatchableObjectByte(22) == 1;
|
||||
}
|
||||
|
||||
public void setHasDisplayTile(boolean p_94096_1_)
|
||||
{
|
||||
this.getDataWatcher().updateObject(22, Byte.valueOf((byte)(p_94096_1_ ? 1 : 0)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the custom name tag for this entity
|
||||
*/
|
||||
|
|
|
@ -48,12 +48,12 @@ public class EntityChestCart extends EntityCartContainer
|
|||
return EntityCart.EnumMinecartType.CHEST;
|
||||
}
|
||||
|
||||
public State getDefaultDisplayTile()
|
||||
public State getDisplayTile()
|
||||
{
|
||||
return Blocks.chest.getState().withProperty(BlockChest.FACING, Facing.NORTH);
|
||||
}
|
||||
|
||||
public int getDefaultDisplayTileOffset()
|
||||
public int getDisplayTileOffset()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
|
|
@ -203,10 +203,7 @@ public class EntityFalling extends Entity implements IObjectData
|
|||
*/
|
||||
protected void writeEntity(TagObject tagCompound)
|
||||
{
|
||||
Block block = this.fallTile != null ? this.fallTile.getBlock() : Blocks.air;
|
||||
String resourcelocation = BlockRegistry.getNameFromBlock(block);
|
||||
tagCompound.setString("Block", resourcelocation == null ? "" : resourcelocation.toString());
|
||||
tagCompound.setByte("Data", (byte)block.getMetaFromState(this.fallTile));
|
||||
tagCompound.setString("Block", (this.fallTile != null ? this.fallTile : Blocks.air.getState()).getId());
|
||||
tagCompound.setByte("Time", (byte)this.fallTime);
|
||||
tagCompound.setBool("DropItem", this.shouldDropItem);
|
||||
tagCompound.setBool("HurtEntities", this.hurtEntities);
|
||||
|
@ -219,11 +216,9 @@ public class EntityFalling extends Entity implements IObjectData
|
|||
*/
|
||||
protected void readEntity(TagObject tagCompund)
|
||||
{
|
||||
int i = tagCompund.getByte("Data") & 255;
|
||||
|
||||
if (tagCompund.hasString("Block"))
|
||||
{
|
||||
this.fallTile = BlockRegistry.getRegisteredBlock(tagCompund.getString("Block")).getStateFromMeta(i);
|
||||
this.fallTile = State.getState(tagCompund.getString("Block"), Blocks.sand.getState());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -40,12 +40,12 @@ public class EntityHopperCart extends EntityCartContainer implements IHopper
|
|||
return EntityCart.EnumMinecartType.HOPPER;
|
||||
}
|
||||
|
||||
public State getDefaultDisplayTile()
|
||||
public State getDisplayTile()
|
||||
{
|
||||
return Blocks.hopper.getState();
|
||||
}
|
||||
|
||||
public int getDefaultDisplayTileOffset()
|
||||
public int getDisplayTileOffset()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public class EntityTntCart extends EntityCart
|
|||
return EntityCart.EnumMinecartType.TNT;
|
||||
}
|
||||
|
||||
public State getDefaultDisplayTile()
|
||||
public State getDisplayTile()
|
||||
{
|
||||
return Blocks.tnt.getState();
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import common.entity.npc.EntityNPC;
|
|||
import common.entity.types.EntityLiving;
|
||||
import common.entity.types.IObjectData;
|
||||
import common.entity.types.IProjectile;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
|
@ -32,8 +31,7 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData
|
|||
private int xTile = -1;
|
||||
private int yTile = -1;
|
||||
private int zTile = -1;
|
||||
private Block inTile;
|
||||
private int inData;
|
||||
private State inTile;
|
||||
private boolean inGround;
|
||||
|
||||
/** 1 if the player can pick up the arrow */
|
||||
|
@ -219,9 +217,7 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData
|
|||
|
||||
if (this.inGround)
|
||||
{
|
||||
int j = block.getMetaFromState(iblockstate);
|
||||
|
||||
if (block == this.inTile && j == this.inData)
|
||||
if (iblockstate == this.inTile)
|
||||
{
|
||||
++this.ticksInGround;
|
||||
|
||||
|
@ -383,8 +379,7 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData
|
|||
this.yTile = blockpos1.getY();
|
||||
this.zTile = blockpos1.getZ();
|
||||
State iblockstate1 = this.worldObj.getState(blockpos1);
|
||||
this.inTile = iblockstate1.getBlock();
|
||||
this.inData = this.inTile.getMetaFromState(iblockstate1);
|
||||
this.inTile = iblockstate1;
|
||||
this.motionX = (double)((float)(movingobjectposition.vec.xCoord - this.posX));
|
||||
this.motionY = (double)((float)(movingobjectposition.vec.yCoord - this.posY));
|
||||
this.motionZ = (double)((float)(movingobjectposition.vec.zCoord - this.posZ));
|
||||
|
@ -397,9 +392,9 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData
|
|||
this.arrowShake = 7;
|
||||
this.setIsCritical(false);
|
||||
|
||||
if (this.inTile != Blocks.air)
|
||||
if (this.inTile.getBlock() != Blocks.air)
|
||||
{
|
||||
this.inTile.onEntityCollidedWithBlock(this.worldObj, blockpos1, iblockstate1, this);
|
||||
this.inTile.getBlock().onEntityCollidedWithBlock(this.worldObj, blockpos1, iblockstate1, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -478,10 +473,8 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData
|
|||
tagCompound.setShort("zTile", (short)this.zTile);
|
||||
tagCompound.setShort("life", (short)this.ticksInGround);
|
||||
if(this.inTile != null) {
|
||||
String id = BlockRegistry.getNameFromBlock(this.inTile);
|
||||
tagCompound.setString("inTile", id == null ? "" : id.toString());
|
||||
tagCompound.setString("inTile", this.inTile.getId());
|
||||
}
|
||||
tagCompound.setByte("inData", (byte)this.inData);
|
||||
tagCompound.setByte("shake", (byte)this.arrowShake);
|
||||
tagCompound.setBool("inGround", this.inGround);
|
||||
tagCompound.setByte("pickup", (byte)this.canBePickedUp);
|
||||
|
@ -500,14 +493,13 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData
|
|||
|
||||
if (tagCompund.hasString("inTile"))
|
||||
{
|
||||
this.inTile = BlockRegistry.getRegisteredBlock(tagCompund.getString("inTile"));
|
||||
this.inTile = State.getState(tagCompund.getString("inTile"), null);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.inTile = null;
|
||||
}
|
||||
|
||||
this.inData = tagCompund.getByte("inData") & 255;
|
||||
this.arrowShake = tagCompund.getByte("shake") & 255;
|
||||
this.inGround = tagCompund.getBool("inGround");
|
||||
|
||||
|
|
|
@ -132,14 +132,12 @@ import common.color.DyeColor;
|
|||
import common.item.CheatTab;
|
||||
import common.log.Log;
|
||||
import common.model.TextureAnimation;
|
||||
import common.util.IdMap;
|
||||
import common.util.Mapping;
|
||||
import common.util.Util;
|
||||
import common.world.State;
|
||||
|
||||
public abstract class BlockRegistry {
|
||||
public static final Mapping<Block> REGISTRY = new Mapping("air");
|
||||
public static final IdMap<State> STATEMAP = new IdMap();
|
||||
|
||||
private static int nextBlockId = 0;
|
||||
|
||||
|
@ -147,56 +145,29 @@ public abstract class BlockRegistry {
|
|||
return REGISTRY.getId(block);
|
||||
}
|
||||
|
||||
public static Block getBlockById(int id) {
|
||||
return REGISTRY.byId(id);
|
||||
}
|
||||
|
||||
public static String getNameFromBlock(Block block) {
|
||||
return REGISTRY.getName(block);
|
||||
}
|
||||
|
||||
public static Block getRegisteredBlock(String name) {
|
||||
return REGISTRY.byName(name);
|
||||
}
|
||||
|
||||
public static int getStateId(State state) {
|
||||
Block block = state.getBlock();
|
||||
return getIdFromBlock(block) + (block.getMetaFromState(state) << 12);
|
||||
}
|
||||
|
||||
public static Block getBlockById(int id) {
|
||||
return REGISTRY.byId(id);
|
||||
}
|
||||
|
||||
public static State getStateById(int id) {
|
||||
int i = id & 4095;
|
||||
int j = id >> 12 & 15;
|
||||
return getBlockById(i).getStateFromMeta(j);
|
||||
}
|
||||
|
||||
public static State getFromIdName(String name, State def) {
|
||||
if(name == null)
|
||||
return def;
|
||||
String[] tok = name.split(":");
|
||||
if(tok.length < 1 || tok.length > 2)
|
||||
return def;
|
||||
Block block = REGISTRY.byNameExact(tok[0]);
|
||||
if(block == null)
|
||||
return def;
|
||||
byte data;
|
||||
if(tok.length == 2) {
|
||||
try {
|
||||
int i = Integer.parseUnsignedInt(tok[1]);
|
||||
if(i >= 16)
|
||||
return def;
|
||||
data = (byte)i;
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
else {
|
||||
data = (byte)block.getMetaFromState(block.getState());
|
||||
}
|
||||
return block.getStateFromMeta(data);
|
||||
}
|
||||
|
||||
public static Block getRegisteredBlock(String name) {
|
||||
return REGISTRY.byName(name);
|
||||
}
|
||||
|
||||
private static void registerBlock(String name, Block block) {
|
||||
REGISTRY.register(nextBlockId++, name, block);
|
||||
}
|
||||
|
@ -651,7 +622,7 @@ public abstract class BlockRegistry {
|
|||
|
||||
for(Block block : REGISTRY) {
|
||||
for(State state : block.getValidStates()) {
|
||||
STATEMAP.put(state, REGISTRY.getId(block) << 4 | block.getMetaFromState(state));
|
||||
state.buildSaved();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -93,25 +93,16 @@ public abstract class ItemRegistry {
|
|||
return item == null ? 0 : REGISTRY.getId(item);
|
||||
}
|
||||
|
||||
public static String getNameFromItem(Item item) {
|
||||
return REGISTRY.getName(item);
|
||||
}
|
||||
|
||||
public static Item getItemById(int id) {
|
||||
return REGISTRY.byId(id);
|
||||
}
|
||||
|
||||
public static Item getRegisteredItem(String name) {
|
||||
return REGISTRY.byName(name);
|
||||
public static String getNameFromItem(Item item) {
|
||||
return REGISTRY.getName(item);
|
||||
}
|
||||
|
||||
public static ItemStack getFromIdName(String name, ItemStack def) {
|
||||
if(name == null)
|
||||
return def;
|
||||
Item item = REGISTRY.byName(name);
|
||||
if(item == null)
|
||||
return def;
|
||||
return new ItemStack(item);
|
||||
public static Item getRegisteredItem(String name) {
|
||||
return REGISTRY.byName(name);
|
||||
}
|
||||
|
||||
private static void registerItem(String name, Item item) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package common.item;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
@ -67,6 +68,17 @@ public final class ItemStack
|
|||
return itemstack.getItem() != null ? itemstack : null;
|
||||
}
|
||||
|
||||
public static ItemStack getStack(String name, ItemStack def) {
|
||||
if(name == null)
|
||||
return def;
|
||||
Item item = ItemRegistry.REGISTRY.byNameExact(name);
|
||||
return item == null ? def : new ItemStack(item);
|
||||
}
|
||||
|
||||
public static Collection<String> getKeys() {
|
||||
return ItemRegistry.REGISTRY.getKeys();
|
||||
}
|
||||
|
||||
private ItemStack()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package common.item.block;
|
|||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.tile.BlockBanner;
|
||||
import common.block.tile.BlockBannerStanding;
|
||||
import common.block.tile.BlockStandingSign;
|
||||
import common.block.tile.BlockWallSign;
|
||||
import common.color.DyeColor;
|
||||
|
@ -26,9 +26,9 @@ import common.world.World;
|
|||
|
||||
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.setTab(CheatTab.DECORATION);
|
||||
|
|
|
@ -23,33 +23,21 @@ public class ItemBlock extends Item
|
|||
{
|
||||
protected final Block block;
|
||||
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)
|
||||
{
|
||||
this(block, flatTexture, 0);
|
||||
this.block = block;
|
||||
this.flatTexture = flatTexture;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
this(block, null, 0);
|
||||
this(block, null);
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
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))
|
||||
{
|
||||
|
@ -224,8 +212,8 @@ public class ItemBlock extends Item
|
|||
public Model getModel(ModelProvider provider, String name) {
|
||||
return this.flatTexture != null ? provider.getModel(this.getTransform(), !this.flatTexture.isEmpty() ? this.flatTexture :
|
||||
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,
|
||||
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;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.tech.BlockChest;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transforms;
|
||||
|
||||
public class ItemChest extends ItemBlock {
|
||||
public ItemChest(Block block) {
|
||||
public ItemChest(BlockChest 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);
|
||||
}
|
||||
|
||||
public ItemColored(Block block, int fixedMeta)
|
||||
{
|
||||
super(block, fixedMeta);
|
||||
}
|
||||
|
||||
public ItemColored(Block block)
|
||||
{
|
||||
super(block);
|
||||
|
|
|
@ -15,9 +15,9 @@ import common.world.World;
|
|||
|
||||
public class ItemDoor extends Item
|
||||
{
|
||||
private Block block;
|
||||
private final BlockDoor block;
|
||||
|
||||
public ItemDoor(Block block)
|
||||
public ItemDoor(BlockDoor block)
|
||||
{
|
||||
this.block = block;
|
||||
this.setTab(block.getMaterial() == Material.WOOD ? CheatTab.WOOD : CheatTab.TECHNOLOGY);
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package common.item.block;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.artificial.BlockFence;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
||||
public class ItemFence extends ItemBlock {
|
||||
public ItemFence(Block block) {
|
||||
public ItemFence(BlockFence block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package common.item.block;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.foliage.BlockLilyPad;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.entity.npc.EntityNPC;
|
||||
|
@ -13,7 +12,7 @@ import common.world.World;
|
|||
|
||||
public class ItemLilyPad extends ItemColored
|
||||
{
|
||||
public ItemLilyPad(Block block)
|
||||
public ItemLilyPad(BlockLilyPad block)
|
||||
{
|
||||
super(block, "");
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import java.util.Map;
|
|||
import common.attributes.Attribute;
|
||||
import common.attributes.UsageSlot;
|
||||
import common.block.Block;
|
||||
import common.block.artificial.BlockMetalBlock;
|
||||
import common.block.natural.BlockMetalOre;
|
||||
import common.color.TextColor;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.MetalType;
|
||||
|
@ -14,7 +16,7 @@ public class ItemMetalBlock extends ItemBlock {
|
|||
private final MetalType metal;
|
||||
private final boolean ore;
|
||||
|
||||
public ItemMetalBlock(Block block, MetalType metal, boolean ore) {
|
||||
private ItemMetalBlock(Block block, MetalType metal, boolean ore) {
|
||||
super(block);
|
||||
this.metal = metal;
|
||||
this.ore = ore;
|
||||
|
@ -22,6 +24,14 @@ public class ItemMetalBlock extends ItemBlock {
|
|||
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)
|
||||
{
|
||||
tooltip.add(this.metal.formatSymbol());
|
||||
|
@ -30,11 +40,6 @@ public class ItemMetalBlock extends ItemBlock {
|
|||
}
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package common.item.block;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.tech.BlockPistonBase;
|
||||
import common.init.Blocks;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
||||
public class ItemPiston extends ItemBlock
|
||||
{
|
||||
public ItemPiston(Block block)
|
||||
public ItemPiston(BlockPistonBase block)
|
||||
{
|
||||
super(block, 7);
|
||||
super(block);
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package common.item.block;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.tech.BlockBasePressurePlate;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
||||
public class ItemPressurePlate extends ItemBlock {
|
||||
public ItemPressurePlate(Block block) {
|
||||
public ItemPressurePlate(BlockBasePressurePlate block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package common.item.block;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.foliage.BlockCrops;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.item.CheatTab;
|
||||
import common.item.ItemStack;
|
||||
|
@ -11,16 +12,14 @@ import common.world.World;
|
|||
|
||||
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. */
|
||||
private Block soilId;
|
||||
|
||||
public ItemSeedFood(int healAmount, Block crops, Block soil)
|
||||
public ItemSeedFood(int healAmount, BlockCrops crops, Block soil)
|
||||
{
|
||||
super(healAmount, false);
|
||||
this.crops = crops;
|
||||
this.soilId = soil;
|
||||
this.soil = soil;
|
||||
this.setTab(CheatTab.PLANTS);
|
||||
}
|
||||
|
||||
|
@ -42,7 +41,7 @@ public class ItemSeedFood extends ItemFood
|
|||
{
|
||||
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());
|
||||
--stack.size;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package common.item.block;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.foliage.BlockBush;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
|
@ -12,15 +13,13 @@ import common.world.World;
|
|||
|
||||
public class ItemSeeds extends Item
|
||||
{
|
||||
private Block crops;
|
||||
private BlockBush crops;
|
||||
private Block soil;
|
||||
|
||||
/** BlockID of the block the seeds can be planted on. */
|
||||
private Block soilBlockID;
|
||||
|
||||
public ItemSeeds(Block crops, Block soil)
|
||||
public ItemSeeds(BlockBush crops, Block soil)
|
||||
{
|
||||
this.crops = crops;
|
||||
this.soilBlockID = soil;
|
||||
this.soil = soil;
|
||||
this.setTab(CheatTab.PLANTS);
|
||||
}
|
||||
|
||||
|
@ -42,7 +41,7 @@ public class ItemSeeds extends Item
|
|||
{
|
||||
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());
|
||||
--stack.size;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package common.item.block;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.tile.BlockSign;
|
||||
import common.block.tile.BlockStandingSign;
|
||||
import common.block.tile.BlockWallSign;
|
||||
import common.entity.npc.EntityNPC;
|
||||
|
@ -18,9 +17,9 @@ import common.world.World;
|
|||
|
||||
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.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)
|
||||
return false;
|
||||
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)) {
|
||||
newState = world.getState(pos);
|
||||
|
|
|
@ -12,7 +12,7 @@ import common.world.World;
|
|||
|
||||
public class ItemSnow extends ItemBlock
|
||||
{
|
||||
public ItemSnow(Block block)
|
||||
public ItemSnow(BlockSnow block)
|
||||
{
|
||||
super(block);
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public class ItemDye extends Item
|
|||
|
||||
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);
|
||||
|
||||
// if (!playerIn.creative)
|
||||
|
|
|
@ -2,7 +2,6 @@ package common.packet;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import common.init.BlockRegistry;
|
||||
import common.network.IClientPlayer;
|
||||
import common.network.Packet;
|
||||
import common.network.PacketBuffer;
|
||||
|
@ -31,7 +30,7 @@ public class SPacketBlockChange implements Packet<IClientPlayer>
|
|||
public void readPacketData(PacketBuffer buf) throws IOException
|
||||
{
|
||||
this.blockPosition = buf.readBlockPos();
|
||||
this.blockState = (State)BlockRegistry.STATEMAP.getByValue(buf.readVarInt());
|
||||
this.blockState = (State)State.ID_MAP.getByValue(buf.readVarInt());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,7 +39,7 @@ public class SPacketBlockChange implements Packet<IClientPlayer>
|
|||
public void writePacketData(PacketBuffer buf) throws IOException
|
||||
{
|
||||
buf.writeBlockPos(this.blockPosition);
|
||||
buf.writeVarInt(BlockRegistry.STATEMAP.get(this.blockState));
|
||||
buf.writeVarInt(State.ID_MAP.get(this.blockState));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,6 @@ package common.packet;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import common.init.BlockRegistry;
|
||||
import common.network.IClientPlayer;
|
||||
import common.network.Packet;
|
||||
import common.network.PacketBuffer;
|
||||
|
@ -39,7 +38,7 @@ public class SPacketMultiBlockChange implements Packet<IClientPlayer>
|
|||
|
||||
for (int i = 0; i < this.changedBlocks.length; ++i)
|
||||
{
|
||||
this.changedBlocks[i] = new SPacketMultiBlockChange.BlockUpdateData(buf.readLong(), (State)BlockRegistry.STATEMAP.getByValue(buf.readVarInt()));
|
||||
this.changedBlocks[i] = new SPacketMultiBlockChange.BlockUpdateData(buf.readLong(), (State)State.ID_MAP.getByValue(buf.readVarInt()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +54,7 @@ public class SPacketMultiBlockChange implements Packet<IClientPlayer>
|
|||
for (SPacketMultiBlockChange.BlockUpdateData s22packetmultiblockchange$blockupdatedata : this.changedBlocks)
|
||||
{
|
||||
buf.writeLong(s22packetmultiblockchange$blockupdatedata.getRawPos());
|
||||
buf.writeVarInt(BlockRegistry.STATEMAP.get(s22packetmultiblockchange$blockupdatedata.getBlockState()));
|
||||
buf.writeVarInt(State.ID_MAP.get(s22packetmultiblockchange$blockupdatedata.getBlockState()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||
|
||||
import common.collect.Lists;
|
||||
import common.entity.Entity;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.tags.TagObject;
|
||||
import common.util.BoundingBox;
|
||||
|
@ -201,7 +200,7 @@ public class TileEntityPiston extends TileEntity implements ITickable
|
|||
public void readTags(TagObject compound)
|
||||
{
|
||||
super.readTags(compound);
|
||||
this.pistonState = BlockRegistry.getRegisteredBlock(compound.getString("blockId")).getStateFromMeta(compound.getInt("blockData"));
|
||||
this.pistonState = State.getState(compound.getString("block"), Blocks.air.getState());
|
||||
this.pistonFacing = Facing.getFront(compound.getInt("facing"));
|
||||
this.lastProgress = this.progress = compound.getFloat("progress");
|
||||
this.extending = compound.getBool("extending");
|
||||
|
@ -210,8 +209,7 @@ public class TileEntityPiston extends TileEntity implements ITickable
|
|||
public void writeTags(TagObject compound)
|
||||
{
|
||||
super.writeTags(compound);
|
||||
compound.setString("blockId", BlockRegistry.getNameFromBlock(this.pistonState.getBlock()));
|
||||
compound.setInt("blockData", this.pistonState.getBlock().getMetaFromState(this.pistonState));
|
||||
compound.setString("block", this.pistonState.getId());
|
||||
compound.setInt("facing", this.pistonFacing.getIndex());
|
||||
compound.setFloat("progress", this.lastProgress);
|
||||
compound.setBool("extending", this.extending);
|
||||
|
|
|
@ -3,7 +3,6 @@ package common.world;
|
|||
import java.util.Arrays;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.util.NibbleArray;
|
||||
|
||||
|
@ -22,14 +21,14 @@ public class BlockArray {
|
|||
if(sky)
|
||||
this.skylight = new NibbleArray();
|
||||
if(filler != null && filler.getBlock() != Blocks.air) {
|
||||
Arrays.fill(this.data, (char)BlockRegistry.STATEMAP.get(filler));
|
||||
Arrays.fill(this.data, (char)State.ID_MAP.get(filler));
|
||||
this.blocks = this.data.length;
|
||||
this.ticked = filler.getBlock().getTickRandomly() ? this.data.length : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public State get(int x, int y, int z) {
|
||||
State iblockstate = BlockRegistry.STATEMAP.getByValue(this.data[y << 8 | z << 4 | x]);
|
||||
State iblockstate = State.ID_MAP.getByValue(this.data[y << 8 | z << 4 | x]);
|
||||
return iblockstate != null ? iblockstate : Blocks.air.getState();
|
||||
}
|
||||
|
||||
|
@ -47,18 +46,13 @@ public class BlockArray {
|
|||
if(block.getTickRandomly())
|
||||
++this.ticked;
|
||||
}
|
||||
this.data[y << 8 | z << 4 | x] = (char)BlockRegistry.STATEMAP.get(state);
|
||||
this.data[y << 8 | z << 4 | x] = (char)State.ID_MAP.get(state);
|
||||
}
|
||||
|
||||
public Block getBlock(int x, int y, int z) {
|
||||
return this.get(x, y, z).getBlock();
|
||||
}
|
||||
|
||||
public int getMeta(int x, int y, int z) {
|
||||
State state = this.get(x, y, z);
|
||||
return state.getBlock().getMetaFromState(state);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return this.blocks == 0;
|
||||
}
|
||||
|
|
|
@ -4,21 +4,24 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.function.Function;
|
||||
|
||||
import common.block.Block;
|
||||
import common.collect.ImmutableMap;
|
||||
import common.collect.ImmutableSet;
|
||||
import common.collect.ImmutableTable;
|
||||
import common.collect.Iterables;
|
||||
import common.collect.Maps;
|
||||
import common.collect.Sets;
|
||||
import common.collect.StandardTable;
|
||||
import common.collect.Table;
|
||||
import common.init.BlockRegistry;
|
||||
import common.properties.Property;
|
||||
import common.util.IdMap;
|
||||
|
||||
public class State {
|
||||
// private static final Joiner COMMA_JOINER = Joiner.on(',');
|
||||
private static final Function<Entry<Property, Comparable>, String> MAP_ENTRY_TO_STRING =
|
||||
new Function<Entry<Property, Comparable>, String>() {
|
||||
public String apply(Entry<Property, Comparable> entry) {
|
||||
|
@ -31,10 +34,68 @@ public class State {
|
|||
}
|
||||
}
|
||||
};
|
||||
private static final Map<String, State> NAME_MAP = Maps.newLinkedHashMap();
|
||||
public static final IdMap<State> ID_MAP = new IdMap();
|
||||
|
||||
private final Block block;
|
||||
private final ImmutableMap<Property, Comparable> properties;
|
||||
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 static State getState(String name, State def) {
|
||||
if(name == null)
|
||||
return def;
|
||||
State state = NAME_MAP.get(name);
|
||||
if(state != null)
|
||||
return state;
|
||||
int idx = name.indexOf(",");
|
||||
if(idx >= 0) {
|
||||
Block block = BlockRegistry.REGISTRY.byNameExact(name.substring(0, idx));
|
||||
if(block != null)
|
||||
return block.getState();
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
public static Collection<String> getKeys() {
|
||||
return NAME_MAP.keySet();
|
||||
}
|
||||
|
||||
public State(Block block, ImmutableMap<Property, Comparable> properties) {
|
||||
this.block = block;
|
||||
|
@ -58,6 +119,14 @@ public class State {
|
|||
public Collection<Property> getPropertyNames() {
|
||||
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) {
|
||||
if(!this.properties.containsKey(property)) {
|
||||
|
@ -118,21 +187,26 @@ public class State {
|
|||
}
|
||||
|
||||
public void buildTable(Map<Map<Property, Comparable>, State> map) {
|
||||
if(this.map != null) {
|
||||
if(this.map != null)
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
else {
|
||||
Table<Property, Comparable, State> table = new StandardTable<Property, Comparable, State>();
|
||||
for(Property<? extends Comparable> prop : this.properties.keySet()) {
|
||||
for(Comparable value : prop.getStates()) {
|
||||
if(value != this.properties.get(prop)) {
|
||||
Map<Property, Comparable> props = Maps.<Property, Comparable>newHashMap(this.properties);
|
||||
props.put(prop, value);
|
||||
table.put(prop, value, map.get(props));
|
||||
}
|
||||
Table<Property, Comparable, State> table = new StandardTable<Property, Comparable, State>();
|
||||
for(Property<? extends Comparable> prop : this.properties.keySet()) {
|
||||
for(Comparable value : prop.getStates()) {
|
||||
if(value != this.properties.get(prop)) {
|
||||
Map<Property, Comparable> props = Maps.<Property, Comparable>newHashMap(this.properties);
|
||||
props.put(prop, value);
|
||||
table.put(prop, value, map.get(props));
|
||||
}
|
||||
}
|
||||
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();
|
||||
ID_MAP.put(this, BlockRegistry.getIdFromBlock(this.block) << 4 | this.block.getMetaFromState(this));
|
||||
this.saved = ImmutableSet.copyOf(getSavedProperties(this.block));
|
||||
NAME_MAP.put(this.id = filterProperties(this, this.saved), this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package server.command.commands;
|
||||
|
||||
import java.util.Collection;
|
||||
import common.init.BlockRegistry;
|
||||
import common.tags.TagObject;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
|
@ -19,7 +18,7 @@ public class CommandBlock extends Command {
|
|||
|
||||
this.addString("block", false, new StringCompleter() {
|
||||
public Collection<String> complete(CommandEnvironment env) {
|
||||
return BlockRegistry.REGISTRY.getKeys();
|
||||
return State.getKeys();
|
||||
}
|
||||
});
|
||||
this.addBlockPos("position", true);
|
||||
|
@ -30,7 +29,7 @@ public class CommandBlock extends Command {
|
|||
}
|
||||
|
||||
public Object exec(CommandEnvironment env, Executor exec, String block, BlockPos position, WorldServer world, TagObject tag) {
|
||||
State state = BlockRegistry.getFromIdName(block, null);
|
||||
State state = State.getState(block, null);
|
||||
if(state == null)
|
||||
throw new RunException("Block '%s' existiert nicht", block);
|
||||
boolean success = world.setState(position, state);
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.ItemStack;
|
||||
import common.tags.TagObject;
|
||||
import server.command.Command;
|
||||
|
@ -20,7 +19,7 @@ public class CommandItem extends Command {
|
|||
|
||||
this.addString("item", false, new StringCompleter() {
|
||||
public Collection<String> complete(CommandEnvironment env) {
|
||||
return ItemRegistry.REGISTRY.getKeys();
|
||||
return ItemStack.getKeys();
|
||||
}
|
||||
});
|
||||
this.setParamsOptional();
|
||||
|
@ -31,7 +30,7 @@ public class CommandItem extends Command {
|
|||
}
|
||||
|
||||
public Object exec(CommandEnvironment env, Executor exec, String item, int amount, TagObject tag, List<EntityNPC> players) {
|
||||
ItemStack stack = ItemRegistry.getFromIdName(item, null);
|
||||
ItemStack stack = ItemStack.getStack(item, null);
|
||||
if(stack == null)
|
||||
throw new RunException("Gegenstand '%s' existiert nicht", item);
|
||||
stack.setTagCompound(tag);
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.Set;
|
|||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.entity.Entity;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.log.Log;
|
||||
import common.rng.Random;
|
||||
|
@ -31,7 +30,7 @@ public class ChunkServer extends Chunk {
|
|||
for(int bx = 0; bx < 16; ++bx) {
|
||||
for(int bz = 0; bz < 16; ++bz) {
|
||||
for(int by = 0; by < height; ++by) {
|
||||
State state = BlockRegistry.STATEMAP.getByValue(data[bx << 4 | bz | by << 8]);
|
||||
State state = State.ID_MAP.getByValue(data[bx << 4 | bz | by << 8]);
|
||||
if(state != null && state.getBlock() != Blocks.air) {
|
||||
int y = by >> 4;
|
||||
BlockArray arr = this.getArray(y);
|
||||
|
|
|
@ -51,7 +51,6 @@ import common.entity.animal.EntitySquid;
|
|||
import common.entity.animal.EntityWolf;
|
||||
import common.entity.item.EntityBoat;
|
||||
import common.entity.item.EntityMinecart;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.init.EntityRegistry;
|
||||
import common.init.TileRegistry;
|
||||
|
@ -272,7 +271,7 @@ public abstract class Converter {
|
|||
}
|
||||
|
||||
private static void mapBlock(State state, int id, int data) {
|
||||
BLOCK_MAP[(id << 4) | data] = (char)BlockRegistry.STATEMAP.get(state);
|
||||
BLOCK_MAP[(id << 4) | data] = (char)State.ID_MAP.get(state);
|
||||
}
|
||||
|
||||
private static void mapBlock(State state, int id) {
|
||||
|
|
|
@ -28,7 +28,6 @@ import common.init.BlockRegistry;
|
|||
import common.init.Blocks;
|
||||
import common.init.EntityRegistry;
|
||||
import common.log.Log;
|
||||
import common.properties.Property;
|
||||
import common.tags.TagObject;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
|
@ -38,41 +37,6 @@ import common.world.BlockArray;
|
|||
import common.world.State;
|
||||
|
||||
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) {
|
||||
Set<String> removed = Sets.newHashSet();
|
||||
for(String id : tag.keySet()) {
|
||||
|
@ -86,12 +50,11 @@ public class Region {
|
|||
for(int z = 0; z < 4096; z++) {
|
||||
Block block = BlockRegistry.getBlockById(z);
|
||||
if(block != Blocks.air) {
|
||||
Set<Property> stored = getSavedProperties(block);
|
||||
for(int n = 0; n < 16; n++) {
|
||||
State state = block.getStateFromMeta(n);
|
||||
String id = filterProperties(state, stored);
|
||||
String id = state.getId();
|
||||
List<Character> ids = current.get(id);
|
||||
char mid = (char)BlockRegistry.STATEMAP.get(state);
|
||||
char mid = (char)State.ID_MAP.get(state);
|
||||
if(ids == null) {
|
||||
current.put(id, Lists.newArrayList(mid));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package server.worldgen;
|
||||
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.world.State;
|
||||
|
||||
|
@ -18,11 +17,11 @@ public class ChunkPrimer {
|
|||
}
|
||||
|
||||
public State get(int x, int y, int z) {
|
||||
State state = BlockRegistry.STATEMAP.getByValue(this.data[x << 4 | z | y << 8]);
|
||||
State state = State.ID_MAP.getByValue(this.data[x << 4 | z | y << 8]);
|
||||
return state != null ? state : Blocks.air.getState();
|
||||
}
|
||||
|
||||
public void set(int x, int y, int z, State state) {
|
||||
this.data[x << 4 | z | y << 8] = (short)BlockRegistry.STATEMAP.get(state);
|
||||
this.data[x << 4 | z | y << 8] = (short)State.ID_MAP.get(state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.block.artificial.BlockSlab;
|
||||
import common.block.artificial.BlockStairs;
|
||||
import common.block.foliage.BlockCrops;
|
||||
import common.block.foliage.BlockLog;
|
||||
import common.block.tech.BlockTorch;
|
||||
import common.collect.Lists;
|
||||
|
@ -381,10 +381,10 @@ public class StructureVillage
|
|||
|
||||
public static class Field1 extends StructureVillage.Village
|
||||
{
|
||||
private Block cropTypeA;
|
||||
private Block cropTypeB;
|
||||
private Block cropTypeC;
|
||||
private Block cropTypeD;
|
||||
private BlockCrops cropTypeA;
|
||||
private BlockCrops cropTypeB;
|
||||
private BlockCrops cropTypeC;
|
||||
private BlockCrops cropTypeD;
|
||||
|
||||
public Field1()
|
||||
{
|
||||
|
@ -413,13 +413,13 @@ public class StructureVillage
|
|||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readTags(tagCompound);
|
||||
this.cropTypeA = BlockRegistry.getRegisteredBlock(tagCompound.getString("CA"));
|
||||
this.cropTypeB = BlockRegistry.getRegisteredBlock(tagCompound.getString("CB"));
|
||||
this.cropTypeC = BlockRegistry.getRegisteredBlock(tagCompound.getString("CC"));
|
||||
this.cropTypeD = BlockRegistry.getRegisteredBlock(tagCompound.getString("CD"));
|
||||
this.cropTypeA = BlockRegistry.getRegisteredBlock(tagCompound.getString("CA")) instanceof BlockCrops crops ? crops : Blocks.wheat;
|
||||
this.cropTypeB = BlockRegistry.getRegisteredBlock(tagCompound.getString("CB")) instanceof BlockCrops crops ? crops : Blocks.wheat;
|
||||
this.cropTypeC = BlockRegistry.getRegisteredBlock(tagCompound.getString("CC")) instanceof BlockCrops crops ? crops : Blocks.wheat;
|
||||
this.cropTypeD = BlockRegistry.getRegisteredBlock(tagCompound.getString("CD")) instanceof BlockCrops crops ? crops : Blocks.wheat;
|
||||
}
|
||||
|
||||
private Block func_151559_a(Random rand)
|
||||
private BlockCrops func_151559_a(Random rand)
|
||||
{
|
||||
switch (rand.zrange(5))
|
||||
{
|
||||
|
@ -469,14 +469,14 @@ public class StructureVillage
|
|||
|
||||
for (int i = 1; i <= 7; ++i)
|
||||
{
|
||||
this.setBlockState(worldIn, this.cropTypeA.getStateFromMeta(randomIn.range(2, 7)), 1, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeA.getStateFromMeta(randomIn.range(2, 7)), 2, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeB.getStateFromMeta(randomIn.range(2, 7)), 4, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeB.getStateFromMeta(randomIn.range(2, 7)), 5, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeC.getStateFromMeta(randomIn.range(2, 7)), 7, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeC.getStateFromMeta(randomIn.range(2, 7)), 8, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeD.getStateFromMeta(randomIn.range(2, 7)), 10, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeD.getStateFromMeta(randomIn.range(2, 7)), 11, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeA.getState().withProperty(BlockCrops.AGE, randomIn.range(2, 7)), 1, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeA.getState().withProperty(BlockCrops.AGE, randomIn.range(2, 7)), 2, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeB.getState().withProperty(BlockCrops.AGE, randomIn.range(2, 7)), 4, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeB.getState().withProperty(BlockCrops.AGE, randomIn.range(2, 7)), 5, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeC.getState().withProperty(BlockCrops.AGE, randomIn.range(2, 7)), 7, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeC.getState().withProperty(BlockCrops.AGE, randomIn.range(2, 7)), 8, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeD.getState().withProperty(BlockCrops.AGE, randomIn.range(2, 7)), 10, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeD.getState().withProperty(BlockCrops.AGE, randomIn.range(2, 7)), 11, 1, i, structureBoundingBoxIn);
|
||||
}
|
||||
|
||||
for (int k = 0; k < 9; ++k)
|
||||
|
@ -494,8 +494,8 @@ public class StructureVillage
|
|||
|
||||
public static class Field2 extends StructureVillage.Village
|
||||
{
|
||||
private Block cropTypeA;
|
||||
private Block cropTypeB;
|
||||
private BlockCrops cropTypeA;
|
||||
private BlockCrops cropTypeB;
|
||||
|
||||
public Field2()
|
||||
{
|
||||
|
@ -520,11 +520,11 @@ public class StructureVillage
|
|||
protected void readTags(TagObject tagCompound)
|
||||
{
|
||||
super.readTags(tagCompound);
|
||||
this.cropTypeA = BlockRegistry.getRegisteredBlock(tagCompound.getString("CA"));
|
||||
this.cropTypeB = BlockRegistry.getRegisteredBlock(tagCompound.getString("CB"));
|
||||
this.cropTypeA = BlockRegistry.getRegisteredBlock(tagCompound.getString("CA")) instanceof BlockCrops crops ? crops : Blocks.wheat;
|
||||
this.cropTypeB = BlockRegistry.getRegisteredBlock(tagCompound.getString("CB")) instanceof BlockCrops crops ? crops : Blocks.wheat;
|
||||
}
|
||||
|
||||
private Block func_151560_a(Random rand)
|
||||
private BlockCrops func_151560_a(Random rand)
|
||||
{
|
||||
switch (rand.zrange(5))
|
||||
{
|
||||
|
@ -570,10 +570,10 @@ public class StructureVillage
|
|||
|
||||
for (int i = 1; i <= 7; ++i)
|
||||
{
|
||||
this.setBlockState(worldIn, this.cropTypeA.getStateFromMeta(randomIn.range(2, 7)), 1, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeA.getStateFromMeta(randomIn.range(2, 7)), 2, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeB.getStateFromMeta(randomIn.range(2, 7)), 4, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeB.getStateFromMeta(randomIn.range(2, 7)), 5, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeA.getState().withProperty(BlockCrops.AGE, randomIn.range(2, 7)), 1, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeA.getState().withProperty(BlockCrops.AGE, randomIn.range(2, 7)), 2, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeB.getState().withProperty(BlockCrops.AGE, randomIn.range(2, 7)), 4, 1, i, structureBoundingBoxIn);
|
||||
this.setBlockState(worldIn, this.cropTypeB.getState().withProperty(BlockCrops.AGE, randomIn.range(2, 7)), 5, 1, i, structureBoundingBoxIn);
|
||||
}
|
||||
|
||||
for (int k = 0; k < 9; ++k)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue