general Block* code cleanup
This commit is contained in:
parent
8bd9370bab
commit
7fd8879c73
294 changed files with 2229 additions and 2650 deletions
|
@ -114,6 +114,7 @@ import common.future.ListenableFuture;
|
|||
import common.future.ListenableFutureTask;
|
||||
import common.future.ThreadFactoryBuilder;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.init.EntityRegistry;
|
||||
import common.init.ItemRegistry;
|
||||
|
@ -129,7 +130,6 @@ import common.item.ItemStack;
|
|||
import common.log.Log;
|
||||
import common.log.LogLevel;
|
||||
import common.log.Message;
|
||||
import common.material.Material;
|
||||
import common.network.IThreadListener;
|
||||
import common.network.NetConnection;
|
||||
import common.network.PacketDecoder;
|
||||
|
@ -1267,7 +1267,7 @@ public class Client implements IThreadListener {
|
|||
{
|
||||
BlockPos blockpos = this.pointed.block;
|
||||
|
||||
if (this.world.getState(blockpos).getBlock().getMaterial() != Material.air && this.controller.onPlayerDamageBlock(blockpos, this.pointed.side))
|
||||
if (this.world.getState(blockpos).getBlock() != Blocks.air && this.controller.onPlayerDamageBlock(blockpos, this.pointed.side))
|
||||
{
|
||||
this.effectRenderer.addBlockHitEffects(blockpos, this.pointed.side);
|
||||
this.player.swingItem();
|
||||
|
@ -1293,7 +1293,7 @@ public class Client implements IThreadListener {
|
|||
else
|
||||
{
|
||||
ItemStack itemstack = this.player.inventory.getCurrentItem();
|
||||
if ((this.pointed.type != ObjectType.BLOCK || this.world.getState(this.pointed.block).getBlock().getMaterial() == Material.air) && itemstack != null && itemstack.getItem().onAction(itemstack, this.player, this.world, ItemControl.PRIMARY, null))
|
||||
if ((this.pointed.type != ObjectType.BLOCK || this.world.getState(this.pointed.block).getBlock() == Blocks.air) && itemstack != null && itemstack.getItem().onAction(itemstack, this.player, this.world, ItemControl.PRIMARY, null))
|
||||
{
|
||||
this.player.swingItem();
|
||||
this.player.client.addToSendQueue(new CPacketAction(Action.ITEM_ACTION, ItemControl.PRIMARY.ordinal()));
|
||||
|
@ -1310,7 +1310,7 @@ public class Client implements IThreadListener {
|
|||
case BLOCK:
|
||||
this.player.swingItem();
|
||||
BlockPos blockpos = this.pointed.block;
|
||||
if (this.world.getState(blockpos).getBlock().getMaterial() != Material.air)
|
||||
if (this.world.getState(blockpos).getBlock() != Blocks.air)
|
||||
{
|
||||
this.controller.clickBlock(blockpos, this.pointed.side);
|
||||
break;
|
||||
|
@ -1345,7 +1345,7 @@ public class Client implements IThreadListener {
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((this.pointed.type != ObjectType.BLOCK || this.world.getState(this.pointed.block).getBlock().getMaterial() == Material.air) && itemstack != null && itemstack.getItem().onAction(itemstack, this.player, this.world, ItemControl.SECONDARY, null))
|
||||
if ((this.pointed.type != ObjectType.BLOCK || this.world.getState(this.pointed.block).getBlock() == Blocks.air) && itemstack != null && itemstack.getItem().onAction(itemstack, this.player, this.world, ItemControl.SECONDARY, null))
|
||||
{
|
||||
this.player.swingItem();
|
||||
this.player.client.addToSendQueue(new CPacketAction(Action.ITEM_ACTION, ItemControl.SECONDARY.ordinal()));
|
||||
|
@ -1370,7 +1370,7 @@ public class Client implements IThreadListener {
|
|||
case BLOCK:
|
||||
BlockPos blockpos = this.pointed.block;
|
||||
|
||||
if (this.world.getState(blockpos).getBlock().getMaterial() != Material.air)
|
||||
if (this.world.getState(blockpos).getBlock() != Blocks.air)
|
||||
{
|
||||
int i = itemstack != null ? itemstack.stackSize : 0;
|
||||
|
||||
|
@ -1430,7 +1430,7 @@ public class Client implements IThreadListener {
|
|||
BlockPos blockpos = this.pointed.block;
|
||||
Block block = this.world.getState(blockpos).getBlock();
|
||||
|
||||
if (block.getMaterial() == Material.air)
|
||||
if (block == Blocks.air)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package client.gui.container;
|
||||
|
||||
import common.block.BlockWorkbench;
|
||||
import common.block.tech.BlockWorkbench;
|
||||
import common.inventory.ContainerWorkbench;
|
||||
import common.inventory.InventoryPlayer;
|
||||
import common.util.BlockPos;
|
||||
|
|
|
@ -35,7 +35,7 @@ import common.attributes.AttributeInstance;
|
|||
import common.attributes.AttributeMap;
|
||||
import common.attributes.AttributeModifier;
|
||||
import common.block.Block;
|
||||
import common.block.BlockWorkbench;
|
||||
import common.block.tech.BlockWorkbench;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.dimension.Dimension;
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.nio.IntBuffer;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockLiquid;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.util.BlockPos;
|
||||
|
|
|
@ -15,7 +15,7 @@ import client.renderer.texture.TextureAtlasSprite;
|
|||
import client.renderer.texture.TextureMap;
|
||||
import client.renderer.tileentity.TileEntityItemStackRenderer;
|
||||
import common.block.Block;
|
||||
import common.block.BlockLiquid;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.collect.Maps;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.FluidRegistry;
|
||||
|
|
|
@ -20,6 +20,7 @@ import common.entity.Entity;
|
|||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityAnimal;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.material.Material;
|
||||
|
@ -1168,7 +1169,7 @@ public class EntityRenderer {
|
|||
if(temp < 194.0f || this.random.chance(5))
|
||||
this.gm.world.spawnParticle(temp >= 194.0f && this.random.chance(10) ? ParticleType.LAVA : ParticleType.SMOKE_NORMAL, (double)blockpos1.getX() + d3, (double)((float)blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(), (double)blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (block.getMaterial() != Material.air)
|
||||
else if (block != Blocks.air)
|
||||
{
|
||||
block.setBlockBoundsBasedOnState(world, blockpos2);
|
||||
++j;
|
||||
|
|
|
@ -192,7 +192,7 @@ public class RegionRenderCache implements IWorldAccess
|
|||
// */
|
||||
// public boolean isAirBlock(BlockPos pos)
|
||||
// {
|
||||
// return this.getBlockState(pos).getBlock().getMaterial() == Material.air;
|
||||
// return this.getBlockState(pos).getBlock() == Blocks.air;
|
||||
// }
|
||||
|
||||
public int getLightFor(LightType p_175628_1_, BlockPos pos)
|
||||
|
|
|
@ -28,9 +28,9 @@ import client.renderer.tileentity.TileEntityRendererDispatcher;
|
|||
import client.world.ChunkClient;
|
||||
import client.world.WorldClient;
|
||||
import common.block.Block;
|
||||
import common.block.BlockChest;
|
||||
import common.block.BlockSign;
|
||||
import common.block.BlockSkull;
|
||||
import common.block.tech.BlockChest;
|
||||
import common.block.tile.BlockSign;
|
||||
import common.block.tile.BlockSkull;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.collect.Sets;
|
||||
|
@ -38,7 +38,7 @@ import common.entity.Entity;
|
|||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.projectile.EntityBox;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.material.Material;
|
||||
import common.init.Blocks;
|
||||
import common.model.BlockLayer;
|
||||
import common.rng.Random;
|
||||
import common.sound.Sound;
|
||||
|
@ -1580,7 +1580,7 @@ public class RenderGlobal
|
|||
{
|
||||
State iblockstate = this.theWorld.getState(blockpos);
|
||||
|
||||
if (iblockstate.getBlock().getMaterial() != Material.air)
|
||||
if (iblockstate.getBlock() != Blocks.air)
|
||||
{
|
||||
int i = destroyblockprogress.getPartialBlockDamage();
|
||||
TextureAtlasSprite textureatlassprite = this.destroyBlockIcons[i];
|
||||
|
@ -1616,7 +1616,7 @@ public class RenderGlobal
|
|||
BlockPos blockpos = movingObjectPositionIn.block;
|
||||
Block block = this.theWorld.getState(blockpos).getBlock();
|
||||
|
||||
if (block.getMaterial() != Material.air) // && this.theWorld.getWorldBorder().contains(blockpos))
|
||||
if (block != Blocks.air) // && this.theWorld.getWorldBorder().contains(blockpos))
|
||||
{
|
||||
block.setBlockBoundsBasedOnState(this.theWorld, blockpos);
|
||||
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks;
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.Set;
|
|||
import client.renderer.texture.TextureAtlasSprite;
|
||||
import client.renderer.texture.TextureMap;
|
||||
import common.block.Block;
|
||||
import common.block.BlockLiquid;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.collect.Maps;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
|
|
|
@ -6,7 +6,7 @@ import client.Client;
|
|||
import client.renderer.BlockRenderer;
|
||||
import client.renderer.GlState;
|
||||
import client.renderer.texture.TextureMap;
|
||||
import common.block.BlockTNT;
|
||||
import common.block.tech.BlockTNT;
|
||||
import common.entity.item.EntityTnt;
|
||||
import common.init.Blocks;
|
||||
import common.util.ExtMath;
|
||||
|
|
|
@ -16,7 +16,7 @@ import common.block.Block;
|
|||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.entity.Entity;
|
||||
import common.material.Material;
|
||||
import common.init.Blocks;
|
||||
import common.model.ParticleType;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -319,7 +319,7 @@ public class EffectRenderer
|
|||
|
||||
public void addBlockDestroyEffects(BlockPos pos, State state)
|
||||
{
|
||||
if (state.getBlock().getMaterial() != Material.air)
|
||||
if (state.getBlock() != Blocks.air)
|
||||
{
|
||||
state = state.getBlock().getActualState(state, this.worldObj, pos);
|
||||
int i = 4;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockLiquid;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.material.Material;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import common.block.BlockLiquid;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.material.Material;
|
||||
import common.model.ParticleType;
|
||||
import common.util.BlockPos;
|
||||
|
|
|
@ -6,7 +6,7 @@ import client.renderer.GlState;
|
|||
import client.renderer.model.ModelChest;
|
||||
import client.renderer.model.ModelLargeChest;
|
||||
import common.block.Block;
|
||||
import common.block.BlockChest;
|
||||
import common.block.tech.BlockChest;
|
||||
import common.tileentity.TileEntityChest;
|
||||
|
||||
|
||||
|
|
|
@ -11,10 +11,9 @@ import client.renderer.RenderBuffer;
|
|||
import client.renderer.Tessellator;
|
||||
import client.renderer.texture.TextureMap;
|
||||
import common.block.Block;
|
||||
import common.block.BlockPistonBase;
|
||||
import common.block.BlockPistonHead;
|
||||
import common.block.tech.BlockPistonBase;
|
||||
import common.block.tech.BlockPistonHead;
|
||||
import common.init.Blocks;
|
||||
import common.material.Material;
|
||||
import common.tileentity.TileEntityPiston;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
|
@ -30,7 +29,7 @@ public class TileEntityPistonRenderer extends TileEntitySpecialRenderer<TileEnti
|
|||
State iblockstate = te.getPistonState();
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if (block.getMaterial() != Material.air && te.getProgress(partialTicks) < 1.0F)
|
||||
if (block != Blocks.air && te.getProgress(partialTicks) < 1.0F)
|
||||
{
|
||||
// Tessellator tessellator = Tessellator.getInstance();
|
||||
RenderBuffer worldrenderer = Tessellator.getBuffer();
|
||||
|
|
|
@ -7,11 +7,11 @@ import common.block.Block;
|
|||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.init.EntityRegistry;
|
||||
import common.item.ItemBlock;
|
||||
import common.item.ItemControl;
|
||||
import common.item.ItemStack;
|
||||
import common.material.Material;
|
||||
import common.packet.CPacketAction;
|
||||
import common.packet.CPacketBreak;
|
||||
import common.packet.CPacketClick;
|
||||
|
@ -118,7 +118,7 @@ public class PlayerController
|
|||
State iblockstate = world.getState(pos);
|
||||
Block block1 = iblockstate.getBlock();
|
||||
|
||||
if (block1.getMaterial() == Material.air)
|
||||
if (block1 == Blocks.air)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ public class PlayerController
|
|||
|
||||
this.netClientHandler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.START_DESTROY_BLOCK, loc, face));
|
||||
Block block1 = this.gm.world.getState(loc).getBlock();
|
||||
boolean flag = block1.getMaterial() != Material.air;
|
||||
boolean flag = block1 != Blocks.air;
|
||||
|
||||
if (flag && this.curBlockDamageMP == 0.0F)
|
||||
{
|
||||
|
@ -280,7 +280,7 @@ public class PlayerController
|
|||
{
|
||||
Block block = this.gm.world.getState(posBlock).getBlock();
|
||||
|
||||
if (block.getMaterial() == Material.air)
|
||||
if (block == Blocks.air)
|
||||
{
|
||||
this.isHittingBlock = false;
|
||||
return false;
|
||||
|
|
|
@ -15,12 +15,12 @@ import common.entity.Entity;
|
|||
import common.entity.item.EntityCart;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.init.ItemRegistry;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.item.ItemDye;
|
||||
import common.log.Log;
|
||||
import common.material.Material;
|
||||
import common.model.ParticleType;
|
||||
import common.nbt.NBTTagCompound;
|
||||
import common.rng.Random;
|
||||
|
@ -637,7 +637,7 @@ public class WorldClient extends AWorldClient
|
|||
case 2001:
|
||||
Block block = BlockRegistry.getBlockById(data & 4095);
|
||||
|
||||
if (block.getMaterial() != Material.air)
|
||||
if (block != Blocks.air)
|
||||
{
|
||||
this.gm.getSoundManager().playSound(new PositionedSound(block.sound.getBreakSound(), 1.0F, /* block.sound.getFrequency() * 0.8F, */ (float)blockPosIn.getX() + 0.5F, (float)blockPosIn.getY() + 0.5F, (float)blockPosIn.getZ() + 0.5F));
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package common.ai;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockSlab;
|
||||
import common.block.BlockStairs;
|
||||
import common.block.artificial.BlockSlab;
|
||||
import common.block.artificial.BlockStairs;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.item.ItemStack;
|
||||
import common.material.Material;
|
||||
import common.pathfinding.WalkNodeProcessor;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
|
@ -162,7 +162,7 @@ public class EntityAIControlledByPlayer extends EntityAIBase
|
|||
if (i != l || k != i1)
|
||||
{
|
||||
Block block = this.thisEntity.worldObj.getState(new BlockPos(i, j, k)).getBlock();
|
||||
boolean flag = !this.isStairOrSlab(block) && (block.getMaterial() != Material.air || !this.isStairOrSlab(this.thisEntity.worldObj.getState(new BlockPos(i, j - 1, k)).getBlock()));
|
||||
boolean flag = !this.isStairOrSlab(block) && (block != Blocks.air || !this.isStairOrSlab(this.thisEntity.worldObj.getState(new BlockPos(i, j - 1, k)).getBlock()));
|
||||
|
||||
if (flag && 0 == WalkNodeProcessor.getColliding(this.thisEntity.worldObj, this.thisEntity, l, j, i1, j1, k1, l1, false, false, true) && 1 == WalkNodeProcessor.getColliding(this.thisEntity.worldObj, this.thisEntity, i, j + 1, k, j1, k1, l1, false, false, true) && 1 == WalkNodeProcessor.getColliding(this.thisEntity.worldObj, this.thisEntity, l, j + 1, i1, j1, k1, l1, false, false, true))
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package common.ai;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDoor;
|
||||
import common.block.artificial.BlockDoor;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.material.Material;
|
||||
import common.pathfinding.PathEntity;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package common.ai;
|
||||
|
||||
import common.block.BlockTallGrass;
|
||||
import common.block.foliage.BlockTallGrass;
|
||||
import common.entity.animal.EntitySheep;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package common.ai;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockBed;
|
||||
import common.block.artificial.BlockBed;
|
||||
import common.entity.animal.EntityOcelot;
|
||||
import common.init.Blocks;
|
||||
import common.tileentity.TileEntity;
|
||||
|
|
|
@ -9,7 +9,6 @@ import common.init.Blocks;
|
|||
import common.init.Config;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.ItemStack;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
|
@ -108,8 +107,8 @@ public class EntityAITakePlace extends EntityAIBase
|
|||
Block replace = world.getState(blockpos).getBlock();
|
||||
Block below = world.getState(blockpos.down()).getBlock();
|
||||
State state = PLACEABLE.get(new StackKey(this.entity.getHeldItem()));
|
||||
if (state.getBlock().canPlaceBlockAt(world, blockpos) && replace.getMaterial() == Material.air &&
|
||||
below.getMaterial() != Material.air && below.isFullCube())
|
||||
if (state.getBlock().canPlaceBlockAt(world, blockpos) && replace == Blocks.air &&
|
||||
below != Blocks.air && below.isFullCube())
|
||||
{
|
||||
this.entity.getLookHelper().setLookPosition((double)i + 0.5, (double)j + 0.5, (double)k + 0.5, 10.0F,
|
||||
(float)this.entity.getVerticalFaceSpeed());
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,56 +1,36 @@
|
|||
package common.block;
|
||||
|
||||
import common.material.Material;
|
||||
import common.material.MaterialTransparent;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockAir extends Block
|
||||
{
|
||||
public BlockAir()
|
||||
{
|
||||
super(Material.air);
|
||||
public final class BlockAir extends Block {
|
||||
public BlockAir() {
|
||||
super(new MaterialTransparent());
|
||||
}
|
||||
|
||||
/**
|
||||
* The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render
|
||||
*/
|
||||
public int getRenderType()
|
||||
{
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state)
|
||||
{
|
||||
public BoundingBox getCollisionBoundingBox(World world, BlockPos pos, State state) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to determine ambient occlusion and culling when rebuilding chunks for render
|
||||
*/
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canCollideCheck(State state, boolean hitIfLiquid)
|
||||
{
|
||||
public boolean canCollideCheck(State state, boolean liquid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawns this Block's drops into the World as EntityItems.
|
||||
*/
|
||||
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, State state, float chance, int fortune)
|
||||
{
|
||||
public void dropBlockAsItemWithChance(World world, BlockPos pos, State state, float chance, int fortune) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this Block can be replaced directly by other blocks (true for e.g. tall grass)
|
||||
*/
|
||||
public boolean isReplaceable(World worldIn, BlockPos pos)
|
||||
{
|
||||
public boolean isReplaceable(World world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
package common.block;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.material.Material;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
|
||||
public class BlockBreakable extends Block
|
||||
{
|
||||
private boolean ignoreSimilarity;
|
||||
|
||||
public BlockBreakable(Material p_i46393_1_, boolean p_i46393_2_)
|
||||
{
|
||||
super(p_i46393_1_);
|
||||
this.ignoreSimilarity = p_i46393_2_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to determine ambient occlusion and culling when rebuilding chunks for render
|
||||
*/
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side)
|
||||
{
|
||||
State iblockstate = worldIn.getState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if (this == Blocks.glass || this == Blocks.stained_glass)
|
||||
{
|
||||
if (worldIn.getState(pos.offset(side.getOpposite())) != iblockstate)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block == this)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return !this.ignoreSimilarity && block == this ? false : super.shouldSideBeRendered(worldIn, pos, side);
|
||||
}
|
||||
}
|
|
@ -13,63 +13,34 @@ import common.properties.IProperty;
|
|||
import common.properties.PropertyEnum;
|
||||
import common.world.State;
|
||||
|
||||
public class BlockColored extends Block
|
||||
{
|
||||
public class BlockColored extends Block {
|
||||
public static final PropertyEnum<DyeColor> COLOR = PropertyEnum.<DyeColor>create("color", DyeColor.class);
|
||||
|
||||
public BlockColored(Material materialIn)
|
||||
{
|
||||
super(materialIn);
|
||||
public BlockColored(Material material) {
|
||||
super(material);
|
||||
this.setDefaultState(this.getBaseState().withProperty(COLOR, DyeColor.WHITE));
|
||||
this.setTab(CheatTab.tabBlocks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It
|
||||
* returns the metadata of the dropped item based on the old metadata of the block.
|
||||
*/
|
||||
public int damageDropped(State state)
|
||||
{
|
||||
return ((DyeColor)state.getValue(COLOR)).getMetadata();
|
||||
public int damageDropped(State state) {
|
||||
return state.getValue(COLOR).getMetadata();
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
|
||||
*/
|
||||
public void getSubBlocks(Item itemIn, CheatTab tab, List<ItemStack> list)
|
||||
{
|
||||
for (DyeColor enumdyecolor : DyeColor.values())
|
||||
{
|
||||
list.add(new ItemStack(itemIn, 1, enumdyecolor.getMetadata()));
|
||||
public void getSubBlocks(Item item, CheatTab tab, List<ItemStack> list) {
|
||||
for(DyeColor color : DyeColor.values()) {
|
||||
list.add(new ItemStack(item, 1, color.getMetadata()));
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Get the MapColor for this Block and the given BlockState
|
||||
// */
|
||||
// public MapColor getMapColor(IBlockState state)
|
||||
// {
|
||||
// return ((EnumDyeColor)state.getValue(COLOR)).getMapColor();
|
||||
// }
|
||||
|
||||
/**
|
||||
* Convert the given metadata into a BlockState for this Block
|
||||
*/
|
||||
public State getStateFromMeta(int meta)
|
||||
{
|
||||
public State getStateFromMeta(int meta) {
|
||||
return this.getState().withProperty(COLOR, DyeColor.byMetadata(meta));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the BlockState into the correct metadata value
|
||||
*/
|
||||
public int getMetaFromState(State state)
|
||||
{
|
||||
return ((DyeColor)state.getValue(COLOR)).getMetadata();
|
||||
public int getMetaFromState(State state) {
|
||||
return state.getValue(COLOR).getMetadata();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
{
|
||||
protected IProperty[] getProperties() {
|
||||
return new IProperty[] {COLOR};
|
||||
}
|
||||
|
||||
|
|
|
@ -8,45 +8,33 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public abstract class BlockContainer extends Block implements ITileEntityProvider
|
||||
{
|
||||
public BlockContainer(Material p_i46402_1_)
|
||||
{
|
||||
super(p_i46402_1_);
|
||||
public abstract class BlockContainer extends Block implements ITileEntityProvider {
|
||||
public BlockContainer(Material material) {
|
||||
super(material);
|
||||
this.hasTile = true;
|
||||
}
|
||||
|
||||
protected boolean isInvalidNeighbor(World p_181086_1_, BlockPos p_181086_2_, Facing p_181086_3_)
|
||||
{
|
||||
return p_181086_1_.getState(p_181086_2_.offset(p_181086_3_)).getBlock().getMaterial() == Material.cactus;
|
||||
protected boolean isInvalidNeighbor(World world, BlockPos pos, Facing face) {
|
||||
return world.getState(pos.offset(face)).getBlock().getMaterial() == Material.cactus;
|
||||
}
|
||||
|
||||
protected boolean hasInvalidNeighbor(World p_181087_1_, BlockPos p_181087_2_)
|
||||
{
|
||||
return this.isInvalidNeighbor(p_181087_1_, p_181087_2_, Facing.NORTH) || this.isInvalidNeighbor(p_181087_1_, p_181087_2_, Facing.SOUTH) || this.isInvalidNeighbor(p_181087_1_, p_181087_2_, Facing.WEST) || this.isInvalidNeighbor(p_181087_1_, p_181087_2_, Facing.EAST);
|
||||
protected boolean hasInvalidNeighbor(World world, BlockPos pos) {
|
||||
return this.isInvalidNeighbor(world, pos, Facing.NORTH) || this.isInvalidNeighbor(world, pos, Facing.SOUTH)
|
||||
|| this.isInvalidNeighbor(world, pos, Facing.WEST) || this.isInvalidNeighbor(world, pos, Facing.EAST);
|
||||
}
|
||||
|
||||
/**
|
||||
* The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render
|
||||
*/
|
||||
public int getRenderType()
|
||||
{
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state)
|
||||
{
|
||||
super.onBlockRemoved(worldIn, pos, state);
|
||||
worldIn.removeTileEntity(pos);
|
||||
public void onBlockRemoved(AWorldServer world, BlockPos pos, State state) {
|
||||
super.onBlockRemoved(world, pos, state);
|
||||
world.removeTileEntity(pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on both Client and Server when World#addBlockEvent is called
|
||||
*/
|
||||
public boolean onBlockEventReceived(World worldIn, BlockPos pos, State state, int eventID, int eventParam)
|
||||
{
|
||||
super.onBlockEventReceived(worldIn, pos, state, eventID, eventParam);
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
return tileentity == null ? false : tileentity.receiveClientEvent(eventID, eventParam);
|
||||
public boolean onBlockEventReceived(World world, BlockPos pos, State state, int id, int param) {
|
||||
super.onBlockEventReceived(world, pos, state, id, param);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
return tile == null ? false : tile.receiveClientEvent(id, param);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,12 +4,10 @@ import common.material.Material;
|
|||
import common.properties.PropertyDirection;
|
||||
import common.util.Facing;
|
||||
|
||||
public abstract class BlockDirectional extends Block
|
||||
{
|
||||
public abstract class BlockDirectional extends Block {
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL);
|
||||
|
||||
public BlockDirectional(Material materialIn)
|
||||
{
|
||||
super(materialIn);
|
||||
public BlockDirectional(Material material) {
|
||||
super(material);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package common.block;
|
||||
|
||||
import common.block.natural.BlockFire;
|
||||
import common.entity.item.EntityFalling;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -11,93 +11,63 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockFalling extends Block
|
||||
{
|
||||
public class BlockFalling extends Block {
|
||||
public static boolean fallInstantly;
|
||||
|
||||
public BlockFalling()
|
||||
{
|
||||
super(Material.sand);
|
||||
this.setTab(CheatTab.tabNature);
|
||||
public static boolean canFallInto(World world, BlockPos pos) {
|
||||
Block block = world.getState(pos).getBlock();
|
||||
return block instanceof BlockFire || block == Blocks.air || block.material.isLiquid();
|
||||
}
|
||||
|
||||
public BlockFalling(Material materialIn)
|
||||
{
|
||||
super(materialIn);
|
||||
public BlockFalling(Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state)
|
||||
{
|
||||
worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn, pos));
|
||||
public void onBlockAdded(AWorldServer world, BlockPos pos, State state) {
|
||||
world.scheduleUpdate(pos, this, this.tickRate(world, pos));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a neighboring block changes.
|
||||
*/
|
||||
public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock)
|
||||
{
|
||||
worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn, pos));
|
||||
public void onNeighborBlockChange(World world, BlockPos pos, State state, Block neighbor) {
|
||||
world.scheduleUpdate(pos, this, this.tickRate(world, pos));
|
||||
}
|
||||
|
||||
public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
||||
{
|
||||
if(/* !worldIn.client && */ Config.blockGravity)
|
||||
this.checkFallable(worldIn, pos);
|
||||
public void updateTick(AWorldServer world, BlockPos pos, State state, Random rand) {
|
||||
if(Config.blockGravity)
|
||||
this.checkFallable(world, pos);
|
||||
}
|
||||
|
||||
private void checkFallable(World worldIn, BlockPos pos)
|
||||
{
|
||||
if (canFallInto(worldIn, pos.down()) && pos.getY() >= 0)
|
||||
{
|
||||
int i = 32;
|
||||
|
||||
if (!fallInstantly && worldIn.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i)))
|
||||
{
|
||||
if (!worldIn.client)
|
||||
{
|
||||
EntityFalling entityfallingblock = new EntityFalling(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, worldIn.getState(pos));
|
||||
this.onStartFalling(entityfallingblock);
|
||||
worldIn.spawnEntityInWorld(entityfallingblock);
|
||||
private void checkFallable(World world, BlockPos pos) {
|
||||
if(canFallInto(world, pos.down()) && pos.getY() >= 0) {
|
||||
int range = 32;
|
||||
if(!fallInstantly && world.isAreaLoaded(pos.add(-range, -range, -range), pos.add(range, range, range))) {
|
||||
if(!world.client) {
|
||||
EntityFalling entity = new EntityFalling(world, (double)pos.getX() + 0.5D, (double)pos.getY(),
|
||||
(double)pos.getZ() + 0.5D, world.getState(pos));
|
||||
this.onStartFalling(entity);
|
||||
world.spawnEntityInWorld(entity);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setBlockToAir(pos);
|
||||
BlockPos blockpos;
|
||||
|
||||
for (blockpos = pos.down(); canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down())
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
if (blockpos.getY() > 0)
|
||||
{
|
||||
worldIn.setState(blockpos.up(), this.getState());
|
||||
else {
|
||||
world.setBlockToAir(pos);
|
||||
BlockPos loc;
|
||||
int limit = 512;
|
||||
for(loc = pos.down(); canFallInto(world, loc) && loc.getY() > -World.MAX_SIZE_Y; loc = loc.down()) {
|
||||
if(--limit <= 0)
|
||||
return;
|
||||
}
|
||||
if(loc.getY() > -World.MAX_SIZE_Y)
|
||||
world.setState(loc.up(), this.getState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void onStartFalling(EntityFalling fallingEntity)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* How many world ticks before ticking
|
||||
*/
|
||||
public int tickRate(World worldIn, BlockPos pos)
|
||||
{
|
||||
public int tickRate(World world, BlockPos pos) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
public static boolean canFallInto(World worldIn, BlockPos pos)
|
||||
{
|
||||
Block block = worldIn.getState(pos).getBlock();
|
||||
Material material = block.material;
|
||||
return block == Blocks.fire || material == Material.air || material.isLiquid();
|
||||
protected void onStartFalling(EntityFalling entity) {
|
||||
}
|
||||
|
||||
public void onEndFalling(World worldIn, BlockPos pos)
|
||||
{
|
||||
public void onEndFalling(World world, BlockPos pos) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
package common.block;
|
||||
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
||||
import common.model.BlockLayer;
|
||||
import common.rng.Random;
|
||||
|
||||
public class BlockGlass extends BlockBreakable
|
||||
{
|
||||
public BlockGlass(Material materialIn, boolean ignoreSimilarity)
|
||||
{
|
||||
super(materialIn, ignoreSimilarity);
|
||||
this.setTab(CheatTab.tabBlocks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer()
|
||||
{
|
||||
return BlockLayer.CUTOUT;
|
||||
}
|
||||
|
||||
public boolean isFullCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canSilkHarvest()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
package common.block;
|
||||
|
||||
import common.enchantment.EnchantmentHelper;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.item.CheatTab;
|
||||
import common.item.ItemStack;
|
||||
import common.material.Material;
|
||||
import common.model.BlockLayer;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.world.LightType;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockIce extends BlockBreakable
|
||||
{
|
||||
public BlockIce()
|
||||
{
|
||||
super(Material.ice, false);
|
||||
this.slipperiness = 0.98F;
|
||||
this.setTickRandomly();
|
||||
this.setTab(CheatTab.tabNature);
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer()
|
||||
{
|
||||
return BlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
public void harvestBlock(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te)
|
||||
{
|
||||
// player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]);
|
||||
|
||||
if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player))
|
||||
{
|
||||
ItemStack itemstack = this.createStackedBlock(state);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
spawnAsEntity(worldIn, pos, itemstack);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (worldIn.doesWaterVaporize(pos))
|
||||
{
|
||||
worldIn.setBlockToAir(pos);
|
||||
return;
|
||||
}
|
||||
|
||||
int i = EnchantmentHelper.getFortuneModifier(player);
|
||||
this.dropBlockAsItem(worldIn, pos, state, i);
|
||||
Material material = worldIn.getState(pos.down()).getBlock().getMaterial();
|
||||
|
||||
if (material.blocksMovement() || material.isLiquid())
|
||||
{
|
||||
worldIn.setState(pos, Blocks.flowing_water.getState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
||||
{
|
||||
if (Config.iceMelt && ((worldIn.getLightFor(LightType.BLOCK, pos) > 11 - this.getLightOpacity()) || !worldIn.canFreezeAt(pos)))
|
||||
{
|
||||
if (worldIn.doesWaterVaporize(pos))
|
||||
{
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.dropBlockAsItem(worldIn, pos, worldIn.getState(pos), 0);
|
||||
worldIn.setState(pos, Blocks.water.getState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getMobilityFlag()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -8,13 +8,11 @@ import common.properties.PropertyEnum;
|
|||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
|
||||
public abstract class BlockRotatedPillar extends Block
|
||||
{
|
||||
public abstract class BlockRotatedPillar extends Block {
|
||||
public static final PropertyEnum<Facing.Axis> AXIS = PropertyEnum.<Facing.Axis>create("axis", Facing.Axis.class);
|
||||
|
||||
public BlockRotatedPillar(Material materialIn)
|
||||
{
|
||||
super(materialIn);
|
||||
public BlockRotatedPillar(Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
package common.block;
|
||||
|
||||
import common.entity.Entity;
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockSlime extends BlockBreakable
|
||||
{
|
||||
private static final Model slime = ModelProvider.getModelProvider().getModel("slime")
|
||||
.add(0, 0, 0, 16, 16, 16)
|
||||
.d().uv(0, 0, 16, 16).noCull()
|
||||
.u().uv(0, 0, 16, 16).noCull()
|
||||
.n().uv(0, 0, 16, 16).noCull()
|
||||
.s().uv(0, 0, 16, 16).noCull()
|
||||
.w().uv(0, 0, 16, 16).noCull()
|
||||
.e().uv(0, 0, 16, 16).noCull()
|
||||
.add(3, 3, 3, 13, 13, 13)
|
||||
.d().uv(3, 3, 13, 13).noCull()
|
||||
.u().uv(3, 3, 13, 13).noCull()
|
||||
.n().uv(3, 3, 13, 13).noCull()
|
||||
.s().uv(3, 3, 13, 13).noCull()
|
||||
.w().uv(3, 3, 13, 13).noCull()
|
||||
.e().uv(3, 3, 13, 13).noCull()
|
||||
;
|
||||
|
||||
public BlockSlime()
|
||||
{
|
||||
super(Material.clay, false);
|
||||
this.setTab(CheatTab.tabTech);
|
||||
this.slipperiness = 0.8F;
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer()
|
||||
{
|
||||
return BlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Block's chance to react to a living entity falling on it.
|
||||
*/
|
||||
public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance)
|
||||
{
|
||||
if (entityIn.isSneaking())
|
||||
{
|
||||
super.onFallenUpon(worldIn, pos, entityIn, fallDistance);
|
||||
}
|
||||
else
|
||||
{
|
||||
entityIn.fall(fallDistance, 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when an Entity lands on this Block. This method *must* update motionY because the entity will not do that
|
||||
* on its own
|
||||
*/
|
||||
public void onLanded(World worldIn, Entity entityIn)
|
||||
{
|
||||
if (entityIn.isSneaking())
|
||||
{
|
||||
super.onLanded(worldIn, entityIn);
|
||||
}
|
||||
else if (entityIn.motionY < 0.0D)
|
||||
{
|
||||
entityIn.motionY = -entityIn.motionY;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered whenever an entity collides with this block (enters into the block)
|
||||
*/
|
||||
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn)
|
||||
{
|
||||
if (Math.abs(entityIn.motionY) < 0.1D && !entityIn.isSneaking())
|
||||
{
|
||||
double d0 = 0.4D + Math.abs(entityIn.motionY) * 0.2D;
|
||||
entityIn.motionX *= d0;
|
||||
entityIn.motionZ *= d0;
|
||||
}
|
||||
|
||||
super.onEntityCollidedWithBlock(worldIn, pos, entityIn);
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return slime;
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package common.block;
|
||||
|
||||
import common.init.Config;
|
||||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.LightType;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockSnowBlock extends Block
|
||||
{
|
||||
public BlockSnowBlock()
|
||||
{
|
||||
super(Material.craftedSnow);
|
||||
this.setTickRandomly();
|
||||
this.setTab(CheatTab.tabNature);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return Items.snowball;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
||||
{
|
||||
if (Config.snowFullMelt && worldIn.getLightFor(LightType.BLOCK, pos) > 11)
|
||||
{
|
||||
this.dropBlockAsItem(worldIn, pos, worldIn.getState(pos), 0);
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
package common.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.color.DyeColor;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.material.Material;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
import common.world.State;
|
||||
|
||||
public class BlockStainedGlass extends BlockBreakable
|
||||
{
|
||||
public static final PropertyEnum<DyeColor> COLOR = PropertyEnum.<DyeColor>create("color", DyeColor.class);
|
||||
|
||||
public BlockStainedGlass(Material materialIn)
|
||||
{
|
||||
super(materialIn, false);
|
||||
this.setDefaultState(this.getBaseState().withProperty(COLOR, DyeColor.WHITE));
|
||||
this.setTab(CheatTab.tabBlocks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It
|
||||
* returns the metadata of the dropped item based on the old metadata of the block.
|
||||
*/
|
||||
public int damageDropped(State state)
|
||||
{
|
||||
return ((DyeColor)state.getValue(COLOR)).getMetadata();
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
|
||||
*/
|
||||
public void getSubBlocks(Item itemIn, CheatTab tab, List<ItemStack> list)
|
||||
{
|
||||
for (DyeColor enumdyecolor : DyeColor.values())
|
||||
{
|
||||
list.add(new ItemStack(itemIn, 1, enumdyecolor.getMetadata()));
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Get the MapColor for this Block and the given BlockState
|
||||
// */
|
||||
// public MapColor getMapColor(IBlockState state)
|
||||
// {
|
||||
// return ((EnumDyeColor)state.getValue(COLOR)).getMapColor();
|
||||
// }
|
||||
|
||||
public BlockLayer getBlockLayer()
|
||||
{
|
||||
return BlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean canSilkHarvest()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isFullCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given metadata into a BlockState for this Block
|
||||
*/
|
||||
public State getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getState().withProperty(COLOR, DyeColor.byMetadata(meta));
|
||||
}
|
||||
|
||||
// public void onBlockAdded(IWorldServer worldIn, BlockPos pos, State state)
|
||||
// {
|
||||
// if (!worldIn.client)
|
||||
// {
|
||||
// BlockBeacon.updateColorAsync(worldIn, pos);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void onBlockRemoved(IWorldServer worldIn, BlockPos pos, State state)
|
||||
// {
|
||||
// if (!worldIn.client)
|
||||
// {
|
||||
// BlockBeacon.updateColorAsync(worldIn, pos);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Convert the BlockState into the correct metadata value
|
||||
*/
|
||||
public int getMetaFromState(State state)
|
||||
{
|
||||
return ((DyeColor)state.getValue(COLOR)).getMetadata();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
{
|
||||
return new IProperty[] {COLOR};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel(state.getValue(COLOR).getName() + "_glass").add().all();
|
||||
}
|
||||
}
|
28
common/src/common/block/BlockTranslucent.java
Executable file
28
common/src/common/block/BlockTranslucent.java
Executable file
|
@ -0,0 +1,28 @@
|
|||
package common.block;
|
||||
|
||||
import common.material.Material;
|
||||
import common.model.BlockLayer;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
|
||||
public class BlockTranslucent extends Block {
|
||||
public BlockTranslucent(Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
public final boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public final BlockLayer getBlockLayer() {
|
||||
return BlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IWorldAccess world, BlockPos pos, Facing side) {
|
||||
State state = world.getState(pos);
|
||||
Block block = state.getBlock();
|
||||
return block != this && super.shouldSideBeRendered(world, pos, side);
|
||||
}
|
||||
}
|
|
@ -3,8 +3,8 @@ package common.block;
|
|||
import common.material.Material;
|
||||
|
||||
public class BlockTreasure extends Block {
|
||||
public BlockTreasure(Material materialIn) {
|
||||
super(materialIn);
|
||||
public BlockTreasure(Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
public boolean isXrayVisible() {
|
||||
|
|
|
@ -3,7 +3,6 @@ package common.block;
|
|||
import common.tileentity.TileEntity;
|
||||
import common.world.World;
|
||||
|
||||
public interface ITileEntityProvider
|
||||
{
|
||||
TileEntity createNewTileEntity(World worldIn);
|
||||
public interface ITileEntityProvider {
|
||||
TileEntity createNewTileEntity(World world);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.color.DyeColor;
|
||||
import common.color.TextColor;
|
||||
import common.entity.npc.EntityNPC;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Items;
|
||||
import common.item.Item;
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.color.DyeColor;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.material.Material;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.collect.Lists;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
|
@ -1,7 +1,10 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockFalling;
|
||||
import common.entity.item.EntityFalling;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.material.Material;
|
||||
import common.model.Model;
|
||||
|
@ -146,7 +149,7 @@ public class BlockDragonEgg extends Block
|
|||
{
|
||||
BlockPos blockpos = pos.add(worldIn.rand.zrange(16) - worldIn.rand.zrange(16), worldIn.rand.zrange(8) - worldIn.rand.zrange(8), worldIn.rand.zrange(16) - worldIn.rand.zrange(16));
|
||||
|
||||
if (worldIn.getState(blockpos).getBlock().material == Material.air)
|
||||
if (worldIn.getState(blockpos).getBlock() == Blocks.air)
|
||||
{
|
||||
if (worldIn.client)
|
||||
{
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.collect.Lists;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
|
@ -165,7 +166,7 @@ public class BlockFence extends Block
|
|||
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
Block block = worldIn.getState(pos).getBlock();
|
||||
return ((!(block instanceof BlockFence) || block.material != this.material) && !(block instanceof BlockFenceGate) ? (block.material.isOpaque() && block.isFullCube() ? block.material != Material.gourd : false) : true);
|
||||
return ((!(block instanceof BlockFence) || block.getMaterial() != this.material) && !(block instanceof BlockFenceGate) ? (block.getMaterial().isOpaque() && block.isFullCube() ? block.getMaterial() != Material.gourd : false) : true);
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side)
|
|
@ -1,5 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
|
@ -1,9 +1,10 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import common.block.Block;
|
||||
import common.collect.Sets;
|
||||
import common.entity.Entity;
|
||||
import common.item.Item;
|
|
@ -1,5 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.foliage.BlockFlower;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.init.ItemRegistry;
|
44
common/src/common/block/artificial/BlockGlass.java
Executable file
44
common/src/common/block/artificial/BlockGlass.java
Executable file
|
@ -0,0 +1,44 @@
|
|||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
||||
import common.model.BlockLayer;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
|
||||
public class BlockGlass extends Block {
|
||||
public BlockGlass() {
|
||||
super(Material.glass);
|
||||
this.setTab(CheatTab.tabBlocks);
|
||||
}
|
||||
|
||||
public int quantityDropped(Random rand) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer() {
|
||||
return BlockLayer.CUTOUT;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canSilkHarvest() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IWorldAccess world, BlockPos pos, Facing side) {
|
||||
State state = world.getState(pos);
|
||||
Block block = state.getBlock();
|
||||
return world.getState(pos.offset(side.getOpposite())) != state || (block != this && super.shouldSideBeRendered(world, pos, side));
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.BlockRotatedPillar;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.CheatTab;
|
|
@ -1,5 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.Entity;
|
||||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
|
@ -1,7 +1,9 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.natural.BlockFire;
|
||||
import common.entity.Entity;
|
||||
import common.init.Blocks;
|
||||
import common.item.Item;
|
||||
|
@ -23,7 +25,7 @@ import common.world.AWorldClient;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockPortal extends BlockBreakable
|
||||
public class BlockPortal extends Block
|
||||
{
|
||||
public static final PropertyEnum<Facing.Axis> AXIS = PropertyEnum.<Facing.Axis>create("axis", Facing.Axis.class, Facing.Axis.X, Facing.Axis.Z);
|
||||
public static final PropertyInteger DIM = PropertyInteger.create("dim", 0, 7);
|
||||
|
@ -32,7 +34,7 @@ public class BlockPortal extends BlockBreakable
|
|||
|
||||
public BlockPortal()
|
||||
{
|
||||
super(Material.portal, false);
|
||||
super(Material.portal);
|
||||
this.setDefaultState(this.getBaseState().withProperty(AXIS, Facing.Axis.X).withProperty(DIM, 0));
|
||||
// this.setTickRandomly();
|
||||
}
|
||||
|
@ -97,6 +99,14 @@ public class BlockPortal extends BlockBreakable
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer() {
|
||||
return BlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
public boolean tryIgnitePortal(World worldIn, BlockPos pos, int dim)
|
||||
{
|
||||
BlockPortal.Size size = new BlockPortal.Size(worldIn, pos, Facing.Axis.X, dim);
|
||||
|
@ -192,11 +202,6 @@ public class BlockPortal extends BlockBreakable
|
|||
return 0;
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer()
|
||||
{
|
||||
return BlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called When an Entity Collided with the Block
|
||||
*/
|
||||
|
@ -323,7 +328,7 @@ public class BlockPortal extends BlockBreakable
|
|||
// {
|
||||
// BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, j, 1);
|
||||
//
|
||||
// if (blockworldstate.getBlockState() != null && blockworldstate.getBlockState().getBlock().getMaterial() != Material.air)
|
||||
// if (blockworldstate.getBlockState() != null && blockworldstate.getBlockState().getBlock() != Blocks.air)
|
||||
// {
|
||||
// ++aint[enumfacing$axisdirection.ordinal()];
|
||||
// }
|
||||
|
@ -493,7 +498,7 @@ public class BlockPortal extends BlockBreakable
|
|||
|
||||
protected boolean func_150857_a(Block p_150857_1_)
|
||||
{
|
||||
return p_150857_1_.material == Material.air || p_150857_1_ == Blocks.fire || p_150857_1_ == Blocks.portal;
|
||||
return p_150857_1_ == Blocks.air || p_150857_1_ instanceof BlockFire || p_150857_1_ == Blocks.portal;
|
||||
}
|
||||
|
||||
public boolean func_150860_b()
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.CheatTab;
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.collect.Lists;
|
||||
import common.entity.Entity;
|
||||
import common.entity.types.EntityLiving;
|
52
common/src/common/block/artificial/BlockStainedGlass.java
Executable file
52
common/src/common/block/artificial/BlockStainedGlass.java
Executable file
|
@ -0,0 +1,52 @@
|
|||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.color.DyeColor;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.world.State;
|
||||
|
||||
public class BlockStainedGlass extends BlockGlass {
|
||||
public static final PropertyEnum<DyeColor> COLOR = PropertyEnum.<DyeColor>create("color", DyeColor.class);
|
||||
|
||||
public BlockStainedGlass() {
|
||||
this.setDefaultState(this.getBaseState().withProperty(COLOR, DyeColor.WHITE));
|
||||
}
|
||||
|
||||
public int damageDropped(State state) {
|
||||
return state.getValue(COLOR).getMetadata();
|
||||
}
|
||||
|
||||
public void getSubBlocks(Item item, CheatTab tab, List<ItemStack> list) {
|
||||
for(DyeColor color : DyeColor.values()) {
|
||||
list.add(new ItemStack(item, 1, color.getMetadata()));
|
||||
}
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer() {
|
||||
return BlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
public State getStateFromMeta(int meta) {
|
||||
return this.getState().withProperty(COLOR, DyeColor.byMetadata(meta));
|
||||
}
|
||||
|
||||
public int getMetaFromState(State state) {
|
||||
return state.getValue(COLOR).getMetadata();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties() {
|
||||
return new IProperty[] {COLOR};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel(state.getValue(COLOR).getName() + "_glass").add().all();
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
|
@ -52,15 +53,15 @@ public class BlockStairs extends Block
|
|||
|
||||
public BlockStairs(State modelState, String down, String up)
|
||||
{
|
||||
super(modelState.getBlock().material);
|
||||
super(modelState.getBlock().getMaterial());
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(HALF, BlockStairs.EnumHalf.BOTTOM).withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT));
|
||||
this.modelBlock = modelState.getBlock();
|
||||
this.modelState = modelState;
|
||||
this.setHardness(this.modelBlock.blockHardness);
|
||||
this.setResistance(this.modelBlock.blockResistance / 3.0F);
|
||||
this.setHardness(this.modelBlock.getRawHardness());
|
||||
this.setResistance(this.modelBlock.getRawResistance() / 3.0F);
|
||||
this.setStepSound(this.modelBlock.sound);
|
||||
this.setLightOpacity(255);
|
||||
this.setTab(modelState.getBlock().material == Material.wood ? CheatTab.tabWood : CheatTab.tabBlocks);
|
||||
this.setTab(modelState.getBlock().getMaterial() == Material.wood ? CheatTab.tabWood : CheatTab.tabBlocks);
|
||||
this.downTex = down;
|
||||
this.upTex = up;
|
||||
}
|
||||
|
@ -623,9 +624,9 @@ public class BlockStairs extends Block
|
|||
return this.modelBlock.isCollidable();
|
||||
}
|
||||
|
||||
public boolean canCollideCheck(State state, boolean hitIfLiquid)
|
||||
public boolean canCollideCheck(State state, boolean liquid)
|
||||
{
|
||||
return this.modelBlock.canCollideCheck(state, hitIfLiquid);
|
||||
return this.modelBlock.canCollideCheck(state, liquid);
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
|
@ -1,7 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
|
@ -249,7 +250,7 @@ public class BlockTrapDoor extends Block
|
|||
|
||||
private static boolean isValidSupportBlock(Block blockIn)
|
||||
{
|
||||
return blockIn.material.isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glass || blockIn == Blocks.stained_glass || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs;
|
||||
return blockIn.getMaterial().isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glass || blockIn == Blocks.stained_glass || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs;
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer()
|
|
@ -1,7 +1,9 @@
|
|||
package common.block;
|
||||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
|
@ -32,10 +34,10 @@ public class BlockWall extends Block
|
|||
|
||||
public BlockWall(Block modelBlock)
|
||||
{
|
||||
super(modelBlock.material);
|
||||
super(modelBlock.getMaterial());
|
||||
this.setDefaultState(this.getBaseState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)).withProperty(VARIANT, BlockWall.EnumType.NORMAL));
|
||||
this.setHardness(modelBlock.blockHardness);
|
||||
this.setResistance(modelBlock.blockResistance / 3.0F);
|
||||
this.setHardness(modelBlock.getRawHardness());
|
||||
this.setResistance(modelBlock.getRawResistance() / 3.0F);
|
||||
this.setStepSound(modelBlock.sound);
|
||||
this.setTab(CheatTab.tabBlocks);
|
||||
}
|
||||
|
@ -124,7 +126,7 @@ public class BlockWall extends Block
|
|||
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
Block block = worldIn.getState(pos).getBlock();
|
||||
return (block != this && !(block instanceof BlockFenceGate) ? (block.material.isOpaque() && block.isFullCube() ? block.material != Material.gourd : false) : true);
|
||||
return (block != this && !(block instanceof BlockFenceGate) ? (block.getMaterial().isOpaque() && block.isFullCube() ? block.getMaterial() != Material.gourd : false) : true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -174,7 +176,7 @@ public class BlockWall extends Block
|
|||
*/
|
||||
public State getActualState(State state, IWorldAccess worldIn, BlockPos pos)
|
||||
{
|
||||
return state.withProperty(UP, Boolean.valueOf(worldIn.getState(pos.up()).getBlock().getMaterial() != Material.air)).withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, pos.west())));
|
||||
return state.withProperty(UP, Boolean.valueOf(worldIn.getState(pos.up()).getBlock() != Blocks.air)).withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, pos.west())));
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
|
@ -1,4 +1,4 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
public class BlockBaseFlower extends BlockFlower
|
||||
{
|
|
@ -1,6 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.item.CheatTab;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.model.Model;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.DamageSource;
|
||||
import common.entity.Entity;
|
||||
import common.init.Blocks;
|
|
@ -1,4 +1,4 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.init.Items;
|
||||
import common.item.Item;
|
|
@ -1,5 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.color.DyeColor;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
|
@ -1,5 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.SoundType;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.init.Items;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
|
@ -1,7 +1,10 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.SoundType;
|
||||
import common.color.Colorizer;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.SoundType;
|
||||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
|
@ -1,5 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.natural.BlockDirt;
|
||||
import common.entity.Entity;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
|
@ -1,4 +1,4 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
|
@ -1,6 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.biome.IBiome;
|
||||
import common.block.Block;
|
||||
import common.block.natural.BlockDirt;
|
||||
import common.color.Colorizer;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.Item;
|
|
@ -1,7 +1,9 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.SoundType;
|
||||
import common.collect.Lists;
|
||||
import common.color.Colorizer;
|
||||
import common.entity.npc.EntityNPC;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.material.Material;
|
||||
import common.model.BlockLayer;
|
||||
|
|
@ -1,7 +1,11 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.block.liquid.BlockStaticLiquid;
|
||||
import common.entity.Entity;
|
||||
import common.entity.item.EntityBoat;
|
||||
import common.entity.types.EntityLiving;
|
|
@ -1,5 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.BlockRotatedPillar;
|
||||
import common.block.SoundType;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
|
@ -1,6 +1,8 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.biome.IBiome;
|
||||
import common.block.Block;
|
||||
import common.block.natural.BlockDirt;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.model.Model;
|
|
@ -1,5 +1,7 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.natural.BlockDirt;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.item.CheatTab;
|
|
@ -1,4 +1,4 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.init.Items;
|
||||
import common.item.Item;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.BlockDirectional;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.item.CheatTab;
|
||||
import common.material.Material;
|
||||
|
@ -111,7 +112,7 @@ public class BlockPumpkin extends BlockDirectional
|
|||
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
||||
{
|
||||
return worldIn.getState(pos).getBlock().material.isReplaceable() && worldIn.isBlockSolid(pos.down());
|
||||
return worldIn.getState(pos).getBlock().getMaterial().isReplaceable() && worldIn.isBlockSolid(pos.down());
|
||||
}
|
||||
|
||||
/**
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.init.Items;
|
|
@ -1,4 +1,4 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.material.Material;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
|
@ -103,7 +103,7 @@ public class BlockStem extends BlockBush implements IGrowable
|
|||
pos = pos.offset(Facing.Plane.HORIZONTAL.random(rand));
|
||||
Block block = worldIn.getState(pos.down()).getBlock();
|
||||
|
||||
if (worldIn.getState(pos).getBlock().material == Material.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass))
|
||||
if (worldIn.getState(pos).getBlock() == Blocks.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass))
|
||||
{
|
||||
worldIn.setState(pos, this.crop.getState());
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.color.Colorizer;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
|
@ -177,7 +178,7 @@ public class BlockVine extends Block
|
|||
|
||||
private boolean canPlaceOn(Block blockIn)
|
||||
{
|
||||
return blockIn.isFullCube() && blockIn.material.blocksMovement();
|
||||
return blockIn.isFullCube() && blockIn.getMaterial().blocksMovement();
|
||||
}
|
||||
|
||||
private boolean recheckGrownSides(World worldIn, BlockPos pos, State state)
|
||||
|
@ -307,7 +308,7 @@ public class BlockVine extends Block
|
|||
BlockPos blockpos3 = pos.offset(enumfacing1);
|
||||
Block block1 = worldIn.getState(blockpos3).getBlock();
|
||||
|
||||
if (block1.material == Material.air)
|
||||
if (block1 == Blocks.air)
|
||||
{
|
||||
Facing enumfacing2 = enumfacing1.rotateY();
|
||||
Facing enumfacing4 = enumfacing1.rotateYCCW();
|
||||
|
@ -337,7 +338,7 @@ public class BlockVine extends Block
|
|||
worldIn.setState(blockpos3, this.getState(), 2);
|
||||
}
|
||||
}
|
||||
else if (block1.material.isOpaque() && block1.isFullCube())
|
||||
else if (block1.getMaterial().isOpaque() && block1.isFullCube())
|
||||
{
|
||||
worldIn.setState(pos, state.withProperty(getPropertyFor(enumfacing1), Boolean.valueOf(true)), 2);
|
||||
}
|
||||
|
@ -351,7 +352,7 @@ public class BlockVine extends Block
|
|||
State iblockstate = worldIn.getState(blockpos2);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if (block.material == Material.air)
|
||||
if (block == Blocks.air)
|
||||
{
|
||||
State iblockstate1 = state;
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.init.Items;
|
|
@ -1,4 +1,4 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
|
@ -1,4 +1,4 @@
|
|||
package common.block;
|
||||
package common.block.foliage;
|
||||
|
||||
import common.util.Identifyable;
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
package common.block;
|
||||
package common.block.liquid;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.artificial.BlockDoor;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.material.Material;
|
||||
|
@ -260,7 +262,7 @@ public class BlockDynamicLiquid extends BlockLiquid
|
|||
private boolean isBlocked(World worldIn, BlockPos pos, State state)
|
||||
{
|
||||
Block block = worldIn.getState(pos).getBlock();
|
||||
return !(block instanceof BlockDoor) && block != Blocks.sign && block != Blocks.ladder && block != Blocks.reeds ? (block.material == Material.portal ? true : block.material.blocksMovement()) : true;
|
||||
return !(block instanceof BlockDoor) && block != Blocks.sign && block != Blocks.ladder && block != Blocks.reeds ? (block.getMaterial() == Material.portal ? true : block.getMaterial().blocksMovement()) : true;
|
||||
}
|
||||
|
||||
protected int checkAdjacentBlock(World worldIn, BlockPos pos, int currentMinLevel)
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.liquid;
|
||||
|
||||
import common.block.Block;
|
||||
import common.color.Colorizer;
|
||||
import common.entity.Entity;
|
||||
import common.init.Blocks;
|
||||
|
@ -90,9 +91,9 @@ public abstract class BlockLiquid extends Block
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean canCollideCheck(State state, boolean hitIfLiquid)
|
||||
public boolean canCollideCheck(State state, boolean liquid)
|
||||
{
|
||||
return hitIfLiquid && ((Integer)state.getValue(LEVEL)).intValue() == 0;
|
||||
return liquid && ((Integer)state.getValue(LEVEL)).intValue() == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -257,7 +258,7 @@ public abstract class BlockLiquid extends Block
|
|||
}
|
||||
}
|
||||
|
||||
if (this.material == Material.lava && worldIn.getState(pos.up()).getBlock().getMaterial() == Material.air && !worldIn.getState(pos.up()).getBlock().isOpaqueCube())
|
||||
if (this.material == Material.lava && worldIn.getState(pos.up()).getBlock() == Blocks.air && !worldIn.getState(pos.up()).getBlock().isOpaqueCube())
|
||||
{
|
||||
if (rand.chance(100))
|
||||
{
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.liquid;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.material.Material;
|
||||
|
@ -58,7 +59,7 @@ public class BlockStaticLiquid extends BlockLiquid
|
|||
blockpos = blockpos.add(rand.zrange(3) - 1, 1, rand.zrange(3) - 1);
|
||||
Block block = worldIn.getState(blockpos).getBlock();
|
||||
|
||||
if (block.material == Material.air)
|
||||
if (block == Blocks.air)
|
||||
{
|
||||
if (this.isSurroundingBlockFlammable(worldIn, blockpos))
|
||||
{
|
||||
|
@ -66,7 +67,7 @@ public class BlockStaticLiquid extends BlockLiquid
|
|||
return;
|
||||
}
|
||||
}
|
||||
else if (block.material.blocksMovement())
|
||||
else if (block.getMaterial().blocksMovement())
|
||||
{
|
||||
return;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
package common.block.natural;
|
||||
|
||||
import common.block.Block;
|
||||
import common.material.Material;
|
||||
import common.model.ParticleType;
|
||||
import common.rng.Random;
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue