mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 01:39:52 +03:00
211 lines
12 KiB
Diff
211 lines
12 KiB
Diff
--- ../src-base/minecraft/net/minecraft/block/BlockFlowerPot.java
|
|
+++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java
|
|
@@ -36,13 +36,13 @@
|
|
public class BlockFlowerPot extends BlockContainer
|
|
{
|
|
public static final PropertyInteger LEGACY_DATA = PropertyInteger.create("legacy_data", 0, 15);
|
|
- public static final PropertyEnum<BlockFlowerPot.EnumFlowerType> CONTENTS = PropertyEnum.<BlockFlowerPot.EnumFlowerType>create("contents", BlockFlowerPot.EnumFlowerType.class);
|
|
+ public static final PropertyEnum<EnumFlowerType> CONTENTS = PropertyEnum.<EnumFlowerType>create("contents", EnumFlowerType.class);
|
|
protected static final AxisAlignedBB FLOWER_POT_AABB = new AxisAlignedBB(0.3125D, 0.0D, 0.3125D, 0.6875D, 0.375D, 0.6875D);
|
|
|
|
public BlockFlowerPot()
|
|
{
|
|
super(Material.CIRCUITS);
|
|
- this.setDefaultState(this.blockState.getBaseState().withProperty(CONTENTS, BlockFlowerPot.EnumFlowerType.EMPTY).withProperty(LEGACY_DATA, Integer.valueOf(0)));
|
|
+ this.setDefaultState(this.blockState.getBaseState().withProperty(CONTENTS, EnumFlowerType.EMPTY).withProperty(LEGACY_DATA, Integer.valueOf(0)));
|
|
}
|
|
|
|
public String getLocalizedName()
|
|
@@ -152,12 +152,14 @@
|
|
|
|
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
|
{
|
|
- return super.canPlaceBlockAt(worldIn, pos) && worldIn.getBlockState(pos.down()).isTopSolid();
|
|
+ IBlockState downState = worldIn.getBlockState(pos.down());
|
|
+ return super.canPlaceBlockAt(worldIn, pos) && (downState.isTopSolid() || downState.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP) == BlockFaceShape.SOLID);
|
|
}
|
|
|
|
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos)
|
|
{
|
|
- if (!worldIn.getBlockState(pos.down()).isTopSolid())
|
|
+ IBlockState downState = worldIn.getBlockState(pos.down());
|
|
+ if (!downState.isTopSolid() && downState.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP) != BlockFaceShape.SOLID)
|
|
{
|
|
this.dropBlockAsItem(worldIn, pos, state, 0);
|
|
worldIn.setBlockToAir(pos);
|
|
@@ -166,13 +168,6 @@
|
|
|
|
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
|
{
|
|
- TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos);
|
|
-
|
|
- if (tileentityflowerpot != null && tileentityflowerpot.getFlowerPotItem() != null)
|
|
- {
|
|
- spawnAsEntity(worldIn, pos, new ItemStack(tileentityflowerpot.getFlowerPotItem(), 1, tileentityflowerpot.getFlowerPotData()));
|
|
- }
|
|
-
|
|
super.breakBlock(worldIn, pos, state);
|
|
}
|
|
|
|
@@ -273,7 +268,7 @@
|
|
|
|
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
|
|
{
|
|
- BlockFlowerPot.EnumFlowerType blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.EMPTY;
|
|
+ EnumFlowerType blockflowerpot$enumflowertype = EnumFlowerType.EMPTY;
|
|
TileEntity tileentity = worldIn instanceof ChunkCache ? ((ChunkCache)worldIn).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : worldIn.getTileEntity(pos);
|
|
|
|
if (tileentity instanceof TileEntityFlowerPot)
|
|
@@ -291,25 +286,25 @@
|
|
switch (BlockPlanks.EnumType.byMetadata(i))
|
|
{
|
|
case OAK:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.OAK_SAPLING;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.OAK_SAPLING;
|
|
break;
|
|
case SPRUCE:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.SPRUCE_SAPLING;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.SPRUCE_SAPLING;
|
|
break;
|
|
case BIRCH:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.BIRCH_SAPLING;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.BIRCH_SAPLING;
|
|
break;
|
|
case JUNGLE:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.JUNGLE_SAPLING;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.JUNGLE_SAPLING;
|
|
break;
|
|
case ACACIA:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.ACACIA_SAPLING;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.ACACIA_SAPLING;
|
|
break;
|
|
case DARK_OAK:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.DARK_OAK_SAPLING;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.DARK_OAK_SAPLING;
|
|
break;
|
|
default:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.EMPTY;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.EMPTY;
|
|
}
|
|
}
|
|
else if (block == Blocks.TALLGRASS)
|
|
@@ -317,69 +312,69 @@
|
|
switch (i)
|
|
{
|
|
case 0:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.DEAD_BUSH;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.DEAD_BUSH;
|
|
break;
|
|
case 2:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.FERN;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.FERN;
|
|
break;
|
|
default:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.EMPTY;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.EMPTY;
|
|
}
|
|
}
|
|
else if (block == Blocks.YELLOW_FLOWER)
|
|
{
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.DANDELION;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.DANDELION;
|
|
}
|
|
else if (block == Blocks.RED_FLOWER)
|
|
{
|
|
switch (BlockFlower.EnumFlowerType.getType(BlockFlower.EnumFlowerColor.RED, i))
|
|
{
|
|
case POPPY:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.POPPY;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.POPPY;
|
|
break;
|
|
case BLUE_ORCHID:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.BLUE_ORCHID;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.BLUE_ORCHID;
|
|
break;
|
|
case ALLIUM:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.ALLIUM;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.ALLIUM;
|
|
break;
|
|
case HOUSTONIA:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.HOUSTONIA;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.HOUSTONIA;
|
|
break;
|
|
case RED_TULIP:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.RED_TULIP;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.RED_TULIP;
|
|
break;
|
|
case ORANGE_TULIP:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.ORANGE_TULIP;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.ORANGE_TULIP;
|
|
break;
|
|
case WHITE_TULIP:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.WHITE_TULIP;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.WHITE_TULIP;
|
|
break;
|
|
case PINK_TULIP:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.PINK_TULIP;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.PINK_TULIP;
|
|
break;
|
|
case OXEYE_DAISY:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.OXEYE_DAISY;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.OXEYE_DAISY;
|
|
break;
|
|
default:
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.EMPTY;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.EMPTY;
|
|
}
|
|
}
|
|
else if (block == Blocks.RED_MUSHROOM)
|
|
{
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.MUSHROOM_RED;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.MUSHROOM_RED;
|
|
}
|
|
else if (block == Blocks.BROWN_MUSHROOM)
|
|
{
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.MUSHROOM_BROWN;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.MUSHROOM_BROWN;
|
|
}
|
|
else if (block == Blocks.DEADBUSH)
|
|
{
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.DEAD_BUSH;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.DEAD_BUSH;
|
|
}
|
|
else if (block == Blocks.CACTUS)
|
|
{
|
|
- blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.CACTUS;
|
|
+ blockflowerpot$enumflowertype = EnumFlowerType.CACTUS;
|
|
}
|
|
}
|
|
}
|
|
@@ -398,6 +393,30 @@
|
|
return BlockFaceShape.UNDEFINED;
|
|
}
|
|
|
|
+
|
|
+ /*============================FORGE START=====================================*/
|
|
+ @Override
|
|
+ public void getDrops(net.minecraft.util.NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
|
+ {
|
|
+ super.getDrops(drops, world, pos, state, fortune);
|
|
+ TileEntityFlowerPot te = world.getTileEntity(pos) instanceof TileEntityFlowerPot ? (TileEntityFlowerPot)world.getTileEntity(pos) : null;
|
|
+ if (te != null && te.getFlowerPotItem() != null)
|
|
+ drops.add(new ItemStack(te.getFlowerPotItem(), 1, te.getFlowerPotData()));
|
|
+ }
|
|
+ @Override
|
|
+ public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
|
|
+ {
|
|
+ if (willHarvest) return true; //If it will harvest, delay deletion of the block until after getDrops
|
|
+ return super.removedByPlayer(state, world, pos, player, willHarvest);
|
|
+ }
|
|
+ @Override
|
|
+ public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack tool)
|
|
+ {
|
|
+ super.harvestBlock(world, player, pos, state, te, tool);
|
|
+ world.setBlockToAir(pos);
|
|
+ }
|
|
+ /*===========================FORGE END==========================================*/
|
|
+
|
|
public static enum EnumFlowerType implements IStringSerializable
|
|
{
|
|
EMPTY("empty"),
|