clanup
This commit is contained in:
parent
5a69c0545b
commit
cf37d48292
122 changed files with 633 additions and 2384 deletions
|
@ -173,8 +173,9 @@ public class Block {
|
|||
protected boolean axeHarvest;
|
||||
protected boolean shovelHarvest;
|
||||
protected boolean ticked;
|
||||
protected boolean hasTile;
|
||||
protected boolean flatItemTexture;
|
||||
private boolean flatBlockTexture;
|
||||
private boolean flatItemTexture;
|
||||
private boolean itemColored;
|
||||
protected int lightOpacity;
|
||||
protected int lightValue;
|
||||
protected int miningLevel;
|
||||
|
@ -367,11 +368,21 @@ public class Block {
|
|||
return this;
|
||||
}
|
||||
|
||||
protected Block setFlatBlockTexture() {
|
||||
this.flatBlockTexture = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Block setFlatItemTexture() {
|
||||
this.flatItemTexture = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Block setItemColored() {
|
||||
this.itemColored = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Block setDisplay(String name) {
|
||||
this.display = name;
|
||||
return this;
|
||||
|
@ -507,10 +518,6 @@ public class Block {
|
|||
return this.ticked;
|
||||
}
|
||||
|
||||
public boolean hasTileEntity() {
|
||||
return this.hasTile;
|
||||
}
|
||||
|
||||
protected final void setBlockBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) {
|
||||
this.minX = (double)minX;
|
||||
this.minY = (double)minY;
|
||||
|
@ -614,14 +621,6 @@ public class Block {
|
|||
public void onBlockRemoved(AWorldServer world, BlockPos pos, State state) {
|
||||
}
|
||||
|
||||
public int quantityDropped(Random random) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public Item getItemDropped(State state, Random rand, int fortune) {
|
||||
return this.getItem() instanceof ItemBlock item ? item : null;
|
||||
}
|
||||
|
||||
public float getPlayerRelativeBlockHardness(EntityNPC playerIn, World worldIn, BlockPos pos) {
|
||||
float f = this.getBlockHardness(worldIn, pos);
|
||||
return f < 0.0F ? 0.0F
|
||||
|
@ -629,48 +628,6 @@ public class Block {
|
|||
: playerIn.getToolDigEfficiency(this) / f / 30.0F);
|
||||
}
|
||||
|
||||
public final void dropBlockAsItem(World worldIn, BlockPos pos, State state, int forture) {
|
||||
this.dropBlockAsItemWithChance(worldIn, pos, state, 1.0F, forture);
|
||||
}
|
||||
|
||||
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, State state, float chance, int fortune) {
|
||||
if(!worldIn.client) {
|
||||
int i = this.quantityDroppedWithBonus(fortune, worldIn.rand);
|
||||
|
||||
for(int j = 0; j < i; ++j) {
|
||||
if(worldIn.rand.floatv() <= chance) {
|
||||
Item item = this.getItemDropped(state, worldIn.rand, fortune);
|
||||
|
||||
if(item != null) {
|
||||
spawnAsEntity(worldIn, pos, new ItemStack(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack) {
|
||||
if(!worldIn.client && Vars.blockDrop) {
|
||||
float f = 0.5F;
|
||||
double d0 = (double)(worldIn.rand.floatv() * f) + (double)(1.0F - f) * 0.5D;
|
||||
double d1 = (double)(worldIn.rand.floatv() * f) + (double)(1.0F - f) * 0.5D;
|
||||
double d2 = (double)(worldIn.rand.floatv() * f) + (double)(1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, stack);
|
||||
entityitem.setDefaultPickupDelay();
|
||||
worldIn.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
|
||||
protected void dropXpOnBlockBreak(World worldIn, BlockPos pos, int amount) {
|
||||
if(!worldIn.client && Vars.blockXP) {
|
||||
while(amount > 0) {
|
||||
int i = EntityXp.getXPSplit(amount);
|
||||
amount -= i;
|
||||
worldIn.spawnEntityInWorld(new EntityXp(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float getExplosionResistance(Entity exploder) {
|
||||
return this.blockResistance / 5.0F;
|
||||
}
|
||||
|
@ -792,10 +749,6 @@ public class Block {
|
|||
return BlockLayer.SOLID;
|
||||
}
|
||||
|
||||
public boolean canReplace(World worldIn, BlockPos pos, Facing side, ItemStack stack) {
|
||||
return this.canPlaceBlockOnSide(worldIn, pos, side);
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, Facing side) {
|
||||
return this.canPlaceBlockAt(worldIn, pos);
|
||||
}
|
||||
|
@ -867,35 +820,11 @@ public class Block {
|
|||
public void setBlockBoundsForItemRender() {
|
||||
}
|
||||
|
||||
public void harvestBlock(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) {
|
||||
if(this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) {
|
||||
ItemStack itemstack = this.createStackedBlock(state);
|
||||
|
||||
if(itemstack != null) {
|
||||
spawnAsEntity(worldIn, pos, itemstack);
|
||||
}
|
||||
}
|
||||
else {
|
||||
int i = EnchantmentHelper.getFortuneModifier(player);
|
||||
this.dropBlockAsItem(worldIn, pos, state, i);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canSilkHarvest() {
|
||||
return this.isFullCube() && !this.hasTile;
|
||||
return this.isFullCube() && !(this instanceof ITileEntityProvider);
|
||||
}
|
||||
|
||||
public ItemStack createStackedBlock(State state) {
|
||||
Item item = this.getItem();
|
||||
// TODO: data
|
||||
return item instanceof ItemBlock ? new ItemStack(item) : null;
|
||||
}
|
||||
|
||||
public int quantityDroppedWithBonus(int fortune, Random random) {
|
||||
return this.quantityDropped(random);
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, State state, EntityLiving placer, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, State state, EntityLiving placer) {
|
||||
}
|
||||
|
||||
public boolean canSpawnInBlock() {
|
||||
|
@ -906,10 +835,6 @@ public class Block {
|
|||
return this.display;
|
||||
}
|
||||
|
||||
public boolean onBlockEventReceived(World worldIn, BlockPos pos, State state, int eventID, int eventParam) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getMobilityFlag() {
|
||||
return this.material.getMobility();
|
||||
}
|
||||
|
@ -922,10 +847,6 @@ public class Block {
|
|||
entityIn.motionY = 0.0D;
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos) {
|
||||
return this.getItem() instanceof ItemBlock item ? item : null;
|
||||
}
|
||||
|
||||
public CheatTab getTab() {
|
||||
return this.tab;
|
||||
}
|
||||
|
@ -936,10 +857,6 @@ public class Block {
|
|||
public void fillWithRain(World worldIn, BlockPos pos) {
|
||||
}
|
||||
|
||||
public boolean isPickStrict() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean requiresUpdates() {
|
||||
return true;
|
||||
}
|
||||
|
@ -1039,7 +956,7 @@ public class Block {
|
|||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemBlock(this, this.flatItemTexture ? "" : null);
|
||||
return new ItemBlock(this);
|
||||
}
|
||||
|
||||
public final Item registerItem() {
|
||||
|
@ -1051,12 +968,78 @@ public class Block {
|
|||
this.item = item;
|
||||
return item;
|
||||
}
|
||||
|
||||
public final Item getItem() {
|
||||
|
||||
public Item getItem() {
|
||||
return this.item;
|
||||
}
|
||||
|
||||
public boolean canConnectToWire() {
|
||||
public Item getItemDropped(State state, Random rand, int fortune) {
|
||||
return this.getItem();
|
||||
}
|
||||
|
||||
protected int quantityDropped(Random random) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected int quantityDroppedWithBonus(int fortune, Random random) {
|
||||
return this.quantityDropped(random);
|
||||
}
|
||||
|
||||
public void harvestBlock(World world, EntityNPC player, BlockPos pos, State state, TileEntity te) {
|
||||
if(this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) {
|
||||
Item item = this.getItem();
|
||||
if(item != null)
|
||||
spawnAsEntity(world, pos, new ItemStack(item));
|
||||
}
|
||||
else {
|
||||
int fortune = EnchantmentHelper.getFortuneModifier(player);
|
||||
this.dropBlockAsItem(world, pos, state, fortune);
|
||||
}
|
||||
}
|
||||
|
||||
public final void dropBlockAsItem(World worldIn, BlockPos pos, State state, int fortune) {
|
||||
this.dropBlockAsItemWithChance(worldIn, pos, state, 1.0F, fortune);
|
||||
}
|
||||
|
||||
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, State state, float chance, int fortune) {
|
||||
if(!worldIn.client) {
|
||||
int i = this.quantityDroppedWithBonus(fortune, worldIn.rand);
|
||||
|
||||
for(int j = 0; j < i; ++j) {
|
||||
if(worldIn.rand.floatv() <= chance) {
|
||||
Item item = this.getItemDropped(state, worldIn.rand, fortune);
|
||||
|
||||
if(item != null) {
|
||||
spawnAsEntity(worldIn, pos, new ItemStack(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack) {
|
||||
if(!worldIn.client && Vars.blockDrop) {
|
||||
float f = 0.5F;
|
||||
double d0 = (double)(worldIn.rand.floatv() * f) + (double)(1.0F - f) * 0.5D;
|
||||
double d1 = (double)(worldIn.rand.floatv() * f) + (double)(1.0F - f) * 0.5D;
|
||||
double d2 = (double)(worldIn.rand.floatv() * f) + (double)(1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, stack);
|
||||
entityitem.setDefaultPickupDelay();
|
||||
worldIn.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
|
||||
protected void dropXpOnBlockBreak(World worldIn, BlockPos pos, int amount) {
|
||||
if(!worldIn.client && Vars.blockXP) {
|
||||
while(amount > 0) {
|
||||
int i = EntityXp.getXPSplit(amount);
|
||||
amount -= i;
|
||||
worldIn.spawnEntityInWorld(new EntityXp(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canConnectToWire(State state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1067,4 +1050,20 @@ public class Block {
|
|||
public double powerTick(World worldIn, BlockPos pos, State state, Random rand, double voltage, double currentLimit) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
public final boolean hasBlockFlatTexture() {
|
||||
return this.flatBlockTexture;
|
||||
}
|
||||
|
||||
public final boolean hasItemFlatTexture() {
|
||||
return this.flatItemTexture;
|
||||
}
|
||||
|
||||
public final boolean isItemColored() {
|
||||
return this.itemColored;
|
||||
}
|
||||
|
||||
public String getItemTexture(String name) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
package common.block;
|
||||
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public abstract class BlockContainer extends Block implements ITileEntityProvider {
|
||||
public BlockContainer(Material material) {
|
||||
super(material);
|
||||
this.hasTile = true;
|
||||
}
|
||||
|
||||
private boolean isInvalidNeighbor(World world, BlockPos pos, Facing face) {
|
||||
return world.getState(pos.offset(face)).getBlock().getMaterial() == Material.BLOCKING;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void onBlockRemoved(AWorldServer world, BlockPos pos, State state) {
|
||||
super.onBlockRemoved(world, pos, state);
|
||||
world.removeTileEntity(pos);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -6,7 +6,6 @@ import common.block.Material;
|
|||
import common.color.DyeColor;
|
||||
import common.color.TextColor;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemBed;
|
||||
import common.model.BlockLayer;
|
||||
|
@ -113,7 +112,7 @@ public class BlockBed extends Block implements Rotatable {
|
|||
}
|
||||
|
||||
public Item getItemDropped(State state, Random rand, int fortune) {
|
||||
return state.getValue(PART) == BlockBed.EnumPartType.HEAD ? null : ItemRegistry.byName(this.color.getName() + "_bed");
|
||||
return state.getValue(PART) == BlockBed.EnumPartType.HEAD ? null : super.getItemDropped(state, rand, fortune);
|
||||
}
|
||||
|
||||
private void setBedBounds() {
|
||||
|
@ -168,10 +167,6 @@ public class BlockBed extends Block implements Rotatable {
|
|||
return BlockLayer.CUTOUT;
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos) {
|
||||
return ItemRegistry.byName(this.color.getName() + "_bed");
|
||||
}
|
||||
|
||||
// public void onBlockHarvested(World worldIn, BlockPos pos, State state, EntityNPC player) {
|
||||
// if(player.creative && state.getValue(PART) == BlockBed.EnumPartType.HEAD) {
|
||||
// BlockPos blockpos = pos.offset(((Facing)state.getValue(FACING)).getOpposite());
|
||||
|
|
|
@ -22,7 +22,7 @@ public class BlockBookshelf extends Block
|
|||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
|
|
@ -3,10 +3,7 @@ package common.block.artificial;
|
|||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemSmallBlock;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -95,6 +92,7 @@ public class BlockCake extends Block
|
|||
super(Material.SOFT);
|
||||
this.setDefaultState(this.getBaseState().withProperty(BITES, Integer.valueOf(0)));
|
||||
// this.setTickRandomly(true);
|
||||
this.setFlatItemTexture();
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos)
|
||||
|
@ -191,7 +189,7 @@ public class BlockCake extends Block
|
|||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -204,11 +202,6 @@ public class BlockCake extends Block
|
|||
return null;
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
return Items.cake;
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer()
|
||||
{
|
||||
return BlockLayer.CUTOUT;
|
||||
|
@ -222,8 +215,4 @@ public class BlockCake extends Block
|
|||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return cake_slices[state.getValue(BITES)];
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSmallBlock(this).setDisplay("Kuchen").setTab(CheatTab.DECORATION);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ public class BlockDoor extends Block implements Rotatable {
|
|||
}
|
||||
|
||||
public Item getItemDropped(State state, Random rand, int fortune) {
|
||||
return state.getValue(HALF) == EnumDoorHalf.UPPER ? null : this.getItem();
|
||||
return state.getValue(HALF) == EnumDoorHalf.UPPER ? null : super.getItemDropped(state, rand, fortune);
|
||||
}
|
||||
|
||||
public HitPosition collisionRayTrace(World world, BlockPos pos, Vec3 start, Vec3 end) {
|
||||
|
@ -243,10 +243,6 @@ public class BlockDoor extends Block implements Rotatable {
|
|||
return 1;
|
||||
}
|
||||
|
||||
public Item getItem(World world, BlockPos pos) {
|
||||
return this.getItem();
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer() {
|
||||
return BlockLayer.CUTOUT;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class BlockFloorPortal extends Block
|
|||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -99,11 +99,6 @@ public class BlockFloorPortal extends Block
|
|||
worldIn.spawnParticle(ParticleType.SMOKE, d0, d1, d2);
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Get the MapColor for this Block and the given BlockState
|
||||
// */
|
||||
|
|
|
@ -14,7 +14,6 @@ import common.item.CheatTab;
|
|||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.item.block.ItemSmallBlock;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -111,6 +110,7 @@ public class BlockFlowerPot extends Block
|
|||
super(Material.SMALL);
|
||||
this.content = content;
|
||||
this.setBlockBoundsForItemRender();
|
||||
this.setFlatItemTexture();
|
||||
POTS.add(this);
|
||||
}
|
||||
|
||||
|
@ -178,16 +178,6 @@ public class BlockFlowerPot extends Block
|
|||
}
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
return worldIn.getState(pos).getBlock() == this && this.content != null ? this.content.getItem() : Items.flowerpot;
|
||||
}
|
||||
|
||||
public boolean isPickStrict()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
||||
{
|
||||
return super.canPlaceBlockAt(worldIn, pos) && worldIn.isBlockSolid(pos.down());
|
||||
|
@ -270,6 +260,6 @@ public class BlockFlowerPot extends Block
|
|||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return this.content == null ? new ItemSmallBlock(this).setDisplay("Blumentopf").setTab(CheatTab.DECORATION) : null;
|
||||
return this.content == null ? super.getItemToRegister() : null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public class BlockGlass extends Block {
|
|||
this.setTab(CheatTab.BLOCKS);
|
||||
}
|
||||
|
||||
public int quantityDropped(Random rand) {
|
||||
protected int quantityDropped(Random rand) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,15 +26,6 @@ public class BlockHay extends BlockRotatedPillar
|
|||
return new Property[] {AXIS};
|
||||
}
|
||||
|
||||
public ItemStack createStackedBlock(State state)
|
||||
{
|
||||
return new ItemStack(this.getItem());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, EntityLiving placer)
|
||||
{
|
||||
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, placer).withProperty(AXIS, facing.getAxis());
|
||||
|
|
|
@ -24,7 +24,7 @@ public class BlockLadder extends Block implements Rotatable
|
|||
super(Material.SMALL);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
this.setTab(CheatTab.WOOD);
|
||||
this.setFlatItemTexture();
|
||||
this.setFlatBlockTexture();
|
||||
}
|
||||
|
||||
public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state)
|
||||
|
|
|
@ -29,15 +29,13 @@ public class BlockPane extends Block
|
|||
public static final PropertyBool EAST = PropertyBool.create("east");
|
||||
public static final PropertyBool SOUTH = PropertyBool.create("south");
|
||||
public static final PropertyBool WEST = PropertyBool.create("west");
|
||||
private final boolean canDrop;
|
||||
|
||||
public BlockPane(Material materialIn, boolean canDrop)
|
||||
public BlockPane(Material materialIn)
|
||||
{
|
||||
super(materialIn);
|
||||
this.setDefaultState(this.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)));
|
||||
this.canDrop = canDrop;
|
||||
this.setTab(CheatTab.BLOCKS);
|
||||
this.setFlatItemTexture();
|
||||
this.setFlatBlockTexture();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,7 +52,7 @@ public class BlockPane extends Block
|
|||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return !this.canDrop ? null : super.getItemDropped(state, rand, fortune);
|
||||
return this.material != Material.SOLID ? null : super.getItemDropped(state, rand, fortune);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -210,12 +208,12 @@ public class BlockPane extends Block
|
|||
return this.material == Material.SOLID;
|
||||
}
|
||||
|
||||
protected String getPaneBase(State state) {
|
||||
return "glass";
|
||||
protected String getPaneBase() {
|
||||
return this.material == Material.SOLID ? "iron_bars" : "glass";
|
||||
}
|
||||
|
||||
protected String getPaneEdge(State state) {
|
||||
return "glass_pane";
|
||||
protected String getPaneEdge() {
|
||||
return this.material == Material.SOLID ? "iron_bars" : "glass_pane";
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
@ -224,9 +222,11 @@ public class BlockPane extends Block
|
|||
boolean w = state.getValue(WEST);
|
||||
boolean e = state.getValue(EAST);
|
||||
int sides = (n ? 1 : 0) + (s ? 1 : 0) + (w ? 1 : 0) + (e ? 1 : 0);
|
||||
if(this.canDrop) {
|
||||
String pane = this.getPaneBase();
|
||||
String edge = this.getPaneEdge();
|
||||
if(this.material == Material.SOLID) {
|
||||
if(sides == 0 || sides == 4)
|
||||
return provider.getModel(name)
|
||||
return provider.getModel(pane)
|
||||
.add(8, 0, 0, 8, 16, 16)
|
||||
.w().uv(0, 0, 16, 16).noCull()
|
||||
.e().uv(0, 0, 16, 16).noCull()
|
||||
|
@ -249,7 +249,7 @@ public class BlockPane extends Block
|
|||
.d().uv(9, 0, 7, 7).rot(90).noCull()
|
||||
.u().uv(7, 0, 9, 7).rot(90).noCull();
|
||||
else if(sides == 1)
|
||||
return provider.getModel(name)
|
||||
return provider.getModel(pane)
|
||||
.add(8, 0, 0, 8, 16, 8)
|
||||
.w().uv(8, 0, 16, 16).noCull()
|
||||
.e().uv(8, 0, 16, 16).noCull()
|
||||
|
@ -261,7 +261,7 @@ public class BlockPane extends Block
|
|||
.u().uv(7, 0, 9, 9).noCull()
|
||||
.rotate(n ? ModelRotation.X0_Y0 : (s ? ModelRotation.X0_Y180 : (w ? ModelRotation.X0_Y270 : ModelRotation.X0_Y90)));
|
||||
else if(sides == 2 && ((e != w) || (n != s)))
|
||||
return provider.getModel(name)
|
||||
return provider.getModel(pane)
|
||||
.add(8, 0, 0, 8, 16, 8)
|
||||
.w().uv(0, 0, 8, 16).noCull()
|
||||
.e().uv(8, 0, 16, 16).noCull()
|
||||
|
@ -281,7 +281,7 @@ public class BlockPane extends Block
|
|||
.rotate(n && e ? ModelRotation.X0_Y0 : (s && w ? ModelRotation.X0_Y180 :
|
||||
(n && w ? ModelRotation.X0_Y270 : ModelRotation.X0_Y90)));
|
||||
else if(sides == 2)
|
||||
return provider.getModel(name)
|
||||
return provider.getModel(pane)
|
||||
.add(8, 0, 0, 8, 16, 16)
|
||||
.w().uv(0, 0, 16, 16).noCull()
|
||||
.e().uv(0, 0, 16, 16).noCull()
|
||||
|
@ -293,7 +293,7 @@ public class BlockPane extends Block
|
|||
.u().uv(9, 0, 7, 16).noCull()
|
||||
.rotate(n ? ModelRotation.X0_Y0 : ModelRotation.X0_Y90);
|
||||
else
|
||||
return provider.getModel(name)
|
||||
return provider.getModel(pane)
|
||||
.add(8, 0, 0, 8, 16, 16)
|
||||
.w().uv(0, 0, 16, 16).noCull()
|
||||
.e().uv(0, 0, 16, 16).noCull()
|
||||
|
@ -314,8 +314,6 @@ public class BlockPane extends Block
|
|||
.rotate(!w ? ModelRotation.X0_Y0 : (!e ? ModelRotation.X0_Y180 : (!s ? ModelRotation.X0_Y270 : ModelRotation.X0_Y90)));
|
||||
}
|
||||
else {
|
||||
String pane = this.getPaneBase(state);
|
||||
String edge = this.getPaneEdge(state);
|
||||
if(sides == 0 || sides == 4)
|
||||
return provider.getModel(pane)
|
||||
.add(7, 0, 0, 9, 16, 16).noShade()
|
||||
|
@ -492,12 +490,12 @@ public class BlockPane extends Block
|
|||
.e(edge).uv(7, 0, 9, 16);
|
||||
}
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return this.canDrop ? super.getItemToRegister() : new ItemBlock(this, "glass", false);
|
||||
}
|
||||
|
||||
public Property[] getUnsavedProperties() {
|
||||
return new Property[] {NORTH, SOUTH, WEST, EAST};
|
||||
}
|
||||
|
||||
public String getItemTexture(String name) {
|
||||
return this.getPaneBase();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ public class BlockPortal extends Block
|
|||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -239,11 +239,6 @@ public class BlockPortal extends Block
|
|||
}
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getRenderColor(State state)
|
||||
{
|
||||
return COLORS[state.getValue(DIM)];
|
||||
|
|
|
@ -76,7 +76,7 @@ public class BlockPortalFrame extends Block implements Rotatable
|
|||
return Items.obsidian;
|
||||
}
|
||||
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import common.entity.types.EntityLiving;
|
|||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemSmallBlock;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
|
@ -24,6 +23,7 @@ public class BlockSkull extends Block implements Rotatable {
|
|||
super(Material.SMALL);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
|
||||
this.setFlatItemTexture();
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World world, BlockPos pos) {
|
||||
|
@ -51,14 +51,6 @@ public class BlockSkull extends Block implements Rotatable {
|
|||
return false;
|
||||
}
|
||||
|
||||
public Item getItemDropped(State state, Random rand, int fortune) {
|
||||
return Items.skull;
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos) {
|
||||
return Items.skull;
|
||||
}
|
||||
|
||||
public boolean isXrayVisible() {
|
||||
return true;
|
||||
}
|
||||
|
@ -67,8 +59,4 @@ public class BlockSkull extends Block implements Rotatable {
|
|||
world.destroyBlock(pos, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSmallBlock(this).setDisplay("Schädel").setTab(CheatTab.DECORATION);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,10 +57,6 @@ public class BlockSlab extends Block implements Directional {
|
|||
return new Property[] {FACING};
|
||||
}
|
||||
|
||||
public boolean canSilkHarvest() {
|
||||
return false;
|
||||
}
|
||||
|
||||
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 : iblockstate.withProperty(FACING, Facing.UP);
|
||||
|
|
|
@ -7,7 +7,6 @@ import common.item.Item;
|
|||
import common.item.block.ItemBlock;
|
||||
import common.model.BlockLayer;
|
||||
import common.properties.Property;
|
||||
import common.world.State;
|
||||
|
||||
public class BlockStainedGlassPane extends BlockPane
|
||||
{
|
||||
|
@ -21,7 +20,7 @@ public class BlockStainedGlassPane extends BlockPane
|
|||
|
||||
public BlockStainedGlassPane(DyeColor color)
|
||||
{
|
||||
super(Material.TRANSLUCENT, false);
|
||||
super(Material.TRANSLUCENT);
|
||||
this.color = color;
|
||||
this.setDefaultState(this.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)));
|
||||
this.setTab(CheatTab.BLOCKS);
|
||||
|
@ -42,15 +41,11 @@ public class BlockStainedGlassPane extends BlockPane
|
|||
return new Property[] {NORTH, EAST, WEST, SOUTH};
|
||||
}
|
||||
|
||||
protected String getPaneBase(State state) {
|
||||
protected String getPaneBase() {
|
||||
return this.color.getName() + "_glass";
|
||||
}
|
||||
|
||||
protected String getPaneEdge(State state) {
|
||||
protected String getPaneEdge() {
|
||||
return this.color.getName() + "_glass_pane";
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemBlock(this, "");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class BlockBush extends Block
|
|||
float f = 0.2F;
|
||||
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 3.0F, 0.5F + f);
|
||||
this.setTab(CheatTab.PLANTS);
|
||||
this.setFlatItemTexture();
|
||||
this.setFlatBlockTexture();
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
||||
|
|
|
@ -11,11 +11,6 @@ import common.world.State;
|
|||
|
||||
public class BlockCarrot extends BlockCrops
|
||||
{
|
||||
protected Item getSeed()
|
||||
{
|
||||
return Items.carrot;
|
||||
}
|
||||
|
||||
protected Item getCrop()
|
||||
{
|
||||
return Items.carrot;
|
||||
|
|
|
@ -2,12 +2,13 @@ package common.block.foliage;
|
|||
|
||||
import common.block.Block;
|
||||
import common.block.Rotatable;
|
||||
import common.color.DyeColor;
|
||||
import common.block.Material;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.material.ItemDye;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -116,7 +117,7 @@ public class BlockCocoa extends Block implements Rotatable, IGrowable
|
|||
/**
|
||||
* Called by ItemBlocks after a block is set in the world, to allow post-place logic
|
||||
*/
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, State state, EntityLiving placer, ItemStack stack)
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, State state, EntityLiving placer)
|
||||
{
|
||||
Facing enumfacing = Facing.fromAngle((double)placer.rotYaw);
|
||||
worldIn.setState(pos, state.withProperty(FACING, enumfacing), 2);
|
||||
|
@ -168,15 +169,10 @@ public class BlockCocoa extends Block implements Rotatable, IGrowable
|
|||
|
||||
for (int k = 0; k < j; ++k)
|
||||
{
|
||||
spawnAsEntity(worldIn, pos, new ItemStack(Items.cocoa));
|
||||
spawnAsEntity(worldIn, pos, new ItemStack(this.getItem()));
|
||||
}
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
return Items.cocoa;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this IGrowable can grow
|
||||
*/
|
||||
|
@ -253,6 +249,6 @@ public class BlockCocoa extends Block implements Rotatable, IGrowable
|
|||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return null;
|
||||
return new ItemDye(DyeColor.BROWN, this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,11 +136,6 @@ public class BlockCrops extends BlockBush implements IGrowable
|
|||
return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock());
|
||||
}
|
||||
|
||||
protected Item getSeed()
|
||||
{
|
||||
return Items.wheat;
|
||||
}
|
||||
|
||||
protected Item getCrop()
|
||||
{
|
||||
return Items.wheats;
|
||||
|
@ -165,7 +160,7 @@ public class BlockCrops extends BlockBush implements IGrowable
|
|||
{
|
||||
if (worldIn.rand.zrange(15) <= i)
|
||||
{
|
||||
spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed()));
|
||||
spawnAsEntity(worldIn, pos, new ItemStack(this.getItem()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -177,12 +172,7 @@ public class BlockCrops extends BlockBush implements IGrowable
|
|||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return ((Integer)state.getValue(AGE)).intValue() == 7 ? this.getCrop() : this.getSeed();
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
return this.getSeed();
|
||||
return ((Integer)state.getValue(AGE)).intValue() == 7 ? this.getCrop() : super.getItemDropped(state, rand, fortune);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,6 +46,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
|||
this.setHardness(0.0F);
|
||||
this.setStepSound(SoundType.GRASS);
|
||||
this.setFlammable(60, 100);
|
||||
this.setFlatBlockTexture();
|
||||
PLANTS[type.ordinal()] = this;
|
||||
}
|
||||
|
||||
|
@ -149,7 +150,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
|||
}
|
||||
else
|
||||
{
|
||||
return this.type == BlockDoublePlant.EnumPlantType.FERN ? null : (this.type == BlockDoublePlant.EnumPlantType.GRASS ? (rand.chance(8) ? Items.wheat : null) : this.getItem());
|
||||
return this.type == BlockDoublePlant.EnumPlantType.FERN ? null : (this.type == BlockDoublePlant.EnumPlantType.GRASS ? (rand.chance(8) ? Items.wheat : null) : super.getItemDropped(state, rand, fortune));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,7 +168,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
|||
/**
|
||||
* Called by ItemBlocks after a block is set in the world, to allow post-place logic
|
||||
*/
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, State state, EntityLiving placer, ItemStack stack)
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, State state, EntityLiving placer)
|
||||
{
|
||||
worldIn.setState(pos.up(), this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.UPPER), 2);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class BlockDryLeaves extends BlockLeavesBase
|
|||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return random.chance(0, 1, 5);
|
||||
}
|
||||
|
|
|
@ -151,11 +151,6 @@ public class BlockFarmland extends Block
|
|||
return Blocks.dirt.getItemDropped(Blocks.dirt.getState(), rand, fortune);
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
return Items.dirt;
|
||||
}
|
||||
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new Property[] {MOISTURE};
|
||||
|
|
|
@ -7,7 +7,6 @@ import common.color.Colorizer;
|
|||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemColored;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -31,6 +30,7 @@ public class BlockGrass extends Block implements IGrowable
|
|||
this.setDefaultState(this.getBaseState().withProperty(SNOWY, Boolean.valueOf(false)));
|
||||
this.setTickRandomly();
|
||||
this.setTab(CheatTab.NATURE);
|
||||
this.setItemColored();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,10 +136,6 @@ public class BlockGrass extends Block implements IGrowable
|
|||
return provider.getModel("dirt").add().d().u("grass_top").tint().nswe("grass_side")
|
||||
.add().nswe("grass_side_overlay").tint();
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemColored(this);
|
||||
}
|
||||
|
||||
public Property[] getUnsavedProperties() {
|
||||
return new Property[] {SNOWY};
|
||||
|
|
|
@ -2,160 +2,107 @@ package common.block.foliage;
|
|||
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.item.Item;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Identifyable;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockHugeMushroom extends Block
|
||||
{
|
||||
public static final PropertyEnum<BlockHugeMushroom.EnumType> VARIANT = PropertyEnum.<BlockHugeMushroom.EnumType>create("variant", BlockHugeMushroom.EnumType.class);
|
||||
|
||||
private final Block smallBlock;
|
||||
public class BlockHugeMushroom extends Block {
|
||||
public static enum EnumType implements Identifyable {
|
||||
NORTH_WEST("north_west"),
|
||||
NORTH("north"),
|
||||
NORTH_EAST("north_east"),
|
||||
WEST("west"),
|
||||
CENTER("center"),
|
||||
EAST("east"),
|
||||
SOUTH_WEST("south_west"),
|
||||
SOUTH("south"),
|
||||
SOUTH_EAST("south_east"),
|
||||
STEM("stem"),
|
||||
ALL_INSIDE("all_inside"),
|
||||
ALL_OUTSIDE("all_outside"),
|
||||
ALL_STEM("all_stem");
|
||||
|
||||
public BlockHugeMushroom(Material p_i46392_1_, Block p_i46392_3_)
|
||||
{
|
||||
super(p_i46392_1_);
|
||||
this.setDefaultState(this.getBaseState().withProperty(VARIANT, BlockHugeMushroom.EnumType.ALL_OUTSIDE));
|
||||
this.smallBlock = p_i46392_3_;
|
||||
}
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return Math.max(0, random.range(-7, 2));
|
||||
}
|
||||
private EnumType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Get the MapColor for this Block and the given BlockState
|
||||
// */
|
||||
// public MapColor getMapColor(IBlockState state)
|
||||
// {
|
||||
// switch ((BlockHugeMushroom.EnumType)state.getValue(VARIANT))
|
||||
// {
|
||||
// case ALL_STEM:
|
||||
// return MapColor.clothColor;
|
||||
//
|
||||
// case ALL_INSIDE:
|
||||
// return MapColor.sandColor;
|
||||
//
|
||||
// case STEM:
|
||||
// return MapColor.sandColor;
|
||||
//
|
||||
// default:
|
||||
// return super.getMapColor(state);
|
||||
// }
|
||||
// }
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return this.smallBlock.getItem();
|
||||
}
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
return this.smallBlock.getItem();
|
||||
}
|
||||
public static final PropertyEnum<BlockHugeMushroom.EnumType> VARIANT = PropertyEnum.<BlockHugeMushroom.EnumType>create("variant",
|
||||
BlockHugeMushroom.EnumType.class);
|
||||
|
||||
/**
|
||||
* 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, EntityLiving placer)
|
||||
{
|
||||
return this.getState();
|
||||
}
|
||||
private final Block smallBlock;
|
||||
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new Property[] {VARIANT};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
switch(state.getValue(VARIANT)) {
|
||||
case ALL_INSIDE:
|
||||
return provider.getModel(name + "_inside").add().all();
|
||||
case ALL_OUTSIDE:
|
||||
default:
|
||||
return provider.getModel(name + "_cap").add().all();
|
||||
case ALL_STEM:
|
||||
return provider.getModel(name + "_stem").add().all();
|
||||
case STEM:
|
||||
return provider.getModel(name + "_stem").add().nswe().du(name + "_inside");
|
||||
case CENTER:
|
||||
return provider.getModel(name + "_inside").add().d(name + "_inside").u(name + "_cap").n(name + "_inside").s(name + "_inside")
|
||||
.w(name + "_inside").e(name + "_inside");
|
||||
case EAST:
|
||||
return provider.getModel(name + "_inside").add().d(name + "_inside").u(name + "_cap").n(name + "_inside").s(name + "_inside")
|
||||
.w(name + "_inside").e(name + "_cap");
|
||||
case NORTH_EAST:
|
||||
return provider.getModel(name + "_inside").add().d(name + "_inside").u(name + "_cap").n(name + "_cap").s(name + "_inside")
|
||||
.w(name + "_inside").e(name + "_cap");
|
||||
case NORTH:
|
||||
return provider.getModel(name + "_inside").add().d(name + "_inside").u(name + "_cap").n(name + "_cap").s(name + "_inside")
|
||||
.w(name + "_inside").e(name + "_inside");
|
||||
case NORTH_WEST:
|
||||
return provider.getModel(name + "_inside").add().d(name + "_inside").u(name + "_cap").n(name + "_cap").s(name + "_inside")
|
||||
.w(name + "_cap").e(name + "_inside");
|
||||
case SOUTH_EAST:
|
||||
return provider.getModel(name + "_inside").add().d(name + "_inside").u(name + "_cap").n(name + "_inside").s(name + "_cap")
|
||||
.w(name + "_inside").e(name + "_cap");
|
||||
case SOUTH:
|
||||
return provider.getModel(name + "_inside").add().d(name + "_inside").u(name + "_cap").n(name + "_inside").s(name + "_cap")
|
||||
.w(name + "_inside").e(name + "_inside");
|
||||
case SOUTH_WEST:
|
||||
return provider.getModel(name + "_inside").add().d(name + "_inside").u(name + "_cap").n(name + "_inside").s(name + "_cap")
|
||||
.w(name + "_cap").e(name + "_inside");
|
||||
case WEST:
|
||||
return provider.getModel(name + "_inside").add().d(name + "_inside").u(name + "_cap").n(name + "_inside").s(name + "_inside")
|
||||
.w(name + "_cap").e(name + "_inside");
|
||||
}
|
||||
}
|
||||
public BlockHugeMushroom(Block smallBlock) {
|
||||
super(Material.WOOD);
|
||||
this.setDefaultState(this.getBaseState().withProperty(VARIANT, BlockHugeMushroom.EnumType.ALL_OUTSIDE));
|
||||
this.smallBlock = smallBlock;
|
||||
}
|
||||
|
||||
public static enum EnumType implements Identifyable
|
||||
{
|
||||
NORTH_WEST("north_west"),
|
||||
NORTH("north"),
|
||||
NORTH_EAST("north_east"),
|
||||
WEST("west"),
|
||||
CENTER("center"),
|
||||
EAST("east"),
|
||||
SOUTH_WEST("south_west"),
|
||||
SOUTH("south"),
|
||||
SOUTH_EAST("south_east"),
|
||||
STEM("stem"),
|
||||
ALL_INSIDE("all_inside"),
|
||||
ALL_OUTSIDE("all_outside"),
|
||||
ALL_STEM("all_stem");
|
||||
protected int quantityDropped(Random random) {
|
||||
return Math.max(0, random.range(-7, 2));
|
||||
}
|
||||
|
||||
private final String name;
|
||||
public Item getItemDropped(State state, Random rand, int fortune) {
|
||||
return this.smallBlock.getItemDropped(state, rand, fortune);
|
||||
}
|
||||
|
||||
private EnumType(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
protected Property[] getProperties() {
|
||||
return new Property[] {VARIANT};
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
switch(state.getValue(VARIANT)) {
|
||||
case ALL_INSIDE:
|
||||
return provider.getModel(name + "_inside").add().all();
|
||||
case ALL_OUTSIDE:
|
||||
default:
|
||||
return provider.getModel(name + "_cap").add().all();
|
||||
case ALL_STEM:
|
||||
return provider.getModel(name + "_stem").add().all();
|
||||
case STEM:
|
||||
return provider.getModel(name + "_stem").add().nswe().du(name + "_inside");
|
||||
case CENTER:
|
||||
return provider.getModel(name + "_inside").add().d(name + "_inside").u(name + "_cap").n(name + "_inside").s(name + "_inside")
|
||||
.w(name + "_inside").e(name + "_inside");
|
||||
case EAST:
|
||||
return provider.getModel(name + "_inside").add().d(name + "_inside").u(name + "_cap").n(name + "_inside").s(name + "_inside")
|
||||
.w(name + "_inside").e(name + "_cap");
|
||||
case NORTH_EAST:
|
||||
return provider.getModel(name + "_inside").add().d(name + "_inside").u(name + "_cap").n(name + "_cap").s(name + "_inside")
|
||||
.w(name + "_inside").e(name + "_cap");
|
||||
case NORTH:
|
||||
return provider.getModel(name + "_inside").add().d(name + "_inside").u(name + "_cap").n(name + "_cap").s(name + "_inside")
|
||||
.w(name + "_inside").e(name + "_inside");
|
||||
case NORTH_WEST:
|
||||
return provider.getModel(name + "_inside").add().d(name + "_inside").u(name + "_cap").n(name + "_cap").s(name + "_inside")
|
||||
.w(name + "_cap").e(name + "_inside");
|
||||
case SOUTH_EAST:
|
||||
return provider.getModel(name + "_inside").add().d(name + "_inside").u(name + "_cap").n(name + "_inside").s(name + "_cap")
|
||||
.w(name + "_inside").e(name + "_cap");
|
||||
case SOUTH:
|
||||
return provider.getModel(name + "_inside").add().d(name + "_inside").u(name + "_cap").n(name + "_inside").s(name + "_cap")
|
||||
.w(name + "_inside").e(name + "_inside");
|
||||
case SOUTH_WEST:
|
||||
return provider.getModel(name + "_inside").add().d(name + "_inside").u(name + "_cap").n(name + "_inside").s(name + "_cap")
|
||||
.w(name + "_cap").e(name + "_inside");
|
||||
case WEST:
|
||||
return provider.getModel(name + "_inside").add().d(name + "_inside").u(name + "_cap").n(name + "_inside").s(name + "_inside")
|
||||
.w(name + "_cap").e(name + "_inside");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import common.init.WoodType;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemColored;
|
||||
import common.item.tool.ItemShears;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -59,6 +58,7 @@ public class BlockLeaves extends BlockLeavesBase
|
|||
this.setLightOpacity(1);
|
||||
this.setStepSound(SoundType.GRASS);
|
||||
this.setFlammable(30, 60);
|
||||
this.setItemColored();
|
||||
LEAVES.add(this);
|
||||
MAPPING[type.ordinal() * LeavesType.values().length + subType.ordinal()] = this;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ public class BlockLeaves extends BlockLeavesBase
|
|||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return random.chance(0, 1, this.type.getSaplingChance());
|
||||
}
|
||||
|
@ -317,8 +317,4 @@ public class BlockLeaves extends BlockLeavesBase
|
|||
public Property<?>[] getIgnoredProperties() {
|
||||
return new Property[] {DECAY, BUSH};
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemColored(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ public class BlockLilyPad extends BlockBush implements Rotatable
|
|||
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
this.setTab(CheatTab.PLANTS);
|
||||
this.setFlatBlockTexture();
|
||||
this.setItemColored();
|
||||
}
|
||||
|
||||
public void addCollisionBoxesToList(World worldIn, BlockPos pos, State state, BoundingBox mask, List<BoundingBox> list, Entity collidingEntity)
|
||||
|
|
|
@ -29,7 +29,7 @@ public class BlockMelon extends Block
|
|||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return random.range(3, 7);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class BlockMelon extends Block
|
|||
/**
|
||||
* Get the quantity dropped based on the given fortune level
|
||||
*/
|
||||
public int quantityDroppedWithBonus(int fortune, Random random)
|
||||
protected int quantityDroppedWithBonus(int fortune, Random random)
|
||||
{
|
||||
return Math.min(9, this.quantityDropped(random) + random.zrange(1 + fortune));
|
||||
}
|
||||
|
|
|
@ -14,11 +14,6 @@ import common.world.World;
|
|||
|
||||
public class BlockPotato extends BlockCrops
|
||||
{
|
||||
protected Item getSeed()
|
||||
{
|
||||
return Items.potato;
|
||||
}
|
||||
|
||||
protected Item getCrop()
|
||||
{
|
||||
return Items.potato;
|
||||
|
|
|
@ -7,7 +7,6 @@ import common.init.Items;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.StackSize;
|
||||
import common.item.block.ItemSmallBlock;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -34,6 +33,7 @@ public class BlockReed extends Block
|
|||
float f = 0.375F;
|
||||
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f);
|
||||
this.setTickRandomly();
|
||||
this.setFlatItemTexture();
|
||||
}
|
||||
|
||||
public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
||||
|
@ -130,14 +130,6 @@ public class BlockReed extends Block
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return Items.reeds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to determine ambient occlusion and culling when rebuilding chunks for render
|
||||
*/
|
||||
|
@ -151,11 +143,6 @@ public class BlockReed extends Block
|
|||
return false;
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
return Items.reeds;
|
||||
}
|
||||
|
||||
public int colorMultiplier(IWorldAccess worldIn, BlockPos pos, int renderPass)
|
||||
{
|
||||
return worldIn.getBiomeGenForCoords(pos).getGrassColorAtPos(pos);
|
||||
|
@ -180,6 +167,6 @@ public class BlockReed extends Block
|
|||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSmallBlock(this).setDisplay("Zuckerrohr").setTab(CheatTab.PLANTS).setMaxAmount(StackSize.L);
|
||||
return super.getItemToRegister().setMaxAmount(StackSize.L);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,28 +160,18 @@ public class BlockStem extends BlockBush implements DirectionalUp, IGrowable
|
|||
|
||||
if (!worldIn.client)
|
||||
{
|
||||
Item item = this.getSeedItem();
|
||||
int i = ((Integer)state.getValue(AGE)).intValue();
|
||||
|
||||
if (item != null)
|
||||
for (int j = 0; j < 3; ++j)
|
||||
{
|
||||
int i = ((Integer)state.getValue(AGE)).intValue();
|
||||
|
||||
for (int j = 0; j < 3; ++j)
|
||||
if (worldIn.rand.zrange(15) <= i)
|
||||
{
|
||||
if (worldIn.rand.zrange(15) <= i)
|
||||
{
|
||||
spawnAsEntity(worldIn, pos, new ItemStack(item));
|
||||
}
|
||||
spawnAsEntity(worldIn, pos, new ItemStack(this.getItem()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Item getSeedItem()
|
||||
{
|
||||
return this.crop == Blocks.pumpkin ? Items.pumpkin_stem : (this.crop == Blocks.melon_block ? Items.melon_stem : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
|
@ -190,12 +180,6 @@ public class BlockStem extends BlockBush implements DirectionalUp, IGrowable
|
|||
return null;
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
Item item = this.getSeedItem();
|
||||
return item != null ? item : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this IGrowable can grow
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,6 @@ import common.init.Blocks;
|
|||
import common.init.Items;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemColored;
|
||||
import common.item.tool.ItemShears;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -38,6 +37,8 @@ public class BlockTallGrass extends BlockBush implements IGrowable
|
|||
float f = 0.4F;
|
||||
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f);
|
||||
this.setFlammable(60, 100);
|
||||
this.setFlatBlockTexture();
|
||||
this.setItemColored();
|
||||
BUSHES[type.ordinal()] = this;
|
||||
}
|
||||
|
||||
|
@ -97,7 +98,7 @@ public class BlockTallGrass extends BlockBush implements IGrowable
|
|||
/**
|
||||
* Get the quantity dropped based on the given fortune level
|
||||
*/
|
||||
public int quantityDroppedWithBonus(int fortune, Random random)
|
||||
protected int quantityDroppedWithBonus(int fortune, Random random)
|
||||
{
|
||||
return random.roll(fortune * 2 + 1);
|
||||
}
|
||||
|
@ -146,12 +147,8 @@ public class BlockTallGrass extends BlockBush implements IGrowable
|
|||
if(this.type != EnumType.DEAD_BUSH)
|
||||
return provider.getModel(this.type.getName()).crossTint();
|
||||
else
|
||||
return provider.getModel("deadbush").cross();
|
||||
return provider.getModel(this.type.getName()).cross();
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemColored(this, "");
|
||||
}
|
||||
|
||||
public static enum EnumType implements Identifyable
|
||||
{
|
||||
|
|
|
@ -10,7 +10,6 @@ import common.init.Items;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemColored;
|
||||
import common.item.tool.ItemShears;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
|
@ -45,6 +44,8 @@ public class BlockVine extends Block
|
|||
this.setTickRandomly();
|
||||
this.setTab(CheatTab.PLANTS);
|
||||
this.setFlammable(15, 100);
|
||||
this.setFlatBlockTexture();
|
||||
this.setItemColored();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -418,7 +419,7 @@ public class BlockVine extends Block
|
|||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -555,10 +556,6 @@ public class BlockVine extends Block
|
|||
return model;
|
||||
}
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemColored(this, "");
|
||||
}
|
||||
|
||||
public Property[] getUnsavedProperties() {
|
||||
return new Property[] {UP};
|
||||
|
|
|
@ -83,7 +83,7 @@ public class BlockWart extends BlockBush
|
|||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
spawnAsEntity(worldIn, pos, new ItemStack(Items.soul_wart));
|
||||
spawnAsEntity(worldIn, pos, new ItemStack(this.getItem()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,16 +99,11 @@ public class BlockWart extends BlockBush
|
|||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
return Items.soul_wart;
|
||||
}
|
||||
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new Property[] {AGE};
|
||||
|
|
|
@ -163,7 +163,7 @@ public abstract class BlockLiquid extends Block
|
|||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class BlockClay extends Block
|
|||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ public class BlockFire extends Block
|
|||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public class BlockGlowstone extends Block
|
|||
/**
|
||||
* Get the quantity dropped based on the given fortune level
|
||||
*/
|
||||
public int quantityDroppedWithBonus(int fortune, Random random)
|
||||
protected int quantityDroppedWithBonus(int fortune, Random random)
|
||||
{
|
||||
return ExtMath.clampi(this.quantityDropped(random) + random.zrange(fortune + 1), 1, 4);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class BlockGlowstone extends Block
|
|||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return random.range(2, 4);
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@ public class BlockGravel extends BlockFalling
|
|||
{
|
||||
int chance = Vars.flintChance;
|
||||
if(chance <= 0)
|
||||
return this.getItem();
|
||||
return super.getItemDropped(state, rand, fortune);
|
||||
fortune *= 3;
|
||||
if(fortune >= chance)
|
||||
fortune = chance - 1;
|
||||
return rand.chance(chance - fortune) ? Items.flint : this.getItem();
|
||||
return rand.chance(chance - fortune) ? Items.flint : super.getItemDropped(state, rand, fortune);
|
||||
}
|
||||
|
||||
// public MapColor getMapColor(IBlockState state)
|
||||
|
|
|
@ -6,7 +6,6 @@ import common.enchantment.EnchantmentHelper;
|
|||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
||||
import common.item.ItemStack;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
|
@ -26,24 +25,21 @@ public class BlockIce extends BlockTranslucent {
|
|||
|
||||
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);
|
||||
super.harvestBlock(world, player, pos, state, tile);
|
||||
}
|
||||
else {
|
||||
if(world.doesWaterVaporize(pos)) {
|
||||
world.setBlockToAir(pos);
|
||||
return;
|
||||
}
|
||||
int fortune = EnchantmentHelper.getFortuneModifier(player);
|
||||
this.dropBlockAsItem(world, pos, state, fortune);
|
||||
super.harvestBlock(world, player, pos, state, tile);
|
||||
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) {
|
||||
protected int quantityDropped(Random rand) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public class BlockOre extends Block
|
|||
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return this.dropItem == null ? this.getItem() : this.dropItem.getItem();
|
||||
return this.dropItem == null ? super.getItemDropped(state, rand, fortune) : this.dropItem.getItem();
|
||||
// this == Blocks.coal_ore ? Items.coal :
|
||||
// (this == Blocks.diamond_ore ? Items.diamond :
|
||||
// (this == Blocks.lapis_ore ? Items.dye :
|
||||
|
@ -57,13 +57,13 @@ public class BlockOre extends Block
|
|||
// this.getItem()))));
|
||||
}
|
||||
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return this.dropItem == null ? 1 : (this.dropItem.getSize() + (this.dropChance > 0 ? random.zrange(this.dropChance + 1) : 0));
|
||||
// this == Blocks.lapis_ore ? 4 + random.nextInt(5) : 1;
|
||||
}
|
||||
|
||||
public int quantityDroppedWithBonus(int fortune, Random random)
|
||||
protected int quantityDroppedWithBonus(int fortune, Random random)
|
||||
{
|
||||
if (fortune > 0 &&
|
||||
this.getItem() != this.getItemDropped(this.getState(), random, fortune))
|
||||
|
|
|
@ -17,7 +17,7 @@ public class BlockPackedIce extends Block
|
|||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ public class BlockSnow extends Block
|
|||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public class BlockSnowBlock extends Block {
|
|||
return Items.snowball;
|
||||
}
|
||||
|
||||
public int quantityDropped(Random rand) {
|
||||
protected int quantityDropped(Random rand) {
|
||||
return rand.range(2, 4);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ public class BlockWeb extends Block
|
|||
{
|
||||
super(Material.FLUFF);
|
||||
this.setTab(CheatTab.DECORATION);
|
||||
this.setFlatItemTexture();
|
||||
this.setFlatBlockTexture();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,7 +19,6 @@ public class BlockActiveDisplay extends BlockDisplay implements ITileEntityProvi
|
|||
|
||||
public BlockActiveDisplay(BlockInactiveDisplay inactive) {
|
||||
super(inactive.getDensity());
|
||||
this.hasTile = true;
|
||||
this.setLightLevel(1.0f);
|
||||
this.inactive = inactive;
|
||||
inactive.setActive(this);
|
||||
|
@ -27,9 +26,9 @@ public class BlockActiveDisplay extends BlockDisplay implements ITileEntityProvi
|
|||
|
||||
public void onBlockRemoved(AWorldServer world, BlockPos pos, State state) {
|
||||
super.onBlockRemoved(world, pos, state);
|
||||
world.removeTileEntity(pos);
|
||||
Pair<BlockPos, BlockPos> span = removing ? null : this.getSpan(world, pos, state.getValue(FACING));
|
||||
if(span != null) {
|
||||
world.removeTileEntity(pos);
|
||||
removing = true;
|
||||
for(BlockPos loc : BlockPos.getAllInBox(span.first(), span.second())) {
|
||||
if(!loc.equals(pos))
|
||||
|
@ -39,12 +38,6 @@ public class BlockActiveDisplay extends BlockDisplay implements ITileEntityProvi
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public TileEntity createNewTileEntity() {
|
||||
return new TileEntityDisplay(this.density);
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ public abstract class BlockBasePressurePlate extends Block
|
|||
/**
|
||||
* Can this block provide power. Only wire currently seems to have this change based on its state.
|
||||
*/
|
||||
public boolean canConnectToWire()
|
||||
public boolean canConnectToWire(State state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2,15 +2,12 @@ package common.block.tech;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.BlockContainer;
|
||||
import common.block.Block;
|
||||
import common.block.ITileEntityProvider;
|
||||
import common.block.Material;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Items;
|
||||
import common.inventory.InventoryHelper;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemSmallBlock;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -28,7 +25,7 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockBrewingStand extends BlockContainer
|
||||
public class BlockBrewingStand extends Block implements ITileEntityProvider
|
||||
{
|
||||
private static final Model brewing_stand_bottles_2 = ModelProvider.getModelProvider().getModel("brewing_stand")
|
||||
.add(7, 0, 7, 9, 14, 9)
|
||||
|
@ -356,6 +353,7 @@ public class BlockBrewingStand extends BlockContainer
|
|||
{
|
||||
super(Material.SOLID);
|
||||
this.setDefaultState(this.getBaseState().withProperty(HAS_BOTTLE[0], Boolean.valueOf(false)).withProperty(HAS_BOTTLE[1], Boolean.valueOf(false)).withProperty(HAS_BOTTLE[2], Boolean.valueOf(false)));
|
||||
this.setFlatItemTexture();
|
||||
}
|
||||
|
||||
// /**
|
||||
|
@ -374,14 +372,6 @@ public class BlockBrewingStand extends BlockContainer
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
|
@ -454,19 +444,6 @@ public class BlockBrewingStand extends BlockContainer
|
|||
super.onBlockRemoved(worldIn, pos, state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return Items.brewing_stand;
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
return Items.brewing_stand;
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer()
|
||||
{
|
||||
return BlockLayer.CUTOUT;
|
||||
|
@ -485,8 +462,4 @@ public class BlockBrewingStand extends BlockContainer
|
|||
return brewing_stand_bottles[(state.getValue(HAS_BOTTLE[0]) ? 1 : 0) | (state.getValue(HAS_BOTTLE[1]) ? 2 : 0)
|
||||
| (state.getValue(HAS_BOTTLE[2]) ? 4 : 0)];
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSmallBlock(this).setDisplay("Braustand").setTab(CheatTab.TECHNOLOGY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ public class BlockButton extends Block implements Directional
|
|||
/**
|
||||
* Can this block provide power. Only wire currently seems to have this change based on its state.
|
||||
*/
|
||||
public boolean canConnectToWire()
|
||||
public boolean canConnectToWire(State state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import common.init.Items;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemSmallBlock;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.Property;
|
||||
|
@ -413,6 +412,7 @@ public class BlockCauldron extends Block
|
|||
{
|
||||
super(Material.SOLID);
|
||||
this.setDefaultState(this.getBaseState().withProperty(LEVEL, Integer.valueOf(0)));
|
||||
this.setFlatItemTexture();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -571,19 +571,6 @@ public class BlockCauldron extends Block
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return Items.cauldron;
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
return Items.cauldron;
|
||||
}
|
||||
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new Property[] {LEVEL};
|
||||
|
@ -596,8 +583,4 @@ public class BlockCauldron extends Block
|
|||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return cauldron_levels[state.getValue(LEVEL)];
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSmallBlock(this).setDisplay("Kessel").setTab(CheatTab.TECHNOLOGY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,8 @@ package common.block.tech;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import common.block.BlockContainer;
|
||||
import common.block.Block;
|
||||
import common.block.ITileEntityProvider;
|
||||
import common.block.Rotatable;
|
||||
import common.block.SoundType;
|
||||
import common.collect.Maps;
|
||||
|
@ -12,13 +13,12 @@ import common.entity.Entity;
|
|||
import common.entity.animal.EntityCat;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.inventory.IInventory;
|
||||
import common.inventory.InventoryHelper;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemChest;
|
||||
import common.item.tool.ItemKey;
|
||||
import common.packet.SPacketSoundEffect;
|
||||
import common.properties.Property;
|
||||
|
@ -32,7 +32,7 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockChest extends BlockContainer implements Rotatable
|
||||
public class BlockChest extends Block implements ITileEntityProvider, Rotatable
|
||||
{
|
||||
private static final Map<Integer, BlockChest> CHESTS = Maps.newHashMap();
|
||||
|
||||
|
@ -84,19 +84,6 @@ public class BlockChest extends BlockContainer implements Rotatable
|
|||
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, State state, EntityLiving placer, ItemStack stack)
|
||||
{
|
||||
if (stack.hasDisplayName())
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileEntityChest)
|
||||
{
|
||||
((TileEntityChest)tileentity).setCustomName(stack.getDisplayName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public State correctFacing(World worldIn, BlockPos pos, State state)
|
||||
{
|
||||
Facing enumfacing = null;
|
||||
|
@ -173,8 +160,8 @@ public class BlockChest extends BlockContainer implements Rotatable
|
|||
|
||||
if (chest != null)
|
||||
{
|
||||
ItemStack stack = Vars.locking ? playerIn.getHeldItem() : null;
|
||||
if(stack != null && stack.getItem() instanceof ItemKey) {
|
||||
ItemStack stack = playerIn.getHeldItem();
|
||||
if(Vars.locking && stack != null && stack.getItem() instanceof ItemKey) {
|
||||
if(chest.getLockCode() != null) {
|
||||
if(stack.hasDisplayName() && stack.getDisplayName().equals(chest.getLockCode())) {
|
||||
chest.setLockCode(null);
|
||||
|
@ -189,7 +176,11 @@ public class BlockChest extends BlockContainer implements Rotatable
|
|||
playerIn.connection.sendPacket(new SPacketSoundEffect(SoundEvent.DOOR, playerIn.posX, playerIn.posY, playerIn.posZ, 1.0F));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(stack != null && stack.getItem() == Items.name_tag && stack.hasDisplayName()) {
|
||||
chest.setCustomName(stack.getDisplayName());
|
||||
return true;
|
||||
}
|
||||
playerIn.connection.show(chest);
|
||||
}
|
||||
|
||||
|
@ -250,8 +241,4 @@ public class BlockChest extends BlockContainer implements Rotatable
|
|||
public String getFallbackTexture() {
|
||||
return "oak_planks";
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemChest(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package common.block.tech;
|
||||
|
||||
import common.block.BlockContainer;
|
||||
import common.block.Block;
|
||||
import common.block.ITileEntityProvider;
|
||||
import common.block.Material;
|
||||
import common.block.SoundType;
|
||||
import common.entity.npc.EntityNPC;
|
||||
|
@ -13,7 +14,6 @@ import common.model.ModelProvider;
|
|||
import common.model.Transforms;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityDaylightDetector;
|
||||
import common.util.BlockPos;
|
||||
|
@ -25,7 +25,7 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockDaylightDetector extends BlockContainer
|
||||
public class BlockDaylightDetector extends Block implements ITileEntityProvider
|
||||
{
|
||||
public static final PropertyInteger POWER = PropertyInteger.create("power", 0, 15);
|
||||
private final boolean inverted;
|
||||
|
@ -105,15 +105,7 @@ public class BlockDaylightDetector extends BlockContainer
|
|||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return Items.daylight_detector;
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
public Item getItem()
|
||||
{
|
||||
return Items.daylight_detector;
|
||||
}
|
||||
|
@ -131,18 +123,10 @@ public class BlockDaylightDetector extends BlockContainer
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can this block provide power. Only wire currently seems to have this change based on its state.
|
||||
*/
|
||||
public boolean canConnectToWire()
|
||||
public boolean canConnectToWire(State state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package common.block.tech;
|
||||
|
||||
import common.block.BlockContainer;
|
||||
import common.block.Block;
|
||||
import common.block.Directional;
|
||||
import common.block.ITileEntityProvider;
|
||||
import common.block.Material;
|
||||
import common.entity.item.EntityItem;
|
||||
import common.entity.npc.EntityNPC;
|
||||
|
@ -23,7 +24,7 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockDispenser extends BlockContainer implements Directional
|
||||
public class BlockDispenser extends Block implements ITileEntityProvider, Directional
|
||||
{
|
||||
protected Random rand = new Random();
|
||||
|
||||
|
@ -158,14 +159,6 @@ public class BlockDispenser extends BlockContainer implements Directional
|
|||
return new Vec3(d0, d1, d2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Possibly modify the given BlockState before rendering it on an Entity (Minecarts, Endermen, ...)
|
||||
*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package common.block.tech;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockContainer;
|
||||
import common.block.ITileEntityProvider;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.entity.npc.EntityNPC;
|
||||
|
@ -25,7 +25,7 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockFurnace extends BlockContainer implements Rotatable
|
||||
public class BlockFurnace extends Block implements ITileEntityProvider, Rotatable
|
||||
{
|
||||
private final boolean isBurning;
|
||||
private static boolean keepInventory;
|
||||
|
@ -37,14 +37,6 @@ public class BlockFurnace extends BlockContainer implements Rotatable
|
|||
this.isBurning = isBurning;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return Items.furnace;
|
||||
}
|
||||
|
||||
public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state)
|
||||
{
|
||||
this.setDefaultFacing(worldIn, pos, state);
|
||||
|
@ -195,19 +187,11 @@ public class BlockFurnace extends BlockContainer implements Rotatable
|
|||
super.onBlockRemoved(worldIn, pos, state);
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
public Item getItem()
|
||||
{
|
||||
return Items.furnace;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Possibly modify the given BlockState before rendering it on an Entity (Minecarts, Endermen, ...)
|
||||
*/
|
||||
|
@ -225,4 +209,8 @@ public class BlockFurnace extends BlockContainer implements Rotatable
|
|||
return provider.getModel("furnace_side").add().du("furnace_top").n("furnace_front_" + (this.isBurning ? "on" : "off"))
|
||||
.s().we().rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return this.isBurning ? null : super.getItemToRegister();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package common.block.tech;
|
||||
|
||||
import java.util.List;
|
||||
import common.block.BlockContainer;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.DirectionalDown;
|
||||
import common.block.ITileEntityProvider;
|
||||
import common.block.Material;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
|
@ -26,7 +28,7 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockHopper extends BlockContainer implements DirectionalDown
|
||||
public class BlockHopper extends Block implements ITileEntityProvider, DirectionalDown
|
||||
{
|
||||
private static final Model hopper_down = ModelProvider.getModelProvider().getModel("hopper_outside")
|
||||
.add(0, 10, 0, 16, 11, 16)
|
||||
|
@ -86,6 +88,7 @@ public class BlockHopper extends BlockContainer implements DirectionalDown
|
|||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.DOWN));
|
||||
this.setTab(CheatTab.TECHNOLOGY);
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.setFlatItemTexture();
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos)
|
||||
|
@ -168,14 +171,6 @@ public class BlockHopper extends BlockContainer implements DirectionalDown
|
|||
super.onBlockRemoved(worldIn, pos, state);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 3;
|
||||
}
|
||||
|
||||
public boolean isFullCube()
|
||||
{
|
||||
return false;
|
||||
|
@ -261,8 +256,4 @@ public class BlockHopper extends BlockContainer implements DirectionalDown
|
|||
.e().uv(0, 8, 4, 12).noCull()
|
||||
.rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemBlock(this, "hopper", true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,10 +41,6 @@ public class BlockInactiveDisplay extends BlockDisplay {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemBlock(this, BlockRegistry.getName(this));
|
||||
}
|
||||
|
||||
protected BlockDisplay getOtherBlock() {
|
||||
return this.active;
|
||||
|
|
|
@ -34,6 +34,7 @@ public class BlockLever extends Block
|
|||
super(Material.SMALL);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, BlockLever.EnumOrientation.NORTH).withProperty(POWERED, Boolean.valueOf(false)));
|
||||
this.setTab(CheatTab.TECHNOLOGY);
|
||||
this.setFlatBlockTexture();
|
||||
}
|
||||
|
||||
public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state)
|
||||
|
@ -238,7 +239,7 @@ public class BlockLever extends Block
|
|||
/**
|
||||
* Can this block provide power. Only wire currently seems to have this change based on its state.
|
||||
*/
|
||||
public boolean canConnectToWire()
|
||||
public boolean canConnectToWire(State state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -288,10 +289,6 @@ public class BlockLever extends Block
|
|||
.e("lever").uv(7, 6, 9, 16).noCull()
|
||||
.rotate(getRotation(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemBlock(this, "lever", false);
|
||||
}
|
||||
|
||||
public static enum EnumOrientation implements Identifyable, DirectionVec<EnumOrientation>
|
||||
{
|
||||
|
|
|
@ -111,15 +111,7 @@ public class BlockLitTorch extends BlockTorch {
|
|||
return null;
|
||||
}
|
||||
|
||||
public Item getItemDropped(State state, Random rand, int fortune) {
|
||||
public Item getItem() {
|
||||
return this.unlit.getItem();
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos) {
|
||||
return this.unlit.getItem();
|
||||
}
|
||||
|
||||
public ItemStack createStackedBlock(State state) {
|
||||
return new ItemStack(this.unlit.getItem());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import common.world.AWorldServer;
|
|||
public abstract class BlockMachine extends Block implements Rotatable, ITileEntityProvider {
|
||||
protected BlockMachine(Material material) {
|
||||
super(material);
|
||||
this.hasTile = true;
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
this.setTab(CheatTab.TECHNOLOGY);
|
||||
}
|
||||
|
@ -58,13 +57,6 @@ public abstract class BlockMachine extends Block implements Rotatable, ITileEnti
|
|||
InventoryHelper.dropInventoryItems(worldIn, pos, (Device)tileentity);
|
||||
}
|
||||
super.onBlockRemoved(worldIn, pos, state);
|
||||
worldIn.removeTileEntity(pos);
|
||||
}
|
||||
|
||||
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 State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) {
|
||||
|
|
|
@ -57,6 +57,6 @@ public class BlockNuke extends Block
|
|||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemBlock(this).setColor(TextColor.RED);
|
||||
return super.getItemToRegister().setColor(TextColor.RED);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,15 +14,12 @@ import common.init.Blocks;
|
|||
import common.init.SoundEvent;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemPiston;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityPiston;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.ExtMath;
|
||||
|
@ -249,6 +246,7 @@ public class BlockPistonBase extends Block implements Directional
|
|||
}
|
||||
|
||||
public static final PropertyBool EXTENDED = PropertyBool.create("extended");
|
||||
private static final List<Entity> TEMP_ENTITIES = Lists.<Entity>newArrayList();
|
||||
|
||||
/** This piston is the sticky one? */
|
||||
private final boolean isSticky;
|
||||
|
@ -274,7 +272,7 @@ public class BlockPistonBase extends Block implements Directional
|
|||
/**
|
||||
* Called by ItemBlocks after a block is set in the world, to allow post-place logic
|
||||
*/
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, State state, EntityLiving placer, ItemStack stack)
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, State state, EntityLiving placer)
|
||||
{
|
||||
worldIn.setState(pos, state.withProperty(FACING, getFacingFromEntity(worldIn, pos, placer)), 2);
|
||||
|
||||
|
@ -321,13 +319,34 @@ public class BlockPistonBase extends Block implements Directional
|
|||
{
|
||||
if ((new BlockPistonStructureHelper(worldIn, pos, enumfacing, true)).canMove())
|
||||
{
|
||||
worldIn.addBlockEvent(pos, this, 0, enumfacing.getIndex());
|
||||
if (!this.doMove(worldIn, pos, enumfacing, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
worldIn.setState(pos, state.withProperty(EXTENDED, Boolean.valueOf(true)), 2);
|
||||
worldIn.playSound(SoundEvent.PISTON_OUT, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.5F);
|
||||
}
|
||||
}
|
||||
else if (!flag && ((Boolean)state.getValue(EXTENDED)).booleanValue())
|
||||
{
|
||||
worldIn.setState(pos, state.withProperty(EXTENDED, Boolean.valueOf(false)), 2);
|
||||
worldIn.addBlockEvent(pos, this, 1, enumfacing.getIndex());
|
||||
if (this.isSticky)
|
||||
{
|
||||
BlockPos blockpos = pos.add(enumfacing.getFrontOffsetX() * 2, enumfacing.getFrontOffsetY() * 2, enumfacing.getFrontOffsetZ() * 2);
|
||||
Block block = worldIn.getState(blockpos).getBlock();
|
||||
|
||||
if (block != Blocks.air && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston))
|
||||
{
|
||||
this.doMove(worldIn, pos, enumfacing, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setBlockToAir(pos.offset(enumfacing));
|
||||
}
|
||||
|
||||
worldIn.playSound(SoundEvent.PISTON_IN, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.5F);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -361,89 +380,6 @@ public class BlockPistonBase extends Block implements Directional
|
|||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on both Client and Server when World#addBlockEvent is called
|
||||
*/
|
||||
public boolean onBlockEventReceived(World worldIn, BlockPos pos, State state, int eventID, int eventParam)
|
||||
{
|
||||
Facing enumfacing = (Facing)state.getValue(FACING);
|
||||
|
||||
if (!worldIn.client)
|
||||
{
|
||||
boolean flag = this.shouldBeExtended(worldIn, pos, enumfacing);
|
||||
|
||||
if (flag && eventID == 1)
|
||||
{
|
||||
worldIn.setState(pos, state.withProperty(EXTENDED, Boolean.valueOf(true)), 2);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!flag && eventID == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (eventID == 0)
|
||||
{
|
||||
if (!this.doMove(worldIn, pos, enumfacing, true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
worldIn.setState(pos, state.withProperty(EXTENDED, Boolean.valueOf(true)), 2);
|
||||
worldIn.playSound(SoundEvent.PISTON_OUT, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.5F);
|
||||
}
|
||||
else if (eventID == 1)
|
||||
{
|
||||
TileEntity tileentity1 = worldIn.getTileEntity(pos.offset(enumfacing));
|
||||
|
||||
if (tileentity1 instanceof TileEntityPiston)
|
||||
{
|
||||
((TileEntityPiston)tileentity1).clearPistonTileEntity();
|
||||
}
|
||||
|
||||
worldIn.setState(pos, Blocks.piston_extension.getState().withProperty(BlockPistonMoving.FACING, enumfacing).withProperty(BlockPistonMoving.TYPE, this.isSticky ? BlockPistonHead.EnumPistonType.STICKY : BlockPistonHead.EnumPistonType.DEFAULT), 3);
|
||||
worldIn.setTileEntity(pos, BlockPistonMoving.newTileEntity(this.getState().withProperty(FACING, getFacing(eventParam)).withProperty(EXTENDED, (eventParam & 8) > 0), enumfacing, false, true));
|
||||
|
||||
if (this.isSticky)
|
||||
{
|
||||
BlockPos blockpos = pos.add(enumfacing.getFrontOffsetX() * 2, enumfacing.getFrontOffsetY() * 2, enumfacing.getFrontOffsetZ() * 2);
|
||||
Block block = worldIn.getState(blockpos).getBlock();
|
||||
boolean flag1 = false;
|
||||
|
||||
if (block == Blocks.piston_extension)
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(blockpos);
|
||||
|
||||
if (tileentity instanceof TileEntityPiston)
|
||||
{
|
||||
TileEntityPiston tileentitypiston = (TileEntityPiston)tileentity;
|
||||
|
||||
if (tileentitypiston.getFacing() == enumfacing && tileentitypiston.isExtending())
|
||||
{
|
||||
tileentitypiston.clearPistonTileEntity();
|
||||
flag1 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag1 && block != Blocks.air && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston))
|
||||
{
|
||||
this.doMove(worldIn, pos, enumfacing, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setBlockToAir(pos.offset(enumfacing));
|
||||
}
|
||||
|
||||
worldIn.playSound(SoundEvent.PISTON_IN, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.5F);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos)
|
||||
{
|
||||
State iblockstate = worldIn.getState(pos);
|
||||
|
@ -634,8 +570,7 @@ public class BlockPistonBase extends Block implements Directional
|
|||
Block block1 = iblockstate.getBlock();
|
||||
worldIn.setBlockToAir(blockpos2);
|
||||
blockpos2 = blockpos2.offset(enumfacing);
|
||||
worldIn.setState(blockpos2, Blocks.piston_extension.getState().withProperty(FACING, direction), 4);
|
||||
worldIn.setTileEntity(blockpos2, BlockPistonMoving.newTileEntity(iblockstate, direction, extending, false));
|
||||
worldIn.setState(blockpos2, iblockstate, 2);
|
||||
--i;
|
||||
ablock[i] = block1;
|
||||
}
|
||||
|
@ -644,11 +579,8 @@ public class BlockPistonBase extends Block implements Directional
|
|||
|
||||
if (extending)
|
||||
{
|
||||
BlockPistonHead.EnumPistonType blockpistonextension$enumpistontype = this.isSticky ? BlockPistonHead.EnumPistonType.STICKY : BlockPistonHead.EnumPistonType.DEFAULT;
|
||||
State iblockstate1 = Blocks.piston_head.getState().withProperty(BlockPistonHead.FACING, direction).withProperty(BlockPistonHead.TYPE, blockpistonextension$enumpistontype);
|
||||
State iblockstate2 = Blocks.piston_extension.getState().withProperty(BlockPistonMoving.FACING, direction).withProperty(BlockPistonMoving.TYPE, this.isSticky ? BlockPistonHead.EnumPistonType.STICKY : BlockPistonHead.EnumPistonType.DEFAULT);
|
||||
worldIn.setState(blockpos1, iblockstate2, 4);
|
||||
worldIn.setTileEntity(blockpos1, BlockPistonMoving.newTileEntity(iblockstate1, direction, true, false));
|
||||
State iblockstate1 = (this.isSticky ? Blocks.sticky_piston_head : Blocks.piston_head).getState().withProperty(BlockPistonHead.FACING, direction);
|
||||
worldIn.setState(blockpos1, iblockstate1, 2);
|
||||
}
|
||||
|
||||
for (int l = list1.size() - 1; l >= 0; --l)
|
||||
|
@ -663,7 +595,7 @@ public class BlockPistonBase extends Block implements Directional
|
|||
|
||||
if (extending)
|
||||
{
|
||||
worldIn.notifyNeighborsOfStateChange(blockpos1, Blocks.piston_head);
|
||||
worldIn.notifyNeighborsOfStateChange(blockpos1, this.isSticky ? Blocks.sticky_piston_head : Blocks.piston_head);
|
||||
worldIn.notifyNeighborsOfStateChange(pos, this);
|
||||
}
|
||||
|
||||
|
@ -671,6 +603,50 @@ public class BlockPistonBase extends Block implements Directional
|
|||
}
|
||||
}
|
||||
|
||||
private void launchWithSlimeBlock(World world, BlockPos pos, Facing pistonFacing, boolean extending)
|
||||
{
|
||||
float step = 0.25f;
|
||||
|
||||
State state = world.getState(pos);
|
||||
BoundingBox axisalignedbb = state.getBlock().getCollisionBoundingBox(world, pos, state);
|
||||
|
||||
if (axisalignedbb != null)
|
||||
{
|
||||
List<Entity> list = world.getEntitiesWithinAABBExcludingEntity((Entity)null, axisalignedbb);
|
||||
|
||||
if (!list.isEmpty())
|
||||
{
|
||||
TEMP_ENTITIES.addAll(list);
|
||||
|
||||
for (Entity entity : TEMP_ENTITIES)
|
||||
{
|
||||
if (state.getBlock() == Blocks.slime_block && extending)
|
||||
{
|
||||
switch (pistonFacing.getAxis())
|
||||
{
|
||||
case X:
|
||||
entity.motionX = (double)pistonFacing.getFrontOffsetX();
|
||||
break;
|
||||
|
||||
case Y:
|
||||
entity.motionY = (double)pistonFacing.getFrontOffsetY();
|
||||
break;
|
||||
|
||||
case Z:
|
||||
entity.motionZ = (double)pistonFacing.getFrontOffsetZ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.moveEntity((double)pistonFacing.getFrontOffsetX(), (double)pistonFacing.getFrontOffsetY(), (double)pistonFacing.getFrontOffsetZ());
|
||||
}
|
||||
}
|
||||
|
||||
TEMP_ENTITIES.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Possibly modify the given BlockState before rendering it on an Entity (Minecarts, Endermen, ...)
|
||||
*/
|
||||
|
|
|
@ -14,13 +14,10 @@ import common.model.Model;
|
|||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Facing;
|
||||
import common.util.Identifyable;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
@ -28,38 +25,17 @@ import common.world.AWorldServer;
|
|||
|
||||
public class BlockPistonHead extends Block implements Directional
|
||||
{
|
||||
public static final PropertyEnum<BlockPistonHead.EnumPistonType> TYPE = PropertyEnum.<BlockPistonHead.EnumPistonType>create("type", BlockPistonHead.EnumPistonType.class);
|
||||
public static final PropertyBool SHORT = PropertyBool.create("short");
|
||||
private final boolean sticky;
|
||||
|
||||
public BlockPistonHead()
|
||||
public BlockPistonHead(boolean sticky)
|
||||
{
|
||||
super(Material.PISTON);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(TYPE, BlockPistonHead.EnumPistonType.DEFAULT).withProperty(SHORT, Boolean.valueOf(false)));
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
this.setStepSound(SoundType.STONE);
|
||||
this.setHardness(0.5F);
|
||||
this.sticky = sticky;
|
||||
}
|
||||
|
||||
// public void onBlockHarvested(World worldIn, BlockPos pos, State state, EntityNPC player)
|
||||
// {
|
||||
// if (player.creative)
|
||||
// {
|
||||
// Facing enumfacing = (Facing)state.getValue(FACING);
|
||||
//
|
||||
// if (enumfacing != null)
|
||||
// {
|
||||
// BlockPos blockpos = pos.offset(enumfacing.getOpposite());
|
||||
// Block block = worldIn.getState(blockpos).getBlock();
|
||||
//
|
||||
// if (block == Blocks.piston || block == Blocks.sticky_piston)
|
||||
// {
|
||||
// worldIn.setBlockToAir(blockpos);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// super.onBlockHarvested(worldIn, pos, state, player);
|
||||
// }
|
||||
|
||||
public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state)
|
||||
{
|
||||
super.onBlockRemoved(worldIn, pos, state);
|
||||
|
@ -103,7 +79,7 @@ public class BlockPistonHead extends Block implements Directional
|
|||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -219,38 +195,19 @@ public class BlockPistonHead extends Block implements Directional
|
|||
return true;
|
||||
}
|
||||
|
||||
public static Facing getFacing(int meta)
|
||||
public Item getItem()
|
||||
{
|
||||
int i = meta & 7;
|
||||
return i > 5 ? Facing.getFront(0) : Facing.getFront(i);
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
return worldIn.getState(pos).getValue(TYPE) == BlockPistonHead.EnumPistonType.STICKY ? Items.sticky_piston : Items.piston;
|
||||
return this.sticky ? Items.sticky_piston : Items.piston;
|
||||
}
|
||||
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new Property[] {FACING, TYPE, SHORT};
|
||||
return new Property[] {FACING};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
String side = "piston_side";
|
||||
return (state.getValue(SHORT) ? provider.getModel(state.getValue(TYPE) == EnumPistonType.STICKY ? "piston_top_sticky" : "piston_top")
|
||||
.add(0, 0, 0, 16, 16, 4)
|
||||
.d(side).uv(0, 0, 16, 4).rot(180)
|
||||
.u(side).uv(0, 0, 16, 4)
|
||||
.n().uv(0, 0, 16, 16)
|
||||
.s("piston_top").uv(0, 0, 16, 16).noCull()
|
||||
.w(side).uv(0, 0, 16, 4).rot(270)
|
||||
.e(side).uv(0, 0, 16, 4).rot(90)
|
||||
.add(6, 6, 4, 10, 10, 16)
|
||||
.d(side).uv(4, 0, 16, 4).rot(90).noCull()
|
||||
.u(side).uv(4, 0, 16, 4).rot(270).noCull()
|
||||
.w(side).uv(16, 4, 4, 0).noCull()
|
||||
.e(side).uv(4, 0, 16, 4).noCull()
|
||||
: provider.getModel(state.getValue(TYPE) == EnumPistonType.STICKY ? "piston_top_sticky" : "piston_top")
|
||||
return provider.getModel(this.sticky ? "piston_top_sticky" : "piston_top")
|
||||
.add(0, 0, 0, 16, 16, 4)
|
||||
.d(side).uv(0, 0, 16, 4).rot(180)
|
||||
.u(side).uv(0, 0, 16, 4)
|
||||
|
@ -267,7 +224,7 @@ public class BlockPistonHead extends Block implements Directional
|
|||
.d(side).uv(0, 0, 4, 4).rot(90).noCull()
|
||||
.u(side).uv(0, 0, 4, 4).rot(270).noCull()
|
||||
.w(side).uv(4, 4, 0, 0).noCull()
|
||||
.e(side).uv(0, 0, 4, 4).noCull())
|
||||
.e(side).uv(0, 0, 4, 4).noCull()
|
||||
.rotate(ModelRotation.getNorthRot(state.getValue(FACING).getAxis() == Facing.Axis.Y
|
||||
? state.getValue(FACING).getOpposite() : state.getValue(FACING)));
|
||||
}
|
||||
|
@ -275,31 +232,4 @@ public class BlockPistonHead extends Block implements Directional
|
|||
protected Item getItemToRegister() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Property[] getUnsavedProperties() {
|
||||
return new Property[] {SHORT};
|
||||
}
|
||||
|
||||
public static enum EnumPistonType implements Identifyable
|
||||
{
|
||||
DEFAULT("normal"),
|
||||
STICKY("sticky");
|
||||
|
||||
private final String name;
|
||||
|
||||
private EnumPistonType(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,293 +0,0 @@
|
|||
package common.block.tech;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockContainer;
|
||||
import common.block.Material;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.item.Item;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityPiston;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Facing;
|
||||
import common.util.HitPosition;
|
||||
import common.util.Vec3;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockPistonMoving extends BlockContainer
|
||||
{
|
||||
public static final PropertyEnum<Facing> FACING = BlockPistonHead.FACING;
|
||||
public static final PropertyEnum<BlockPistonHead.EnumPistonType> TYPE = BlockPistonHead.TYPE;
|
||||
|
||||
public BlockPistonMoving()
|
||||
{
|
||||
super(Material.PISTON);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(TYPE, BlockPistonHead.EnumPistonType.DEFAULT));
|
||||
this.setHardness(-1.0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public static TileEntity newTileEntity(State state, Facing facing, boolean extending, boolean renderHead)
|
||||
{
|
||||
return new TileEntityPiston(state, facing, extending, renderHead);
|
||||
}
|
||||
|
||||
public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state)
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileEntityPiston)
|
||||
{
|
||||
((TileEntityPiston)tileentity).clearPistonTileEntity();
|
||||
}
|
||||
else
|
||||
{
|
||||
super.onBlockRemoved(worldIn, pos, state);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether this Block can be placed on the given side
|
||||
*/
|
||||
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, Facing side)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player destroys this Block
|
||||
*/
|
||||
public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, State state)
|
||||
{
|
||||
BlockPos blockpos = pos.offset(((Facing)state.getValue(FACING)).getOpposite());
|
||||
State iblockstate = worldIn.getState(blockpos);
|
||||
|
||||
if (iblockstate.getBlock() instanceof BlockPistonBase && ((Boolean)iblockstate.getValue(BlockPistonBase.EXTENDED)).booleanValue())
|
||||
{
|
||||
worldIn.setBlockToAir(blockpos);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to determine ambient occlusion and culling when rebuilding chunks for render
|
||||
*/
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isFullCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!worldIn.client && worldIn.getTileEntity(pos) == null)
|
||||
{
|
||||
worldIn.setBlockToAir(pos);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawns this Block's drops into the World as EntityItems.
|
||||
*/
|
||||
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, State state, float chance, int fortune)
|
||||
{
|
||||
if (!worldIn.client)
|
||||
{
|
||||
TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos);
|
||||
|
||||
if (tileentitypiston != null)
|
||||
{
|
||||
State iblockstate = tileentitypiston.getPistonState();
|
||||
iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ray traces through the blocks collision from start vector to end vector returning a ray trace hit.
|
||||
*/
|
||||
public HitPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a neighboring block changes.
|
||||
*/
|
||||
public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock)
|
||||
{
|
||||
if (!worldIn.client)
|
||||
{
|
||||
worldIn.getTileEntity(pos);
|
||||
}
|
||||
}
|
||||
|
||||
public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state)
|
||||
{
|
||||
TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos);
|
||||
|
||||
if (tileentitypiston == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
float f = tileentitypiston.getProgress(0.0F);
|
||||
|
||||
if (tileentitypiston.isExtending())
|
||||
{
|
||||
f = 1.0F - f;
|
||||
}
|
||||
|
||||
return this.getBoundingBox(worldIn, pos, tileentitypiston.getPistonState(), f, tileentitypiston.getFacing());
|
||||
}
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos)
|
||||
{
|
||||
TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos);
|
||||
|
||||
if (tileentitypiston != null)
|
||||
{
|
||||
State iblockstate = tileentitypiston.getPistonState();
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if (block == this || block == Blocks.air)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float f = tileentitypiston.getProgress(0.0F);
|
||||
|
||||
if (tileentitypiston.isExtending())
|
||||
{
|
||||
f = 1.0F - f;
|
||||
}
|
||||
|
||||
block.setBlockBoundsBasedOnState(worldIn, pos);
|
||||
|
||||
if (block == Blocks.piston || block == Blocks.sticky_piston)
|
||||
{
|
||||
f = 0.0F;
|
||||
}
|
||||
|
||||
Facing enumfacing = tileentitypiston.getFacing();
|
||||
this.minX = block.getBlockBoundsMinX() - (double)((float)enumfacing.getFrontOffsetX() * f);
|
||||
this.minY = block.getBlockBoundsMinY() - (double)((float)enumfacing.getFrontOffsetY() * f);
|
||||
this.minZ = block.getBlockBoundsMinZ() - (double)((float)enumfacing.getFrontOffsetZ() * f);
|
||||
this.maxX = block.getBlockBoundsMaxX() - (double)((float)enumfacing.getFrontOffsetX() * f);
|
||||
this.maxY = block.getBlockBoundsMaxY() - (double)((float)enumfacing.getFrontOffsetY() * f);
|
||||
this.maxZ = block.getBlockBoundsMaxZ() - (double)((float)enumfacing.getFrontOffsetZ() * f);
|
||||
}
|
||||
}
|
||||
|
||||
public BoundingBox getBoundingBox(World worldIn, BlockPos pos, State extendingBlock, float progress, Facing direction)
|
||||
{
|
||||
if (extendingBlock.getBlock() != this && extendingBlock.getBlock() != Blocks.air)
|
||||
{
|
||||
BoundingBox axisalignedbb = extendingBlock.getBlock().getCollisionBoundingBox(worldIn, pos, extendingBlock);
|
||||
|
||||
if (axisalignedbb == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
double d0 = axisalignedbb.minX;
|
||||
double d1 = axisalignedbb.minY;
|
||||
double d2 = axisalignedbb.minZ;
|
||||
double d3 = axisalignedbb.maxX;
|
||||
double d4 = axisalignedbb.maxY;
|
||||
double d5 = axisalignedbb.maxZ;
|
||||
|
||||
if (direction.getFrontOffsetX() < 0)
|
||||
{
|
||||
d0 -= (double)((float)direction.getFrontOffsetX() * progress);
|
||||
}
|
||||
else
|
||||
{
|
||||
d3 -= (double)((float)direction.getFrontOffsetX() * progress);
|
||||
}
|
||||
|
||||
if (direction.getFrontOffsetY() < 0)
|
||||
{
|
||||
d1 -= (double)((float)direction.getFrontOffsetY() * progress);
|
||||
}
|
||||
else
|
||||
{
|
||||
d4 -= (double)((float)direction.getFrontOffsetY() * progress);
|
||||
}
|
||||
|
||||
if (direction.getFrontOffsetZ() < 0)
|
||||
{
|
||||
d2 -= (double)((float)direction.getFrontOffsetZ() * progress);
|
||||
}
|
||||
else
|
||||
{
|
||||
d5 -= (double)((float)direction.getFrontOffsetZ() * progress);
|
||||
}
|
||||
|
||||
return new BoundingBox(d0, d1, d2, d3, d4, d5);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private TileEntityPiston getTileEntity(IWorldAccess worldIn, BlockPos pos)
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
return tileentity instanceof TileEntityPiston ? (TileEntityPiston)tileentity : null;
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new Property[] {FACING, TYPE};
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -45,7 +45,7 @@ public class BlockRail extends Block
|
|||
super(Material.SMALL);
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
|
||||
this.setTab(CheatTab.TECHNOLOGY);
|
||||
this.setFlatItemTexture();
|
||||
this.setFlatBlockTexture();
|
||||
this.setDefaultState(this.getBaseState().withProperty(SHAPE, BlockRail.EnumRailDirection.NORTH_SOUTH));
|
||||
}
|
||||
|
||||
|
|
|
@ -44,18 +44,10 @@ public class BlockToggleableLight extends Block {
|
|||
return true;
|
||||
}
|
||||
|
||||
public Item getItemDropped(State state, Random rand, int fortune) {
|
||||
public Item getItem() {
|
||||
return Items.lamp;
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos) {
|
||||
return Items.lamp;
|
||||
}
|
||||
|
||||
public ItemStack createStackedBlock(State state) {
|
||||
return new ItemStack(Items.lamp);
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public abstract class BlockTorch extends Block implements DirectionalUp
|
|||
super(Material.SMALL);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.UP));
|
||||
this.setTab(CheatTab.TECHNOLOGY);
|
||||
this.setFlatItemTexture();
|
||||
this.setFlatBlockTexture();
|
||||
}
|
||||
|
||||
public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state)
|
||||
|
|
|
@ -11,7 +11,6 @@ import common.init.Items;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.StackSize;
|
||||
import common.item.block.ItemSmallBlock;
|
||||
import common.item.tool.ItemShears;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
|
@ -46,6 +45,7 @@ public class BlockTripWire extends Block
|
|||
this.setDefaultState(this.getBaseState().withProperty(POWERED, Boolean.valueOf(false)).withProperty(SUSPENDED, Boolean.valueOf(false)).withProperty(ATTACHED, Boolean.valueOf(false)).withProperty(DISARMED, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)));
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.15625F, 1.0F);
|
||||
// this.setTickRandomly(true);
|
||||
this.setFlatItemTexture();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,19 +80,6 @@ public class BlockTripWire extends Block
|
|||
return BlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return Items.string;
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
return Items.string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a neighboring block changes.
|
||||
*/
|
||||
|
@ -663,7 +650,7 @@ public class BlockTripWire extends Block
|
|||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSmallBlock(this).setDisplay("Faden").setTab(CheatTab.TECHNOLOGY).setMaxAmount(StackSize.XXXL);
|
||||
return super.getItemToRegister().setMaxAmount(StackSize.XXXL);
|
||||
}
|
||||
|
||||
public Property[] getUnsavedProperties() {
|
||||
|
|
|
@ -8,7 +8,6 @@ import common.init.Blocks;
|
|||
import common.init.SoundEvent;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
|
@ -37,6 +36,7 @@ public class BlockTripWireHook extends Block implements Rotatable
|
|||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(POWERED, Boolean.valueOf(false)).withProperty(ATTACHED, Boolean.valueOf(false)).withProperty(SUSPENDED, Boolean.valueOf(false)));
|
||||
this.setTab(CheatTab.TECHNOLOGY);
|
||||
// this.setTickRandomly(true);
|
||||
this.setFlatBlockTexture();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,7 +106,7 @@ public class BlockTripWireHook extends Block implements Rotatable
|
|||
/**
|
||||
* Called by ItemBlocks after a block is set in the world, to allow post-place logic
|
||||
*/
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, State state, EntityLiving placer, ItemStack stack)
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, State state, EntityLiving placer)
|
||||
{
|
||||
this.triggerHookAt(worldIn, pos, state, false, false, -1, (State)null);
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ public class BlockTripWireHook extends Block implements Rotatable
|
|||
/**
|
||||
* Can this block provide power. Only wire currently seems to have this change based on its state.
|
||||
*/
|
||||
public boolean canConnectToWire()
|
||||
public boolean canConnectToWire(State state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -555,10 +555,6 @@ public class BlockTripWireHook extends Block implements Rotatable
|
|||
}
|
||||
return model.rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemBlock(this, "tripwire_hook", false);
|
||||
}
|
||||
|
||||
public Property[] getUnsavedProperties() {
|
||||
return new Property[] {SUSPENDED};
|
||||
|
|
|
@ -11,7 +11,6 @@ import common.inventory.ContainerChest;
|
|||
import common.inventory.InventoryPlayer;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
|
@ -71,7 +70,7 @@ public class BlockWarpChest extends Block implements Rotatable
|
|||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
@ -90,14 +89,6 @@ public class BlockWarpChest extends Block implements Rotatable
|
|||
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by ItemBlocks after a block is set in the world, to allow post-place logic
|
||||
*/
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, State state, EntityLiving placer, ItemStack stack)
|
||||
{
|
||||
worldIn.setState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2);
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if(!worldIn.client) {
|
||||
|
|
|
@ -1,29 +1,24 @@
|
|||
package common.block.tech;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Sets;
|
||||
import common.init.Blocks;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemWire;
|
||||
import common.item.StackSize;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Facing;
|
||||
import common.util.Identifyable;
|
||||
import common.world.IBlockAccess;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
|
@ -240,49 +235,36 @@ public class BlockWire extends Block
|
|||
.w("wire_line").uv(0, 0, 16, 16).rot(90).noCull()
|
||||
.rotate(rot);
|
||||
}
|
||||
|
||||
public static final PropertyEnum<EnumAttachPosition> NORTH = PropertyEnum.<EnumAttachPosition>create("north", EnumAttachPosition.class);
|
||||
public static final PropertyEnum<EnumAttachPosition> EAST = PropertyEnum.<EnumAttachPosition>create("east", EnumAttachPosition.class);
|
||||
public static final PropertyEnum<EnumAttachPosition> SOUTH = PropertyEnum.<EnumAttachPosition>create("south", EnumAttachPosition.class);
|
||||
public static final PropertyEnum<EnumAttachPosition> WEST = PropertyEnum.<EnumAttachPosition>create("west", EnumAttachPosition.class);
|
||||
public static final PropertyInteger POWER = PropertyInteger.create("power", 0, 15);
|
||||
|
||||
private final Set<BlockPos> blocksNeedingUpdate = Sets.<BlockPos>newHashSet();
|
||||
|
||||
public static final PropertyBool DOWN = PropertyBool.create("down");
|
||||
public static final PropertyBool UP = PropertyBool.create("up");
|
||||
public static final PropertyBool NORTH = PropertyBool.create("north");
|
||||
public static final PropertyBool EAST = PropertyBool.create("east");
|
||||
public static final PropertyBool SOUTH = PropertyBool.create("south");
|
||||
public static final PropertyBool WEST = PropertyBool.create("west");
|
||||
|
||||
public BlockWire()
|
||||
{
|
||||
super(Material.SMALL);
|
||||
this.setDefaultState(this.getBaseState().withProperty(NORTH, EnumAttachPosition.NONE).withProperty(EAST, EnumAttachPosition.NONE).withProperty(SOUTH, EnumAttachPosition.NONE).withProperty(WEST, EnumAttachPosition.NONE).withProperty(POWER, Integer.valueOf(0)));
|
||||
this.setDefaultState(this.getBaseState().withProperty(DOWN, false).withProperty(UP, false).withProperty(NORTH, false).withProperty(EAST, false).withProperty(SOUTH, false).withProperty(WEST, false));
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
|
||||
this.setFlatItemTexture();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actual Block state of this Block at the given position. This applies properties not visible in the
|
||||
* metadata, such as fence connections.
|
||||
*/
|
||||
public State getActualState(State state, IWorldAccess worldIn, BlockPos pos)
|
||||
{
|
||||
state = state.withProperty(WEST, this.getAttachPosition(worldIn, pos, Facing.WEST));
|
||||
state = state.withProperty(EAST, this.getAttachPosition(worldIn, pos, Facing.EAST));
|
||||
state = state.withProperty(NORTH, this.getAttachPosition(worldIn, pos, Facing.NORTH));
|
||||
state = state.withProperty(SOUTH, this.getAttachPosition(worldIn, pos, Facing.SOUTH));
|
||||
state = state.withProperty(DOWN, this.canConnect(worldIn, pos, Facing.DOWN));
|
||||
state = state.withProperty(UP, this.canConnect(worldIn, pos, Facing.UP));
|
||||
state = state.withProperty(WEST, this.canConnect(worldIn, pos, Facing.WEST));
|
||||
state = state.withProperty(EAST, this.canConnect(worldIn, pos, Facing.EAST));
|
||||
state = state.withProperty(NORTH, this.canConnect(worldIn, pos, Facing.NORTH));
|
||||
state = state.withProperty(SOUTH, this.canConnect(worldIn, pos, Facing.SOUTH));
|
||||
return state;
|
||||
}
|
||||
|
||||
private EnumAttachPosition getAttachPosition(IBlockAccess worldIn, BlockPos pos, Facing direction)
|
||||
private boolean canConnect(IBlockAccess worldIn, BlockPos pos, Facing direction)
|
||||
{
|
||||
BlockPos blockpos = pos.offset(direction);
|
||||
Block block = worldIn.getState(pos.offset(direction)).getBlock();
|
||||
|
||||
if (!this.canConnectTo(worldIn.getState(blockpos), direction) && (block.isBlockNormalCube() || !this.canConnectUpwardsTo(worldIn.getState(blockpos.down()))))
|
||||
{
|
||||
Block block1 = worldIn.getState(pos.up()).getBlock();
|
||||
return !block1.isBlockNormalCube() && block.isBlockNormalCube() && this.canConnectUpwardsTo(worldIn.getState(blockpos.up())) ? EnumAttachPosition.UP : EnumAttachPosition.NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return EnumAttachPosition.SIDE;
|
||||
}
|
||||
return worldIn.getState(pos.offset(direction)).getBlock().canConnectToWire(this.getState());
|
||||
}
|
||||
|
||||
public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state)
|
||||
|
@ -290,9 +272,6 @@ public class BlockWire extends Block
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to determine ambient occlusion and culling when rebuilding chunks for render
|
||||
*/
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
|
@ -302,265 +281,6 @@ public class BlockWire extends Block
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
||||
{
|
||||
return worldIn.isBlockSolid(pos.down()) || worldIn.getState(pos.down()).getBlock() == Blocks.glowstone;
|
||||
}
|
||||
|
||||
private State updateSurroundings(World worldIn, BlockPos pos, State state)
|
||||
{
|
||||
state = this.calculateCurrentChanges(worldIn, pos, pos, state);
|
||||
List<BlockPos> list = Lists.newArrayList(this.blocksNeedingUpdate);
|
||||
this.blocksNeedingUpdate.clear();
|
||||
|
||||
for (BlockPos blockpos : list)
|
||||
{
|
||||
worldIn.notifyNeighborsOfStateChange(blockpos, this);
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
private State calculateCurrentChanges(World worldIn, BlockPos pos1, BlockPos pos2, State state)
|
||||
{
|
||||
State iblockstate = state;
|
||||
int i = ((Integer)state.getValue(POWER)).intValue();
|
||||
int j = 0;
|
||||
j = this.getMaxCurrentStrength(worldIn, pos2, j);
|
||||
// this.canProvidePower = false;
|
||||
int k = 0; // TODO: worldIn.isBlockIndirectlyGettingPowered(pos1);
|
||||
// this.canProvidePower = true;
|
||||
|
||||
if (k > 0 && k > j - 1)
|
||||
{
|
||||
j = k;
|
||||
}
|
||||
|
||||
int l = 0;
|
||||
|
||||
for (Facing enumfacing : Facing.Plane.HORIZONTAL)
|
||||
{
|
||||
BlockPos blockpos = pos1.offset(enumfacing);
|
||||
boolean flag = blockpos.getX() != pos2.getX() || blockpos.getZ() != pos2.getZ();
|
||||
|
||||
if (flag)
|
||||
{
|
||||
l = this.getMaxCurrentStrength(worldIn, blockpos, l);
|
||||
}
|
||||
|
||||
if (worldIn.getState(blockpos).getBlock().isNormalCube() && !worldIn.getState(pos1.up()).getBlock().isNormalCube())
|
||||
{
|
||||
if (flag && pos1.getY() >= pos2.getY())
|
||||
{
|
||||
l = this.getMaxCurrentStrength(worldIn, blockpos.up(), l);
|
||||
}
|
||||
}
|
||||
else if (!worldIn.getState(blockpos).getBlock().isNormalCube() && flag && pos1.getY() <= pos2.getY())
|
||||
{
|
||||
l = this.getMaxCurrentStrength(worldIn, blockpos.down(), l);
|
||||
}
|
||||
}
|
||||
|
||||
if (l > j)
|
||||
{
|
||||
j = l - 1;
|
||||
}
|
||||
else if (j > 0)
|
||||
{
|
||||
--j;
|
||||
}
|
||||
else
|
||||
{
|
||||
j = 0;
|
||||
}
|
||||
|
||||
if (k > j - 1)
|
||||
{
|
||||
j = k;
|
||||
}
|
||||
|
||||
if (i != j)
|
||||
{
|
||||
state = state.withProperty(POWER, Integer.valueOf(j));
|
||||
|
||||
if (worldIn.getState(pos1) == iblockstate)
|
||||
{
|
||||
worldIn.setState(pos1, state, 2);
|
||||
}
|
||||
|
||||
this.blocksNeedingUpdate.add(pos1);
|
||||
|
||||
for (Facing enumfacing1 : Facing.values())
|
||||
{
|
||||
this.blocksNeedingUpdate.add(pos1.offset(enumfacing1));
|
||||
}
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls World.notifyNeighborsOfStateChange() for all neighboring blocks, but only if the given block is a
|
||||
* wire.
|
||||
*/
|
||||
private void notifyWireNeighborsOfStateChange(World worldIn, BlockPos pos)
|
||||
{
|
||||
if (worldIn.getState(pos).getBlock() == this)
|
||||
{
|
||||
worldIn.notifyNeighborsOfStateChange(pos, this);
|
||||
|
||||
for (Facing enumfacing : Facing.values())
|
||||
{
|
||||
worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state)
|
||||
{
|
||||
if (!worldIn.client)
|
||||
{
|
||||
this.updateSurroundings(worldIn, pos, state);
|
||||
|
||||
for (Facing enumfacing : Facing.Plane.VERTICAL)
|
||||
{
|
||||
worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this);
|
||||
}
|
||||
|
||||
for (Facing enumfacing1 : Facing.Plane.HORIZONTAL)
|
||||
{
|
||||
this.notifyWireNeighborsOfStateChange(worldIn, pos.offset(enumfacing1));
|
||||
}
|
||||
|
||||
for (Facing enumfacing2 : Facing.Plane.HORIZONTAL)
|
||||
{
|
||||
BlockPos blockpos = pos.offset(enumfacing2);
|
||||
|
||||
if (worldIn.getState(blockpos).getBlock().isNormalCube())
|
||||
{
|
||||
this.notifyWireNeighborsOfStateChange(worldIn, blockpos.up());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.notifyWireNeighborsOfStateChange(worldIn, blockpos.down());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state)
|
||||
{
|
||||
super.onBlockRemoved(worldIn, pos, state);
|
||||
|
||||
if (!worldIn.client)
|
||||
{
|
||||
for (Facing enumfacing : Facing.values())
|
||||
{
|
||||
worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this);
|
||||
}
|
||||
|
||||
this.updateSurroundings(worldIn, pos, state);
|
||||
|
||||
for (Facing enumfacing1 : Facing.Plane.HORIZONTAL)
|
||||
{
|
||||
this.notifyWireNeighborsOfStateChange(worldIn, pos.offset(enumfacing1));
|
||||
}
|
||||
|
||||
for (Facing enumfacing2 : Facing.Plane.HORIZONTAL)
|
||||
{
|
||||
BlockPos blockpos = pos.offset(enumfacing2);
|
||||
|
||||
if (worldIn.getState(blockpos).getBlock().isNormalCube())
|
||||
{
|
||||
this.notifyWireNeighborsOfStateChange(worldIn, blockpos.up());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.notifyWireNeighborsOfStateChange(worldIn, blockpos.down());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int getMaxCurrentStrength(World worldIn, BlockPos pos, int strength)
|
||||
{
|
||||
if (worldIn.getState(pos).getBlock() != this)
|
||||
{
|
||||
return strength;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = ((Integer)worldIn.getState(pos).getValue(POWER)).intValue();
|
||||
return i > strength ? i : strength;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a neighboring block changes.
|
||||
*/
|
||||
public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock)
|
||||
{
|
||||
if (!worldIn.client)
|
||||
{
|
||||
if (this.canPlaceBlockAt(worldIn, pos))
|
||||
{
|
||||
this.updateSurroundings(worldIn, pos, state);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.dropBlockAsItem(worldIn, pos, state, 0);
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return this.getItem();
|
||||
}
|
||||
|
||||
private boolean isConnectedTo(IBlockAccess worldIn, BlockPos pos, Facing side)
|
||||
{
|
||||
BlockPos blockpos = pos.offset(side);
|
||||
State iblockstate = worldIn.getState(blockpos);
|
||||
Block block = iblockstate.getBlock();
|
||||
boolean flag = block.isNormalCube();
|
||||
boolean flag1 = worldIn.getState(pos.up()).getBlock().isNormalCube();
|
||||
return !flag1 && flag && this.canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (this.canConnectTo(iblockstate, side) ? true : /* (block == Blocks.powered_repeater && iblockstate.getValue(BlockwireDiode.FACING) == side ? true : */ !flag && this.canConnectUpwardsTo(worldIn, blockpos.down()));
|
||||
}
|
||||
|
||||
protected boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
return this.canConnectUpwardsTo(worldIn.getState(pos));
|
||||
}
|
||||
|
||||
protected boolean canConnectUpwardsTo(State state)
|
||||
{
|
||||
return this.canConnectTo(state, (Facing)null);
|
||||
}
|
||||
|
||||
protected boolean canConnectTo(State blockState, Facing side)
|
||||
{
|
||||
Block block = blockState.getBlock();
|
||||
|
||||
if (block == this)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// else if (Blocks.repeater.isAssociated(block))
|
||||
// {
|
||||
// Facing enumfacing = (Facing)blockState.getValue(BlockwireRepeater.FACING);
|
||||
// return enumfacing == side || enumfacing.getOpposite() == side;
|
||||
// }
|
||||
else
|
||||
{
|
||||
return block.canConnectToWire() && side != null;
|
||||
}
|
||||
}
|
||||
|
||||
public double doPowerPhase(AWorldServer world, BlockPos pos, Random rand, double voltage, double currentLimit) { // TODO: implement
|
||||
Queue<BlockPos> queue = new ArrayDeque<BlockPos>();
|
||||
|
@ -574,7 +294,7 @@ public class BlockWire extends Block
|
|||
if(!traversed.contains(bpos)) {
|
||||
traversed.add(bpos);
|
||||
State state = world.getState(bpos);
|
||||
if(state.getBlock().canConnectToWire() || state.getBlock() instanceof BlockWire) {
|
||||
if(state.getBlock().canConnectToWire(this.getState())) {
|
||||
double power = state.getBlock().powerTick(world, bpos, state, rand, voltage, currentLimit);
|
||||
converted += power;
|
||||
voltage -= state.getBlock().getResistance(world, bpos, state) * (power / voltage);
|
||||
|
@ -598,14 +318,9 @@ public class BlockWire extends Block
|
|||
return 0.01;
|
||||
}
|
||||
|
||||
// public boolean canConnectToWire()
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
public boolean canConnectToWire(State state)
|
||||
{
|
||||
return this.getItem();
|
||||
return state.getBlock() == this;
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer()
|
||||
|
@ -615,26 +330,27 @@ public class BlockWire extends Block
|
|||
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new Property[] {NORTH, EAST, SOUTH, WEST, POWER};
|
||||
return new Property[] {DOWN, UP, NORTH, EAST, SOUTH, WEST};
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
boolean na = state.getValue(NORTH) == EnumAttachPosition.NONE;
|
||||
boolean sa = state.getValue(SOUTH) == EnumAttachPosition.NONE;
|
||||
boolean wa = state.getValue(WEST) == EnumAttachPosition.NONE;
|
||||
boolean ea = state.getValue(EAST) == EnumAttachPosition.NONE;
|
||||
boolean nu = state.getValue(NORTH) == EnumAttachPosition.UP;
|
||||
boolean su = state.getValue(SOUTH) == EnumAttachPosition.UP;
|
||||
boolean wu = state.getValue(WEST) == EnumAttachPosition.UP;
|
||||
boolean eu = state.getValue(EAST) == EnumAttachPosition.UP;
|
||||
boolean nr = state.getValue(NORTH) == EnumAttachPosition.SIDE;
|
||||
boolean sr = state.getValue(SOUTH) == EnumAttachPosition.SIDE;
|
||||
boolean wr = state.getValue(WEST) == EnumAttachPosition.SIDE;
|
||||
boolean er = state.getValue(EAST) == EnumAttachPosition.SIDE;
|
||||
public Model getModel(ModelProvider provider, String name, State state) { //TODO: fix model
|
||||
boolean nr = state.getValue(NORTH);
|
||||
boolean sr = state.getValue(SOUTH);
|
||||
boolean wr = state.getValue(WEST);
|
||||
boolean er = state.getValue(EAST);
|
||||
boolean na = !nr;
|
||||
boolean sa = !sr;
|
||||
boolean wa = !wr;
|
||||
boolean ea = !er;
|
||||
boolean ud = state.getValue(DOWN) || state.getValue(UP);
|
||||
boolean nu = nr && ud;
|
||||
boolean su = sr && ud;
|
||||
boolean wu = wr && ud;
|
||||
boolean eu = er && ud;
|
||||
|
||||
if(ea && na && sa && wa)
|
||||
return wire_none;
|
||||
|
@ -818,40 +534,12 @@ public class BlockWire extends Block
|
|||
else
|
||||
return wire_none;
|
||||
}
|
||||
|
||||
public Property<?>[] getIgnoredProperties() {
|
||||
return new Property[] {POWER};
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemWire(this);
|
||||
return super.getItemToRegister().setMaxAmount(StackSize.XL);
|
||||
}
|
||||
|
||||
public Property[] getUnsavedProperties() {
|
||||
return new Property[] {EAST, NORTH, SOUTH, WEST};
|
||||
return new Property[] {DOWN, UP, EAST, NORTH, SOUTH, WEST};
|
||||
}
|
||||
|
||||
public static enum EnumAttachPosition implements Identifyable
|
||||
{
|
||||
UP("up"),
|
||||
SIDE("side"),
|
||||
NONE("none");
|
||||
|
||||
private final String name;
|
||||
|
||||
private EnumAttachPosition(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package common.block.tile;
|
||||
|
||||
import common.block.BlockContainer;
|
||||
import common.block.Block;
|
||||
import common.block.ITileEntityProvider;
|
||||
import common.block.Material;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Items;
|
||||
import common.item.Item;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntitySign;
|
||||
import common.util.BlockPos;
|
||||
|
@ -16,7 +16,7 @@ import common.world.IBlockAccess;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockSign extends BlockContainer
|
||||
public class BlockSign extends Block implements ITileEntityProvider
|
||||
{
|
||||
public BlockSign()
|
||||
{
|
||||
|
@ -85,15 +85,7 @@ public class BlockSign extends BlockContainer
|
|||
return new TileEntitySign();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return Items.sign;
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
public Item getItem()
|
||||
{
|
||||
return Items.sign;
|
||||
}
|
||||
|
@ -122,6 +114,15 @@ public class BlockSign extends BlockContainer
|
|||
// super.onBlockRemoved(worldIn, pos, state);
|
||||
// }
|
||||
|
||||
private boolean isInvalidNeighbor(World world, BlockPos pos, Facing face) {
|
||||
return world.getState(pos.offset(face)).getBlock().getMaterial() == Material.BLOCKING;
|
||||
}
|
||||
|
||||
private 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);
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
||||
{
|
||||
return !this.hasInvalidNeighbor(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos);
|
||||
|
@ -135,4 +136,8 @@ public class BlockSign extends BlockContainer
|
|||
public String getFallbackTexture() {
|
||||
return "oak_planks";
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,24 +125,21 @@ public class EntityFalling extends Entity implements IObjectData
|
|||
this.motionZ *= 0.699999988079071D;
|
||||
this.motionY *= -0.5D;
|
||||
|
||||
if (this.worldObj.getState(blockpos1).getBlock() != Blocks.piston_extension)
|
||||
{
|
||||
this.setDead();
|
||||
this.setDead();
|
||||
|
||||
if (!this.canSetAsBlock)
|
||||
if (!this.canSetAsBlock)
|
||||
{
|
||||
if (this.worldObj.canBlockBePlaced(block, blockpos1, true, Facing.UP, (Entity)null, (ItemStack)null) && !BlockFalling.canFallInto(this.worldObj, blockpos1.down()) && this.worldObj.setState(blockpos1, this.fallTile, 3))
|
||||
{
|
||||
if (this.worldObj.canBlockBePlaced(block, blockpos1, true, Facing.UP, (Entity)null, (ItemStack)null) && !BlockFalling.canFallInto(this.worldObj, blockpos1.down()) && this.worldObj.setState(blockpos1, this.fallTile, 3))
|
||||
if (block instanceof BlockFalling)
|
||||
{
|
||||
if (block instanceof BlockFalling)
|
||||
{
|
||||
((BlockFalling)block).onEndFalling(this.worldObj, blockpos1);
|
||||
}
|
||||
}
|
||||
else if (this.shouldDropItem && Vars.objectDrop)
|
||||
{
|
||||
this.entityDropItem(new ItemStack(block.getItem()), 0.0F);
|
||||
((BlockFalling)block).onEndFalling(this.worldObj, blockpos1);
|
||||
}
|
||||
}
|
||||
else if (this.shouldDropItem && Vars.objectDrop)
|
||||
{
|
||||
this.entityDropItem(new ItemStack(block.getItem()), 0.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this.fallTime > 100 && !this.worldObj.client && (blockpos1.getY() < -World.MAX_SIZE_Y + 1 || blockpos1.getY() > World.MAX_SIZE_Y) || this.fallTime > 600)
|
||||
|
|
|
@ -111,7 +111,6 @@ import common.block.tech.BlockMobSpawner;
|
|||
import common.block.tech.BlockNuke;
|
||||
import common.block.tech.BlockPistonBase;
|
||||
import common.block.tech.BlockPistonHead;
|
||||
import common.block.tech.BlockPistonMoving;
|
||||
import common.block.tech.BlockPressurePlate;
|
||||
import common.block.tech.BlockPressurePlateWeighted;
|
||||
import common.block.tech.BlockRail;
|
||||
|
@ -359,7 +358,7 @@ public abstract class BlockRegistry {
|
|||
}
|
||||
Block cactus = (new BlockCactus()).setHardness(0.4F).setStepSound(SoundType.CLOTH).setDisplay("Kaktus");
|
||||
register("cactus", cactus);
|
||||
register("reeds", (new BlockReed()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Zuckerrohr"));
|
||||
register("reeds", (new BlockReed()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Zuckerrohr").setTab(CheatTab.PLANTS));
|
||||
register("vine", (new BlockVine()).setHardness(0.2F).setStepSound(SoundType.GRASS).setDisplay("Ranken").setShearsEfficiency(0));
|
||||
register("waterlily", (new BlockLilyPad()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Seerosenblatt"));
|
||||
register("cocoa", (new BlockCocoa()).setHardness(0.2F).setResistance(5.0F).setStepSound(SoundType.WOOD).setDisplay("Kakao"));
|
||||
|
@ -369,11 +368,11 @@ public abstract class BlockRegistry {
|
|||
Block brownMushroom = (new BlockMushroom()).setHardness(0.0F).setStepSound(SoundType.GRASS).setLightLevel(0.125F)
|
||||
.setDisplay("Pilz");
|
||||
register("brown_mushroom", brownMushroom);
|
||||
register("brown_mushroom_block", (new BlockHugeMushroom(Material.WOOD, brownMushroom)).setHardness(0.2F)
|
||||
register("brown_mushroom_block", (new BlockHugeMushroom(brownMushroom)).setHardness(0.2F)
|
||||
.setStepSound(SoundType.WOOD).setDisplay("Pilzblock").setTab(CheatTab.PLANTS));
|
||||
Block redMushrooom = (new BlockMushroom()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Pilz");
|
||||
register("red_mushroom", redMushrooom);
|
||||
register("red_mushroom_block", (new BlockHugeMushroom(Material.WOOD, redMushrooom)).setHardness(0.2F)
|
||||
register("red_mushroom_block", (new BlockHugeMushroom(redMushrooom)).setHardness(0.2F)
|
||||
.setStepSound(SoundType.WOOD).setDisplay("Pilzblock").setTab(CheatTab.PLANTS));
|
||||
register("blue_mushroom", (new BlockBlueShroom()).setHardness(0.0F).setStepSound(SoundType.GRASS).setLightLevel(0.5F)
|
||||
.setDisplay("Tianpilz"));
|
||||
|
@ -414,7 +413,7 @@ public abstract class BlockRegistry {
|
|||
for(DyeColor color : DyeColor.values()) {
|
||||
register(color.getName() + "_glass", (new BlockStainedGlass(color)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay(color.getDisplay() + " gefärbtes Glas"));
|
||||
}
|
||||
register("glass_pane", (new BlockPane(Material.TRANSLUCENT, false)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("Glasscheibe"));
|
||||
register("glass_pane", (new BlockPane(Material.TRANSLUCENT)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("Glasscheibe"));
|
||||
for(DyeColor color : DyeColor.values()) {
|
||||
register(color.getName() + "_glass_pane", (new BlockStainedGlassPane(color)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay(color.getDisplay() + " gefärbte Glasscheibe"));
|
||||
}
|
||||
|
@ -433,10 +432,10 @@ public abstract class BlockRegistry {
|
|||
|
||||
register("ladder", (new BlockLadder()).setHardness(0.4F).setStepSound(SoundType.LADDER).setDisplay("Leiter").setAxeHarvestable());
|
||||
register("bookshelf", (new BlockBookshelf()).setHardness(1.5F).setStepSound(SoundType.WOOD).setDisplay("Bücherregal"));
|
||||
register("cake", (new BlockCake()).setHardness(0.5F).setStepSound(SoundType.CLOTH).setDisplay("Kuchen"));
|
||||
register("cake", (new BlockCake()).setHardness(0.5F).setStepSound(SoundType.CLOTH).setDisplay("Kuchen").setTab(CheatTab.DECORATION));
|
||||
register("dragon_egg", (new BlockDragonEgg()).setHardness(3.0F).setResistance(15.0F).setStepSound(SoundType.STONE)
|
||||
.setLightLevel(0.125F).setDisplay("Drachenei").setTab(CheatTab.DECORATION));
|
||||
register("flowerpot", (new BlockFlowerPot(null)).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf"));
|
||||
register("flowerpot", (new BlockFlowerPot(null)).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf").setTab(CheatTab.DECORATION));
|
||||
register("flowerpot_cactus", (new BlockFlowerPot(cactus)).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf mit " + cactus.getDisplay()));
|
||||
for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) {
|
||||
register("flowerpot_" + type.getName(), (new BlockFlowerPot(BlockFlower.getByType(type))).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf mit " + type.getDisplay()));
|
||||
|
@ -510,7 +509,7 @@ public abstract class BlockRegistry {
|
|||
"quartz_block_bottom", "quartz_top"))
|
||||
.setDisplay("Quarztreppe"));
|
||||
|
||||
register("iron_bars", (new BlockPane(Material.SOLID, true)).setHardness(5.0F).setResistance(10.0F).setStepSound(SoundType.STONE)
|
||||
register("iron_bars", (new BlockPane(Material.SOLID)).setHardness(5.0F).setResistance(10.0F).setStepSound(SoundType.STONE)
|
||||
.setDisplay("Eisengitter"));
|
||||
register("iron_trapdoor", (new BlockTrapDoor(Material.SOLID)).setHardness(5.0F).setStepSound(SoundType.STONE).setDisplay("Eisenfalltür"));
|
||||
|
||||
|
@ -603,8 +602,8 @@ public abstract class BlockRegistry {
|
|||
register("anvil" + (z == 0 ? "" : "_damaged_" + z), (new BlockAnvil(z)).setHardness(5.0F).setStepSound(SoundType.ANVIL).setResistance(2000.0F).setDisplay((z == 0 ? "" : (z == 1 ? "Leicht beschädigter " : "Stark beschädigter ")) + "Amboss"));
|
||||
}
|
||||
register("enchanting_table", (new BlockEnchantmentTable()).setHardness(5.0F).setResistance(2000.0F).setDisplay("Zaubertisch"));
|
||||
register("brewing_stand", (new BlockBrewingStand()).setHardness(0.5F).setLightLevel(0.125F).setDisplay("Braustand"));
|
||||
register("cauldron", (new BlockCauldron()).setHardness(2.0F).setDisplay("Kessel"));
|
||||
register("brewing_stand", (new BlockBrewingStand()).setHardness(0.5F).setLightLevel(0.125F).setDisplay("Braustand").setTab(CheatTab.TECHNOLOGY));
|
||||
register("cauldron", (new BlockCauldron()).setHardness(2.0F).setDisplay("Kessel").setTab(CheatTab.TECHNOLOGY));
|
||||
register("effect_generator", (new BlockEffectGenerator()).setDisplay("Effektgenerator").setLightLevel(1.0F));
|
||||
register("construction_table", (new BlockWorkbench(4)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Konstruktionstisch"));
|
||||
register("assembly_unit", (new BlockWorkbench(5)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Fertigungseinheit"));
|
||||
|
@ -627,8 +626,8 @@ public abstract class BlockRegistry {
|
|||
|
||||
register("piston", (new BlockPistonBase(false)).setDisplay("Kolben"));
|
||||
register("sticky_piston", (new BlockPistonBase(true)).setDisplay("Klebriger Kolben"));
|
||||
register("piston_head", (new BlockPistonHead()).setDisplay("Kolben"));
|
||||
register("piston_extension", new BlockPistonMoving().setDisplay("Kolben"));
|
||||
register("piston_head", (new BlockPistonHead(false)).setDisplay("Kolben"));
|
||||
register("sticky_piston_head", (new BlockPistonHead(true)).setDisplay("Klebriger Kolben"));
|
||||
register("dispenser", (new BlockDispenser()).setHardness(3.5F).setStepSound(SoundType.STONE).setDisplay("Werfer"));
|
||||
register("dropper", (new BlockDropper()).setHardness(3.5F).setStepSound(SoundType.STONE).setDisplay("Spender"));
|
||||
register("hopper", (new BlockHopper()).setHardness(3.0F).setResistance(8.0F).setStepSound(SoundType.STONE).setDisplay("Trichter"));
|
||||
|
@ -651,7 +650,7 @@ public abstract class BlockRegistry {
|
|||
register("wooden_button", (new BlockButton(true, 30, "oak_planks")).setHardness(0.5F).setStepSound(SoundType.WOOD).setDisplay("Knopf"));
|
||||
register("red_button", (new BlockButton(true, 10, "red_button")).setHardness(0.5F).setStepSound(SoundType.STONE).setDisplay("Knopf"));
|
||||
|
||||
register("wire", (new BlockWire()).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Kabel"));
|
||||
register("wire", (new BlockWire()).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Kabel").setTab(CheatTab.TECHNOLOGY));
|
||||
BlockUnlitTorch torch;
|
||||
register("torch", (torch = new BlockUnlitTorch(0xffffffff)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Fackel"));
|
||||
register("lit_torch", (new BlockLitTorch(torch)).setHardness(0.0F).setLightLevel(0.9375F).setStepSound(SoundType.WOOD).setDisplay("Fackel"));
|
||||
|
@ -669,7 +668,7 @@ public abstract class BlockRegistry {
|
|||
register("daylight_detector", new BlockDaylightDetector(false).setDisplay("Tageslichtsensor"));
|
||||
register("daylight_detector_inverted", new BlockDaylightDetector(true).setDisplay("Tageslichtsensor"));
|
||||
register("tripwire_hook", (new BlockTripWireHook()).setDisplay("Haken"));
|
||||
register("string", (new BlockTripWire()).setDisplay("Stolperdraht").setShearsEfficiency(0));
|
||||
register("string", (new BlockTripWire()).setDisplay("Stolperdraht").setShearsEfficiency(0).setTab(CheatTab.TECHNOLOGY));
|
||||
|
||||
register("iron_door", (new BlockDoor(Material.SOLID)).setHardness(5.0F).setStepSound(SoundType.STONE).setDisplay("Eisentür"));
|
||||
for(WoodType wood : WoodType.values()) {
|
||||
|
|
|
@ -387,8 +387,8 @@ public abstract class Blocks {
|
|||
public static final BlockFlower pink_tulip = get("pink_tulip");
|
||||
public static final BlockWool pink_wool = get("pink_wool");
|
||||
public static final BlockPistonBase piston = get("piston");
|
||||
public static final BlockPistonMoving piston_extension = get("piston_extension");
|
||||
public static final BlockPistonHead piston_head = get("piston_head");
|
||||
public static final BlockPistonHead sticky_piston_head = get("sticky_piston_head");
|
||||
public static final Block platinum_block = get("platinum_block");
|
||||
public static final BlockOre platinum_ore = get("platinum_ore");
|
||||
public static final Block plutonium_block = get("plutonium_block");
|
||||
|
|
|
@ -275,7 +275,9 @@ public abstract class ItemRegistry {
|
|||
}
|
||||
Item lapis = null;
|
||||
for(DyeColor color : DyeColor.values()) {
|
||||
Item dye = (new ItemDye(color)).setDisplay(color.getDyeName()).setMaxAmount(StackSize.XXL);
|
||||
if(color == DyeColor.BROWN)
|
||||
continue;
|
||||
Item dye = new ItemDye(color, null);
|
||||
if(color == DyeColor.BLUE)
|
||||
lapis = dye;
|
||||
register(color.getDye(), dye);
|
||||
|
|
|
@ -14,8 +14,7 @@ import common.item.*;
|
|||
import common.item.block.ItemBed;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.item.block.ItemButton;
|
||||
import common.item.block.ItemChest;
|
||||
import common.item.block.ItemColored;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.item.block.ItemDoor;
|
||||
import common.item.block.ItemDoublePlant;
|
||||
import common.item.block.ItemFence;
|
||||
|
@ -23,12 +22,10 @@ import common.item.block.ItemLilyPad;
|
|||
import common.item.block.ItemMetalBlock;
|
||||
import common.item.block.ItemPiston;
|
||||
import common.item.block.ItemPressurePlate;
|
||||
import common.item.block.ItemWire;
|
||||
import common.item.block.ItemSeedFood;
|
||||
import common.item.block.ItemSeeds;
|
||||
import common.item.block.ItemSign;
|
||||
import common.item.block.ItemSlab;
|
||||
import common.item.block.ItemSmallBlock;
|
||||
import common.item.block.ItemSnow;
|
||||
import common.item.block.ItemWall;
|
||||
import common.item.material.ItemBook;
|
||||
|
@ -93,11 +90,11 @@ public abstract class Items {
|
|||
public static final ItemDoor acacia_door = get("acacia_door");
|
||||
public static final ItemFence acacia_fence = get("acacia_fence");
|
||||
public static final ItemBlock acacia_fence_gate = get("acacia_fence_gate");
|
||||
public static final ItemColored acacia_leaves_autumn = get("acacia_leaves_autumn");
|
||||
public static final ItemColored acacia_leaves_snowy = get("acacia_leaves_snowy");
|
||||
public static final ItemColored acacia_leaves_spring = get("acacia_leaves_spring");
|
||||
public static final ItemColored acacia_leaves_summer = get("acacia_leaves_summer");
|
||||
public static final ItemColored acacia_leaves_winter = get("acacia_leaves_winter");
|
||||
public static final ItemBlock acacia_leaves_autumn = get("acacia_leaves_autumn");
|
||||
public static final ItemBlock acacia_leaves_snowy = get("acacia_leaves_snowy");
|
||||
public static final ItemBlock acacia_leaves_spring = get("acacia_leaves_spring");
|
||||
public static final ItemBlock acacia_leaves_summer = get("acacia_leaves_summer");
|
||||
public static final ItemBlock acacia_leaves_winter = get("acacia_leaves_winter");
|
||||
public static final ItemBlock acacia_log = get("acacia_log");
|
||||
public static final ItemBlock acacia_planks = get("acacia_planks");
|
||||
public static final ItemBlock acacia_sapling = get("acacia_sapling");
|
||||
|
@ -137,11 +134,11 @@ public abstract class Items {
|
|||
public static final ItemDoor birch_door = get("birch_door");
|
||||
public static final ItemFence birch_fence = get("birch_fence");
|
||||
public static final ItemBlock birch_fence_gate = get("birch_fence_gate");
|
||||
public static final ItemColored birch_leaves_autumn = get("birch_leaves_autumn");
|
||||
public static final ItemColored birch_leaves_snowy = get("birch_leaves_snowy");
|
||||
public static final ItemColored birch_leaves_spring = get("birch_leaves_spring");
|
||||
public static final ItemColored birch_leaves_summer = get("birch_leaves_summer");
|
||||
public static final ItemColored birch_leaves_winter = get("birch_leaves_winter");
|
||||
public static final ItemBlock birch_leaves_autumn = get("birch_leaves_autumn");
|
||||
public static final ItemBlock birch_leaves_snowy = get("birch_leaves_snowy");
|
||||
public static final ItemBlock birch_leaves_spring = get("birch_leaves_spring");
|
||||
public static final ItemBlock birch_leaves_summer = get("birch_leaves_summer");
|
||||
public static final ItemBlock birch_leaves_winter = get("birch_leaves_winter");
|
||||
public static final ItemBlock birch_log = get("birch_log");
|
||||
public static final ItemBlock birch_planks = get("birch_planks");
|
||||
public static final ItemBlock birch_sapling = get("birch_sapling");
|
||||
|
@ -179,11 +176,11 @@ public abstract class Items {
|
|||
public static final ItemDoor blackwood_door = get("blackwood_door");
|
||||
public static final ItemFence blackwood_fence = get("blackwood_fence");
|
||||
public static final ItemBlock blackwood_fence_gate = get("blackwood_fence_gate");
|
||||
public static final ItemColored blackwood_leaves_autumn = get("blackwood_leaves_autumn");
|
||||
public static final ItemColored blackwood_leaves_snowy = get("blackwood_leaves_snowy");
|
||||
public static final ItemColored blackwood_leaves_spring = get("blackwood_leaves_spring");
|
||||
public static final ItemColored blackwood_leaves_summer = get("blackwood_leaves_summer");
|
||||
public static final ItemColored blackwood_leaves_winter = get("blackwood_leaves_winter");
|
||||
public static final ItemBlock blackwood_leaves_autumn = get("blackwood_leaves_autumn");
|
||||
public static final ItemBlock blackwood_leaves_snowy = get("blackwood_leaves_snowy");
|
||||
public static final ItemBlock blackwood_leaves_spring = get("blackwood_leaves_spring");
|
||||
public static final ItemBlock blackwood_leaves_summer = get("blackwood_leaves_summer");
|
||||
public static final ItemBlock blackwood_leaves_winter = get("blackwood_leaves_winter");
|
||||
public static final ItemBlock blackwood_log = get("blackwood_log");
|
||||
public static final ItemBlock blackwood_planks = get("blackwood_planks");
|
||||
public static final ItemBlock blackwood_sapling = get("blackwood_sapling");
|
||||
|
@ -214,7 +211,7 @@ public abstract class Items {
|
|||
public static final ItemBow bow = get("bow");
|
||||
public static final ItemSmall bowl = get("bowl");
|
||||
public static final ItemFood bread = get("bread");
|
||||
public static final ItemSmallBlock brewing_stand = get("brewing_stand");
|
||||
public static final ItemBlock brewing_stand = get("brewing_stand");
|
||||
public static final Item brick = get("brick");
|
||||
public static final ItemBlock brick_block = get("brick_block");
|
||||
public static final ItemSlab brick_slab = get("brick_slab");
|
||||
|
@ -230,7 +227,7 @@ public abstract class Items {
|
|||
public static final ItemFlintAndSteel burning_soul = get("burning_soul");
|
||||
public static final ItemBlock cactus = get("cactus");
|
||||
public static final ItemDye cactus_green = get("cactus_green");
|
||||
public static final ItemSmallBlock cake = get("cake");
|
||||
public static final ItemBlock cake = get("cake");
|
||||
public static final ItemMetalBlock calcium_block = get("calcium_block");
|
||||
public static final ItemMetalBlock calcium_ore = get("calcium_ore");
|
||||
public static final ItemMetal calcium_powder = get("calcium_powder");
|
||||
|
@ -239,7 +236,7 @@ public abstract class Items {
|
|||
public static final ItemCarrotOnAStick carrot_on_a_stick = get("carrot_on_a_stick");
|
||||
public static final ItemBlock carved_sandstone = get("carved_sandstone");
|
||||
public static final ItemBlock carved_stonebrick = get("carved_stonebrick");
|
||||
public static final ItemSmallBlock cauldron = get("cauldron");
|
||||
public static final ItemBlock cauldron = get("cauldron");
|
||||
public static final ItemBlock cell_rock = get("cell_rock");
|
||||
public static final ItemMagnetic chain = get("chain");
|
||||
public static final ItemArmor chain_boots = get("chain_boots");
|
||||
|
@ -252,17 +249,17 @@ public abstract class Items {
|
|||
public static final ItemDoor cherry_door = get("cherry_door");
|
||||
public static final ItemFence cherry_fence = get("cherry_fence");
|
||||
public static final ItemBlock cherry_fence_gate = get("cherry_fence_gate");
|
||||
public static final ItemColored cherry_leaves_autumn = get("cherry_leaves_autumn");
|
||||
public static final ItemColored cherry_leaves_snowy = get("cherry_leaves_snowy");
|
||||
public static final ItemColored cherry_leaves_spring = get("cherry_leaves_spring");
|
||||
public static final ItemColored cherry_leaves_summer = get("cherry_leaves_summer");
|
||||
public static final ItemColored cherry_leaves_winter = get("cherry_leaves_winter");
|
||||
public static final ItemBlock cherry_leaves_autumn = get("cherry_leaves_autumn");
|
||||
public static final ItemBlock cherry_leaves_snowy = get("cherry_leaves_snowy");
|
||||
public static final ItemBlock cherry_leaves_spring = get("cherry_leaves_spring");
|
||||
public static final ItemBlock cherry_leaves_summer = get("cherry_leaves_summer");
|
||||
public static final ItemBlock cherry_leaves_winter = get("cherry_leaves_winter");
|
||||
public static final ItemBlock cherry_log = get("cherry_log");
|
||||
public static final ItemBlock cherry_planks = get("cherry_planks");
|
||||
public static final ItemBlock cherry_sapling = get("cherry_sapling");
|
||||
public static final ItemSlab cherry_slab = get("cherry_slab");
|
||||
public static final ItemBlock cherry_stairs = get("cherry_stairs");
|
||||
public static final ItemChest chest = get("chest");
|
||||
public static final ItemBlock chest = get("chest");
|
||||
public static final ItemMagnet chick_magnet = get("chick_magnet");
|
||||
public static final ItemFood chicken = get("chicken");
|
||||
public static final ItemMetalBlock chrome_block = get("chrome_block");
|
||||
|
@ -311,18 +308,18 @@ public abstract class Items {
|
|||
public static final ItemDoor dark_oak_door = get("dark_oak_door");
|
||||
public static final ItemFence dark_oak_fence = get("dark_oak_fence");
|
||||
public static final ItemBlock dark_oak_fence_gate = get("dark_oak_fence_gate");
|
||||
public static final ItemColored dark_oak_leaves_autumn = get("dark_oak_leaves_autumn");
|
||||
public static final ItemColored dark_oak_leaves_snowy = get("dark_oak_leaves_snowy");
|
||||
public static final ItemColored dark_oak_leaves_spring = get("dark_oak_leaves_spring");
|
||||
public static final ItemColored dark_oak_leaves_summer = get("dark_oak_leaves_summer");
|
||||
public static final ItemColored dark_oak_leaves_winter = get("dark_oak_leaves_winter");
|
||||
public static final ItemBlock dark_oak_leaves_autumn = get("dark_oak_leaves_autumn");
|
||||
public static final ItemBlock dark_oak_leaves_snowy = get("dark_oak_leaves_snowy");
|
||||
public static final ItemBlock dark_oak_leaves_spring = get("dark_oak_leaves_spring");
|
||||
public static final ItemBlock dark_oak_leaves_summer = get("dark_oak_leaves_summer");
|
||||
public static final ItemBlock dark_oak_leaves_winter = get("dark_oak_leaves_winter");
|
||||
public static final ItemBlock dark_oak_log = get("dark_oak_log");
|
||||
public static final ItemBlock dark_oak_planks = get("dark_oak_planks");
|
||||
public static final ItemBlock dark_oak_sapling = get("dark_oak_sapling");
|
||||
public static final ItemSlab dark_oak_slab = get("dark_oak_slab");
|
||||
public static final ItemBlock dark_oak_stairs = get("dark_oak_stairs");
|
||||
public static final ItemBlock daylight_detector = get("daylight_detector");
|
||||
public static final ItemColored dead_bush = get("dead_bush");
|
||||
public static final ItemBlock dead_bush = get("dead_bush");
|
||||
public static final ItemBlock deadbush = get("deadbush");
|
||||
public static final Item diamond = get("diamond");
|
||||
public static final ItemAxe diamond_axe = get("diamond_axe");
|
||||
|
@ -367,7 +364,7 @@ public abstract class Items {
|
|||
public static final ItemBlock farmland = get("farmland");
|
||||
public static final Item feather = get("feather");
|
||||
public static final Item fermented_spider_eye = get("fermented_spider_eye");
|
||||
public static final ItemColored fern = get("fern");
|
||||
public static final ItemBlock fern = get("fern");
|
||||
public static final ItemFireball fireball = get("fireball");
|
||||
public static final ItemFishingRod fishing_rod = get("fishing_rod");
|
||||
public static final Item flint = get("flint");
|
||||
|
@ -376,7 +373,7 @@ public abstract class Items {
|
|||
public static final ItemBlock floor_tiles_black = get("floor_tiles_black");
|
||||
public static final ItemBlock floor_tiles_red = get("floor_tiles_red");
|
||||
public static final ItemBlock floor_tiles_white = get("floor_tiles_white");
|
||||
public static final ItemSmallBlock flowerpot = get("flowerpot");
|
||||
public static final ItemBlock flowerpot = get("flowerpot");
|
||||
public static final ItemBlock furnace = get("furnace");
|
||||
public static final ItemTiny tear = get("tear");
|
||||
public static final Item ghi_fragment = get("ghi_fragment");
|
||||
|
@ -404,7 +401,7 @@ public abstract class Items {
|
|||
public static final ItemAppleGold charged_apple = get("charged_apple");
|
||||
public static final ItemFood golden_carrot = get("golden_carrot");
|
||||
public static final ItemBucket goo_bucket = get("goo_bucket");
|
||||
public static final ItemColored grass = get("grass");
|
||||
public static final ItemBlock grass = get("grass");
|
||||
public static final ItemBlock gravel = get("gravel");
|
||||
public static final ItemBlock gray_carpet = get("gray_carpet");
|
||||
public static final ItemBlock gray_clay = get("gray_clay");
|
||||
|
@ -457,11 +454,11 @@ public abstract class Items {
|
|||
public static final ItemDoor jungle_door = get("jungle_door");
|
||||
public static final ItemFence jungle_fence = get("jungle_fence");
|
||||
public static final ItemBlock jungle_fence_gate = get("jungle_fence_gate");
|
||||
public static final ItemColored jungle_leaves_autumn = get("jungle_leaves_autumn");
|
||||
public static final ItemColored jungle_leaves_snowy = get("jungle_leaves_snowy");
|
||||
public static final ItemColored jungle_leaves_spring = get("jungle_leaves_spring");
|
||||
public static final ItemColored jungle_leaves_summer = get("jungle_leaves_summer");
|
||||
public static final ItemColored jungle_leaves_winter = get("jungle_leaves_winter");
|
||||
public static final ItemBlock jungle_leaves_autumn = get("jungle_leaves_autumn");
|
||||
public static final ItemBlock jungle_leaves_snowy = get("jungle_leaves_snowy");
|
||||
public static final ItemBlock jungle_leaves_spring = get("jungle_leaves_spring");
|
||||
public static final ItemBlock jungle_leaves_summer = get("jungle_leaves_summer");
|
||||
public static final ItemBlock jungle_leaves_winter = get("jungle_leaves_winter");
|
||||
public static final ItemBlock jungle_log = get("jungle_log");
|
||||
public static final ItemBlock jungle_planks = get("jungle_planks");
|
||||
public static final ItemBlock jungle_sapling = get("jungle_sapling");
|
||||
|
@ -498,7 +495,6 @@ public abstract class Items {
|
|||
public static final ItemBlock lime_glass = get("lime_glass");
|
||||
public static final ItemBlock lime_glass_pane = get("lime_glass_pane");
|
||||
public static final ItemBlock lime_wool = get("lime_wool");
|
||||
public static final ItemBlock lit_furnace = get("lit_furnace");
|
||||
public static final ItemBlock lit_pumpkin = get("lit_pumpkin");
|
||||
public static final ItemMetalBlock lithium_block = get("lithium_block");
|
||||
public static final ItemMetal lithium_ingot = get("lithium_ingot");
|
||||
|
@ -521,11 +517,11 @@ public abstract class Items {
|
|||
public static final ItemDoor maple_door = get("maple_door");
|
||||
public static final ItemFence maple_fence = get("maple_fence");
|
||||
public static final ItemBlock maple_fence_gate = get("maple_fence_gate");
|
||||
public static final ItemColored maple_leaves_autumn = get("maple_leaves_autumn");
|
||||
public static final ItemColored maple_leaves_snowy = get("maple_leaves_snowy");
|
||||
public static final ItemColored maple_leaves_spring = get("maple_leaves_spring");
|
||||
public static final ItemColored maple_leaves_summer = get("maple_leaves_summer");
|
||||
public static final ItemColored maple_leaves_winter = get("maple_leaves_winter");
|
||||
public static final ItemBlock maple_leaves_autumn = get("maple_leaves_autumn");
|
||||
public static final ItemBlock maple_leaves_snowy = get("maple_leaves_snowy");
|
||||
public static final ItemBlock maple_leaves_spring = get("maple_leaves_spring");
|
||||
public static final ItemBlock maple_leaves_summer = get("maple_leaves_summer");
|
||||
public static final ItemBlock maple_leaves_winter = get("maple_leaves_winter");
|
||||
public static final ItemBlock maple_log = get("maple_log");
|
||||
public static final ItemBlock maple_planks = get("maple_planks");
|
||||
public static final ItemBlock maple_sapling = get("maple_sapling");
|
||||
|
@ -573,11 +569,11 @@ public abstract class Items {
|
|||
public static final ItemDoor oak_door = get("oak_door");
|
||||
public static final ItemFence oak_fence = get("oak_fence");
|
||||
public static final ItemBlock oak_fence_gate = get("oak_fence_gate");
|
||||
public static final ItemColored oak_leaves_autumn = get("oak_leaves_autumn");
|
||||
public static final ItemColored oak_leaves_snowy = get("oak_leaves_snowy");
|
||||
public static final ItemColored oak_leaves_spring = get("oak_leaves_spring");
|
||||
public static final ItemColored oak_leaves_summer = get("oak_leaves_summer");
|
||||
public static final ItemColored oak_leaves_winter = get("oak_leaves_winter");
|
||||
public static final ItemBlock oak_leaves_autumn = get("oak_leaves_autumn");
|
||||
public static final ItemBlock oak_leaves_snowy = get("oak_leaves_snowy");
|
||||
public static final ItemBlock oak_leaves_spring = get("oak_leaves_spring");
|
||||
public static final ItemBlock oak_leaves_summer = get("oak_leaves_summer");
|
||||
public static final ItemBlock oak_leaves_winter = get("oak_leaves_winter");
|
||||
public static final ItemBlock oak_log = get("oak_log");
|
||||
public static final ItemBlock oak_planks = get("oak_planks");
|
||||
public static final ItemBlock oak_sapling = get("oak_sapling");
|
||||
|
@ -687,7 +683,7 @@ public abstract class Items {
|
|||
public static final ItemBlock red_sand = get("red_sand");
|
||||
public static final ItemBlock red_tulip = get("red_tulip");
|
||||
public static final ItemBlock red_wool = get("red_wool");
|
||||
public static final ItemSmallBlock reeds = get("reeds");
|
||||
public static final ItemBlock reeds = get("reeds");
|
||||
public static final ItemBlock rock = get("rock");
|
||||
public static final ItemBlock rose = get("rose");
|
||||
public static final ItemDoublePlant rose_bush = get("rose_bush");
|
||||
|
@ -716,7 +712,7 @@ public abstract class Items {
|
|||
public static final ItemMetal silver_ingot = get("silver_ingot");
|
||||
public static final ItemMetalBlock silver_ore = get("silver_ore");
|
||||
public static final ItemBlock silver_wool = get("silver_wool");
|
||||
public static final ItemSmallBlock skull = get("skull");
|
||||
public static final ItemBlock skull = get("skull");
|
||||
public static final Item slime_ball = get("slime_ball");
|
||||
public static final ItemBlock slime_block = get("slime_block");
|
||||
public static final ItemBucket slime_bucket = get("slime_bucket");
|
||||
|
@ -737,11 +733,11 @@ public abstract class Items {
|
|||
public static final ItemDoor spruce_door = get("spruce_door");
|
||||
public static final ItemFence spruce_fence = get("spruce_fence");
|
||||
public static final ItemBlock spruce_fence_gate = get("spruce_fence_gate");
|
||||
public static final ItemColored spruce_leaves_autumn = get("spruce_leaves_autumn");
|
||||
public static final ItemColored spruce_leaves_snowy = get("spruce_leaves_snowy");
|
||||
public static final ItemColored spruce_leaves_spring = get("spruce_leaves_spring");
|
||||
public static final ItemColored spruce_leaves_summer = get("spruce_leaves_summer");
|
||||
public static final ItemColored spruce_leaves_winter = get("spruce_leaves_winter");
|
||||
public static final ItemBlock spruce_leaves_autumn = get("spruce_leaves_autumn");
|
||||
public static final ItemBlock spruce_leaves_snowy = get("spruce_leaves_snowy");
|
||||
public static final ItemBlock spruce_leaves_spring = get("spruce_leaves_spring");
|
||||
public static final ItemBlock spruce_leaves_summer = get("spruce_leaves_summer");
|
||||
public static final ItemBlock spruce_leaves_winter = get("spruce_leaves_winter");
|
||||
public static final ItemBlock spruce_log = get("spruce_log");
|
||||
public static final ItemBlock spruce_planks = get("spruce_planks");
|
||||
public static final ItemBlock spruce_sapling = get("spruce_sapling");
|
||||
|
@ -762,14 +758,14 @@ public abstract class Items {
|
|||
public static final ItemBlock stonebrick = get("stonebrick");
|
||||
public static final ItemSlab stonebrick_slab = get("stonebrick_slab");
|
||||
public static final ItemBlock stonebrick_stairs = get("stonebrick_stairs");
|
||||
public static final ItemSmallBlock string = get("string");
|
||||
public static final ItemBlock string = get("string");
|
||||
public static final Item sugar = get("sugar");
|
||||
public static final ItemMetalBlock sulfur_block = get("sulfur_block");
|
||||
public static final ItemMetalBlock sulfur_ore = get("sulfur_ore");
|
||||
public static final ItemMetal sulfur_powder = get("sulfur_powder");
|
||||
public static final ItemDoublePlant sunflower = get("sunflower");
|
||||
public static final ItemDoublePlant syringa = get("syringa");
|
||||
public static final ItemColored tallgrass = get("tallgrass");
|
||||
public static final ItemBlock tallgrass = get("tallgrass");
|
||||
public static final ItemAxe thetium_axe = get("thetium_axe");
|
||||
public static final ItemBlock thetium_block = get("thetium_block");
|
||||
public static final ItemArmor thetium_boots = get("thetium_boots");
|
||||
|
@ -786,11 +782,11 @@ public abstract class Items {
|
|||
public static final ItemDoor tian_door = get("tian_door");
|
||||
public static final ItemFence tian_fence = get("tian_fence");
|
||||
public static final ItemBlock tian_fence_gate = get("tian_fence_gate");
|
||||
public static final ItemColored tian_leaves_autumn = get("tian_leaves_autumn");
|
||||
public static final ItemColored tian_leaves_snowy = get("tian_leaves_snowy");
|
||||
public static final ItemColored tian_leaves_spring = get("tian_leaves_spring");
|
||||
public static final ItemColored tian_leaves_summer = get("tian_leaves_summer");
|
||||
public static final ItemColored tian_leaves_winter = get("tian_leaves_winter");
|
||||
public static final ItemBlock tian_leaves_autumn = get("tian_leaves_autumn");
|
||||
public static final ItemBlock tian_leaves_snowy = get("tian_leaves_snowy");
|
||||
public static final ItemBlock tian_leaves_spring = get("tian_leaves_spring");
|
||||
public static final ItemBlock tian_leaves_summer = get("tian_leaves_summer");
|
||||
public static final ItemBlock tian_leaves_winter = get("tian_leaves_winter");
|
||||
public static final ItemBlock tian_log = get("tian_log");
|
||||
public static final ItemBlock tian_planks = get("tian_planks");
|
||||
public static final ItemBlock tian_reactor = get("tian_reactor");
|
||||
|
@ -824,7 +820,7 @@ public abstract class Items {
|
|||
public static final ItemMetalBlock vanadium_block = get("vanadium_block");
|
||||
public static final ItemMetal vanadium_ingot = get("vanadium_ingot");
|
||||
public static final ItemMetalBlock vanadium_ore = get("vanadium_ore");
|
||||
public static final ItemColored vine = get("vine");
|
||||
public static final ItemBlock vine = get("vine");
|
||||
public static final ItemEditor editor = get("editor");
|
||||
public static final ItemBlock warp_chest = get("warp_chest");
|
||||
public static final ItemBucket water_bucket = get("water_bucket");
|
||||
|
@ -988,13 +984,13 @@ public abstract class Items {
|
|||
public static final ItemPotion potion_weakness = get("potion_weakness");
|
||||
public static final ItemPotion potion_weakness_base = get("potion_weakness_base");
|
||||
public static final ItemPotion potion_weakness_extended = get("potion_weakness_extended");
|
||||
public static final ItemChest large_chest = get("large_chest");
|
||||
public static final ItemChest giant_chest = get("giant_chest");
|
||||
public static final ItemChest huge_chest = get("huge_chest");
|
||||
public static final ItemChest toolarge_chest = get("toolarge_chest");
|
||||
public static final ItemChest xlarge_chest = get("xlarge_chest");
|
||||
public static final ItemChest xxlarge_chest = get("xxlarge_chest");
|
||||
public static final ItemChest xxxlarge_chest = get("xxxlarge_chest");
|
||||
public static final ItemBlock large_chest = get("large_chest");
|
||||
public static final ItemBlock giant_chest = get("giant_chest");
|
||||
public static final ItemBlock huge_chest = get("huge_chest");
|
||||
public static final ItemBlock toolarge_chest = get("toolarge_chest");
|
||||
public static final ItemBlock xlarge_chest = get("xlarge_chest");
|
||||
public static final ItemBlock xxlarge_chest = get("xxlarge_chest");
|
||||
public static final ItemBlock xxxlarge_chest = get("xxxlarge_chest");
|
||||
public static final ItemKey key = get("key");
|
||||
public static final ItemKey black_key = get("black_key");
|
||||
public static final ItemKey black_keycard = get("black_keycard");
|
||||
|
@ -1005,7 +1001,7 @@ public abstract class Items {
|
|||
public static final ItemKey shiny_key = get("shiny_key");
|
||||
public static final ItemBlock lamp = get("lamp");
|
||||
public static final ItemMagnetic charged_powder = get("charged_powder");
|
||||
public static final ItemWire wire = get("wire");
|
||||
public static final ItemBlock wire = get("wire");
|
||||
public static final ItemBlock charged_block = get("charged_block");
|
||||
public static final ItemBlock charge_ore = get("charge_ore");
|
||||
public static final ItemBlock torch = get("torch");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package common.item.block;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.natural.BlockSnow;
|
||||
import common.color.TextColor;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
|
@ -19,24 +20,12 @@ import common.world.World;
|
|||
public class ItemBlock extends Item
|
||||
{
|
||||
protected final Block block;
|
||||
protected final String flatTexture;
|
||||
|
||||
public ItemBlock(Block block, String flatTexture)
|
||||
{
|
||||
this.block = block;
|
||||
this.flatTexture = flatTexture;
|
||||
this.setDisplay(this.block.getDisplay());
|
||||
this.setTab(this.block.getTab());
|
||||
}
|
||||
|
||||
public ItemBlock(Block block, String flatTexture, boolean item)
|
||||
{
|
||||
this(block, (item ? "items" : "blocks") + "/" + flatTexture);
|
||||
}
|
||||
|
||||
public ItemBlock(Block block)
|
||||
{
|
||||
this(block, null);
|
||||
this.block = block;
|
||||
this.setDisplay(this.block.getDisplay());
|
||||
this.setTab(this.block.getTab());
|
||||
}
|
||||
|
||||
public ItemBlock setDisplay(String unlocalizedName)
|
||||
|
@ -56,7 +45,9 @@ public class ItemBlock extends Item
|
|||
State iblockstate = worldIn.getState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if (!block.isReplaceable(worldIn, pos))
|
||||
if(block == Blocks.snow_layer && iblockstate.getValue(BlockSnow.LAYERS).intValue() < 1)
|
||||
side = Facing.UP;
|
||||
else if (!block.isReplaceable(worldIn, pos))
|
||||
{
|
||||
pos = pos.offset(side);
|
||||
}
|
||||
|
@ -79,7 +70,7 @@ public class ItemBlock extends Item
|
|||
|
||||
if (iblockstate1.getBlock() == this.block)
|
||||
{
|
||||
this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack);
|
||||
this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn);
|
||||
}
|
||||
|
||||
worldIn.playSound(this.block.sound.getPlaceSound(), (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), 1.0F);
|
||||
|
@ -120,14 +111,18 @@ public class ItemBlock extends Item
|
|||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return this.flatTexture != null ? super.getTransform() : this.block.getTransform();
|
||||
return this.block.getRenderType() == 2 ? Transforms.DEFAULT : (this.block.hasBlockFlatTexture() || this.block.hasItemFlatTexture() ? super.getTransform() : this.block.getTransform());
|
||||
}
|
||||
|
||||
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.getName(this.block).toString(), this.block.getState()).getPrimary() /* "blocks/" + name */) :
|
||||
if(this.block.getRenderType() == 2)
|
||||
return provider.getModel(provider.getEntityModel(), this.getTransform());
|
||||
return this.block.hasBlockFlatTexture() || this.block.hasItemFlatTexture() ? provider.getModel(this.getTransform(), (this.block.hasBlockFlatTexture() ? "blocks" : "items") + "/" + this.block.getItemTexture(name)) :
|
||||
provider.getModel(this.block.getModel(provider,
|
||||
BlockRegistry.getName(this.block).toString(), this.block.getState()), this.getTransform());
|
||||
}
|
||||
BlockRegistry.getName(this.block), this.block.getState()), this.getTransform());
|
||||
}
|
||||
|
||||
public int getColorFromItemStack(ItemStack stack, int renderPass) {
|
||||
return this.block.isItemColored() ? this.block.getRenderColor(this.block.getState()) : super.getColorFromItemStack(stack, renderPass);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
package common.item.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(BlockChest block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name) {
|
||||
return provider.getModel(provider.getEntityModel(), this.getTransform());
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.DEFAULT;
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package common.item.block;
|
||||
|
||||
import common.block.Block;
|
||||
import common.item.ItemStack;
|
||||
|
||||
public class ItemColored extends ItemBlock
|
||||
{
|
||||
public ItemColored(Block block, String flatTexture)
|
||||
{
|
||||
super(block, flatTexture);
|
||||
}
|
||||
|
||||
public ItemColored(Block block)
|
||||
{
|
||||
super(block);
|
||||
}
|
||||
|
||||
public int getColorFromItemStack(ItemStack stack, int renderPass)
|
||||
{
|
||||
return this.block.getRenderColor(this.block.getState());
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ public class ItemDoublePlant extends ItemBlock
|
|||
|
||||
public ItemDoublePlant(BlockDoublePlant block)
|
||||
{
|
||||
super(block, "");
|
||||
super(block);
|
||||
this.type = block.getType();
|
||||
this.setMaxAmount(StackSize.S);
|
||||
}
|
||||
|
|
|
@ -10,11 +10,11 @@ import common.util.HitPosition;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class ItemLilyPad extends ItemColored
|
||||
public class ItemLilyPad extends ItemBlock
|
||||
{
|
||||
public ItemLilyPad(BlockLilyPad block)
|
||||
{
|
||||
super(block, "");
|
||||
super(block);
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
package common.item.block;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.natural.BlockSnow;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class ItemSmallBlock extends Item {
|
||||
private Block block;
|
||||
|
||||
public ItemSmallBlock(Block block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
return this.block;
|
||||
}
|
||||
|
||||
public boolean onItemUse(ItemStack stack, EntityNPC player, World world, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) {
|
||||
State state = world.getState(pos);
|
||||
Block block = state.getBlock();
|
||||
|
||||
if(block == Blocks.snow_layer && state.getValue(BlockSnow.LAYERS).intValue() < 1)
|
||||
side = Facing.UP;
|
||||
else if(!block.isReplaceable(world, pos))
|
||||
pos = pos.offset(side);
|
||||
|
||||
if(!player.canPlayerEdit(pos, side, stack) || stack.isEmpty())
|
||||
return false;
|
||||
if(world.canBlockBePlaced(this.block, pos, false, side, null, stack)) {
|
||||
State newState = this.block.onBlockPlaced(world, pos, side, hitX, hitY, hitZ, player);
|
||||
|
||||
if(world.setState(pos, newState, 3)) {
|
||||
newState = world.getState(pos);
|
||||
|
||||
if(newState.getBlock() == this.block) {
|
||||
newState.getBlock().onBlockPlacedBy(world, pos, newState, player, stack);
|
||||
}
|
||||
|
||||
world.playSound(this.block.sound.getPlaceSound(), (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F),
|
||||
(double)((float)pos.getZ() + 0.5F), 1.0F);
|
||||
stack.decrSize();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
return this.block.isMagnetic();
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
package common.item.block;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.tech.BlockWire;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.StackSize;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.World;
|
||||
|
||||
public class ItemWire extends Item
|
||||
{
|
||||
private final BlockWire block;
|
||||
|
||||
public ItemWire(BlockWire block)
|
||||
{
|
||||
this.block = block;
|
||||
this.setTab(CheatTab.TECHNOLOGY);
|
||||
this.setDisplay(block.getDisplay());
|
||||
this.setMaxAmount(StackSize.XL);
|
||||
}
|
||||
|
||||
public Block getBlock()
|
||||
{
|
||||
return this.block;
|
||||
}
|
||||
|
||||
public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
boolean flag = worldIn.getState(pos).getBlock().isReplaceable(worldIn, pos);
|
||||
BlockPos blockpos = flag ? pos : pos.offset(side);
|
||||
|
||||
if (!playerIn.canPlayerEdit(blockpos, side, stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Block block = worldIn.getState(blockpos).getBlock();
|
||||
|
||||
if (!worldIn.canBlockBePlaced(block, blockpos, false, side, (Entity)null, stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (this.block.canPlaceBlockAt(worldIn, blockpos))
|
||||
{
|
||||
stack.decrSize();
|
||||
worldIn.setState(blockpos, this.block.getState());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -12,8 +12,7 @@ import common.init.Blocks;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.item.StackSize;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
|
@ -27,21 +26,29 @@ public class ItemDye extends Item {
|
|||
private static final ItemDye[] DIES = new ItemDye[DyeColor.values().length];
|
||||
|
||||
private final DyeColor color;
|
||||
private final Block block;
|
||||
|
||||
public static ItemDye getByColor(DyeColor color) {
|
||||
return DIES[color.ordinal()];
|
||||
}
|
||||
|
||||
public ItemDye(DyeColor color)
|
||||
public ItemDye(DyeColor color, Block block)
|
||||
{
|
||||
this.color = color;
|
||||
this.setTab(color == DyeColor.BLUE ? CheatTab.METALS : CheatTab.MATERIALS);
|
||||
this.block = block;
|
||||
this.setTab(color == DyeColor.BROWN ? CheatTab.PLANTS : (color == DyeColor.BLUE ? CheatTab.METALS : CheatTab.MATERIALS));
|
||||
this.setDisplay(color.getDyeName());
|
||||
this.setMaxAmount(StackSize.XXL);
|
||||
DIES[this.color.ordinal()] = this;
|
||||
}
|
||||
|
||||
public DyeColor getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
return this.block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a Block is right-clicked with this Item
|
||||
|
@ -87,7 +94,7 @@ public class ItemDye extends Item {
|
|||
|
||||
if (worldIn.isAirBlock(pos))
|
||||
{
|
||||
State iblockstate1 = Blocks.cocoa.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, playerIn);
|
||||
State iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, playerIn);
|
||||
worldIn.setState(pos, iblockstate1, 2);
|
||||
|
||||
// if (!playerIn.creative)
|
||||
|
@ -203,10 +210,6 @@ public class ItemDye extends Item {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name) {
|
||||
return provider.getModel(this.getTransform(), "dye_" + this.color.getName());
|
||||
}
|
||||
|
||||
public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
if(this.color != DyeColor.WHITE)
|
||||
|
|
|
@ -30,7 +30,6 @@ import common.packet.SPacketTabComplete;
|
|||
import common.packet.SPacketUpdateEntityTags;
|
||||
import common.packet.SPacketAnimation;
|
||||
import common.packet.SPacketBiome;
|
||||
import common.packet.SPacketBlockAction;
|
||||
import common.packet.SPacketBlockBreakAnim;
|
||||
import common.packet.SPacketBlockChange;
|
||||
import common.packet.SPacketCamera;
|
||||
|
@ -121,7 +120,6 @@ public interface IClientPlayer extends NetHandler {
|
|||
void handleWindowProperty(SPacketWindowProperty packet);
|
||||
void handleEntityEquipment(SPacketEntityEquipment packet);
|
||||
void handleCloseWindow(SPacketCloseWindow packet);
|
||||
void handleBlockAction(SPacketBlockAction packet);
|
||||
void handleBlockBreakAnim(SPacketBlockBreakAnim packet);
|
||||
void handleMapChunkBulk(SPacketMapChunkBulk packet);
|
||||
void handleChangeGameState(SPacketChangeGameState packet);
|
||||
|
|
|
@ -67,7 +67,6 @@ import common.packet.SPacketTabComplete;
|
|||
import common.packet.SPacketUpdateEntityTags;
|
||||
import common.packet.SPacketAnimation;
|
||||
import common.packet.SPacketBiome;
|
||||
import common.packet.SPacketBlockAction;
|
||||
import common.packet.SPacketBlockBreakAnim;
|
||||
import common.packet.SPacketBlockChange;
|
||||
import common.packet.SPacketCamera;
|
||||
|
@ -153,7 +152,6 @@ public enum PacketRegistry {
|
|||
this.server(SPacketChunkData.class);
|
||||
this.server(SPacketMultiBlockChange.class);
|
||||
this.server(SPacketBlockChange.class);
|
||||
this.server(SPacketBlockAction.class);
|
||||
this.server(SPacketBlockBreakAnim.class);
|
||||
this.server(SPacketMapChunkBulk.class);
|
||||
this.server(SPacketExplosion.class);
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
package common.packet;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.BlockRegistry;
|
||||
import common.network.IClientPlayer;
|
||||
import common.network.Packet;
|
||||
import common.network.PacketBuffer;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
|
||||
public class SPacketBlockAction implements Packet<IClientPlayer>
|
||||
{
|
||||
private BlockPos blockPosition;
|
||||
private int instrument;
|
||||
private int pitch;
|
||||
private Block block;
|
||||
|
||||
public SPacketBlockAction()
|
||||
{
|
||||
}
|
||||
|
||||
public SPacketBlockAction(BlockPos blockPositionIn, Block blockIn, int instrumentIn, int pitchIn)
|
||||
{
|
||||
this.blockPosition = blockPositionIn;
|
||||
this.instrument = instrumentIn;
|
||||
this.pitch = pitchIn;
|
||||
this.block = blockIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the raw packet data from the data stream.
|
||||
*/
|
||||
public void readPacketData(PacketBuffer buf) throws IOException
|
||||
{
|
||||
this.blockPosition = buf.readBlockPos();
|
||||
this.instrument = buf.readUnsignedByte();
|
||||
this.pitch = buf.readUnsignedByte();
|
||||
State state = BlockRegistry.byId(buf.readVarInt());
|
||||
this.block = state == null ? null : state.getBlock();
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the raw packet data to the data stream.
|
||||
*/
|
||||
public void writePacketData(PacketBuffer buf) throws IOException
|
||||
{
|
||||
buf.writeBlockPos(this.blockPosition);
|
||||
buf.writeByte(this.instrument);
|
||||
buf.writeByte(this.pitch);
|
||||
buf.writeVarInt(BlockRegistry.getId(this.block.getState()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Passes this Packet on to the NetHandler for processing.
|
||||
*/
|
||||
public void processPacket(IClientPlayer handler)
|
||||
{
|
||||
handler.handleBlockAction(this);
|
||||
}
|
||||
|
||||
public BlockPos getBlockPosition()
|
||||
{
|
||||
return this.blockPosition;
|
||||
}
|
||||
|
||||
public int getData1()
|
||||
{
|
||||
return this.instrument;
|
||||
}
|
||||
|
||||
public int getData2()
|
||||
{
|
||||
return this.pitch;
|
||||
}
|
||||
|
||||
public Block getBlockType()
|
||||
{
|
||||
return this.block;
|
||||
}
|
||||
}
|
|
@ -161,11 +161,6 @@ public abstract class TileEntity
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean receiveClientEvent(int id, int type)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void updateContainingBlockInfo()
|
||||
{
|
||||
this.blockType = null;
|
||||
|
|
|
@ -262,17 +262,9 @@ public class TileEntityChest extends TileEntity implements ITickable, IInventory
|
|||
}
|
||||
}
|
||||
|
||||
public boolean receiveClientEvent(int id, int type)
|
||||
public void setUsing(int using)
|
||||
{
|
||||
if (id == 1)
|
||||
{
|
||||
this.numPlayersUsing = type;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.receiveClientEvent(id, type);
|
||||
}
|
||||
this.numPlayersUsing = using;
|
||||
}
|
||||
|
||||
public void openInventory(EntityNPC player)
|
||||
|
@ -285,7 +277,7 @@ public class TileEntityChest extends TileEntity implements ITickable, IInventory
|
|||
}
|
||||
|
||||
++this.numPlayersUsing;
|
||||
this.worldObj.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing);
|
||||
this.worldObj.playAuxSFX(2016, this.pos, this.numPlayersUsing);
|
||||
this.worldObj.notifyNeighborsOfStateChange(this.pos, this.getBlockType());
|
||||
this.worldObj.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType());
|
||||
// }
|
||||
|
@ -296,7 +288,7 @@ public class TileEntityChest extends TileEntity implements ITickable, IInventory
|
|||
if (/* !player.isSpectator() && */ this.getBlockType() instanceof BlockChest)
|
||||
{
|
||||
--this.numPlayersUsing;
|
||||
this.worldObj.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing);
|
||||
this.worldObj.playAuxSFX(2016, this.pos, this.numPlayersUsing);
|
||||
this.worldObj.notifyNeighborsOfStateChange(this.pos, this.getBlockType());
|
||||
this.worldObj.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType());
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
import java.util.function.Predicate;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.ITileEntityProvider;
|
||||
import common.block.tech.BlockChest;
|
||||
import common.block.tech.BlockHopper;
|
||||
import common.collect.Lists;
|
||||
|
@ -625,7 +626,7 @@ public class TileEntityHopper extends TileEntityInventory implements ITickable
|
|||
BlockPos blockpos = new BlockPos(i, j, k);
|
||||
Block block = worldIn.getState(blockpos).getBlock();
|
||||
|
||||
if (block.hasTileEntity())
|
||||
if (block instanceof ITileEntityProvider)
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(blockpos);
|
||||
|
||||
|
|
|
@ -1,222 +0,0 @@
|
|||
package common.tileentity;
|
||||
|
||||
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;
|
||||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
|
||||
public class TileEntityPiston extends TileEntity implements ITickable
|
||||
{
|
||||
private State pistonState;
|
||||
private Facing pistonFacing;
|
||||
|
||||
/** if this piston is extending or not */
|
||||
private boolean extending;
|
||||
private boolean shouldHeadBeRendered;
|
||||
private float progress;
|
||||
|
||||
/** the progress in (de)extending */
|
||||
private float lastProgress;
|
||||
private List<Entity> field_174933_k = Lists.<Entity>newArrayList();
|
||||
|
||||
public TileEntityPiston()
|
||||
{
|
||||
}
|
||||
|
||||
public TileEntityPiston(State pistonStateIn, Facing pistonFacingIn, boolean extendingIn, boolean shouldHeadBeRenderedIn)
|
||||
{
|
||||
this.pistonState = pistonStateIn;
|
||||
this.pistonFacing = pistonFacingIn;
|
||||
this.extending = extendingIn;
|
||||
this.shouldHeadBeRendered = shouldHeadBeRenderedIn;
|
||||
}
|
||||
|
||||
public State getPistonState()
|
||||
{
|
||||
return this.pistonState;
|
||||
}
|
||||
|
||||
public State getBlockState()
|
||||
{
|
||||
return Blocks.piston_extension.getState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a piston is extending
|
||||
*/
|
||||
public boolean isExtending()
|
||||
{
|
||||
return this.extending;
|
||||
}
|
||||
|
||||
public Facing getFacing()
|
||||
{
|
||||
return this.pistonFacing;
|
||||
}
|
||||
|
||||
public boolean shouldPistonHeadBeRendered()
|
||||
{
|
||||
return this.shouldHeadBeRendered;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get interpolated progress value (between lastProgress and progress) given the fractional time between ticks as an
|
||||
* argument
|
||||
*/
|
||||
public float getProgress(float ticks)
|
||||
{
|
||||
if (ticks > 1.0F)
|
||||
{
|
||||
ticks = 1.0F;
|
||||
}
|
||||
|
||||
return this.lastProgress + (this.progress - this.lastProgress) * ticks;
|
||||
}
|
||||
|
||||
public float getOffsetX(float ticks)
|
||||
{
|
||||
return this.extending ? (this.getProgress(ticks) - 1.0F) * (float)this.pistonFacing.getFrontOffsetX() : (1.0F - this.getProgress(ticks)) * (float)this.pistonFacing.getFrontOffsetX();
|
||||
}
|
||||
|
||||
public float getOffsetY(float ticks)
|
||||
{
|
||||
return this.extending ? (this.getProgress(ticks) - 1.0F) * (float)this.pistonFacing.getFrontOffsetY() : (1.0F - this.getProgress(ticks)) * (float)this.pistonFacing.getFrontOffsetY();
|
||||
}
|
||||
|
||||
public float getOffsetZ(float ticks)
|
||||
{
|
||||
return this.extending ? (this.getProgress(ticks) - 1.0F) * (float)this.pistonFacing.getFrontOffsetZ() : (1.0F - this.getProgress(ticks)) * (float)this.pistonFacing.getFrontOffsetZ();
|
||||
}
|
||||
|
||||
private void launchWithSlimeBlock(float p_145863_1_, float p_145863_2_)
|
||||
{
|
||||
if (this.extending)
|
||||
{
|
||||
p_145863_1_ = 1.0F - p_145863_1_;
|
||||
}
|
||||
else
|
||||
{
|
||||
--p_145863_1_;
|
||||
}
|
||||
|
||||
BoundingBox axisalignedbb = Blocks.piston_extension.getBoundingBox(this.worldObj, this.pos, this.pistonState, p_145863_1_, this.pistonFacing);
|
||||
|
||||
if (axisalignedbb != null)
|
||||
{
|
||||
List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity((Entity)null, axisalignedbb);
|
||||
|
||||
if (!list.isEmpty())
|
||||
{
|
||||
this.field_174933_k.addAll(list);
|
||||
|
||||
for (Entity entity : this.field_174933_k)
|
||||
{
|
||||
if (this.pistonState.getBlock() == Blocks.slime_block && this.extending)
|
||||
{
|
||||
switch (this.pistonFacing.getAxis())
|
||||
{
|
||||
case X:
|
||||
entity.motionX = (double)this.pistonFacing.getFrontOffsetX();
|
||||
break;
|
||||
|
||||
case Y:
|
||||
entity.motionY = (double)this.pistonFacing.getFrontOffsetY();
|
||||
break;
|
||||
|
||||
case Z:
|
||||
entity.motionZ = (double)this.pistonFacing.getFrontOffsetZ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.moveEntity((double)(p_145863_2_ * (float)this.pistonFacing.getFrontOffsetX()), (double)(p_145863_2_ * (float)this.pistonFacing.getFrontOffsetY()), (double)(p_145863_2_ * (float)this.pistonFacing.getFrontOffsetZ()));
|
||||
}
|
||||
}
|
||||
|
||||
this.field_174933_k.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* removes a piston's tile entity (and if the piston is moving, stops it)
|
||||
*/
|
||||
public void clearPistonTileEntity()
|
||||
{
|
||||
if (this.lastProgress < 1.0F && this.worldObj != null)
|
||||
{
|
||||
this.lastProgress = this.progress = 1.0F;
|
||||
this.worldObj.removeTileEntity(this.pos);
|
||||
this.invalidate();
|
||||
|
||||
if (this.worldObj.getState(this.pos).getBlock() == Blocks.piston_extension)
|
||||
{
|
||||
this.worldObj.setState(this.pos, this.pistonState, 3);
|
||||
this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Like the old updateEntity(), except more generic.
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
this.lastProgress = this.progress;
|
||||
|
||||
if (this.lastProgress >= 1.0F)
|
||||
{
|
||||
this.launchWithSlimeBlock(1.0F, 0.25F);
|
||||
this.worldObj.removeTileEntity(this.pos);
|
||||
this.invalidate();
|
||||
|
||||
if (this.worldObj.getState(this.pos).getBlock() == Blocks.piston_extension)
|
||||
{
|
||||
this.worldObj.setState(this.pos, this.pistonState, 3);
|
||||
this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.progress += 0.5F;
|
||||
|
||||
if (this.progress >= 1.0F)
|
||||
{
|
||||
this.progress = 1.0F;
|
||||
}
|
||||
|
||||
if (this.extending)
|
||||
{
|
||||
this.launchWithSlimeBlock(this.progress, this.progress - this.lastProgress + 0.0625F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void readTags(TagObject compound)
|
||||
{
|
||||
super.readTags(compound);
|
||||
this.pistonState = BlockRegistry.byName(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");
|
||||
}
|
||||
|
||||
public void writeTags(TagObject compound)
|
||||
{
|
||||
super.writeTags(compound);
|
||||
compound.setString("block", BlockRegistry.getName(this.pistonState));
|
||||
compound.setInt("facing", this.pistonFacing.getIndex());
|
||||
compound.setFloat("progress", this.lastProgress);
|
||||
compound.setBool("extending", this.extending);
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return 0x7f7f7f;
|
||||
}
|
||||
}
|
|
@ -347,7 +347,7 @@ public abstract class Chunk {
|
|||
if(!this.world.client) {
|
||||
oldb.onBlockRemoved((AWorldServer)this.world, pos, old);
|
||||
}
|
||||
else if(oldb instanceof ITileEntityProvider) {
|
||||
if(oldb instanceof ITileEntityProvider) {
|
||||
this.world.removeTileEntity(pos);
|
||||
}
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ public abstract class Chunk {
|
|||
|
||||
private TileEntity createNewTileEntity(BlockPos pos) {
|
||||
Block block = this.getBlock(pos);
|
||||
return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity();
|
||||
return !(block instanceof ITileEntityProvider provider) ? null : provider.createNewTileEntity();
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity(BlockPos pos, TileEntity.EnumCreateEntityType type) {
|
||||
|
@ -671,7 +671,7 @@ public abstract class Chunk {
|
|||
while(!this.tileQueue.isEmpty()) {
|
||||
BlockPos pos = (BlockPos)this.tileQueue.poll();
|
||||
|
||||
if(this.getTileEntity(pos, TileEntity.EnumCreateEntityType.CHECK) == null && this.getBlock(pos).hasTileEntity()) {
|
||||
if(this.getTileEntity(pos, TileEntity.EnumCreateEntityType.CHECK) == null && this.getBlock(pos) instanceof ITileEntityProvider) {
|
||||
TileEntity tile = this.createNewTileEntity(pos);
|
||||
this.world.setTileEntity(pos, tile);
|
||||
this.world.markBlockRangeForRenderUpdate(pos, pos);
|
||||
|
|
|
@ -1824,7 +1824,7 @@ public abstract class World implements IWorldAccess {
|
|||
BoundingBox axisalignedbb = p_175716_3_ ? null : blockIn.getCollisionBoundingBox(this, pos, blockIn.getState());
|
||||
return axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, entityIn) ? false
|
||||
: (block.getMaterial() == Material.SMALL && blockIn instanceof BlockAnvil ? true
|
||||
: block.getMaterial().isReplaceable() && blockIn.canReplace(this, pos, side, itemStackIn));
|
||||
: block.getMaterial().isReplaceable() && blockIn.canPlaceBlockOnSide(this, pos, side));
|
||||
}
|
||||
|
||||
public int getSeaLevel() {
|
||||
|
@ -1886,10 +1886,6 @@ public abstract class World implements IWorldAccess {
|
|||
public void setEntityState(Entity entityIn, byte state) {
|
||||
}
|
||||
|
||||
public void addBlockEvent(BlockPos pos, Block blockIn, int eventID, int eventParam) {
|
||||
blockIn.onBlockEventReceived(this, pos, this.getState(pos), eventID, eventParam);
|
||||
}
|
||||
|
||||
public Weather getWeather() {
|
||||
return this.weather;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue