Files
CatServer/patches/net/minecraft/block/BlockSilverfish.java.patch
2019-02-24 22:29:41 +08:00

103 lines
4.1 KiB
Diff

--- ../src-base/minecraft/net/minecraft/block/BlockSilverfish.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSilverfish.java
@@ -14,15 +14,16 @@
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
+import org.bukkit.event.entity.CreatureSpawnEvent;
public class BlockSilverfish extends Block
{
- public static final PropertyEnum<BlockSilverfish.EnumType> VARIANT = PropertyEnum.<BlockSilverfish.EnumType>create("variant", BlockSilverfish.EnumType.class);
+ public static final PropertyEnum<EnumType> VARIANT = PropertyEnum.<EnumType>create("variant", EnumType.class);
public BlockSilverfish()
{
super(Material.CLAY);
- this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockSilverfish.EnumType.STONE));
+ this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, EnumType.STONE));
this.setHardness(0.0F);
this.setCreativeTab(CreativeTabs.DECORATIONS);
}
@@ -40,7 +41,7 @@
protected ItemStack getSilkTouchDrop(IBlockState state)
{
- switch ((BlockSilverfish.EnumType)state.getValue(VARIANT))
+ switch ((EnumType)state.getValue(VARIANT))
{
case COBBLESTONE:
return new ItemStack(Blocks.COBBLESTONE);
@@ -63,7 +64,7 @@
{
EntitySilverfish entitysilverfish = new EntitySilverfish(worldIn);
entitysilverfish.setLocationAndAngles((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, 0.0F, 0.0F);
- worldIn.spawnEntity(entitysilverfish);
+ worldIn.addEntity(entitysilverfish, CreatureSpawnEvent.SpawnReason.SILVERFISH_BLOCK); // CraftBukkit - add SpawnReason
entitysilverfish.spawnExplosionParticle();
}
}
@@ -75,7 +76,7 @@
public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items)
{
- for (BlockSilverfish.EnumType blocksilverfish$enumtype : BlockSilverfish.EnumType.values())
+ for (EnumType blocksilverfish$enumtype : EnumType.values())
{
items.add(new ItemStack(this, 1, blocksilverfish$enumtype.getMetadata()));
}
@@ -83,12 +84,12 @@
public IBlockState getStateFromMeta(int meta)
{
- return this.getDefaultState().withProperty(VARIANT, BlockSilverfish.EnumType.byMetadata(meta));
+ return this.getDefaultState().withProperty(VARIANT, EnumType.byMetadata(meta));
}
public int getMetaFromState(IBlockState state)
{
- return ((BlockSilverfish.EnumType)state.getValue(VARIANT)).getMetadata();
+ return ((EnumType)state.getValue(VARIANT)).getMetadata();
}
protected BlockStateContainer createBlockState()
@@ -141,7 +142,7 @@
}
};
- private static final BlockSilverfish.EnumType[] META_LOOKUP = new BlockSilverfish.EnumType[values().length];
+ private static final EnumType[] META_LOOKUP = new EnumType[values().length];
private final int meta;
private final String name;
private final String unlocalizedName;
@@ -168,7 +169,7 @@
return this.name;
}
- public static BlockSilverfish.EnumType byMetadata(int meta)
+ public static EnumType byMetadata(int meta)
{
if (meta < 0 || meta >= META_LOOKUP.length)
{
@@ -190,9 +191,9 @@
public abstract IBlockState getModelBlock();
- public static BlockSilverfish.EnumType forModelBlock(IBlockState model)
+ public static EnumType forModelBlock(IBlockState model)
{
- for (BlockSilverfish.EnumType blocksilverfish$enumtype : values())
+ for (EnumType blocksilverfish$enumtype : values())
{
if (model == blocksilverfish$enumtype.getModelBlock())
{
@@ -205,7 +206,7 @@
static
{
- for (BlockSilverfish.EnumType blocksilverfish$enumtype : values())
+ for (EnumType blocksilverfish$enumtype : values())
{
META_LOOKUP[blocksilverfish$enumtype.getMetadata()] = blocksilverfish$enumtype;
}