remove skull tile entity
|
@ -30,7 +30,6 @@ import client.world.WorldClient;
|
|||
import common.block.Block;
|
||||
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;
|
||||
|
@ -702,7 +701,7 @@ public class RenderGlobal
|
|||
|
||||
Block block = this.theWorld.getState(blockpos).getBlock();
|
||||
|
||||
if (tileentity1 != null && (block instanceof BlockChest || /* block instanceof BlockWarpChest || */ block instanceof BlockSign || block instanceof BlockSkull))
|
||||
if (tileentity1 != null && (block instanceof BlockChest || block instanceof BlockSign))
|
||||
{
|
||||
TileEntityRendererDispatcher.instance.renderTileEntity(tileentity1, partialTicks, destroyblockprogress.getPartialBlockDamage());
|
||||
}
|
||||
|
@ -1570,7 +1569,7 @@ public class RenderGlobal
|
|||
double d5 = (double)blockpos.getZ() - d2;
|
||||
Block block = this.theWorld.getState(blockpos).getBlock();
|
||||
|
||||
if (!(block instanceof BlockChest) && /* !(block instanceof BlockWarpChest) && */ !(block instanceof BlockSign) && !(block instanceof BlockSkull))
|
||||
if (!(block instanceof BlockChest) && !(block instanceof BlockSign))
|
||||
{
|
||||
if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D)
|
||||
{
|
||||
|
|
|
@ -100,11 +100,6 @@ public class ModelManager
|
|||
return this.texMap.getAtlasSprite("blocks/water_still");
|
||||
}
|
||||
|
||||
if (block == Blocks.skull)
|
||||
{
|
||||
return this.texMap.getAtlasSprite("blocks/soul_sand");
|
||||
}
|
||||
|
||||
// if (block == Blocks.barrier)
|
||||
// {
|
||||
// return this.modelManager.getTextureMap().getAtlasSprite("items/barrier");
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
package client.renderer.model;
|
||||
|
||||
import common.entity.Entity;
|
||||
|
||||
public class ModelHumanoidHead extends ModelHead
|
||||
{
|
||||
private final ModelRenderer head = new ModelRenderer(this, 32, 0);
|
||||
|
||||
public ModelHumanoidHead()
|
||||
{
|
||||
super(0, 0, 64, 64);
|
||||
this.head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.25F);
|
||||
this.head.setRotationPoint(0.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the models various rotation angles then renders the model.
|
||||
*/
|
||||
public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale)
|
||||
{
|
||||
super.render(entityIn, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale);
|
||||
this.head.render(scale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
|
||||
* and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
|
||||
* "far" arms and legs can swing at most.
|
||||
*/
|
||||
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
|
||||
{
|
||||
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
|
||||
this.head.rotateAngleY = this.mainHead.rotateAngleY;
|
||||
this.head.rotateAngleX = this.mainHead.rotateAngleX;
|
||||
}
|
||||
}
|
|
@ -1,64 +1,27 @@
|
|||
package client.renderer.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import client.renderer.GlState;
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.item.ItemStack;
|
||||
import common.tileentity.TileEntityBanner;
|
||||
import common.tileentity.TileEntityChest;
|
||||
import common.tileentity.TileEntitySkull;
|
||||
import common.util.Facing;
|
||||
|
||||
public class TileEntityItemStackRenderer
|
||||
{
|
||||
public static TileEntityItemStackRenderer instance = new TileEntityItemStackRenderer();
|
||||
private TileEntityChest field_147717_b = new TileEntityChest(0);
|
||||
private TileEntityChest field_147718_c = new TileEntityChest(1);
|
||||
// private TileEntityWarpChest warpChest = new TileEntityWarpChest();
|
||||
private TileEntityBanner banner = new TileEntityBanner();
|
||||
private TileEntitySkull skull = new TileEntitySkull();
|
||||
public class TileEntityItemStackRenderer {
|
||||
public static TileEntityItemStackRenderer instance = new TileEntityItemStackRenderer();
|
||||
|
||||
public void renderByItem(ItemStack itemStackIn)
|
||||
{
|
||||
if (itemStackIn.getItem() == Items.banner)
|
||||
{
|
||||
this.banner.setItemValues(itemStackIn);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.banner, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
}
|
||||
else if (itemStackIn.getItem() == Items.skull)
|
||||
{
|
||||
if (TileEntitySkullRenderer.instance != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, 0.0F, -0.5F);
|
||||
GL11.glScalef(2.0F, 2.0F, 2.0F);
|
||||
boolean flag = GlState.isCullEnabled();
|
||||
GlState.disableCull();
|
||||
TileEntitySkullRenderer.instance.renderSkull(0.0F, 0.0F, 0.0F, Facing.UP, 0.0F, -1);
|
||||
if(flag)
|
||||
GlState.enableCull();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Block block = itemStackIn.getItem().getBlock();
|
||||
private final TileEntityChest chest = new TileEntityChest(0);
|
||||
private final TileEntityChest trapChest = new TileEntityChest(1);
|
||||
private final TileEntityBanner banner = new TileEntityBanner();
|
||||
|
||||
// if (block == Blocks.warp_chest)
|
||||
// {
|
||||
// TileEntityRendererDispatcher.instance.renderTileEntityAt(this.warpChest, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
// }
|
||||
if (block == Blocks.trapped_chest)
|
||||
{
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147717_b, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void renderByItem(ItemStack stack) {
|
||||
if(stack.getItem() == Items.banner) {
|
||||
this.banner.setItemValues(stack);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.banner, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
}
|
||||
else if(stack.getItem() == Items.trapped_chest) {
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.trapChest, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
}
|
||||
else if(stack.getItem() == Items.chest) {
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.chest, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import common.tileentity.TileEntityChest;
|
|||
import common.tileentity.TileEntityMobSpawner;
|
||||
import common.tileentity.TileEntityPiston;
|
||||
import common.tileentity.TileEntitySign;
|
||||
import common.tileentity.TileEntitySkull;
|
||||
import common.util.BlockPos;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -51,11 +50,6 @@ public class TileEntityRendererDispatcher
|
|||
this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
|
||||
this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
|
||||
this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
|
||||
// this.mapSpecialRenderers.put(TileEntityWarpChest.class, new TileEntityWarpChestRenderer());
|
||||
// this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
|
||||
// this.mapSpecialRenderers.put(TileEntityPortal.class, new TileEntityPortalRenderer());
|
||||
// this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
|
||||
this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
|
||||
this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());
|
||||
|
||||
for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
|
||||
|
|
|
@ -1,124 +0,0 @@
|
|||
package client.renderer.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import client.renderer.GlState;
|
||||
import client.renderer.model.ModelHumanoidHead;
|
||||
import common.tileentity.TileEntitySkull;
|
||||
import common.util.Facing;
|
||||
|
||||
|
||||
public class TileEntitySkullRenderer extends TileEntitySpecialRenderer<TileEntitySkull>
|
||||
{
|
||||
private static final String TEXTURE_SKULL = "textures/entity/skull.png";
|
||||
public static TileEntitySkullRenderer instance;
|
||||
|
||||
private final ModelHumanoidHead humanoidHead = new ModelHumanoidHead();
|
||||
|
||||
public void renderTileEntityAt(TileEntitySkull te, double x, double y, double z, float partialTicks, int destroyStage)
|
||||
{
|
||||
Facing enumfacing = Facing.getFront(te.getBlockMetadata() & 7);
|
||||
this.renderSkull((float)x, (float)y, (float)z, enumfacing, (float)(te.getSkullRotation() * 360) / 16.0F, destroyStage);
|
||||
}
|
||||
|
||||
public void setRendererDispatcher(TileEntityRendererDispatcher rendererDispatcherIn)
|
||||
{
|
||||
super.setRendererDispatcher(rendererDispatcherIn);
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public void renderSkull(float x, float y, float z, Facing dir, float rot, int destroyStage)
|
||||
{
|
||||
// ModelBase modelbase = this.skeletonHead;
|
||||
|
||||
if (destroyStage >= 0)
|
||||
{
|
||||
this.bindTexture(DESTROY_STAGES[destroyStage]);
|
||||
GL11.glMatrixMode(GL11.GL_TEXTURE);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(4.0F, 2.0F, 1.0F);
|
||||
GL11.glTranslatef(0.0625F, 0.0625F, 0.0625F);
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
}
|
||||
else
|
||||
{
|
||||
// switch (p_180543_6_)
|
||||
// {
|
||||
// case 0:
|
||||
// default:
|
||||
// this.bindTexture(SKELETON_TEXTURES);
|
||||
// break;
|
||||
//
|
||||
// case 1:
|
||||
// this.bindTexture(WITHER_SKELETON_TEXTURES);
|
||||
// break;
|
||||
//
|
||||
// case 2:
|
||||
// this.bindTexture(ZOMBIE_TEXTURES);
|
||||
// modelbase = this.humanoidHead;
|
||||
// break;
|
||||
//
|
||||
// case 3:
|
||||
// modelbase = this.humanoidHead;
|
||||
// String tex = TEXTURE_SKULL; // EntitySkinManager.TEXTURE_DEF;
|
||||
|
||||
// if (user != null && EntityTexManager.getModel(user) == ModelType.HUMANOID)
|
||||
// {
|
||||
// tex = EntityTexManager.getSkin(user, ModelType.HUMANOID);
|
||||
// }
|
||||
|
||||
this.bindTexture(TEXTURE_SKULL);
|
||||
// break;
|
||||
//
|
||||
// case 4:
|
||||
// this.bindTexture(CREEPER_TEXTURES);
|
||||
// }
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GlState.disableCull();
|
||||
|
||||
if (dir != Facing.UP)
|
||||
{
|
||||
switch (dir)
|
||||
{
|
||||
case NORTH:
|
||||
GL11.glTranslatef(x + 0.5F, y + 0.25F, z + 0.74F);
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
GL11.glTranslatef(x + 0.5F, y + 0.25F, z + 0.26F);
|
||||
rot = 180.0F;
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
GL11.glTranslatef(x + 0.74F, y + 0.25F, z + 0.5F);
|
||||
rot = 270.0F;
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
default:
|
||||
GL11.glTranslatef(x + 0.26F, y + 0.25F, z + 0.5F);
|
||||
rot = 90.0F;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslatef(x + 0.5F, y, z + 0.5F);
|
||||
}
|
||||
|
||||
float f = 0.0625F;
|
||||
GlState.enableRescaleNormal();
|
||||
GL11.glScalef(-1.0F, -1.0F, 1.0F);
|
||||
GlState.enableAlpha();
|
||||
this.humanoidHead.render(null, 0.0F, 0.0F, 0.0F, rot, 0.0F, f);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if (destroyStage >= 0)
|
||||
{
|
||||
GL11.glMatrixMode(GL11.GL_TEXTURE);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
}
|
||||
}
|
||||
}
|
BIN
client/src/main/resources/textures/blocks/skull_back.png
Normal file
After Width: | Height: | Size: 299 B |
BIN
client/src/main/resources/textures/blocks/skull_bottom.png
Normal file
After Width: | Height: | Size: 296 B |
BIN
client/src/main/resources/textures/blocks/skull_front.png
Normal file
After Width: | Height: | Size: 318 B |
BIN
client/src/main/resources/textures/blocks/skull_left.png
Normal file
After Width: | Height: | Size: 308 B |
BIN
client/src/main/resources/textures/blocks/skull_right.png
Normal file
After Width: | Height: | Size: 299 B |
BIN
client/src/main/resources/textures/blocks/skull_top.png
Normal file
After Width: | Height: | Size: 265 B |
BIN
client/src/main/resources/textures/items/skull.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
|
@ -13,180 +13,35 @@ import common.util.Facing;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockPumpkin extends BlockDirectional
|
||||
{
|
||||
// private BlockPattern snowmanBasePattern;
|
||||
// private BlockPattern snowmanPattern;
|
||||
// private BlockPattern golemBasePattern;
|
||||
// private BlockPattern golemPattern;
|
||||
// private static final Predicate<IBlockState> field_181085_Q = new Predicate<IBlockState>()
|
||||
// {
|
||||
// public boolean test(IBlockState p_apply_1_)
|
||||
// {
|
||||
// return p_apply_1_ != null && (p_apply_1_.getBlock() == Blocks.pumpkin || p_apply_1_.getBlock() == Blocks.lit_pumpkin);
|
||||
// }
|
||||
// };
|
||||
public class BlockPumpkin extends BlockDirectional {
|
||||
public BlockPumpkin() {
|
||||
super(Material.SOFT);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
this.setTab(CheatTab.PLANTS);
|
||||
}
|
||||
|
||||
public BlockPumpkin()
|
||||
{
|
||||
super(Material.SOFT);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
// this.setTickRandomly(true);
|
||||
this.setTab(CheatTab.PLANTS);
|
||||
}
|
||||
public boolean canPlaceBlockAt(World world, BlockPos pos) {
|
||||
return world.getState(pos).getBlock().getMaterial().isReplaceable() && world.isBlockSolid(pos.down());
|
||||
}
|
||||
|
||||
// public void onBlockAdded(IWorldServer worldIn, BlockPos pos, IBlockState state)
|
||||
// {
|
||||
// super.onBlockAdded(worldIn, pos, state);
|
||||
// this.trySpawnGolem(worldIn, pos);
|
||||
// }
|
||||
public State onBlockPlaced(World world, BlockPos pos, Facing face, float hitX, float hitY, float hitZ, int meta, EntityLiving placer) {
|
||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
||||
}
|
||||
|
||||
// public boolean canDispenserPlace(World worldIn, BlockPos pos)
|
||||
// {
|
||||
// return this.getSnowmanBasePattern().match(worldIn, pos) != null; // || this.getGolemBasePattern().match(worldIn, pos) != null;
|
||||
// }
|
||||
public State getStateFromMeta(int meta) {
|
||||
return this.getState().withProperty(FACING, Facing.getHorizontal(meta));
|
||||
}
|
||||
|
||||
// private void trySpawnGolem(World worldIn, BlockPos pos)
|
||||
// {
|
||||
// if(!Config.createSnowman) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// BlockPattern.PatternHelper blockpattern$patternhelper;
|
||||
//
|
||||
// if ((blockpattern$patternhelper = this.getSnowmanPattern().match(worldIn, pos)) != null)
|
||||
// {
|
||||
// for (int i = 0; i < this.getSnowmanPattern().getThumbLength(); ++i)
|
||||
// {
|
||||
// BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(0, i, 0);
|
||||
// worldIn.setBlockState(blockworldstate.getPos(), Blocks.air.getDefaultState(), 2);
|
||||
// }
|
||||
//
|
||||
// EntitySnowman entitysnowman = new EntitySnowman(worldIn);
|
||||
// BlockPos blockpos1 = blockpattern$patternhelper.translateOffset(0, 2, 0).getPos();
|
||||
// entitysnowman.setLocationAndAngles((double)blockpos1.getX() + 0.5D, (double)blockpos1.getY() + 0.05D, (double)blockpos1.getZ() + 0.5D, 0.0F, 0.0F);
|
||||
// worldIn.spawnEntityInWorld(entitysnowman);
|
||||
//
|
||||
// for (int j = 0; j < 120; ++j)
|
||||
// {
|
||||
// worldIn.spawnParticle(EnumParticleTypes.SNOW_SHOVEL, (double)blockpos1.getX() + worldIn.rand.doublev(), (double)blockpos1.getY() + worldIn.rand.doublev() * 2.5D, (double)blockpos1.getZ() + worldIn.rand.doublev(), 0.0D, 0.0D, 0.0D);
|
||||
// }
|
||||
//
|
||||
// for (int i1 = 0; i1 < this.getSnowmanPattern().getThumbLength(); ++i1)
|
||||
// {
|
||||
// BlockWorldState blockworldstate1 = blockpattern$patternhelper.translateOffset(0, i1, 0);
|
||||
// worldIn.notifyNeighborsRespectDebug(blockworldstate1.getPos(), Blocks.air);
|
||||
// }
|
||||
// }
|
||||
//// else if ((blockpattern$patternhelper = this.getGolemPattern().match(worldIn, pos)) != null)
|
||||
//// {
|
||||
//// for (int k = 0; k < this.getGolemPattern().getPalmLength(); ++k)
|
||||
//// {
|
||||
//// for (int l = 0; l < this.getGolemPattern().getThumbLength(); ++l)
|
||||
//// {
|
||||
//// worldIn.setBlockState(blockpattern$patternhelper.translateOffset(k, l, 0).getPos(), Blocks.air.getDefaultState(), 2);
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
//// BlockPos blockpos = blockpattern$patternhelper.translateOffset(1, 2, 0).getPos();
|
||||
//// EntityIronGolem entityirongolem = new EntityIronGolem(worldIn);
|
||||
////// entityirongolem.setPlayerCreated(true);
|
||||
//// entityirongolem.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.05D, (double)blockpos.getZ() + 0.5D, 0.0F, 0.0F);
|
||||
//// worldIn.spawnEntityInWorld(entityirongolem);
|
||||
////
|
||||
//// for (int j1 = 0; j1 < 120; ++j1)
|
||||
//// {
|
||||
//// worldIn.spawnParticle(EnumParticleTypes.SNOWBALL, (double)blockpos.getX() + worldIn.rand.doublev(), (double)blockpos.getY() + worldIn.rand.doublev() * 3.9D, (double)blockpos.getZ() + worldIn.rand.doublev(), 0.0D, 0.0D, 0.0D);
|
||||
//// }
|
||||
////
|
||||
//// for (int k1 = 0; k1 < this.getGolemPattern().getPalmLength(); ++k1)
|
||||
//// {
|
||||
//// for (int l1 = 0; l1 < this.getGolemPattern().getThumbLength(); ++l1)
|
||||
//// {
|
||||
//// BlockWorldState blockworldstate2 = blockpattern$patternhelper.translateOffset(k1, l1, 0);
|
||||
//// worldIn.notifyNeighborsRespectDebug(blockworldstate2.getPos(), Blocks.air);
|
||||
//// }
|
||||
//// }
|
||||
//// }
|
||||
// }
|
||||
public int getMetaFromState(State state) {
|
||||
return state.getValue(FACING).getHorizontalIndex();
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
||||
{
|
||||
return worldIn.getState(pos).getBlock().getMaterial().isReplaceable() && worldIn.isBlockSolid(pos.down());
|
||||
}
|
||||
protected IProperty[] getProperties() {
|
||||
return new IProperty[] {FACING};
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||
* IBlockstate
|
||||
*/
|
||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
||||
{
|
||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given metadata into a BlockState for this Block
|
||||
*/
|
||||
public State getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getState().withProperty(FACING, Facing.getHorizontal(meta));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the BlockState into the correct metadata value
|
||||
*/
|
||||
public int getMetaFromState(State state)
|
||||
{
|
||||
return ((Facing)state.getValue(FACING)).getHorizontalIndex();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING};
|
||||
}
|
||||
|
||||
// protected BlockPattern getSnowmanBasePattern()
|
||||
// {
|
||||
// if (this.snowmanBasePattern == null)
|
||||
// {
|
||||
// this.snowmanBasePattern = FactoryBlockPattern.start().aisle(" ", "#", "#").where('#', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.snow))).build();
|
||||
// }
|
||||
//
|
||||
// return this.snowmanBasePattern;
|
||||
// }
|
||||
//
|
||||
// protected BlockPattern getSnowmanPattern()
|
||||
// {
|
||||
// if (this.snowmanPattern == null)
|
||||
// {
|
||||
// this.snowmanPattern = FactoryBlockPattern.start().aisle("^", "#", "#").where('^', BlockWorldState.hasState(field_181085_Q)).where('#', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.snow))).build();
|
||||
// }
|
||||
//
|
||||
// return this.snowmanPattern;
|
||||
// }
|
||||
|
||||
// protected BlockPattern getGolemBasePattern()
|
||||
// {
|
||||
// if (this.golemBasePattern == null)
|
||||
// {
|
||||
// this.golemBasePattern = FactoryBlockPattern.start().aisle("~ ~", "###", "~#~").where('#', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.iron_block))).where('~', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.air))).build();
|
||||
// }
|
||||
//
|
||||
// return this.golemBasePattern;
|
||||
// }
|
||||
|
||||
// protected BlockPattern getGolemPattern()
|
||||
// {
|
||||
// if (this.golemPattern == null)
|
||||
// {
|
||||
// this.golemPattern = FactoryBlockPattern.start().aisle("~^~", "###", "~#~").where('^', BlockWorldState.hasState(field_181085_Q)).where('#', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.iron_block))).where('~', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.air))).build();
|
||||
// }
|
||||
//
|
||||
// return this.golemPattern;
|
||||
// }
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel("pumpkin_side").add().du("pumpkin_top").n("pumpkin_face_" + (this.getLightValue() == 0 ? "off" : "on"))
|
||||
.s().we().rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
|
||||
}
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel("pumpkin_side").add().du("pumpkin_top").n("pumpkin_face_" + (this.getLightValue() == 0 ? "off" : "on")).s().we()
|
||||
.rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,148 +1,69 @@
|
|||
package common.block.tile;
|
||||
|
||||
import common.block.BlockContainer;
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.Material;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Items;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Transforms;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntitySkull;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Facing;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockSkull extends BlockContainer
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing");
|
||||
public class BlockSkull extends BlockDirectional {
|
||||
public BlockSkull() {
|
||||
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);
|
||||
}
|
||||
|
||||
public BlockSkull()
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public boolean canPlaceBlockAt(World world, BlockPos pos) {
|
||||
return world.getState(pos).getBlock().getMaterial().isReplaceable() && world.isBlockSolid(pos.down());
|
||||
}
|
||||
|
||||
public boolean isFullCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public State onBlockPlaced(World world, BlockPos pos, Facing face, float hitX, float hitY, float hitZ, int meta, EntityLiving placer) {
|
||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos)
|
||||
{
|
||||
switch ((Facing)worldIn.getState(pos).getValue(FACING))
|
||||
{
|
||||
case UP:
|
||||
default:
|
||||
this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
|
||||
break;
|
||||
public State getStateFromMeta(int meta) {
|
||||
return this.getState().withProperty(FACING, Facing.getHorizontal(meta));
|
||||
}
|
||||
|
||||
case NORTH:
|
||||
this.setBlockBounds(0.25F, 0.25F, 0.5F, 0.75F, 0.75F, 1.0F);
|
||||
break;
|
||||
public int getMetaFromState(State state) {
|
||||
return state.getValue(FACING).getHorizontalIndex();
|
||||
}
|
||||
|
||||
case SOUTH:
|
||||
this.setBlockBounds(0.25F, 0.25F, 0.0F, 0.75F, 0.75F, 0.5F);
|
||||
break;
|
||||
protected IProperty[] getProperties() {
|
||||
return new IProperty[] {FACING};
|
||||
}
|
||||
|
||||
case WEST:
|
||||
this.setBlockBounds(0.5F, 0.25F, 0.25F, 1.0F, 0.75F, 0.75F);
|
||||
break;
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel("skull_top").add(4, 0, 4, 12, 8, 12)
|
||||
.d("skull_bottom").u().n("skull_front").s("skull_back").w("skull_right").e("skull_left").rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
case EAST:
|
||||
this.setBlockBounds(0.0F, 0.25F, 0.25F, 0.5F, 0.75F, 0.75F);
|
||||
}
|
||||
}
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(worldIn, pos);
|
||||
return super.getCollisionBoundingBox(worldIn, pos, state);
|
||||
}
|
||||
|
||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
||||
{
|
||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing());
|
||||
}
|
||||
|
||||
public TileEntity createNewTileEntity(World worldIn)
|
||||
{
|
||||
return new TileEntitySkull();
|
||||
}
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
return Items.skull;
|
||||
}
|
||||
|
||||
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, State state, float chance, int fortune)
|
||||
{
|
||||
}
|
||||
public Item getItemDropped(State state, Random rand, int fortune) {
|
||||
return Items.skull;
|
||||
}
|
||||
|
||||
// public void onBlockHarvested(World worldIn, BlockPos pos, State state, EntityNPC player)
|
||||
// {
|
||||
// if (player.creative)
|
||||
// {
|
||||
// if(!worldIn.client)
|
||||
// worldIn.removeTileEntity(pos);
|
||||
// }
|
||||
//
|
||||
// super.onBlockHarvested(worldIn, pos, state, player);
|
||||
// }
|
||||
public Item getItem(World worldIn, BlockPos pos) {
|
||||
return Items.skull;
|
||||
}
|
||||
|
||||
public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state)
|
||||
{
|
||||
if (!worldIn.client)
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
if (tileentity instanceof TileEntitySkull)
|
||||
{
|
||||
ItemStack itemstack = new ItemStack(Items.skull, 1, 0);
|
||||
spawnAsEntity(worldIn, pos, itemstack);
|
||||
}
|
||||
super.onBlockRemoved(worldIn, pos, state);
|
||||
}
|
||||
}
|
||||
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return Items.skull;
|
||||
}
|
||||
|
||||
public State getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getState().withProperty(FACING, Facing.getFront(meta));
|
||||
}
|
||||
|
||||
public int getMetaFromState(State state)
|
||||
{
|
||||
return ((Facing)state.getValue(FACING)).getIndex();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING};
|
||||
}
|
||||
|
||||
public boolean isXrayVisible()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.SKULL;
|
||||
}
|
||||
public boolean isXrayVisible() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -479,7 +479,7 @@ public abstract class BlockRegistry {
|
|||
registerBlock(307, "flower_pot", (new BlockFlowerPot()).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf"));
|
||||
registerBlock(308, "sponge", (new Block(Material.LOOSE)).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Schwamm")
|
||||
.setTab(CheatTab.DECORATION));
|
||||
registerBlock(309, "skull", (new BlockSkull()).setHardness(1.0F).setStepSound(SoundType.STONE).setDisplay("Kopf"));
|
||||
registerBlock(309, "skull", (new BlockSkull()).setHardness(1.0F).setStepSound(SoundType.STONE).setDisplay("Schädel").setTab(CheatTab.DECORATION));
|
||||
registerBlock(310, "lit_pumpkin",
|
||||
(new BlockPumpkin()).setHardness(1.0F).setStepSound(SoundType.WOOD).setLightLevel(1.0F).setDisplay("Kürbislaterne"));
|
||||
registerBlock(311, "hay_block", (new BlockHay()).setHardness(0.5F).setStepSound(SoundType.GRASS).setDisplay("Strohballen")
|
||||
|
|
|
@ -99,14 +99,13 @@ import common.item.ItemPotion;
|
|||
import common.item.ItemPressurePlate;
|
||||
import common.item.ItemRecord;
|
||||
import common.item.ItemRedstone;
|
||||
import common.item.ItemReed;
|
||||
import common.item.ItemSmallBlock;
|
||||
import common.item.ItemRod;
|
||||
import common.item.ItemSaddle;
|
||||
import common.item.ItemSeedFood;
|
||||
import common.item.ItemSeeds;
|
||||
import common.item.ItemShears;
|
||||
import common.item.ItemSign;
|
||||
import common.item.ItemSkull;
|
||||
import common.item.ItemSlab;
|
||||
import common.item.ItemSmall;
|
||||
import common.item.ItemSnow;
|
||||
|
@ -410,7 +409,7 @@ public abstract class ItemRegistry {
|
|||
registerItem("stick", (new ItemStick()).setDisplay("Stock").setTab(CheatTab.MATERIALS).setMaxStackSize(256));
|
||||
registerItem("bowl", (new ItemSmall()).setDisplay("Schüssel").setTab(CheatTab.MISC));
|
||||
registerItem("mushroom_stew", (new ItemSoup(6)).setDisplay("Pilzsuppe"));
|
||||
registerItem((new ItemReed(Blocks.string)).setDisplay("Faden").setTab(CheatTab.TECHNOLOGY).setMaxStackSize(1024));
|
||||
registerItem((new ItemSmallBlock(Blocks.string)).setDisplay("Faden").setTab(CheatTab.TECHNOLOGY).setMaxStackSize(1024));
|
||||
registerItem("feather", (new Item()).setDisplay("Feder").setTab(CheatTab.MATERIALS).setMaxStackSize(512));
|
||||
registerItem("gunpowder", (new Item()).setDisplay("Schwarzpulver").setPotionEffect(PotionHelper.gunpowderEffect).setTab(CheatTab.MATERIALS).setMaxStackSize(256));
|
||||
registerItem((new ItemSeeds(Blocks.wheat, Blocks.farmland)).setDisplay("Weizenkörner").setMaxStackSize(256));
|
||||
|
@ -432,7 +431,7 @@ public abstract class ItemRegistry {
|
|||
registerItem("leather", (new Item()).setDisplay("Leder").setTab(CheatTab.MATERIALS));
|
||||
registerItem("brick", (new Item()).setDisplay("Ziegel").setTab(CheatTab.MATERIALS));
|
||||
registerItem("clay_ball", (new Item()).setDisplay("Ton").setTab(CheatTab.MATERIALS).setMaxStackSize(128));
|
||||
registerItem((new ItemReed(Blocks.reeds)).setDisplay("Zuckerrohr").setTab(CheatTab.PLANTS).setMaxStackSize(128));
|
||||
registerItem((new ItemSmallBlock(Blocks.reeds)).setDisplay("Zuckerrohr").setTab(CheatTab.PLANTS).setMaxStackSize(128));
|
||||
registerItem("paper", (new Item()).setDisplay("Papier").setTab(CheatTab.MATERIALS).setMaxStackSize(256));
|
||||
registerItem("book", (new ItemBook()).setDisplay("Buch").setTab(CheatTab.MISC));
|
||||
registerItem("slime_ball", (new Item()).setDisplay("Schleimball").setTab(CheatTab.MATERIALS).setMaxStackSize(128));
|
||||
|
@ -448,8 +447,8 @@ public abstract class ItemRegistry {
|
|||
registerItem("dye", dye);
|
||||
registerItem("bone", (new ItemStick()).setDisplay("Knochen").setTab(CheatTab.MATERIALS).setMaxStackSize(128));
|
||||
registerItem("sugar", (new Item()).setDisplay("Zucker").setPotionEffect(PotionHelper.sugarEffect).setTab(CheatTab.MATERIALS).setMaxStackSize(512));
|
||||
registerItem((new ItemReed(Blocks.cake)).setMaxStackSize(1).setDisplay("Kuchen").setTab(CheatTab.DECORATION));
|
||||
registerItem((new ItemReed(Blocks.repeater)).setDisplay("Redstone-Verstärker").setTab(CheatTab.TECHNOLOGY));
|
||||
registerItem((new ItemSmallBlock(Blocks.cake)).setMaxStackSize(1).setDisplay("Kuchen").setTab(CheatTab.DECORATION));
|
||||
registerItem((new ItemSmallBlock(Blocks.repeater)).setDisplay("Redstone-Verstärker").setTab(CheatTab.TECHNOLOGY));
|
||||
registerItem("cookie", (new ItemFood(2, false)).setDisplay("Keks").setMaxStackSize(128));
|
||||
registerItem("melon", (new ItemFood(2, false)).setDisplay("Melone"));
|
||||
registerItem((new ItemSeeds(Blocks.pumpkin_stem, Blocks.farmland)).setDisplay("Kürbiskerne").setMaxStackSize(256));
|
||||
|
@ -473,8 +472,8 @@ public abstract class ItemRegistry {
|
|||
registerItem("blaze_powder", (new Item()).setDisplay("Lohenstaub").setPotionEffect(PotionHelper.blazePowderEffect)
|
||||
.setTab(CheatTab.MATERIALS).setMaxStackSize(256));
|
||||
registerItem("magma_cream", (new Item()).setDisplay("Magmacreme").setPotionEffect(PotionHelper.magmaCreamEffect).setTab(CheatTab.MATERIALS).setMaxStackSize(128));
|
||||
registerItem((new ItemReed(Blocks.brewing_stand)).setDisplay("Braustand").setTab(CheatTab.TECHNOLOGY));
|
||||
registerItem((new ItemReed(Blocks.cauldron)).setDisplay("Kessel").setTab(CheatTab.TECHNOLOGY));
|
||||
registerItem((new ItemSmallBlock(Blocks.brewing_stand)).setDisplay("Braustand").setTab(CheatTab.TECHNOLOGY));
|
||||
registerItem((new ItemSmallBlock(Blocks.cauldron)).setDisplay("Kessel").setTab(CheatTab.TECHNOLOGY));
|
||||
registerItem("charged_orb", (new ItemChargedOrb()).setDisplay("Geladene Kugel"));
|
||||
registerItem("speckled_melon", (new Item()).setDisplay("Glitzernde Melone").setPotionEffect(PotionHelper.speckledMelonEffect)
|
||||
.setTab(CheatTab.MISC));
|
||||
|
@ -484,21 +483,21 @@ public abstract class ItemRegistry {
|
|||
registerItem("written_book", (new Item()).setDisplay("Beschriebenes Buch").setTab(CheatTab.MISC));
|
||||
Item emerald = (new Item()).setDisplay("Smaragd").setTab(CheatTab.METALS);
|
||||
registerItem("emerald", emerald);
|
||||
registerItem((new ItemReed(Blocks.flower_pot)).setDisplay("Blumentopf").setTab(CheatTab.DECORATION));
|
||||
registerItem((new ItemSmallBlock(Blocks.flower_pot)).setDisplay("Blumentopf").setTab(CheatTab.DECORATION));
|
||||
registerItem((new ItemSeedFood(3, Blocks.carrot, Blocks.farmland)).setDisplay("Karotte").setMaxStackSize(128));
|
||||
registerItem((new ItemSeedFood(1, Blocks.potato, Blocks.farmland)).setDisplay("Kartoffel").setMaxStackSize(128));
|
||||
registerItem("baked_potato", (new ItemFood(5, false)).setDisplay("Ofenkartoffel").setMaxStackSize(128));
|
||||
registerItem("poisonous_potato", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 0.6F).setDisplay("Giftige Kartoffel").setMaxStackSize(128));
|
||||
registerItem("golden_carrot", (new ItemFood(6, false)).setDisplay("Goldene Karotte")
|
||||
.setPotionEffect(PotionHelper.goldenCarrotEffect).setTab(CheatTab.MISC));
|
||||
registerItem((new ItemSkull()).setDisplay("Kopf"));
|
||||
registerItem((new ItemSmallBlock(Blocks.skull)).setDisplay("Schädel"));
|
||||
registerItem("carrot_on_a_stick", (new ItemCarrotOnAStick()).setDisplay("Karottenrute"));
|
||||
registerItem("charge_crystal", (new ItemEffect()).setDisplay("Energiekristall").setTab(CheatTab.MISC).setColor(TextColor.DMAGENTA));
|
||||
registerItem("pumpkin_pie", (new ItemFood(8, false)).setDisplay("Kürbiskuchen").setTab(CheatTab.MISC));
|
||||
registerItem("fireworks", (new ItemFirework()).setDisplay("Feuerwerksrakete"));
|
||||
registerItem("firework_charge", (new ItemFireworkCharge()).setDisplay("Feuerwerksstern").setTab(CheatTab.MATERIALS));
|
||||
registerItem("enchanted_book", (new ItemEnchantedBook()).setMaxStackSize(1).setDisplay("Verzaubertes Buch").setTab(CheatTab.MAGIC));
|
||||
registerItem((new ItemReed(Blocks.comparator)).setDisplay("Redstone-Komparator").setTab(CheatTab.TECHNOLOGY));
|
||||
registerItem((new ItemSmallBlock(Blocks.comparator)).setDisplay("Redstone-Komparator").setTab(CheatTab.TECHNOLOGY));
|
||||
registerItem("bloodbrick", (new Item()).setDisplay("Blutroter Ziegel").setTab(CheatTab.MATERIALS));
|
||||
registerItem("blackbrick", (new Item()).setDisplay("Schwarzer Ziegel").setTab(CheatTab.MATERIALS));
|
||||
Item quartz = (new Item()).setDisplay("Quarz").setTab(CheatTab.METALS);
|
||||
|
|
|
@ -111,7 +111,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 ItemReed brewing_stand = get("brewing_stand");
|
||||
public static final ItemSmallBlock 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");
|
||||
|
@ -121,7 +121,7 @@ public abstract class Items {
|
|||
public static final ItemBucket bucket = get("bucket");
|
||||
public static final ItemFlintAndSteel burning_soul = get("burning_soul");
|
||||
public static final ItemBlock cactus = get("cactus");
|
||||
public static final ItemReed cake = get("cake");
|
||||
public static final ItemSmallBlock 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");
|
||||
|
@ -129,7 +129,7 @@ public abstract class Items {
|
|||
public static final ItemCloth carpet = get("carpet");
|
||||
public static final ItemSeedFood carrot = get("carrot");
|
||||
public static final ItemCarrotOnAStick carrot_on_a_stick = get("carrot_on_a_stick");
|
||||
public static final ItemReed cauldron = get("cauldron");
|
||||
public static final ItemSmallBlock 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");
|
||||
|
@ -173,7 +173,7 @@ public abstract class Items {
|
|||
public static final ItemSlab cobblestone_slab = get("cobblestone_slab");
|
||||
public static final ItemBlock cobblestone_stairs = get("cobblestone_stairs");
|
||||
public static final ItemWall cobblestone_wall = get("cobblestone_wall");
|
||||
public static final ItemReed comparator = get("comparator");
|
||||
public static final ItemSmallBlock comparator = get("comparator");
|
||||
public static final ItemBlock construction_table = get("construction_table");
|
||||
public static final ItemFood cooked_beef = get("cooked_beef");
|
||||
public static final ItemFood cooked_chicken = get("cooked_chicken");
|
||||
|
@ -243,7 +243,7 @@ public abstract class Items {
|
|||
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 ItemMultiTexture flower = get("flower");
|
||||
public static final ItemReed flower_pot = get("flower_pot");
|
||||
public static final ItemSmallBlock flower_pot = get("flower_pot");
|
||||
public static final ItemBlock furnace = get("furnace");
|
||||
public static final ItemTiny ghast_tear = get("ghast_tear");
|
||||
public static final Item ghi_fragment = get("ghi_fragment");
|
||||
|
@ -483,8 +483,8 @@ public abstract class Items {
|
|||
public static final ItemBlock redstone_lamp = get("redstone_lamp");
|
||||
public static final ItemBlock redstone_ore = get("redstone_ore");
|
||||
public static final ItemBlock redstone_torch = get("redstone_torch");
|
||||
public static final ItemReed reeds = get("reeds");
|
||||
public static final ItemReed repeater = get("repeater");
|
||||
public static final ItemSmallBlock reeds = get("reeds");
|
||||
public static final ItemSmallBlock repeater = get("repeater");
|
||||
public static final ItemMultiTexture rock = get("rock");
|
||||
public static final ItemFood rotten_flesh = get("rotten_flesh");
|
||||
public static final Item ruby = get("ruby");
|
||||
|
@ -505,7 +505,7 @@ public abstract class Items {
|
|||
public static final ItemMetalBlock silver_block = get("silver_block");
|
||||
public static final ItemMetal silver_ingot = get("silver_ingot");
|
||||
public static final ItemMetalBlock silver_ore = get("silver_ore");
|
||||
public static final ItemSkull skull = get("skull");
|
||||
public static final ItemSmallBlock 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");
|
||||
|
@ -547,7 +547,7 @@ public abstract class Items {
|
|||
public static final ItemMultiTexture stonebrick = get("stonebrick");
|
||||
public static final ItemSlab stonebrick_slab = get("stonebrick_slab");
|
||||
public static final ItemBlock stonebrick_stairs = get("stonebrick_stairs");
|
||||
public static final ItemReed string = get("string");
|
||||
public static final ItemSmallBlock 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");
|
||||
|
|
|
@ -18,7 +18,6 @@ import common.tileentity.TileEntityHopper;
|
|||
import common.tileentity.TileEntityMobSpawner;
|
||||
import common.tileentity.TileEntityPiston;
|
||||
import common.tileentity.TileEntitySign;
|
||||
import common.tileentity.TileEntitySkull;
|
||||
import common.tileentity.TileEntityTianReactor;
|
||||
|
||||
public abstract class TileRegistry {
|
||||
|
@ -47,7 +46,6 @@ public abstract class TileRegistry {
|
|||
addMapping(TileEntityBrewingStand.class, "Cauldron");
|
||||
addMapping(TileEntityEnchantmentTable.class, "EnchantTable");
|
||||
addMapping(TileEntityBeacon.class, "Beacon");
|
||||
addMapping(TileEntitySkull.class, "Skull");
|
||||
addMapping(TileEntityDaylightDetector.class, "DLDetector");
|
||||
addMapping(TileEntityHopper.class, "Hopper");
|
||||
addMapping(TileEntityComparator.class, "Comparator");
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
package common.item;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.natural.BlockSnow;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class ItemReed extends Item
|
||||
{
|
||||
private Block block;
|
||||
|
||||
public ItemReed(Block block)
|
||||
{
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public Block getBlock()
|
||||
{
|
||||
return this.block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a Block is right-clicked with this Item
|
||||
*/
|
||||
public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
State iblockstate = worldIn.getState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if (block == Blocks.snow_layer && ((Integer)iblockstate.getValue(BlockSnow.LAYERS)).intValue() < 1)
|
||||
{
|
||||
side = Facing.UP;
|
||||
}
|
||||
else if (!block.isReplaceable(worldIn, pos))
|
||||
{
|
||||
pos = pos.offset(side);
|
||||
}
|
||||
|
||||
if (!playerIn.canPlayerEdit(pos, side, stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (stack.size == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (worldIn.canBlockBePlaced(this.block, pos, false, side, (Entity)null, stack))
|
||||
{
|
||||
State iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, 0, playerIn);
|
||||
|
||||
if (worldIn.setState(pos, iblockstate1, 3))
|
||||
{
|
||||
iblockstate1 = worldIn.getState(pos);
|
||||
|
||||
if (iblockstate1.getBlock() == this.block)
|
||||
{
|
||||
ItemBlock.setTileEntityNBT(worldIn, playerIn, pos, stack);
|
||||
iblockstate1.getBlock().onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack);
|
||||
}
|
||||
|
||||
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);
|
||||
--stack.size;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
return this.block.isMagnetic();
|
||||
}
|
||||
}
|
|
@ -1,188 +0,0 @@
|
|||
package common.item;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.tile.BlockSkull;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transforms;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntitySkull;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class ItemSkull extends Item
|
||||
{
|
||||
public ItemSkull()
|
||||
{
|
||||
this.setTab(CheatTab.DECORATION);
|
||||
// this.setMaxDamage(0);
|
||||
// this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public Block getBlock()
|
||||
{
|
||||
return Blocks.skull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a Block is right-clicked with this Item
|
||||
*/
|
||||
public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (side == Facing.DOWN)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
State iblockstate = worldIn.getState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
boolean flag = block.isReplaceable(worldIn, pos);
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
if (!worldIn.getState(pos).getBlock().getMaterial().isSolid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pos = pos.offset(side);
|
||||
}
|
||||
|
||||
if (!playerIn.canPlayerEdit(pos, side, stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!Blocks.skull.canPlaceBlockAt(worldIn, pos))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!worldIn.client)
|
||||
{
|
||||
worldIn.setState(pos, Blocks.skull.getState().withProperty(BlockSkull.FACING, side), 3);
|
||||
int i = 0;
|
||||
|
||||
if (side == Facing.UP)
|
||||
{
|
||||
i = ExtMath.floord((double)(playerIn.rotYaw * 16.0F / 360.0F) + 0.5D) & 15;
|
||||
}
|
||||
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileEntitySkull)
|
||||
{
|
||||
TileEntitySkull tileentityskull = (TileEntitySkull)tileentity;
|
||||
|
||||
// if (stack.getMetadata() == 3)
|
||||
// {
|
||||
// String user = null;
|
||||
//
|
||||
// if (stack.hasTagCompound())
|
||||
// {
|
||||
// NBTTagCompound nbttagcompound = stack.getTagCompound();
|
||||
//
|
||||
// if (nbttagcompound.hasString("SkullOwner") && nbttagcompound.getString("SkullOwner").length() > 0)
|
||||
// {
|
||||
// user = nbttagcompound.getString("SkullOwner");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// tileentityskull.setUser(user);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// tileentityskull.setType(stack.getMetadata());
|
||||
// }
|
||||
|
||||
tileentityskull.setSkullRotation(i);
|
||||
// Blocks.skull.checkWitherSpawn(worldIn, pos, tileentityskull);
|
||||
}
|
||||
|
||||
--stack.size;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
||||
// */
|
||||
// public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems)
|
||||
// {
|
||||
// for (int i = 0; i < skullTypes.length; ++i)
|
||||
// {
|
||||
// subItems.add(new ItemStack(itemIn, 1, i));
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is
|
||||
// * placed as a Block (mostly used with ItemBlocks).
|
||||
// */
|
||||
// public int getMetadata(int damage)
|
||||
// {
|
||||
// return damage;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have
|
||||
// * different names based on their damage or NBT.
|
||||
// */
|
||||
// public String getUnlocalizedName(ItemStack stack)
|
||||
// {
|
||||
// int i = stack.getMetadata();
|
||||
//
|
||||
// if (i < 0 || i >= skullTypes.length)
|
||||
// {
|
||||
// i = 0;
|
||||
// }
|
||||
//
|
||||
// return super.getUnlocalizedName() + "." + skullTypes[i];
|
||||
// }
|
||||
|
||||
// public String getDisplay(ItemStack stack)
|
||||
// {
|
||||
// if (stack.hasTagCompound())
|
||||
// {
|
||||
// if (stack.getTagCompound().hasString("SkullOwner"))
|
||||
// {
|
||||
// return super.getDisplay(stack) + " von " + stack.getTagCompound().getString("SkullOwner");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return super.getDisplay(stack);
|
||||
// }
|
||||
|
||||
// public Set<String> getValidTags() {
|
||||
// return Sets.newHashSet("SkullOwner");
|
||||
// }
|
||||
//
|
||||
// protected boolean validateNbt(NBTTagCompound tag) {
|
||||
// if(tag.hasKey("SkullOwner")) {
|
||||
//// if(!adv) {
|
||||
//// return false;
|
||||
//// }
|
||||
// if(!tag.hasString("SkullOwner")) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.SKULL;
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
||||
return provider.getModel(provider.getEntityModel(), this.getTransform());
|
||||
}
|
||||
}
|
57
common/src/main/java/common/item/ItemSmallBlock.java
Executable file
|
@ -0,0 +1,57 @@
|
|||
package common.item;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.natural.BlockSnow;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
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.size == 0)
|
||||
return false;
|
||||
if(world.canBlockBePlaced(this.block, pos, false, side, null, stack)) {
|
||||
State newState = this.block.onBlockPlaced(world, pos, side, hitX, hitY, hitZ, 0, player);
|
||||
|
||||
if(world.setState(pos, newState, 3)) {
|
||||
newState = world.getState(pos);
|
||||
|
||||
if(newState.getBlock() == this.block) {
|
||||
ItemBlock.setTileEntityNBT(world, player, pos, stack);
|
||||
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.size;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
return this.block.isMagnetic();
|
||||
}
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
package common.tileentity;
|
||||
|
||||
import common.network.Packet;
|
||||
import common.packet.SPacketUpdateTileEntity;
|
||||
import common.tags.TagObject;
|
||||
|
||||
public class TileEntitySkull extends TileEntity
|
||||
{
|
||||
private int skullRotation;
|
||||
// private String user = null;
|
||||
|
||||
public void writeTags(TagObject compound)
|
||||
{
|
||||
super.writeTags(compound);
|
||||
compound.setByte("Rot", (byte)(this.skullRotation & 255));
|
||||
// if(this.user != null)
|
||||
// compound.setString("Owner", this.user);
|
||||
}
|
||||
|
||||
public void readTags(TagObject compound)
|
||||
{
|
||||
super.readTags(compound);
|
||||
this.skullRotation = compound.getByte("Rot");
|
||||
// if(compound.hasString("Owner"))
|
||||
// this.user = compound.getString("Owner");
|
||||
}
|
||||
|
||||
// public String getUser()
|
||||
// {
|
||||
// return this.user;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Allows for a specialized description packet to be created. This is often used to sync tile entity data from the
|
||||
* server to the client easily. For example this is used by signs to synchronise the text to be displayed.
|
||||
*/
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
return new SPacketUpdateTileEntity(this);
|
||||
}
|
||||
|
||||
// public void setUser(String user)
|
||||
// {
|
||||
// this.user = user;
|
||||
// this.markDirty();
|
||||
// }
|
||||
|
||||
public int getSkullRotation()
|
||||
{
|
||||
return this.skullRotation;
|
||||
}
|
||||
|
||||
public void setSkullRotation(int rotation)
|
||||
{
|
||||
this.skullRotation = rotation;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return 0x00ff00;
|
||||
}
|
||||
}
|
|
@ -80,7 +80,6 @@ import common.tileentity.TileEntityFurnace;
|
|||
import common.tileentity.TileEntityHopper;
|
||||
import common.tileentity.TileEntityMobSpawner;
|
||||
import common.tileentity.TileEntitySign;
|
||||
import common.tileentity.TileEntitySkull;
|
||||
import common.util.Facing;
|
||||
import common.util.NibbleArray;
|
||||
import common.world.State;
|
||||
|
@ -348,7 +347,6 @@ public abstract class Converter {
|
|||
// mapTile(TileEntityPiston.class, "Piston", "piston");
|
||||
mapTile(TileEntityEnchantmentTable.class, "EnchantTable", "enchanting_table");
|
||||
mapTile(TileEntityBeacon.class, "Beacon", "beacon");
|
||||
mapTile(TileEntitySkull.class, "Skull", "skull");
|
||||
mapTile(TileEntityDaylightDetector.class, "DLDetector", "daylight_detector");
|
||||
mapTile(TileEntityHopper.class, "Hopper", "hopper");
|
||||
mapTile(TileEntityComparator.class, "Comparator", "comparator");
|
||||
|
@ -969,9 +967,6 @@ public abstract class Converter {
|
|||
else if("Comparator".equals(id)) {
|
||||
nent.setInt("OutputSignal", ent.getInt("OutputSignal"));
|
||||
}
|
||||
else if("Skull".equals(id)) {
|
||||
nent.setByte("Rot", ent.getByte("Rot"));
|
||||
}
|
||||
return nent;
|
||||
}
|
||||
|
||||
|
|