general Block* code cleanup
This commit is contained in:
parent
8bd9370bab
commit
7fd8879c73
294 changed files with 2229 additions and 2650 deletions
|
@ -1,13 +1,13 @@
|
|||
package common.ai;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockSlab;
|
||||
import common.block.BlockStairs;
|
||||
import common.block.artificial.BlockSlab;
|
||||
import common.block.artificial.BlockStairs;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.item.ItemStack;
|
||||
import common.material.Material;
|
||||
import common.pathfinding.WalkNodeProcessor;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
|
@ -162,7 +162,7 @@ public class EntityAIControlledByPlayer extends EntityAIBase
|
|||
if (i != l || k != i1)
|
||||
{
|
||||
Block block = this.thisEntity.worldObj.getState(new BlockPos(i, j, k)).getBlock();
|
||||
boolean flag = !this.isStairOrSlab(block) && (block.getMaterial() != Material.air || !this.isStairOrSlab(this.thisEntity.worldObj.getState(new BlockPos(i, j - 1, k)).getBlock()));
|
||||
boolean flag = !this.isStairOrSlab(block) && (block != Blocks.air || !this.isStairOrSlab(this.thisEntity.worldObj.getState(new BlockPos(i, j - 1, k)).getBlock()));
|
||||
|
||||
if (flag && 0 == WalkNodeProcessor.getColliding(this.thisEntity.worldObj, this.thisEntity, l, j, i1, j1, k1, l1, false, false, true) && 1 == WalkNodeProcessor.getColliding(this.thisEntity.worldObj, this.thisEntity, i, j + 1, k, j1, k1, l1, false, false, true) && 1 == WalkNodeProcessor.getColliding(this.thisEntity.worldObj, this.thisEntity, l, j + 1, i1, j1, k1, l1, false, false, true))
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package common.ai;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDoor;
|
||||
import common.block.artificial.BlockDoor;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.material.Material;
|
||||
import common.pathfinding.PathEntity;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package common.ai;
|
||||
|
||||
import common.block.BlockTallGrass;
|
||||
import common.block.foliage.BlockTallGrass;
|
||||
import common.entity.animal.EntitySheep;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package common.ai;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockBed;
|
||||
import common.block.artificial.BlockBed;
|
||||
import common.entity.animal.EntityOcelot;
|
||||
import common.init.Blocks;
|
||||
import common.tileentity.TileEntity;
|
||||
|
|
|
@ -9,7 +9,6 @@ import common.init.Blocks;
|
|||
import common.init.Config;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.ItemStack;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
|
@ -108,8 +107,8 @@ public class EntityAITakePlace extends EntityAIBase
|
|||
Block replace = world.getState(blockpos).getBlock();
|
||||
Block below = world.getState(blockpos.down()).getBlock();
|
||||
State state = PLACEABLE.get(new StackKey(this.entity.getHeldItem()));
|
||||
if (state.getBlock().canPlaceBlockAt(world, blockpos) && replace.getMaterial() == Material.air &&
|
||||
below.getMaterial() != Material.air && below.isFullCube())
|
||||
if (state.getBlock().canPlaceBlockAt(world, blockpos) && replace == Blocks.air &&
|
||||
below != Blocks.air && below.isFullCube())
|
||||
{
|
||||
this.entity.getLookHelper().setLookPosition((double)i + 0.5, (double)j + 0.5, (double)k + 0.5, 10.0F,
|
||||
(float)this.entity.getVerticalFaceSpeed());
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,56 +1,36 @@
|
|||
package common.block;
|
||||
|
||||
import common.material.Material;
|
||||
import common.material.MaterialTransparent;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockAir extends Block
|
||||
{
|
||||
public BlockAir()
|
||||
{
|
||||
super(Material.air);
|
||||
}
|
||||
public final class BlockAir extends Block {
|
||||
public BlockAir() {
|
||||
super(new MaterialTransparent());
|
||||
}
|
||||
|
||||
/**
|
||||
* The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render
|
||||
*/
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public BoundingBox getCollisionBoundingBox(World world, BlockPos pos, State state) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to determine ambient occlusion and culling when rebuilding chunks for render
|
||||
*/
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canCollideCheck(State state, boolean hitIfLiquid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public boolean canCollideCheck(State state, boolean liquid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawns this Block's drops into the World as EntityItems.
|
||||
*/
|
||||
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, State state, float chance, int fortune)
|
||||
{
|
||||
}
|
||||
public void dropBlockAsItemWithChance(World world, BlockPos pos, State state, float chance, int fortune) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this Block can be replaced directly by other blocks (true for e.g. tall grass)
|
||||
*/
|
||||
public boolean isReplaceable(World worldIn, BlockPos pos)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public boolean isReplaceable(World world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
package common.block;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.material.Material;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
|
||||
public class BlockBreakable extends Block
|
||||
{
|
||||
private boolean ignoreSimilarity;
|
||||
|
||||
public BlockBreakable(Material p_i46393_1_, boolean p_i46393_2_)
|
||||
{
|
||||
super(p_i46393_1_);
|
||||
this.ignoreSimilarity = p_i46393_2_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to determine ambient occlusion and culling when rebuilding chunks for render
|
||||
*/
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side)
|
||||
{
|
||||
State iblockstate = worldIn.getState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if (this == Blocks.glass || this == Blocks.stained_glass)
|
||||
{
|
||||
if (worldIn.getState(pos.offset(side.getOpposite())) != iblockstate)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block == this)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return !this.ignoreSimilarity && block == this ? false : super.shouldSideBeRendered(worldIn, pos, side);
|
||||
}
|
||||
}
|
|
@ -13,67 +13,38 @@ import common.properties.IProperty;
|
|||
import common.properties.PropertyEnum;
|
||||
import common.world.State;
|
||||
|
||||
public class BlockColored extends Block
|
||||
{
|
||||
public static final PropertyEnum<DyeColor> COLOR = PropertyEnum.<DyeColor>create("color", DyeColor.class);
|
||||
public class BlockColored extends Block {
|
||||
public static final PropertyEnum<DyeColor> COLOR = PropertyEnum.<DyeColor>create("color", DyeColor.class);
|
||||
|
||||
public BlockColored(Material materialIn)
|
||||
{
|
||||
super(materialIn);
|
||||
this.setDefaultState(this.getBaseState().withProperty(COLOR, DyeColor.WHITE));
|
||||
this.setTab(CheatTab.tabBlocks);
|
||||
}
|
||||
public BlockColored(Material material) {
|
||||
super(material);
|
||||
this.setDefaultState(this.getBaseState().withProperty(COLOR, DyeColor.WHITE));
|
||||
this.setTab(CheatTab.tabBlocks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It
|
||||
* returns the metadata of the dropped item based on the old metadata of the block.
|
||||
*/
|
||||
public int damageDropped(State state)
|
||||
{
|
||||
return ((DyeColor)state.getValue(COLOR)).getMetadata();
|
||||
}
|
||||
public int damageDropped(State state) {
|
||||
return state.getValue(COLOR).getMetadata();
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
|
||||
*/
|
||||
public void getSubBlocks(Item itemIn, CheatTab tab, List<ItemStack> list)
|
||||
{
|
||||
for (DyeColor enumdyecolor : DyeColor.values())
|
||||
{
|
||||
list.add(new ItemStack(itemIn, 1, enumdyecolor.getMetadata()));
|
||||
}
|
||||
}
|
||||
public void getSubBlocks(Item item, CheatTab tab, List<ItemStack> list) {
|
||||
for(DyeColor color : DyeColor.values()) {
|
||||
list.add(new ItemStack(item, 1, color.getMetadata()));
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Get the MapColor for this Block and the given BlockState
|
||||
// */
|
||||
// public MapColor getMapColor(IBlockState state)
|
||||
// {
|
||||
// return ((EnumDyeColor)state.getValue(COLOR)).getMapColor();
|
||||
// }
|
||||
public State getStateFromMeta(int meta) {
|
||||
return this.getState().withProperty(COLOR, DyeColor.byMetadata(meta));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given metadata into a BlockState for this Block
|
||||
*/
|
||||
public State getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getState().withProperty(COLOR, DyeColor.byMetadata(meta));
|
||||
}
|
||||
public int getMetaFromState(State state) {
|
||||
return state.getValue(COLOR).getMetadata();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the BlockState into the correct metadata value
|
||||
*/
|
||||
public int getMetaFromState(State state)
|
||||
{
|
||||
return ((DyeColor)state.getValue(COLOR)).getMetadata();
|
||||
}
|
||||
protected IProperty[] getProperties() {
|
||||
return new IProperty[] {COLOR};
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
{
|
||||
return new IProperty[] {COLOR};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel(state.getValue(COLOR).getName() + "_" + name).add().all();
|
||||
}
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel(state.getValue(COLOR).getName() + "_" + name).add().all();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,45 +8,33 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public abstract class BlockContainer extends Block implements ITileEntityProvider
|
||||
{
|
||||
public BlockContainer(Material p_i46402_1_)
|
||||
{
|
||||
super(p_i46402_1_);
|
||||
this.hasTile = true;
|
||||
}
|
||||
public abstract class BlockContainer extends Block implements ITileEntityProvider {
|
||||
public BlockContainer(Material material) {
|
||||
super(material);
|
||||
this.hasTile = true;
|
||||
}
|
||||
|
||||
protected boolean isInvalidNeighbor(World p_181086_1_, BlockPos p_181086_2_, Facing p_181086_3_)
|
||||
{
|
||||
return p_181086_1_.getState(p_181086_2_.offset(p_181086_3_)).getBlock().getMaterial() == Material.cactus;
|
||||
}
|
||||
protected boolean isInvalidNeighbor(World world, BlockPos pos, Facing face) {
|
||||
return world.getState(pos.offset(face)).getBlock().getMaterial() == Material.cactus;
|
||||
}
|
||||
|
||||
protected boolean hasInvalidNeighbor(World p_181087_1_, BlockPos p_181087_2_)
|
||||
{
|
||||
return this.isInvalidNeighbor(p_181087_1_, p_181087_2_, Facing.NORTH) || this.isInvalidNeighbor(p_181087_1_, p_181087_2_, Facing.SOUTH) || this.isInvalidNeighbor(p_181087_1_, p_181087_2_, Facing.WEST) || this.isInvalidNeighbor(p_181087_1_, p_181087_2_, Facing.EAST);
|
||||
}
|
||||
protected boolean hasInvalidNeighbor(World world, BlockPos pos) {
|
||||
return this.isInvalidNeighbor(world, pos, Facing.NORTH) || this.isInvalidNeighbor(world, pos, Facing.SOUTH)
|
||||
|| this.isInvalidNeighbor(world, pos, Facing.WEST) || this.isInvalidNeighbor(world, pos, Facing.EAST);
|
||||
}
|
||||
|
||||
/**
|
||||
* The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render
|
||||
*/
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state)
|
||||
{
|
||||
super.onBlockRemoved(worldIn, pos, state);
|
||||
worldIn.removeTileEntity(pos);
|
||||
}
|
||||
public void onBlockRemoved(AWorldServer world, BlockPos pos, State state) {
|
||||
super.onBlockRemoved(world, pos, state);
|
||||
world.removeTileEntity(pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on both Client and Server when World#addBlockEvent is called
|
||||
*/
|
||||
public boolean onBlockEventReceived(World worldIn, BlockPos pos, State state, int eventID, int eventParam)
|
||||
{
|
||||
super.onBlockEventReceived(worldIn, pos, state, eventID, eventParam);
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
return tileentity == null ? false : tileentity.receiveClientEvent(eventID, eventParam);
|
||||
}
|
||||
public boolean onBlockEventReceived(World world, BlockPos pos, State state, int id, int param) {
|
||||
super.onBlockEventReceived(world, pos, state, id, param);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
return tile == null ? false : tile.receiveClientEvent(id, param);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,12 +4,10 @@ import common.material.Material;
|
|||
import common.properties.PropertyDirection;
|
||||
import common.util.Facing;
|
||||
|
||||
public abstract class BlockDirectional extends Block
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL);
|
||||
public abstract class BlockDirectional extends Block {
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL);
|
||||
|
||||
public BlockDirectional(Material materialIn)
|
||||
{
|
||||
super(materialIn);
|
||||
}
|
||||
public BlockDirectional(Material material) {
|
||||
super(material);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
package common.block;
|
||||
|
||||
import common.util.BlockPos;
|
||||
|
||||
public class BlockEventData
|
||||
{
|
||||
private BlockPos position;
|
||||
private Block blockType;
|
||||
|
||||
/** Different for each blockID */
|
||||
private int eventID;
|
||||
private int eventParameter;
|
||||
|
||||
public BlockEventData(BlockPos pos, Block blockType, int eventId, int p_i45756_4_)
|
||||
{
|
||||
this.position = pos;
|
||||
this.eventID = eventId;
|
||||
this.eventParameter = p_i45756_4_;
|
||||
this.blockType = blockType;
|
||||
}
|
||||
|
||||
public BlockPos getPosition()
|
||||
{
|
||||
return this.position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Event ID (different for each BlockID)
|
||||
*/
|
||||
public int getEventID()
|
||||
{
|
||||
return this.eventID;
|
||||
}
|
||||
|
||||
public int getEventParameter()
|
||||
{
|
||||
return this.eventParameter;
|
||||
}
|
||||
|
||||
public Block getBlock()
|
||||
{
|
||||
return this.blockType;
|
||||
}
|
||||
|
||||
public boolean equals(Object p_equals_1_)
|
||||
{
|
||||
if (!(p_equals_1_ instanceof BlockEventData))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
BlockEventData blockeventdata = (BlockEventData)p_equals_1_;
|
||||
return this.position.equals(blockeventdata.position) && this.eventID == blockeventdata.eventID && this.eventParameter == blockeventdata.eventParameter && this.blockType == blockeventdata.blockType;
|
||||
}
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "TE(" + this.position + ")," + this.eventID + "," + this.eventParameter + "," + this.blockType;
|
||||
}
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
package common.block;
|
||||
|
||||
import common.block.natural.BlockFire;
|
||||
import common.entity.item.EntityFalling;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -11,93 +11,63 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockFalling extends Block
|
||||
{
|
||||
public static boolean fallInstantly;
|
||||
public class BlockFalling extends Block {
|
||||
public static boolean fallInstantly;
|
||||
|
||||
public BlockFalling()
|
||||
{
|
||||
super(Material.sand);
|
||||
this.setTab(CheatTab.tabNature);
|
||||
}
|
||||
public static boolean canFallInto(World world, BlockPos pos) {
|
||||
Block block = world.getState(pos).getBlock();
|
||||
return block instanceof BlockFire || block == Blocks.air || block.material.isLiquid();
|
||||
}
|
||||
|
||||
public BlockFalling(Material materialIn)
|
||||
{
|
||||
super(materialIn);
|
||||
}
|
||||
public BlockFalling(Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state)
|
||||
{
|
||||
worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn, pos));
|
||||
}
|
||||
public void onBlockAdded(AWorldServer world, BlockPos pos, State state) {
|
||||
world.scheduleUpdate(pos, this, this.tickRate(world, pos));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a neighboring block changes.
|
||||
*/
|
||||
public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock)
|
||||
{
|
||||
worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn, pos));
|
||||
}
|
||||
public void onNeighborBlockChange(World world, BlockPos pos, State state, Block neighbor) {
|
||||
world.scheduleUpdate(pos, this, this.tickRate(world, pos));
|
||||
}
|
||||
|
||||
public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
||||
{
|
||||
if(/* !worldIn.client && */ Config.blockGravity)
|
||||
this.checkFallable(worldIn, pos);
|
||||
}
|
||||
public void updateTick(AWorldServer world, BlockPos pos, State state, Random rand) {
|
||||
if(Config.blockGravity)
|
||||
this.checkFallable(world, pos);
|
||||
}
|
||||
|
||||
private void checkFallable(World worldIn, BlockPos pos)
|
||||
{
|
||||
if (canFallInto(worldIn, pos.down()) && pos.getY() >= 0)
|
||||
{
|
||||
int i = 32;
|
||||
private void checkFallable(World world, BlockPos pos) {
|
||||
if(canFallInto(world, pos.down()) && pos.getY() >= 0) {
|
||||
int range = 32;
|
||||
if(!fallInstantly && world.isAreaLoaded(pos.add(-range, -range, -range), pos.add(range, range, range))) {
|
||||
if(!world.client) {
|
||||
EntityFalling entity = new EntityFalling(world, (double)pos.getX() + 0.5D, (double)pos.getY(),
|
||||
(double)pos.getZ() + 0.5D, world.getState(pos));
|
||||
this.onStartFalling(entity);
|
||||
world.spawnEntityInWorld(entity);
|
||||
}
|
||||
}
|
||||
else {
|
||||
world.setBlockToAir(pos);
|
||||
BlockPos loc;
|
||||
int limit = 512;
|
||||
for(loc = pos.down(); canFallInto(world, loc) && loc.getY() > -World.MAX_SIZE_Y; loc = loc.down()) {
|
||||
if(--limit <= 0)
|
||||
return;
|
||||
}
|
||||
if(loc.getY() > -World.MAX_SIZE_Y)
|
||||
world.setState(loc.up(), this.getState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!fallInstantly && worldIn.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i)))
|
||||
{
|
||||
if (!worldIn.client)
|
||||
{
|
||||
EntityFalling entityfallingblock = new EntityFalling(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, worldIn.getState(pos));
|
||||
this.onStartFalling(entityfallingblock);
|
||||
worldIn.spawnEntityInWorld(entityfallingblock);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setBlockToAir(pos);
|
||||
BlockPos blockpos;
|
||||
public int tickRate(World world, BlockPos pos) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
for (blockpos = pos.down(); canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down())
|
||||
{
|
||||
;
|
||||
}
|
||||
protected void onStartFalling(EntityFalling entity) {
|
||||
}
|
||||
|
||||
if (blockpos.getY() > 0)
|
||||
{
|
||||
worldIn.setState(blockpos.up(), this.getState());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void onStartFalling(EntityFalling fallingEntity)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* How many world ticks before ticking
|
||||
*/
|
||||
public int tickRate(World worldIn, BlockPos pos)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public static boolean canFallInto(World worldIn, BlockPos pos)
|
||||
{
|
||||
Block block = worldIn.getState(pos).getBlock();
|
||||
Material material = block.material;
|
||||
return block == Blocks.fire || material == Material.air || material.isLiquid();
|
||||
}
|
||||
|
||||
public void onEndFalling(World worldIn, BlockPos pos)
|
||||
{
|
||||
}
|
||||
public void onEndFalling(World world, BlockPos pos) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
package common.block;
|
||||
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
||||
import common.model.BlockLayer;
|
||||
import common.rng.Random;
|
||||
|
||||
public class BlockGlass extends BlockBreakable
|
||||
{
|
||||
public BlockGlass(Material materialIn, boolean ignoreSimilarity)
|
||||
{
|
||||
super(materialIn, ignoreSimilarity);
|
||||
this.setTab(CheatTab.tabBlocks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer()
|
||||
{
|
||||
return BlockLayer.CUTOUT;
|
||||
}
|
||||
|
||||
public boolean isFullCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canSilkHarvest()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
package common.block;
|
||||
|
||||
import common.enchantment.EnchantmentHelper;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.item.CheatTab;
|
||||
import common.item.ItemStack;
|
||||
import common.material.Material;
|
||||
import common.model.BlockLayer;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.world.LightType;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockIce extends BlockBreakable
|
||||
{
|
||||
public BlockIce()
|
||||
{
|
||||
super(Material.ice, false);
|
||||
this.slipperiness = 0.98F;
|
||||
this.setTickRandomly();
|
||||
this.setTab(CheatTab.tabNature);
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer()
|
||||
{
|
||||
return BlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
public void harvestBlock(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te)
|
||||
{
|
||||
// player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]);
|
||||
|
||||
if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player))
|
||||
{
|
||||
ItemStack itemstack = this.createStackedBlock(state);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
spawnAsEntity(worldIn, pos, itemstack);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (worldIn.doesWaterVaporize(pos))
|
||||
{
|
||||
worldIn.setBlockToAir(pos);
|
||||
return;
|
||||
}
|
||||
|
||||
int i = EnchantmentHelper.getFortuneModifier(player);
|
||||
this.dropBlockAsItem(worldIn, pos, state, i);
|
||||
Material material = worldIn.getState(pos.down()).getBlock().getMaterial();
|
||||
|
||||
if (material.blocksMovement() || material.isLiquid())
|
||||
{
|
||||
worldIn.setState(pos, Blocks.flowing_water.getState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
||||
{
|
||||
if (Config.iceMelt && ((worldIn.getLightFor(LightType.BLOCK, pos) > 11 - this.getLightOpacity()) || !worldIn.canFreezeAt(pos)))
|
||||
{
|
||||
if (worldIn.doesWaterVaporize(pos))
|
||||
{
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.dropBlockAsItem(worldIn, pos, worldIn.getState(pos), 0);
|
||||
worldIn.setState(pos, Blocks.water.getState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getMobilityFlag()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -8,16 +8,14 @@ import common.properties.PropertyEnum;
|
|||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
|
||||
public abstract class BlockRotatedPillar extends Block
|
||||
{
|
||||
public static final PropertyEnum<Facing.Axis> AXIS = PropertyEnum.<Facing.Axis>create("axis", Facing.Axis.class);
|
||||
public abstract class BlockRotatedPillar extends Block {
|
||||
public static final PropertyEnum<Facing.Axis> AXIS = PropertyEnum.<Facing.Axis>create("axis", Facing.Axis.class);
|
||||
|
||||
public BlockRotatedPillar(Material materialIn)
|
||||
{
|
||||
super(materialIn);
|
||||
}
|
||||
public BlockRotatedPillar(Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
switch(state.getValue(AXIS)) {
|
||||
case X:
|
||||
return provider.getModel(name + "_side").add().d().rot(180).u()
|
||||
|
@ -31,5 +29,5 @@ public abstract class BlockRotatedPillar extends Block
|
|||
.n(name + "_top").rot(180).s(name + "_top").w().rot(270)
|
||||
.e().rot(90);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
package common.block;
|
||||
|
||||
import common.entity.Entity;
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockSlime extends BlockBreakable
|
||||
{
|
||||
private static final Model slime = ModelProvider.getModelProvider().getModel("slime")
|
||||
.add(0, 0, 0, 16, 16, 16)
|
||||
.d().uv(0, 0, 16, 16).noCull()
|
||||
.u().uv(0, 0, 16, 16).noCull()
|
||||
.n().uv(0, 0, 16, 16).noCull()
|
||||
.s().uv(0, 0, 16, 16).noCull()
|
||||
.w().uv(0, 0, 16, 16).noCull()
|
||||
.e().uv(0, 0, 16, 16).noCull()
|
||||
.add(3, 3, 3, 13, 13, 13)
|
||||
.d().uv(3, 3, 13, 13).noCull()
|
||||
.u().uv(3, 3, 13, 13).noCull()
|
||||
.n().uv(3, 3, 13, 13).noCull()
|
||||
.s().uv(3, 3, 13, 13).noCull()
|
||||
.w().uv(3, 3, 13, 13).noCull()
|
||||
.e().uv(3, 3, 13, 13).noCull()
|
||||
;
|
||||
|
||||
public BlockSlime()
|
||||
{
|
||||
super(Material.clay, false);
|
||||
this.setTab(CheatTab.tabTech);
|
||||
this.slipperiness = 0.8F;
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer()
|
||||
{
|
||||
return BlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Block's chance to react to a living entity falling on it.
|
||||
*/
|
||||
public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance)
|
||||
{
|
||||
if (entityIn.isSneaking())
|
||||
{
|
||||
super.onFallenUpon(worldIn, pos, entityIn, fallDistance);
|
||||
}
|
||||
else
|
||||
{
|
||||
entityIn.fall(fallDistance, 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when an Entity lands on this Block. This method *must* update motionY because the entity will not do that
|
||||
* on its own
|
||||
*/
|
||||
public void onLanded(World worldIn, Entity entityIn)
|
||||
{
|
||||
if (entityIn.isSneaking())
|
||||
{
|
||||
super.onLanded(worldIn, entityIn);
|
||||
}
|
||||
else if (entityIn.motionY < 0.0D)
|
||||
{
|
||||
entityIn.motionY = -entityIn.motionY;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered whenever an entity collides with this block (enters into the block)
|
||||
*/
|
||||
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn)
|
||||
{
|
||||
if (Math.abs(entityIn.motionY) < 0.1D && !entityIn.isSneaking())
|
||||
{
|
||||
double d0 = 0.4D + Math.abs(entityIn.motionY) * 0.2D;
|
||||
entityIn.motionX *= d0;
|
||||
entityIn.motionZ *= d0;
|
||||
}
|
||||
|
||||
super.onEntityCollidedWithBlock(worldIn, pos, entityIn);
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return slime;
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package common.block;
|
||||
|
||||
import common.init.Config;
|
||||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.LightType;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockSnowBlock extends Block
|
||||
{
|
||||
public BlockSnowBlock()
|
||||
{
|
||||
super(Material.craftedSnow);
|
||||
this.setTickRandomly();
|
||||
this.setTab(CheatTab.tabNature);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return Items.snowball;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
||||
{
|
||||
if (Config.snowFullMelt && worldIn.getLightFor(LightType.BLOCK, pos) > 11)
|
||||
{
|
||||
this.dropBlockAsItem(worldIn, pos, worldIn.getState(pos), 0);
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
package common.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.color.DyeColor;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.material.Material;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
import common.world.State;
|
||||
|
||||
public class BlockStainedGlass extends BlockBreakable
|
||||
{
|
||||
public static final PropertyEnum<DyeColor> COLOR = PropertyEnum.<DyeColor>create("color", DyeColor.class);
|
||||
|
||||
public BlockStainedGlass(Material materialIn)
|
||||
{
|
||||
super(materialIn, false);
|
||||
this.setDefaultState(this.getBaseState().withProperty(COLOR, DyeColor.WHITE));
|
||||
this.setTab(CheatTab.tabBlocks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It
|
||||
* returns the metadata of the dropped item based on the old metadata of the block.
|
||||
*/
|
||||
public int damageDropped(State state)
|
||||
{
|
||||
return ((DyeColor)state.getValue(COLOR)).getMetadata();
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
|
||||
*/
|
||||
public void getSubBlocks(Item itemIn, CheatTab tab, List<ItemStack> list)
|
||||
{
|
||||
for (DyeColor enumdyecolor : DyeColor.values())
|
||||
{
|
||||
list.add(new ItemStack(itemIn, 1, enumdyecolor.getMetadata()));
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Get the MapColor for this Block and the given BlockState
|
||||
// */
|
||||
// public MapColor getMapColor(IBlockState state)
|
||||
// {
|
||||
// return ((EnumDyeColor)state.getValue(COLOR)).getMapColor();
|
||||
// }
|
||||
|
||||
public BlockLayer getBlockLayer()
|
||||
{
|
||||
return BlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean canSilkHarvest()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isFullCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given metadata into a BlockState for this Block
|
||||
*/
|
||||
public State getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getState().withProperty(COLOR, DyeColor.byMetadata(meta));
|
||||
}
|
||||
|
||||
// public void onBlockAdded(IWorldServer worldIn, BlockPos pos, State state)
|
||||
// {
|
||||
// if (!worldIn.client)
|
||||
// {
|
||||
// BlockBeacon.updateColorAsync(worldIn, pos);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void onBlockRemoved(IWorldServer worldIn, BlockPos pos, State state)
|
||||
// {
|
||||
// if (!worldIn.client)
|
||||
// {
|
||||
// BlockBeacon.updateColorAsync(worldIn, pos);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Convert the BlockState into the correct metadata value
|
||||
*/
|
||||
public int getMetaFromState(State state)
|
||||
{
|
||||
return ((DyeColor)state.getValue(COLOR)).getMetadata();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
{
|
||||
return new IProperty[] {COLOR};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel(state.getValue(COLOR).getName() + "_glass").add().all();
|
||||
}
|
||||
}
|
28
common/src/common/block/BlockTranslucent.java
Executable file
28
common/src/common/block/BlockTranslucent.java
Executable file
|
@ -0,0 +1,28 @@
|
|||
package common.block;
|
||||
|
||||
import common.material.Material;
|
||||
import common.model.BlockLayer;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
|
||||
public class BlockTranslucent extends Block {
|
||||
public BlockTranslucent(Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
public final boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public final BlockLayer getBlockLayer() {
|
||||
return BlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IWorldAccess world, BlockPos pos, Facing side) {
|
||||
State state = world.getState(pos);
|
||||
Block block = state.getBlock();
|
||||
return block != this && super.shouldSideBeRendered(world, pos, side);
|
||||
}
|
||||
}
|
|
@ -3,8 +3,8 @@ package common.block;
|
|||
import common.material.Material;
|
||||
|
||||
public class BlockTreasure extends Block {
|
||||
public BlockTreasure(Material materialIn) {
|
||||
super(materialIn);
|
||||
public BlockTreasure(Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
public boolean isXrayVisible() {
|
||||
|
|
|
@ -3,7 +3,6 @@ package common.block;
|
|||
import common.tileentity.TileEntity;
|
||||
import common.world.World;
|
||||
|
||||
public interface ITileEntityProvider
|
||||
{
|
||||
TileEntity createNewTileEntity(World worldIn);
|
||||
public interface ITileEntityProvider {
|
||||
TileEntity createNewTileEntity(World world);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.color.DyeColor;
|
||||
import common.color.TextColor;
|
||||
import common.entity.npc.EntityNPC;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Items;
|
||||
import common.item.Item;
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.color.DyeColor;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.material.Material;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.collect.Lists;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
|
@ -1,7 +1,10 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockFalling;
|
||||
import common.entity.item.EntityFalling;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.material.Material;
|
||||
import common.model.Model;
|
||||
|
@ -146,7 +149,7 @@ public class BlockDragonEgg extends Block
|
|||
{
|
||||
BlockPos blockpos = pos.add(worldIn.rand.zrange(16) - worldIn.rand.zrange(16), worldIn.rand.zrange(8) - worldIn.rand.zrange(8), worldIn.rand.zrange(16) - worldIn.rand.zrange(16));
|
||||
|
||||
if (worldIn.getState(blockpos).getBlock().material == Material.air)
|
||||
if (worldIn.getState(blockpos).getBlock() == Blocks.air)
|
||||
{
|
||||
if (worldIn.client)
|
||||
{
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.collect.Lists;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
|
@ -165,7 +166,7 @@ public class BlockFence extends Block
|
|||
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
Block block = worldIn.getState(pos).getBlock();
|
||||
return ((!(block instanceof BlockFence) || block.material != this.material) && !(block instanceof BlockFenceGate) ? (block.material.isOpaque() && block.isFullCube() ? block.material != Material.gourd : false) : true);
|
||||
return ((!(block instanceof BlockFence) || block.getMaterial() != this.material) && !(block instanceof BlockFenceGate) ? (block.getMaterial().isOpaque() && block.isFullCube() ? block.getMaterial() != Material.gourd : false) : true);
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side)
|
|
@ -1,5 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
|
@ -1,9 +1,10 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import common.block.Block;
|
||||
import common.collect.Sets;
|
||||
import common.entity.Entity;
|
||||
import common.item.Item;
|
|
@ -1,5 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.foliage.BlockFlower;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.init.ItemRegistry;
|
44
common/src/common/block/artificial/BlockGlass.java
Executable file
44
common/src/common/block/artificial/BlockGlass.java
Executable file
|
@ -0,0 +1,44 @@
|
|||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
||||
import common.model.BlockLayer;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
|
||||
public class BlockGlass extends Block {
|
||||
public BlockGlass() {
|
||||
super(Material.glass);
|
||||
this.setTab(CheatTab.tabBlocks);
|
||||
}
|
||||
|
||||
public int quantityDropped(Random rand) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer() {
|
||||
return BlockLayer.CUTOUT;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canSilkHarvest() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IWorldAccess world, BlockPos pos, Facing side) {
|
||||
State state = world.getState(pos);
|
||||
Block block = state.getBlock();
|
||||
return world.getState(pos.offset(side.getOpposite())) != state || (block != this && super.shouldSideBeRendered(world, pos, side));
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.BlockRotatedPillar;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.CheatTab;
|
|
@ -1,5 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.Entity;
|
||||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
|
@ -1,7 +1,9 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.natural.BlockFire;
|
||||
import common.entity.Entity;
|
||||
import common.init.Blocks;
|
||||
import common.item.Item;
|
||||
|
@ -23,7 +25,7 @@ import common.world.AWorldClient;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockPortal extends BlockBreakable
|
||||
public class BlockPortal extends Block
|
||||
{
|
||||
public static final PropertyEnum<Facing.Axis> AXIS = PropertyEnum.<Facing.Axis>create("axis", Facing.Axis.class, Facing.Axis.X, Facing.Axis.Z);
|
||||
public static final PropertyInteger DIM = PropertyInteger.create("dim", 0, 7);
|
||||
|
@ -32,7 +34,7 @@ public class BlockPortal extends BlockBreakable
|
|||
|
||||
public BlockPortal()
|
||||
{
|
||||
super(Material.portal, false);
|
||||
super(Material.portal);
|
||||
this.setDefaultState(this.getBaseState().withProperty(AXIS, Facing.Axis.X).withProperty(DIM, 0));
|
||||
// this.setTickRandomly();
|
||||
}
|
||||
|
@ -97,6 +99,14 @@ public class BlockPortal extends BlockBreakable
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer() {
|
||||
return BlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
public boolean tryIgnitePortal(World worldIn, BlockPos pos, int dim)
|
||||
{
|
||||
BlockPortal.Size size = new BlockPortal.Size(worldIn, pos, Facing.Axis.X, dim);
|
||||
|
@ -192,11 +202,6 @@ public class BlockPortal extends BlockBreakable
|
|||
return 0;
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer()
|
||||
{
|
||||
return BlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called When an Entity Collided with the Block
|
||||
*/
|
||||
|
@ -323,7 +328,7 @@ public class BlockPortal extends BlockBreakable
|
|||
// {
|
||||
// BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, j, 1);
|
||||
//
|
||||
// if (blockworldstate.getBlockState() != null && blockworldstate.getBlockState().getBlock().getMaterial() != Material.air)
|
||||
// if (blockworldstate.getBlockState() != null && blockworldstate.getBlockState().getBlock() != Blocks.air)
|
||||
// {
|
||||
// ++aint[enumfacing$axisdirection.ordinal()];
|
||||
// }
|
||||
|
@ -493,7 +498,7 @@ public class BlockPortal extends BlockBreakable
|
|||
|
||||
protected boolean func_150857_a(Block p_150857_1_)
|
||||
{
|
||||
return p_150857_1_.material == Material.air || p_150857_1_ == Blocks.fire || p_150857_1_ == Blocks.portal;
|
||||
return p_150857_1_ == Blocks.air || p_150857_1_ instanceof BlockFire || p_150857_1_ == Blocks.portal;
|
||||
}
|
||||
|
||||
public boolean func_150860_b()
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.CheatTab;
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.collect.Lists;
|
||||
import common.entity.Entity;
|
||||
import common.entity.types.EntityLiving;
|
52
common/src/common/block/artificial/BlockStainedGlass.java
Executable file
52
common/src/common/block/artificial/BlockStainedGlass.java
Executable file
|
@ -0,0 +1,52 @@
|
|||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.color.DyeColor;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.world.State;
|
||||
|
||||
public class BlockStainedGlass extends BlockGlass {
|
||||
public static final PropertyEnum<DyeColor> COLOR = PropertyEnum.<DyeColor>create("color", DyeColor.class);
|
||||
|
||||
public BlockStainedGlass() {
|
||||
this.setDefaultState(this.getBaseState().withProperty(COLOR, DyeColor.WHITE));
|
||||
}
|
||||
|
||||
public int damageDropped(State state) {
|
||||
return state.getValue(COLOR).getMetadata();
|
||||
}
|
||||
|
||||
public void getSubBlocks(Item item, CheatTab tab, List<ItemStack> list) {
|
||||
for(DyeColor color : DyeColor.values()) {
|
||||
list.add(new ItemStack(item, 1, color.getMetadata()));
|
||||
}
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer() {
|
||||
return BlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
public State getStateFromMeta(int meta) {
|
||||
return this.getState().withProperty(COLOR, DyeColor.byMetadata(meta));
|
||||
}
|
||||
|
||||
public int getMetaFromState(State state) {
|
||||
return state.getValue(COLOR).getMetadata();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties() {
|
||||
return new IProperty[] {COLOR};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel(state.getValue(COLOR).getName() + "_glass").add().all();
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
|
@ -52,15 +53,15 @@ public class BlockStairs extends Block
|
|||
|
||||
public BlockStairs(State modelState, String down, String up)
|
||||
{
|
||||
super(modelState.getBlock().material);
|
||||
super(modelState.getBlock().getMaterial());
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(HALF, BlockStairs.EnumHalf.BOTTOM).withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT));
|
||||
this.modelBlock = modelState.getBlock();
|
||||
this.modelState = modelState;
|
||||
this.setHardness(this.modelBlock.blockHardness);
|
||||
this.setResistance(this.modelBlock.blockResistance / 3.0F);
|
||||
this.setHardness(this.modelBlock.getRawHardness());
|
||||
this.setResistance(this.modelBlock.getRawResistance() / 3.0F);
|
||||
this.setStepSound(this.modelBlock.sound);
|
||||
this.setLightOpacity(255);
|
||||
this.setTab(modelState.getBlock().material == Material.wood ? CheatTab.tabWood : CheatTab.tabBlocks);
|
||||
this.setTab(modelState.getBlock().getMaterial() == Material.wood ? CheatTab.tabWood : CheatTab.tabBlocks);
|
||||
this.downTex = down;
|
||||
this.upTex = up;
|
||||
}
|
||||
|
@ -623,9 +624,9 @@ public class BlockStairs extends Block
|
|||
return this.modelBlock.isCollidable();
|
||||
}
|
||||
|
||||
public boolean canCollideCheck(State state, boolean hitIfLiquid)
|
||||
public boolean canCollideCheck(State state, boolean liquid)
|
||||
{
|
||||
return this.modelBlock.canCollideCheck(state, hitIfLiquid);
|
||||
return this.modelBlock.canCollideCheck(state, liquid);
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
|
@ -249,7 +250,7 @@ public class BlockTrapDoor extends Block
|
|||
|
||||
private static boolean isValidSupportBlock(Block blockIn)
|
||||
{
|
||||
return blockIn.material.isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glass || blockIn == Blocks.stained_glass || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs;
|
||||
return blockIn.getMaterial().isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glass || blockIn == Blocks.stained_glass || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs;
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer()
|
|
@ -1,7 +1,9 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
|
@ -32,10 +34,10 @@ public class BlockWall extends Block
|
|||
|
||||
public BlockWall(Block modelBlock)
|
||||
{
|
||||
super(modelBlock.material);
|
||||
super(modelBlock.getMaterial());
|
||||
this.setDefaultState(this.getBaseState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)).withProperty(VARIANT, BlockWall.EnumType.NORMAL));
|
||||
this.setHardness(modelBlock.blockHardness);
|
||||
this.setResistance(modelBlock.blockResistance / 3.0F);
|
||||
this.setHardness(modelBlock.getRawHardness());
|
||||
this.setResistance(modelBlock.getRawResistance() / 3.0F);
|
||||
this.setStepSound(modelBlock.sound);
|
||||
this.setTab(CheatTab.tabBlocks);
|
||||
}
|
||||
|
@ -124,7 +126,7 @@ public class BlockWall extends Block
|
|||
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
Block block = worldIn.getState(pos).getBlock();
|
||||
return (block != this && !(block instanceof BlockFenceGate) ? (block.material.isOpaque() && block.isFullCube() ? block.material != Material.gourd : false) : true);
|
||||
return (block != this && !(block instanceof BlockFenceGate) ? (block.getMaterial().isOpaque() && block.isFullCube() ? block.getMaterial() != Material.gourd : false) : true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -174,7 +176,7 @@ public class BlockWall extends Block
|
|||
*/
|
||||
public State getActualState(State state, IWorldAccess worldIn, BlockPos pos)
|
||||
{
|
||||
return state.withProperty(UP, Boolean.valueOf(worldIn.getState(pos.up()).getBlock().getMaterial() != Material.air)).withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, pos.west())));
|
||||
return state.withProperty(UP, Boolean.valueOf(worldIn.getState(pos.up()).getBlock() != Blocks.air)).withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, pos.west())));
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
|
@ -1,4 +1,4 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
public class BlockBaseFlower extends BlockFlower
|
||||
{
|
|
@ -1,6 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.item.CheatTab;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.model.Model;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.DamageSource;
|
||||
import common.entity.Entity;
|
||||
import common.init.Blocks;
|
|
@ -1,4 +1,4 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.init.Items;
|
||||
import common.item.Item;
|
|
@ -1,5 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.color.DyeColor;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
|
@ -1,5 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.SoundType;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.init.Items;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
|
@ -1,7 +1,10 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.SoundType;
|
||||
import common.color.Colorizer;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.SoundType;
|
||||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
|
@ -1,5 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.natural.BlockDirt;
|
||||
import common.entity.Entity;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
|
@ -1,4 +1,4 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
|
@ -1,6 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.biome.IBiome;
|
||||
import common.block.Block;
|
||||
import common.block.natural.BlockDirt;
|
||||
import common.color.Colorizer;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.Item;
|
|
@ -1,7 +1,9 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.SoundType;
|
||||
import common.collect.Lists;
|
||||
import common.color.Colorizer;
|
||||
import common.entity.npc.EntityNPC;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.material.Material;
|
||||
import common.model.BlockLayer;
|
||||
|
|
@ -1,7 +1,11 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.block.liquid.BlockStaticLiquid;
|
||||
import common.entity.Entity;
|
||||
import common.entity.item.EntityBoat;
|
||||
import common.entity.types.EntityLiving;
|
|
@ -1,5 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.BlockRotatedPillar;
|
||||
import common.block.SoundType;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
|
@ -1,6 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.biome.IBiome;
|
||||
import common.block.Block;
|
||||
import common.block.natural.BlockDirt;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.model.Model;
|
|
@ -1,5 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.natural.BlockDirt;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.item.CheatTab;
|
|
@ -1,4 +1,4 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.init.Items;
|
||||
import common.item.Item;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.BlockDirectional;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
||||
|
@ -111,7 +112,7 @@ public class BlockPumpkin extends BlockDirectional
|
|||
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
||||
{
|
||||
return worldIn.getState(pos).getBlock().material.isReplaceable() && worldIn.isBlockSolid(pos.down());
|
||||
return worldIn.getState(pos).getBlock().getMaterial().isReplaceable() && worldIn.isBlockSolid(pos.down());
|
||||
}
|
||||
|
||||
/**
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.init.Items;
|
|
@ -1,4 +1,4 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.material.Material;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
|
@ -103,7 +103,7 @@ public class BlockStem extends BlockBush implements IGrowable
|
|||
pos = pos.offset(Facing.Plane.HORIZONTAL.random(rand));
|
||||
Block block = worldIn.getState(pos.down()).getBlock();
|
||||
|
||||
if (worldIn.getState(pos).getBlock().material == Material.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass))
|
||||
if (worldIn.getState(pos).getBlock() == Blocks.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass))
|
||||
{
|
||||
worldIn.setState(pos, this.crop.getState());
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.color.Colorizer;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
|
@ -177,7 +178,7 @@ public class BlockVine extends Block
|
|||
|
||||
private boolean canPlaceOn(Block blockIn)
|
||||
{
|
||||
return blockIn.isFullCube() && blockIn.material.blocksMovement();
|
||||
return blockIn.isFullCube() && blockIn.getMaterial().blocksMovement();
|
||||
}
|
||||
|
||||
private boolean recheckGrownSides(World worldIn, BlockPos pos, State state)
|
||||
|
@ -307,7 +308,7 @@ public class BlockVine extends Block
|
|||
BlockPos blockpos3 = pos.offset(enumfacing1);
|
||||
Block block1 = worldIn.getState(blockpos3).getBlock();
|
||||
|
||||
if (block1.material == Material.air)
|
||||
if (block1 == Blocks.air)
|
||||
{
|
||||
Facing enumfacing2 = enumfacing1.rotateY();
|
||||
Facing enumfacing4 = enumfacing1.rotateYCCW();
|
||||
|
@ -337,7 +338,7 @@ public class BlockVine extends Block
|
|||
worldIn.setState(blockpos3, this.getState(), 2);
|
||||
}
|
||||
}
|
||||
else if (block1.material.isOpaque() && block1.isFullCube())
|
||||
else if (block1.getMaterial().isOpaque() && block1.isFullCube())
|
||||
{
|
||||
worldIn.setState(pos, state.withProperty(getPropertyFor(enumfacing1), Boolean.valueOf(true)), 2);
|
||||
}
|
||||
|
@ -351,7 +352,7 @@ public class BlockVine extends Block
|
|||
State iblockstate = worldIn.getState(blockpos2);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if (block.material == Material.air)
|
||||
if (block == Blocks.air)
|
||||
{
|
||||
State iblockstate1 = state;
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.init.Items;
|
|
@ -1,4 +1,4 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
|
@ -1,4 +1,4 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.util.Identifyable;
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
package common.block;
|
||||
package common.block.liquid;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.artificial.BlockDoor;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.material.Material;
|
||||
|
@ -260,7 +262,7 @@ public class BlockDynamicLiquid extends BlockLiquid
|
|||
private boolean isBlocked(World worldIn, BlockPos pos, State state)
|
||||
{
|
||||
Block block = worldIn.getState(pos).getBlock();
|
||||
return !(block instanceof BlockDoor) && block != Blocks.sign && block != Blocks.ladder && block != Blocks.reeds ? (block.material == Material.portal ? true : block.material.blocksMovement()) : true;
|
||||
return !(block instanceof BlockDoor) && block != Blocks.sign && block != Blocks.ladder && block != Blocks.reeds ? (block.getMaterial() == Material.portal ? true : block.getMaterial().blocksMovement()) : true;
|
||||
}
|
||||
|
||||
protected int checkAdjacentBlock(World worldIn, BlockPos pos, int currentMinLevel)
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.liquid;
|
||||
|
||||
import common.block.Block;
|
||||
import common.color.Colorizer;
|
||||
import common.entity.Entity;
|
||||
import common.init.Blocks;
|
||||
|
@ -90,9 +91,9 @@ public abstract class BlockLiquid extends Block
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean canCollideCheck(State state, boolean hitIfLiquid)
|
||||
public boolean canCollideCheck(State state, boolean liquid)
|
||||
{
|
||||
return hitIfLiquid && ((Integer)state.getValue(LEVEL)).intValue() == 0;
|
||||
return liquid && ((Integer)state.getValue(LEVEL)).intValue() == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -257,7 +258,7 @@ public abstract class BlockLiquid extends Block
|
|||
}
|
||||
}
|
||||
|
||||
if (this.material == Material.lava && worldIn.getState(pos.up()).getBlock().getMaterial() == Material.air && !worldIn.getState(pos.up()).getBlock().isOpaqueCube())
|
||||
if (this.material == Material.lava && worldIn.getState(pos.up()).getBlock() == Blocks.air && !worldIn.getState(pos.up()).getBlock().isOpaqueCube())
|
||||
{
|
||||
if (rand.chance(100))
|
||||
{
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.liquid;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.material.Material;
|
||||
|
@ -58,7 +59,7 @@ public class BlockStaticLiquid extends BlockLiquid
|
|||
blockpos = blockpos.add(rand.zrange(3) - 1, 1, rand.zrange(3) - 1);
|
||||
Block block = worldIn.getState(blockpos).getBlock();
|
||||
|
||||
if (block.material == Material.air)
|
||||
if (block == Blocks.air)
|
||||
{
|
||||
if (this.isSurroundingBlockFlammable(worldIn, blockpos))
|
||||
{
|
||||
|
@ -66,7 +67,7 @@ public class BlockStaticLiquid extends BlockLiquid
|
|||
return;
|
||||
}
|
||||
}
|
||||
else if (block.material.blocksMovement())
|
||||
else if (block.getMaterial().blocksMovement())
|
||||
{
|
||||
return;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.natural;
|
||||
|
||||
import common.block.Block;
|
||||
import common.material.Material;
|
||||
import common.model.ParticleType;
|
||||
import common.rng.Random;
|
|
@ -1,6 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.natural;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.item.CheatTab;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.natural;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.CheatTab;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.natural;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.natural;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.natural;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.init.FlammabilityRegistry;
|
||||
|
@ -47,7 +48,7 @@ public class BlockFire extends Block
|
|||
int j = pos.getY();
|
||||
int k = pos.getZ();
|
||||
|
||||
if (!World.isSolidSurface(worldIn.getState(pos.down())) && !Blocks.fire.canCatchFire(worldIn, pos.down()))
|
||||
if (!World.isSolidSurface(worldIn.getState(pos.down())) && !this.canCatchFire(worldIn, pos.down()))
|
||||
{
|
||||
boolean flag = (i + j + k & 1) == 1;
|
||||
boolean flag1 = (i / 2 + j / 2 + k / 2 & 1) == 1;
|
||||
|
@ -353,9 +354,9 @@ public class BlockFire extends Block
|
|||
worldIn.playSound((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), SoundEvent.FIRE, 1.0F + rand.floatv());
|
||||
}
|
||||
|
||||
if (!worldIn.isBlockSolid(pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down()))
|
||||
if (!worldIn.isBlockSolid(pos.down()) && !this.canCatchFire(worldIn, pos.down()))
|
||||
{
|
||||
if (Blocks.fire.canCatchFire(worldIn, pos.west()))
|
||||
if (this.canCatchFire(worldIn, pos.west()))
|
||||
{
|
||||
for (int j = 0; j < 2; ++j)
|
||||
{
|
||||
|
@ -366,7 +367,7 @@ public class BlockFire extends Block
|
|||
}
|
||||
}
|
||||
|
||||
if (Blocks.fire.canCatchFire(worldIn, pos.east()))
|
||||
if (this.canCatchFire(worldIn, pos.east()))
|
||||
{
|
||||
for (int k = 0; k < 2; ++k)
|
||||
{
|
||||
|
@ -377,7 +378,7 @@ public class BlockFire extends Block
|
|||
}
|
||||
}
|
||||
|
||||
if (Blocks.fire.canCatchFire(worldIn, pos.north()))
|
||||
if (this.canCatchFire(worldIn, pos.north()))
|
||||
{
|
||||
for (int l = 0; l < 2; ++l)
|
||||
{
|
||||
|
@ -388,7 +389,7 @@ public class BlockFire extends Block
|
|||
}
|
||||
}
|
||||
|
||||
if (Blocks.fire.canCatchFire(worldIn, pos.south()))
|
||||
if (this.canCatchFire(worldIn, pos.south()))
|
||||
{
|
||||
for (int i1 = 0; i1 < 2; ++i1)
|
||||
{
|
||||
|
@ -399,7 +400,7 @@ public class BlockFire extends Block
|
|||
}
|
||||
}
|
||||
|
||||
if (Blocks.fire.canCatchFire(worldIn, pos.up()))
|
||||
if (this.canCatchFire(worldIn, pos.up()))
|
||||
{
|
||||
for (int j1 = 0; j1 < 2; ++j1)
|
||||
{
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.natural;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
|
@ -1,14 +1,22 @@
|
|||
package common.block;
|
||||
package common.block.natural;
|
||||
|
||||
import common.block.BlockFalling;
|
||||
import common.init.Config;
|
||||
import common.init.ItemRegistry;
|
||||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.world.State;
|
||||
|
||||
public class BlockGravel extends BlockFalling
|
||||
{
|
||||
public BlockGravel() {
|
||||
super(Material.sand);
|
||||
this.setTab(CheatTab.tabNature);
|
||||
}
|
||||
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
int chance = Config.flintChance;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.natural;
|
||||
|
||||
import common.block.Block;
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.natural;
|
||||
|
||||
import common.block.Block;
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
||||
|
65
common/src/common/block/natural/BlockIce.java
Executable file
65
common/src/common/block/natural/BlockIce.java
Executable file
|
@ -0,0 +1,65 @@
|
|||
package common.block.natural;
|
||||
|
||||
import common.block.BlockTranslucent;
|
||||
import common.enchantment.EnchantmentHelper;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.item.CheatTab;
|
||||
import common.item.ItemStack;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.world.LightType;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockIce extends BlockTranslucent {
|
||||
public BlockIce() {
|
||||
super(Material.ice);
|
||||
this.slipperiness = 0.98F;
|
||||
this.setTickRandomly();
|
||||
this.setTab(CheatTab.tabNature);
|
||||
}
|
||||
|
||||
public void harvestBlock(World world, EntityNPC player, BlockPos pos, State state, TileEntity tile) {
|
||||
if(this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) {
|
||||
ItemStack stack = this.createStackedBlock(state);
|
||||
if(stack != null)
|
||||
spawnAsEntity(world, pos, stack);
|
||||
}
|
||||
else {
|
||||
if(world.doesWaterVaporize(pos)) {
|
||||
world.setBlockToAir(pos);
|
||||
return;
|
||||
}
|
||||
int fortune = EnchantmentHelper.getFortuneModifier(player);
|
||||
this.dropBlockAsItem(world, pos, state, fortune);
|
||||
Material material = world.getState(pos.down()).getBlock().getMaterial();
|
||||
if(material.blocksMovement() || material.isLiquid())
|
||||
world.setState(pos, Blocks.flowing_water.getState());
|
||||
}
|
||||
}
|
||||
|
||||
public int quantityDropped(Random rand) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void updateTick(AWorldServer world, BlockPos pos, State state, Random rand) {
|
||||
if(Config.iceMelt && (world.getLightFor(LightType.BLOCK, pos) > 11 - this.getLightOpacity() || !world.canFreezeAt(pos))) {
|
||||
if(world.doesWaterVaporize(pos)) {
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
else {
|
||||
this.dropBlockAsItem(world, pos, world.getState(pos), 0);
|
||||
world.setState(pos, Blocks.water.getState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getMobilityFlag() {
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.natural;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.CheatTab;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.natural;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Config;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.CheatTab;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.natural;
|
||||
|
||||
import common.block.Block;
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.natural;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.natural;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
|
@ -1,10 +1,12 @@
|
|||
package common.block;
|
||||
package common.block.natural;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.BlockFalling;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.material.Material;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
|
@ -18,7 +20,9 @@ public class BlockSand extends BlockFalling
|
|||
|
||||
public BlockSand()
|
||||
{
|
||||
super(Material.sand);
|
||||
this.setDefaultState(this.getBaseState().withProperty(VARIANT, BlockSand.EnumType.SAND));
|
||||
this.setTab(CheatTab.tabNature);
|
||||
}
|
||||
|
||||
/**
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue