Block .java

net.minecraft.block.Block (class, 1554 lines): members: getPlayerRelativeBlockHardness, getCreativeTabToDisplayOn, getUseNeighborBrightness, AIR_ID.

net.minecraft.blockclass1,554 linescommon69.1 KB

API Surface (138)

String getBreakSound()
String getPlaceSound()
String getBreakSound()
String getBreakSound()
String getPlaceSound()
String getBreakSound()
String getPlaceSound()
String getStepSound()
int getIdFromBlock(Block blockIn)
int getStateId(IBlockState state)
Block getBlockById(int id)
IBlockState getStateById(int id)
Block getBlockFromItem(Item itemIn)
Block getBlockFromName(String name)
boolean isFullBlock()
int getLightOpacity()
boolean isTranslucent()
int getLightValue()
boolean getUseNeighborBrightness()
Material getMaterial()
MapColor getMapColor(IBlockState state)
IBlockState getStateFromMeta(int meta)
int getMetaFromState(IBlockState state)
IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
Block setStepSound(Block.SoundType sound)
Block setLightOpacity(int opacity)
Block setLightLevel(float value)
Block setResistance(float resistance)
boolean isBlockNormalCube()
boolean isNormalCube()
boolean isVisuallyOpaque()
boolean isFullCube()
boolean isPassable(IBlockAccess worldIn, BlockPos pos)
int getRenderType()
boolean isReplaceable(World worldIn, BlockPos pos)
Block setHardness(float hardness)
Block setBlockUnbreakable()
float getBlockHardness(World worldIn, BlockPos pos)
Block setTickRandomly(boolean shouldTick)
boolean getTickRandomly()
boolean hasTileEntity()
void setBlockBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos)
boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
boolean isBlockSolid(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos)
void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity)
AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
boolean isOpaqueCube()
boolean canCollideCheck(IBlockState state, boolean hitIfLiquid)
boolean isCollidable()
void randomTick(World worldIn, BlockPos pos, IBlockState state, Random random)
void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state)
void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
int tickRate(World worldIn)
void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
void breakBlock(World worldIn, BlockPos pos, IBlockState state)
int quantityDropped(Random random)
Item getItemDropped(IBlockState state, Random rand, int fortune)
float getPlayerRelativeBlockHardness(EntityPlayer playerIn, World worldIn, BlockPos pos)
void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture)
void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack)
void dropXpOnBlockBreak(World worldIn, BlockPos pos, int amount)
int damageDropped(IBlockState state)
float getExplosionResistance(Entity exploder)
MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end)
void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn)
EnumWorldBlockLayer getBlockLayer()
boolean canReplace(World worldIn, BlockPos pos, EnumFacing side, ItemStack stack)
boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side)
boolean canPlaceBlockAt(World worldIn, BlockPos pos)
boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn)
IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn)
Vec3 modifyAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3 motion)
void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
double getBlockBoundsMinX()
double getBlockBoundsMaxX()
double getBlockBoundsMinY()
double getBlockBoundsMaxY()
double getBlockBoundsMinZ()
double getBlockBoundsMaxZ()
int getBlockColor()
int getRenderColor(IBlockState state)
int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass)
int colorMultiplier(IBlockAccess worldIn, BlockPos pos)
int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side)
boolean canProvidePower()
void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
int getStrongPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side)
void setBlockBoundsForItemRender()
void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
boolean canSilkHarvest()
ItemStack createStackedBlock(IBlockState state)
int quantityDroppedWithBonus(int fortune, Random random)
void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
boolean canSpawnInBlock()
Block setUnlocalizedName(String name)
String getLocalizedName()
String getUnlocalizedName()
boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam)
boolean getEnableStats()
Block disableStats()
int getMobilityFlag()
float getAmbientOcclusionLightValue()
void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance)
void onLanded(World worldIn, Entity entityIn)
Item getItem(World worldIn, BlockPos pos)
int getDamageValue(World worldIn, BlockPos pos)
void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
CreativeTabs getCreativeTabToDisplayOn()
Block setCreativeTab(CreativeTabs tab)
void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
void fillWithRain(World worldIn, BlockPos pos)
boolean isFlowerPot()
boolean requiresUpdates()

…and 18 more (see full source).

Fields & Constants (41)

AIR_ID
blockRegistry
BLOCK_STATE_IDS
soundTypeStone
soundTypeWood
soundTypeGravel
soundTypeGrass
soundTypePiston
soundTypeMetal
soundTypeGlass
soundTypeCloth
soundTypeSand
soundTypeSnow
soundTypeLadder
soundTypeAnvil
SLIME_SOUND
displayOnCreativeTab
fullBlock
lightOpacity
translucent
lightValue
useNeighborBrightness
blockHardness
blockResistance
enableStats
needsRandomTick
isBlockContainer
minX
minY
minZ
maxX
maxY
maxZ
stepSound
blockParticleGravity
blockMaterial
blockMapColor
slipperiness
blockState
defaultBlockState

…and 1 more (see full source).

String literals (322)

"stone"
"wood"
"gravel"
"grass"
"dig.glass"
"step.stone"
"cloth"
"sand"
"snow"
"ladder"
"dig.wood"
"anvil"
"dig.stone"
"random.anvil_land"
"slime"
"mob.slime.big"
"mob.slime.small"
"Don\'t know how to convert "
" back into data..."
"doTileDrops"
".name"
"tile."
"Block{"
"dirt"

Full Source

Block.java1554 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.block;
2
3
import java.util.List;
4
import java.util.Random;
5
import net.minecraft.block.material.MapColor;
6
import net.minecraft.block.material.Material;
7
import net.minecraft.block.properties.IProperty;
8
import net.minecraft.block.state.BlockState;
9
import net.minecraft.block.state.IBlockState;
10
import net.minecraft.creativetab.CreativeTabs;
11
import net.minecraft.enchantment.EnchantmentHelper;
12
import net.minecraft.entity.Entity;
13
import net.minecraft.entity.EntityLivingBase;
14
import net.minecraft.entity.item.EntityItem;
15
import net.minecraft.entity.item.EntityXPOrb;
16
import net.minecraft.entity.player.EntityPlayer;
17
import net.minecraft.item.Item;
18
import net.minecraft.item.ItemBlock;
19
import net.minecraft.item.ItemStack;
20
import net.minecraft.stats.StatList;
21
import net.minecraft.tileentity.TileEntity;
22
import net.minecraft.util.AxisAlignedBB;
23
import net.minecraft.util.BlockPos;
24
import net.minecraft.util.EnumFacing;
25
import net.minecraft.util.EnumWorldBlockLayer;
26
import net.minecraft.util.MovingObjectPosition;
27
import net.minecraft.util.ObjectIntIdentityMap;
28
import net.minecraft.util.RegistryNamespacedDefaultedByKey;
29
import net.minecraft.util.ResourceLocation;
30
import net.minecraft.util.StatCollector;
31
import net.minecraft.util.Vec3;
32
import net.minecraft.world.Explosion;
33
import net.minecraft.world.IBlockAccess;
34
import net.minecraft.world.World;
35
36
public class Block
37
{
38
    /** ResourceLocation for the Air block */
39
    private static final ResourceLocation AIR_ID = new ResourceLocation("air");
40
    public static final RegistryNamespacedDefaultedByKey<ResourceLocation, Block> blockRegistry = new RegistryNamespacedDefaultedByKey<>(AIR_ID); // Added type inference
41
    public static final ObjectIntIdentityMap<IBlockState> BLOCK_STATE_IDS = new ObjectIntIdentityMap<>();
42
    private CreativeTabs displayOnCreativeTab;
43
    public static final Block.SoundType soundTypeStone = new Block.SoundType("stone", 1.0F, 1.0F);
44
45
    /** the wood sound type */
46
    public static final Block.SoundType soundTypeWood = new Block.SoundType("wood", 1.0F, 1.0F);
47
48
    /** the gravel sound type */
49
    public static final Block.SoundType soundTypeGravel = new Block.SoundType("gravel", 1.0F, 1.0F);
50
    public static final Block.SoundType soundTypeGrass = new Block.SoundType("grass", 1.0F, 1.0F);
51
    public static final Block.SoundType soundTypePiston = new Block.SoundType("stone", 1.0F, 1.0F);
52
    public static final Block.SoundType soundTypeMetal = new Block.SoundType("stone", 1.0F, 1.5F);
53
    public static final Block.SoundType soundTypeGlass = new Block.SoundType("stone", 1.0F, 1.0F)
54
    {
55
        public String getBreakSound()
56
        {
57
            return "dig.glass";
58
        }
59
        public String getPlaceSound()
60
        {
61
            return "step.stone";
62
        }
63
    };
64
    public static final Block.SoundType soundTypeCloth = new Block.SoundType("cloth", 1.0F, 1.0F);
65
    public static final Block.SoundType soundTypeSand = new Block.SoundType("sand", 1.0F, 1.0F);
66
    public static final Block.SoundType soundTypeSnow = new Block.SoundType("snow", 1.0F, 1.0F);
67
    public static final Block.SoundType soundTypeLadder = new Block.SoundType("ladder", 1.0F, 1.0F)
68
    {
69
        public String getBreakSound()
70
        {
71
            return "dig.wood";
72
        }
73
    };
74
    public static final Block.SoundType soundTypeAnvil = new Block.SoundType("anvil", 0.3F, 1.0F)
75
    {
76
        public String getBreakSound()
77
        {
78
            return "dig.stone";
79
        }
80
        public String getPlaceSound()
81
        {
82
            return "random.anvil_land";
83
        }
84
    };
85
    public static final Block.SoundType SLIME_SOUND = new Block.SoundType("slime", 1.0F, 1.0F)
86
    {
87
        public String getBreakSound()
88
        {
89
            return "mob.slime.big";
90
        }
91
        public String getPlaceSound()
92
        {
93
            return "mob.slime.big";
94
        }
95
        public String getStepSound()
96
        {
97
            return "mob.slime.small";
98
        }
99
    };
100
    protected boolean fullBlock;
101
102
    /** How much light is subtracted for going through this block */
103
    protected int lightOpacity;
104
    protected boolean translucent;
105
106
    /** Amount of light emitted */
107
    protected int lightValue;
108
109
    /**
110
     * Flag if block should use the brightest neighbor light value as its own
111
     */
112
    protected boolean useNeighborBrightness;
113
114
    /** Indicates how many hits it takes to break a block. */
115
    protected float blockHardness;
116
117
    /** Indicates how much this block can resist explosions */
118
    protected float blockResistance;
119
    protected boolean enableStats;
120
121
    /**
122
     * Flags whether or not this block is of a type that needs random ticking. Ref-counted by ExtendedBlockStorage in
123
     * order to broadly cull a chunk from the random chunk update list for efficiency's sake.
124
     */
125
    protected boolean needsRandomTick;
126
127
    /** true if the Block contains a Tile Entity */
128
    protected boolean isBlockContainer;
129
    protected double minX;
130
    protected double minY;
131
    protected double minZ;
132
    protected double maxX;
133
    protected double maxY;
134
    protected double maxZ;
135
136
    /** Sound of stepping on the block */
137
    public Block.SoundType stepSound;
138
    public float blockParticleGravity;
139
    protected final Material blockMaterial;
140
141
    /** The Block's MapColor */
142
    protected final MapColor blockMapColor;
143
144
    /**
145
     * Determines how much velocity is maintained while moving on top of this block
146
     */
147
    public float slipperiness;
148
    protected final BlockState blockState;
149
    private IBlockState defaultBlockState;
150
    private String unlocalizedName;
151
152
    public static int getIdFromBlock(Block blockIn)
153
    {
154
        return blockRegistry.getIDForObject(blockIn);
155
    }
156
157
    /**
158
     * Get a unique ID for the given BlockState, containing both BlockID and metadata
159
     */
160
    public static int getStateId(IBlockState state)
161
    {
162
        Block block = state.getBlock();
163
        return getIdFromBlock(block) + (block.getMetaFromState(state) << 12);
164
    }
165
166
    public static Block getBlockById(int id)
167
    {
168
        return (Block)blockRegistry.getObjectById(id);
169
    }
170
171
    /**
172
     * Get a BlockState by it's ID (see getStateId)
173
     */
174
    public static IBlockState getStateById(int id)
175
    {
176
        int i = id & 4095;
177
        int j = id >> 12 & 15;
178
        return getBlockById(i).getStateFromMeta(j);
179
    }
180
181
    public static Block getBlockFromItem(Item itemIn)
182
    {
183
        return itemIn instanceof ItemBlock ? ((ItemBlock)itemIn).getBlock() : null;
184
    }
185
186
    public static Block getBlockFromName(String name)
187
    {
188
        ResourceLocation resourcelocation = new ResourceLocation(name);
189
190
        if (blockRegistry.containsKey(resourcelocation))
191
        {
192
            return (Block)blockRegistry.getObject(resourcelocation);
193
        }
194
        else
195
        {
196
            try
197
            {
198
                return (Block)blockRegistry.getObjectById(Integer.parseInt(name));
199
            }
200
            catch (NumberFormatException var3)
201
            {
202
                return null;
203
            }
204
        }
205
    }
206
207
    public boolean isFullBlock()
208
    {
209
        return this.fullBlock;
210
    }
211
212
    public int getLightOpacity()
213
    {
214
        return this.lightOpacity;
215
    }
216
217
    /**
218
     * Used in the renderer to apply ambient occlusion
219
     */
220
    public boolean isTranslucent()
221
    {
222
        return this.translucent;
223
    }
224
225
    public int getLightValue()
226
    {
227
        return this.lightValue;
228
    }
229
230
    /**
231
     * Should block use the brightest neighbor light value as its own
232
     */
233
    public boolean getUseNeighborBrightness()
234
    {
235
        return this.useNeighborBrightness;
236
    }
237
238
    /**
239
     * Get a material of block
240
     */
241
    public Material getMaterial()
242
    {
243
        return this.blockMaterial;
244
    }
245
246
    /**
247
     * Get the MapColor for this Block and the given BlockState
248
     */
249
    public MapColor getMapColor(IBlockState state)
250
    {
251
        return this.blockMapColor;
252
    }
253
254
    /**
255
     * Convert the given metadata into a BlockState for this Block
256
     */
257
    public IBlockState getStateFromMeta(int meta)
258
    {
259
        return this.getDefaultState();
260
    }
261
262
    /**
263
     * Convert the BlockState into the correct metadata value
264
     */
265
    public int getMetaFromState(IBlockState state)
266
    {
267
        if (state != null && !state.getPropertyNames().isEmpty())
268
        {
269
            throw new IllegalArgumentException("Don\'t know how to convert " + state + " back into data...");
270
        }
271
        else
272
        {
273
            return 0;
274
        }
275
    }
276
277
    /**
278
     * Get the actual Block state of this Block at the given position. This applies properties not visible in the
279
     * metadata, such as fence connections.
280
     */
281
    public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
282
    {
283
        return state;
284
    }
285
286
    public Block(Material blockMaterialIn, MapColor blockMapColorIn)
287
    {
288
        this.enableStats = true;
289
        this.stepSound = soundTypeStone;
290
        this.blockParticleGravity = 1.0F;
291
        this.slipperiness = 0.6F;
292
        this.blockMaterial = blockMaterialIn;
293
        this.blockMapColor = blockMapColorIn;
294
        this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
295
        this.fullBlock = this.isOpaqueCube();
296
        this.lightOpacity = this.isOpaqueCube() ? 255 : 0;
297
        this.translucent = !blockMaterialIn.blocksLight();
298
        this.blockState = this.createBlockState();
299
        this.setDefaultState(this.blockState.getBaseState());
300
    }
301
302
    protected Block(Material materialIn)
303
    {
304
        this(materialIn, materialIn.getMaterialMapColor());
305
    }
306
307
    /**
308
     * Sets the footstep sound for the block. Returns the object for convenience in constructing.
309
     */
310
    protected Block setStepSound(Block.SoundType sound)
311
    {
312
        this.stepSound = sound;
313
        return this;
314
    }
315
316
    /**
317
     * Sets how much light is blocked going through this block. Returns the object for convenience in constructing.
318
     */
319
    protected Block setLightOpacity(int opacity)
320
    {
321
        this.lightOpacity = opacity;
322
        return this;
323
    }
324
325
    /**
326
     * Sets the light value that the block emits. Returns resulting block instance for constructing convenience. Args:
327
     * level
328
     */
329
    protected Block setLightLevel(float value)
330
    {
331
        this.lightValue = (int)(15.0F * value);
332
        return this;
333
    }
334
335
    /**
336
     * Sets the the blocks resistance to explosions. Returns the object for convenience in constructing.
337
     */
338
    protected Block setResistance(float resistance)
339
    {
340
        this.blockResistance = resistance * 3.0F;
341
        return this;
342
    }
343
344
    /**
345
     * Indicate if a material is a normal solid opaque cube
346
     */
347
    public boolean isBlockNormalCube()
348
    {
349
        return this.blockMaterial.blocksMovement() && this.isFullCube();
350
    }
351
352
    /**
353
     * Used for nearly all game logic (non-rendering) purposes. Use Forge-provided isNormalCube(IBlockAccess, BlockPos)
354
     * instead.
355
     */
356
    public boolean isNormalCube()
357
    {
358
        return this.blockMaterial.isOpaque() && this.isFullCube() && !this.canProvidePower();
359
    }
360
361
    public boolean isVisuallyOpaque()
362
    {
363
        return this.blockMaterial.blocksMovement() && this.isFullCube();
364
    }
365
366
    public boolean isFullCube()
367
    {
368
        return true;
369
    }
370
371
    public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
372
    {
373
        return !this.blockMaterial.blocksMovement();
374
    }
375
376
    /**
377
     * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render
378
     */
379
    public int getRenderType()
380
    {
381
        return 3;
382
    }
383
384
    /**
385
     * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass)
386
     */
387
    public boolean isReplaceable(World worldIn, BlockPos pos)
388
    {
389
        return false;
390
    }
391
392
    /**
393
     * Sets how many hits it takes to break a block.
394
     */
395
    protected Block setHardness(float hardness)
396
    {
397
        this.blockHardness = hardness;
398
399
        if (this.blockResistance < hardness * 5.0F)
400
        {
401
            this.blockResistance = hardness * 5.0F;
402
        }
403
404
        return this;
405
    }
406
407
    protected Block setBlockUnbreakable()
408
    {
409
        this.setHardness(-1.0F);
410
        return this;
411
    }
412
413
    public float getBlockHardness(World worldIn, BlockPos pos)
414
    {
415
        return this.blockHardness;
416
    }
417
418
    /**
419
     * Sets whether this block type will receive random update ticks
420
     */
421
    protected Block setTickRandomly(boolean shouldTick)
422
    {
423
        this.needsRandomTick = shouldTick;
424
        return this;
425
    }
426
427
    /**
428
     * Returns whether or not this block is of a type that needs random ticking. Called for ref-counting purposes by
429
     * ExtendedBlockStorage in order to broadly cull a chunk from the random chunk update list for efficiency's sake.
430
     */
431
    public boolean getTickRandomly()
432
    {
433
        return this.needsRandomTick;
434
    }
435
436
    public boolean hasTileEntity()
437
    {
438
        return this.isBlockContainer;
439
    }
440
441
    protected final void setBlockBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
442
    {
443
        this.minX = (double)minX;
444
        this.minY = (double)minY;
445
        this.minZ = (double)minZ;
446
        this.maxX = (double)maxX;
447
        this.maxY = (double)maxY;
448
        this.maxZ = (double)maxZ;
449
    }
450
451
    public int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos)
452
    {
453
        Block block = worldIn.getBlockState(pos).getBlock();
454
        int i = worldIn.getCombinedLight(pos, block.getLightValue());
455
456
        if (i == 0 && block instanceof BlockSlab)
457
        {
458
            pos = pos.down();
459
            block = worldIn.getBlockState(pos).getBlock();
460
            return worldIn.getCombinedLight(pos, block.getLightValue());
461
        }
462
        else
463
        {
464
            return i;
465
        }
466
    }
467
468
    public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
469
    {
470
        return side == EnumFacing.DOWN && this.minY > 0.0D ? true : (side == EnumFacing.UP && this.maxY < 1.0D ? true : (side == EnumFacing.NORTH && this.minZ > 0.0D ? true : (side == EnumFacing.SOUTH && this.maxZ < 1.0D ? true : (side == EnumFacing.WEST && this.minX > 0.0D ? true : (side == EnumFacing.EAST && this.maxX < 1.0D ? true : !worldIn.getBlockState(pos).getBlock().isOpaqueCube())))));
471
    }
472
473
    /**
474
     * Whether this Block is solid on the given Side
475
     */
476
    public boolean isBlockSolid(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
477
    {
478
        return worldIn.getBlockState(pos).getBlock().getMaterial().isSolid();
479
    }
480
481
    public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos)
482
    {
483
        return new AxisAlignedBB((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ);
484
    }
485
486
    /**
487
     * Add all collision boxes of this Block to the list that intersect with the given mask.
488
     */
489
    public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity)
490
    {
491
        AxisAlignedBB axisalignedbb = this.getCollisionBoundingBox(worldIn, pos, state);
492
493
        if (axisalignedbb != null && mask.intersectsWith(axisalignedbb))
494
        {
495
            list.add(axisalignedbb);
496
        }
497
    }
498
499
    public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
500
    {
501
        return new AxisAlignedBB((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ);
502
    }
503
504
    /**
505
     * Used to determine ambient occlusion and culling when rebuilding chunks for render
506
     */
507
    public boolean isOpaqueCube()
508
    {
509
        return true;
510
    }
511
512
    public boolean canCollideCheck(IBlockState state, boolean hitIfLiquid)
513
    {
514
        return this.isCollidable();
515
    }
516
517
    /**
518
     * Returns if this block is collidable (only used by Fire). Args: x, y, z
519
     */
520
    public boolean isCollidable()
521
    {
522
        return true;
523
    }
524
525
    /**
526
     * Called randomly when setTickRandomly is set to true (used by e.g. crops to grow, etc.)
527
     */
528
    public void randomTick(World worldIn, BlockPos pos, IBlockState state, Random random)
529
    {
530
        this.updateTick(worldIn, pos, state, random);
531
    }
532
533
    public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
534
    {
535
    }
536
537
    public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
538
    {
539
    }
540
541
    /**
542
     * Called when a player destroys this Block
543
     */
544
    public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state)
545
    {
546
    }
547
548
    /**
549
     * Called when a neighboring block changes.
550
     */
551
    public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
552
    {
553
    }
554
555
    /**
556
     * How many world ticks before ticking
557
     */
558
    public int tickRate(World worldIn)
559
    {
560
        return 10;
561
    }
562
563
    public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
564
    {
565
    }
566
567
    public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
568
    {
569
    }
570
571
    /**
572
     * Returns the quantity of items to drop on block destruction.
573
     */
574
    public int quantityDropped(Random random)
575
    {
576
        return 1;
577
    }
578
579
    /**
580
     * Get the Item that this Block should drop when harvested.
581
     */
582
    public Item getItemDropped(IBlockState state, Random rand, int fortune)
583
    {
584
        return Item.getItemFromBlock(this);
585
    }
586
587
    /**
588
     * Get the hardness of this Block relative to the ability of the given player
589
     */
590
    public float getPlayerRelativeBlockHardness(EntityPlayer playerIn, World worldIn, BlockPos pos)
591
    {
592
        float f = this.getBlockHardness(worldIn, pos);
593
        return f < 0.0F ? 0.0F : (!playerIn.canHarvestBlock(this) ? playerIn.getToolDigEfficiency(this) / f / 100.0F : playerIn.getToolDigEfficiency(this) / f / 30.0F);
594
    }
595
596
    /**
597
     * Spawn this Block's drops into the World as EntityItems
598
     */
599
    public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture)
600
    {
601
        this.dropBlockAsItemWithChance(worldIn, pos, state, 1.0F, forture);
602
    }
603
604
    /**
605
     * Spawns this Block's drops into the World as EntityItems.
606
     */
607
    public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
608
    {
609
        if (!worldIn.isRemote)
610
        {
611
            int i = this.quantityDroppedWithBonus(fortune, worldIn.rand);
612
613
            for (int j = 0; j < i; ++j)
614
            {
615
                if (worldIn.rand.nextFloat() <= chance)
616
                {
617
                    Item item = this.getItemDropped(state, worldIn.rand, fortune);
618
619
                    if (item != null)
620
                    {
621
                        spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state)));
622
                    }
623
                }
624
            }
625
        }
626
    }
627
628
    /**
629
     * Spawns the given ItemStack as an EntityItem into the World at the given position
630
     */
631
    public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack)
632
    {
633
        if (!worldIn.isRemote && worldIn.getGameRules().getBoolean("doTileDrops"))
634
        {
635
            float f = 0.5F;
636
            double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
637
            double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
638
            double d2 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
639
            EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, stack);
640
            entityitem.setDefaultPickupDelay();
641
            worldIn.spawnEntityInWorld(entityitem);
642
        }
643
    }
644
645
    /**
646
     * Spawns the given amount of experience into the World as XP orb entities
647
     */
648
    protected void dropXpOnBlockBreak(World worldIn, BlockPos pos, int amount)
649
    {
650
        if (!worldIn.isRemote)
651
        {
652
            while (amount > 0)
653
            {
654
                int i = EntityXPOrb.getXPSplit(amount);
655
                amount -= i;
656
                worldIn.spawnEntityInWorld(new EntityXPOrb(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, i));
657
            }
658
        }
659
    }
660
661
    /**
662
     * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It
663
     * returns the metadata of the dropped item based on the old metadata of the block.
664
     */
665
    public int damageDropped(IBlockState state)
666
    {
667
        return 0;
668
    }
669
670
    /**
671
     * Returns how much this block can resist explosions from the passed in entity.
672
     */
673
    public float getExplosionResistance(Entity exploder)
674
    {
675
        return this.blockResistance / 5.0F;
676
    }
677
678
    /**
679
     * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit.
680
     */
681
    public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end)
682
    {
683
        this.setBlockBoundsBasedOnState(worldIn, pos);
684
        start = start.addVector((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ()));
685
        end = end.addVector((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ()));
686
        Vec3 vec3 = start.getIntermediateWithXValue(end, this.minX);
687
        Vec3 vec31 = start.getIntermediateWithXValue(end, this.maxX);
688
        Vec3 vec32 = start.getIntermediateWithYValue(end, this.minY);
689
        Vec3 vec33 = start.getIntermediateWithYValue(end, this.maxY);
690
        Vec3 vec34 = start.getIntermediateWithZValue(end, this.minZ);
691
        Vec3 vec35 = start.getIntermediateWithZValue(end, this.maxZ);
692
693
        if (!this.isVecInsideYZBounds(vec3))
694
        {
695
            vec3 = null;
696
        }
697
698
        if (!this.isVecInsideYZBounds(vec31))
699
        {
700
            vec31 = null;
701
        }
702
703
        if (!this.isVecInsideXZBounds(vec32))
704
        {
705
            vec32 = null;
706
        }
707
708
        if (!this.isVecInsideXZBounds(vec33))
709
        {
710
            vec33 = null;
711
        }
712
713
        if (!this.isVecInsideXYBounds(vec34))
714
        {
715
            vec34 = null;
716
        }
717
718
        if (!this.isVecInsideXYBounds(vec35))
719
        {
720
            vec35 = null;
721
        }
722
723
        Vec3 vec36 = null;
724
725
        if (vec3 != null && (vec36 == null || start.squareDistanceTo(vec3) < start.squareDistanceTo(vec36)))
726
        {
727
            vec36 = vec3;
728
        }
729
730
        if (vec31 != null && (vec36 == null || start.squareDistanceTo(vec31) < start.squareDistanceTo(vec36)))
731
        {
732
            vec36 = vec31;
733
        }
734
735
        if (vec32 != null && (vec36 == null || start.squareDistanceTo(vec32) < start.squareDistanceTo(vec36)))
736
        {
737
            vec36 = vec32;
738
        }
739
740
        if (vec33 != null && (vec36 == null || start.squareDistanceTo(vec33) < start.squareDistanceTo(vec36)))
741
        {
742
            vec36 = vec33;
743
        }
744
745
        if (vec34 != null && (vec36 == null || start.squareDistanceTo(vec34) < start.squareDistanceTo(vec36)))
746
        {
747
            vec36 = vec34;
748
        }
749
750
        if (vec35 != null && (vec36 == null || start.squareDistanceTo(vec35) < start.squareDistanceTo(vec36)))
751
        {
752
            vec36 = vec35;
753
        }
754
755
        if (vec36 == null)
756
        {
757
            return null;
758
        }
759
        else
760
        {
761
            EnumFacing enumfacing = null;
762
763
            if (vec36 == vec3)
764
            {
765
                enumfacing = EnumFacing.WEST;
766
            }
767
768
            if (vec36 == vec31)
769
            {
770
                enumfacing = EnumFacing.EAST;
771
            }
772
773
            if (vec36 == vec32)
774
            {
775
                enumfacing = EnumFacing.DOWN;
776
            }
777
778
            if (vec36 == vec33)
779
            {
780
                enumfacing = EnumFacing.UP;
781
            }
782
783
            if (vec36 == vec34)
784
            {
785
                enumfacing = EnumFacing.NORTH;
786
            }
787
788
            if (vec36 == vec35)
789
            {
790
                enumfacing = EnumFacing.SOUTH;
791
            }
792
793
            return new MovingObjectPosition(vec36.addVector((double)pos.getX(), (double)pos.getY(), (double)pos.getZ()), enumfacing, pos);
794
        }
795
    }
796
797
    /**
798
     * Checks if a vector is within the Y and Z bounds of the block.
799
     */
800
    private boolean isVecInsideYZBounds(Vec3 point)
801
    {
802
        return point == null ? false : point.yCoord >= this.minY && point.yCoord <= this.maxY && point.zCoord >= this.minZ && point.zCoord <= this.maxZ;
803
    }
804
805
    /**
806
     * Checks if a vector is within the X and Z bounds of the block.
807
     */
808
    private boolean isVecInsideXZBounds(Vec3 point)
809
    {
810
        return point == null ? false : point.xCoord >= this.minX && point.xCoord <= this.maxX && point.zCoord >= this.minZ && point.zCoord <= this.maxZ;
811
    }
812
813
    /**
814
     * Checks if a vector is within the X and Y bounds of the block.
815
     */
816
    private boolean isVecInsideXYBounds(Vec3 point)
817
    {
818
        return point == null ? false : point.xCoord >= this.minX && point.xCoord <= this.maxX && point.yCoord >= this.minY && point.yCoord <= this.maxY;
819
    }
820
821
    /**
822
     * Called when this Block is destroyed by an Explosion
823
     */
824
    public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn)
825
    {
826
    }
827
828
    public EnumWorldBlockLayer getBlockLayer()
829
    {
830
        return EnumWorldBlockLayer.SOLID;
831
    }
832
833
    public boolean canReplace(World worldIn, BlockPos pos, EnumFacing side, ItemStack stack)
834
    {
835
        return this.canPlaceBlockOnSide(worldIn, pos, side);
836
    }
837
838
    /**
839
     * Check whether this Block can be placed on the given side
840
     */
841
    public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side)
842
    {
843
        return this.canPlaceBlockAt(worldIn, pos);
844
    }
845
846
    public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
847
    {
848
        return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable();
849
    }
850
851
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
852
    {
853
        return false;
854
    }
855
856
    /**
857
     * Triggered whenever an entity collides with this block (enters into the block)
858
     */
859
    public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn)
860
    {
861
    }
862
863
    /**
864
     * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
865
     * IBlockstate
866
     */
867
    public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
868
    {
869
        return this.getStateFromMeta(meta);
870
    }
871
872
    public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn)
873
    {
874
    }
875
876
    public Vec3 modifyAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3 motion)
877
    {
878
        return motion;
879
    }
880
881
    public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
882
    {
883
    }
884
885
    /**
886
     * returns the block bounderies minX value
887
     */
888
    public final double getBlockBoundsMinX()
889
    {
890
        return this.minX;
891
    }
892
893
    /**
894
     * returns the block bounderies maxX value
895
     */
896
    public final double getBlockBoundsMaxX()
897
    {
898
        return this.maxX;
899
    }
900
901
    /**
902
     * returns the block bounderies minY value
903
     */
904
    public final double getBlockBoundsMinY()
905
    {
906
        return this.minY;
907
    }
908
909
    /**
910
     * returns the block bounderies maxY value
911
     */
912
    public final double getBlockBoundsMaxY()
913
    {
914
        return this.maxY;
915
    }
916
917
    /**
918
     * returns the block bounderies minZ value
919
     */
920
    public final double getBlockBoundsMinZ()
921
    {
922
        return this.minZ;
923
    }
924
925
    /**
926
     * returns the block bounderies maxZ value
927
     */
928
    public final double getBlockBoundsMaxZ()
929
    {
930
        return this.maxZ;
931
    }
932
933
    public int getBlockColor()
934
    {
935
        return 16777215;
936
    }
937
938
    public int getRenderColor(IBlockState state)
939
    {
940
        return 16777215;
941
    }
942
943
    public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass)
944
    {
945
        return 16777215;
946
    }
947
948
    public final int colorMultiplier(IBlockAccess worldIn, BlockPos pos)
949
    {
950
        return this.colorMultiplier(worldIn, pos, 0);
951
    }
952
953
    public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side)
954
    {
955
        return 0;
956
    }
957
958
    /**
959
     * Can this block provide power. Only wire currently seems to have this change based on its state.
960
     */
961
    public boolean canProvidePower()
962
    {
963
        return false;
964
    }
965
966
    /**
967
     * Called When an Entity Collided with the Block
968
     */
969
    public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
970
    {
971
    }
972
973
    public int getStrongPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side)
974
    {
975
        return 0;
976
    }
977
978
    /**
979
     * Sets the block's bounds for rendering it as an item
980
     */
981
    public void setBlockBoundsForItemRender()
982
    {
983
    }
984
985
    public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
986
    {
987
        player.triggerAchievement(StatList.mineBlockStatArray[getIdFromBlock(this)]);
988
        player.addExhaustion(0.025F);
989
990
        if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player))
991
        {
992
            ItemStack itemstack = this.createStackedBlock(state);
993
994
            if (itemstack != null)
995
            {
996
                spawnAsEntity(worldIn, pos, itemstack);
997
            }
998
        }
999
        else
1000
        {
1001
            int i = EnchantmentHelper.getFortuneModifier(player);
1002
            this.dropBlockAsItem(worldIn, pos, state, i);
1003
        }
1004
    }
1005
1006
    protected boolean canSilkHarvest()
1007
    {
1008
        return this.isFullCube() && !this.isBlockContainer;
1009
    }
1010
1011
    protected ItemStack createStackedBlock(IBlockState state)
1012
    {
1013
        int i = 0;
1014
        Item item = Item.getItemFromBlock(this);
1015
1016
        if (item != null && item.getHasSubtypes())
1017
        {
1018
            i = this.getMetaFromState(state);
1019
        }
1020
1021
        return new ItemStack(item, 1, i);
1022
    }
1023
1024
    /**
1025
     * Get the quantity dropped based on the given fortune level
1026
     */
1027
    public int quantityDroppedWithBonus(int fortune, Random random)
1028
    {
1029
        return this.quantityDropped(random);
1030
    }
1031
1032
    /**
1033
     * Called by ItemBlocks after a block is set in the world, to allow post-place logic
1034
     */
1035
    public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
1036
    {
1037
    }
1038
1039
    /**
1040
     * Return true if an entity can be spawned inside the block (used to get the player's bed spawn location)
1041
     */
1042
    public boolean canSpawnInBlock()
1043
    {
1044
        return !this.blockMaterial.isSolid() && !this.blockMaterial.isLiquid();
1045
    }
1046
1047
    public Block setUnlocalizedName(String name)
1048
    {
1049
        this.unlocalizedName = name;
1050
        return this;
1051
    }
1052
1053
    /**
1054
     * Gets the localized name of this block. Used for the statistics page.
1055
     */
1056
    public String getLocalizedName()
1057
    {
1058
        return StatCollector.translateToLocal(this.getUnlocalizedName() + ".name");
1059
    }
1060
1061
    /**
1062
     * Returns the unlocalized name of the block with "tile." appended to the front.
1063
     */
1064
    public String getUnlocalizedName()
1065
    {
1066
        return "tile." + this.unlocalizedName;
1067
    }
1068
1069
    /**
1070
     * Called on both Client and Server when World#addBlockEvent is called
1071
     */
1072
    public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam)
1073
    {
1074
        return false;
1075
    }
1076
1077
    /**
1078
     * Return the state of blocks statistics flags - if the block is counted for mined and placed.
1079
     */
1080
    public boolean getEnableStats()
1081
    {
1082
        return this.enableStats;
1083
    }
1084
1085
    protected Block disableStats()
1086
    {
1087
        this.enableStats = false;
1088
        return this;
1089
    }
1090
1091
    public int getMobilityFlag()
1092
    {
1093
        return this.blockMaterial.getMaterialMobility();
1094
    }
1095
1096
    /**
1097
     * Returns the default ambient occlusion value based on block opacity
1098
     */
1099
    public float getAmbientOcclusionLightValue()
1100
    {
1101
        return this.isBlockNormalCube() ? 0.2F : 1.0F;
1102
    }
1103
1104
    /**
1105
     * Block's chance to react to a living entity falling on it.
1106
     */
1107
    public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance)
1108
    {
1109
        entityIn.fall(fallDistance, 1.0F);
1110
    }
1111
1112
    /**
1113
     * Called when an Entity lands on this Block. This method *must* update motionY because the entity will not do that
1114
     * on its own
1115
     */
1116
    public void onLanded(World worldIn, Entity entityIn)
1117
    {
1118
        entityIn.motionY = 0.0D;
1119
    }
1120
1121
    public Item getItem(World worldIn, BlockPos pos)
1122
    {
1123
        return Item.getItemFromBlock(this);
1124
    }
1125
1126
    /**
1127
     * Gets the meta to use for the Pick Block ItemStack result
1128
     */
1129
    public int getDamageValue(World worldIn, BlockPos pos)
1130
    {
1131
        return this.damageDropped(worldIn.getBlockState(pos));
1132
    }
1133
1134
    /**
1135
     * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
1136
     */
1137
    public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
1138
    {
1139
        list.add(new ItemStack(itemIn, 1, 0));
1140
    }
1141
1142
    /**
1143
     * Returns the CreativeTab to display the given block on.
1144
     */
1145
    public CreativeTabs getCreativeTabToDisplayOn()
1146
    {
1147
        return this.displayOnCreativeTab;
1148
    }
1149
1150
    public Block setCreativeTab(CreativeTabs tab)
1151
    {
1152
        this.displayOnCreativeTab = tab;
1153
        return this;
1154
    }
1155
1156
    public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
1157
    {
1158
    }
1159
1160
    /**
1161
     * Called similar to random ticks, but only when it is raining.
1162
     */
1163
    public void fillWithRain(World worldIn, BlockPos pos)
1164
    {
1165
    }
1166
1167
    /**
1168
     * Returns true only if block is flowerPot
1169
     */
1170
    public boolean isFlowerPot()
1171
    {
1172
        return false;
1173
    }
1174
1175
    public boolean requiresUpdates()
1176
    {
1177
        return true;
1178
    }
1179
1180
    /**
1181
     * Return whether this block can drop from an explosion.
1182
     */
1183
    public boolean canDropFromExplosion(Explosion explosionIn)
1184
    {
1185
        return true;
1186
    }
1187
1188
    public boolean isAssociatedBlock(Block other)
1189
    {
1190
        return this == other;
1191
    }
1192
1193
    public static boolean isEqualTo(Block blockIn, Block other)
1194
    {
1195
        return blockIn != null && other != null ? (blockIn == other ? true : blockIn.isAssociatedBlock(other)) : false;
1196
    }
1197
1198
    public boolean hasComparatorInputOverride()
1199
    {
1200
        return false;
1201
    }
1202
1203
    public int getComparatorInputOverride(World worldIn, BlockPos pos)
1204
    {
1205
        return 0;
1206
    }
1207
1208
    /**
1209
     * Possibly modify the given BlockState before rendering it on an Entity (Minecarts, Endermen, ...)
1210
     */
1211
    public IBlockState getStateForEntityRender(IBlockState state)
1212
    {
1213
        return state;
1214
    }
1215
1216
    protected BlockState createBlockState()
1217
    {
1218
        return new BlockState(this, new IProperty[0]);
1219
    }
1220
1221
    public BlockState getBlockState()
1222
    {
1223
        return this.blockState;
1224
    }
1225
1226
    protected final void setDefaultState(IBlockState state)
1227
    {
1228
        this.defaultBlockState = state;
1229
    }
1230
1231
    public final IBlockState getDefaultState()
1232
    {
1233
        return this.defaultBlockState;
1234
    }
1235
1236
    /**
1237
     * Get the OffsetType for this Block. Determines if the model is rendered slightly offset.
1238
     */
1239
    public Block.EnumOffsetType getOffsetType()
1240
    {
1241
        return Block.EnumOffsetType.NONE;
1242
    }
1243
1244
    public String toString()
1245
    {
1246
        return "Block{" + blockRegistry.getNameForObject(this) + "}";
1247
    }
1248
1249
    public static void registerBlocks()
1250
    {
1251
        registerBlock(0, AIR_ID, (new BlockAir()).setUnlocalizedName("air"));
1252
        registerBlock(1, "stone", (new BlockStone()).setHardness(1.5F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("stone"));
1253
        registerBlock(2, "grass", (new BlockGrass()).setHardness(0.6F).setStepSound(soundTypeGrass).setUnlocalizedName("grass"));
1254
        registerBlock(3, "dirt", (new BlockDirt()).setHardness(0.5F).setStepSound(soundTypeGravel).setUnlocalizedName("dirt"));
1255
        Block block = (new Block(Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("stonebrick").setCreativeTab(CreativeTabs.tabBlock);
1256
        registerBlock(4, "cobblestone", block);
1257
        Block block1 = (new BlockPlanks()).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("wood");
1258
        registerBlock(5, "planks", block1);
1259
        registerBlock(6, "sapling", (new BlockSapling()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("sapling"));
1260
        registerBlock(7, "bedrock", (new Block(Material.rock)).setBlockUnbreakable().setResistance(6000000.0F).setStepSound(soundTypePiston).setUnlocalizedName("bedrock").disableStats().setCreativeTab(CreativeTabs.tabBlock));
1261
        registerBlock(8, "flowing_water", (new BlockDynamicLiquid(Material.water)).setHardness(100.0F).setLightOpacity(3).setUnlocalizedName("water").disableStats());
1262
        registerBlock(9, "water", (new BlockStaticLiquid(Material.water)).setHardness(100.0F).setLightOpacity(3).setUnlocalizedName("water").disableStats());
1263
        registerBlock(10, "flowing_lava", (new BlockDynamicLiquid(Material.lava)).setHardness(100.0F).setLightLevel(1.0F).setUnlocalizedName("lava").disableStats());
1264
        registerBlock(11, "lava", (new BlockStaticLiquid(Material.lava)).setHardness(100.0F).setLightLevel(1.0F).setUnlocalizedName("lava").disableStats());
1265
        registerBlock(12, "sand", (new BlockSand()).setHardness(0.5F).setStepSound(soundTypeSand).setUnlocalizedName("sand"));
1266
        registerBlock(13, "gravel", (new BlockGravel()).setHardness(0.6F).setStepSound(soundTypeGravel).setUnlocalizedName("gravel"));
1267
        registerBlock(14, "gold_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("oreGold"));
1268
        registerBlock(15, "iron_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("oreIron"));
1269
        registerBlock(16, "coal_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("oreCoal"));
1270
        registerBlock(17, "log", (new BlockOldLog()).setUnlocalizedName("log"));
1271
        registerBlock(18, "leaves", (new BlockOldLeaf()).setUnlocalizedName("leaves"));
1272
        registerBlock(19, "sponge", (new BlockSponge()).setHardness(0.6F).setStepSound(soundTypeGrass).setUnlocalizedName("sponge"));
1273
        registerBlock(20, "glass", (new BlockGlass(Material.glass, false)).setHardness(0.3F).setStepSound(soundTypeGlass).setUnlocalizedName("glass"));
1274
        registerBlock(21, "lapis_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("oreLapis"));
1275
        registerBlock(22, "lapis_block", (new Block(Material.iron, MapColor.lapisColor)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("blockLapis").setCreativeTab(CreativeTabs.tabBlock));
1276
        registerBlock(23, "dispenser", (new BlockDispenser()).setHardness(3.5F).setStepSound(soundTypePiston).setUnlocalizedName("dispenser"));
1277
        Block block2 = (new BlockSandStone()).setStepSound(soundTypePiston).setHardness(0.8F).setUnlocalizedName("sandStone");
1278
        registerBlock(24, "sandstone", block2);
1279
        registerBlock(25, "noteblock", (new BlockNote()).setHardness(0.8F).setUnlocalizedName("musicBlock"));
1280
        registerBlock(26, "bed", (new BlockBed()).setStepSound(soundTypeWood).setHardness(0.2F).setUnlocalizedName("bed").disableStats());
1281
        registerBlock(27, "golden_rail", (new BlockRailPowered()).setHardness(0.7F).setStepSound(soundTypeMetal).setUnlocalizedName("goldenRail"));
1282
        registerBlock(28, "detector_rail", (new BlockRailDetector()).setHardness(0.7F).setStepSound(soundTypeMetal).setUnlocalizedName("detectorRail"));
1283
        registerBlock(29, "sticky_piston", (new BlockPistonBase(true)).setUnlocalizedName("pistonStickyBase"));
1284
        registerBlock(30, "web", (new BlockWeb()).setLightOpacity(1).setHardness(4.0F).setUnlocalizedName("web"));
1285
        registerBlock(31, "tallgrass", (new BlockTallGrass()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("tallgrass"));
1286
        registerBlock(32, "deadbush", (new BlockDeadBush()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("deadbush"));
1287
        registerBlock(33, "piston", (new BlockPistonBase(false)).setUnlocalizedName("pistonBase"));
1288
        registerBlock(34, "piston_head", (new BlockPistonExtension()).setUnlocalizedName("pistonBase"));
1289
        registerBlock(35, "wool", (new BlockColored(Material.cloth)).setHardness(0.8F).setStepSound(soundTypeCloth).setUnlocalizedName("cloth"));
1290
        registerBlock(36, "piston_extension", new BlockPistonMoving());
1291
        registerBlock(37, "yellow_flower", (new BlockYellowFlower()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("flower1"));
1292
        registerBlock(38, "red_flower", (new BlockRedFlower()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("flower2"));
1293
        Block block3 = (new BlockMushroom()).setHardness(0.0F).setStepSound(soundTypeGrass).setLightLevel(0.125F).setUnlocalizedName("mushroom");
1294
        registerBlock(39, "brown_mushroom", block3);
1295
        Block block4 = (new BlockMushroom()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("mushroom");
1296
        registerBlock(40, "red_mushroom", block4);
1297
        registerBlock(41, "gold_block", (new Block(Material.iron, MapColor.goldColor)).setHardness(3.0F).setResistance(10.0F).setStepSound(soundTypeMetal).setUnlocalizedName("blockGold").setCreativeTab(CreativeTabs.tabBlock));
1298
        registerBlock(42, "iron_block", (new Block(Material.iron, MapColor.ironColor)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundTypeMetal).setUnlocalizedName("blockIron").setCreativeTab(CreativeTabs.tabBlock));
1299
        registerBlock(43, "double_stone_slab", (new BlockDoubleStoneSlab()).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("stoneSlab"));
1300
        registerBlock(44, "stone_slab", (new BlockHalfStoneSlab()).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("stoneSlab"));
1301
        Block block5 = (new Block(Material.rock, MapColor.redColor)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("brick").setCreativeTab(CreativeTabs.tabBlock);
1302
        registerBlock(45, "brick_block", block5);
1303
        registerBlock(46, "tnt", (new BlockTNT()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("tnt"));
1304
        registerBlock(47, "bookshelf", (new BlockBookshelf()).setHardness(1.5F).setStepSound(soundTypeWood).setUnlocalizedName("bookshelf"));
1305
        registerBlock(48, "mossy_cobblestone", (new Block(Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("stoneMoss").setCreativeTab(CreativeTabs.tabBlock));
1306
        registerBlock(49, "obsidian", (new BlockObsidian()).setHardness(50.0F).setResistance(2000.0F).setStepSound(soundTypePiston).setUnlocalizedName("obsidian"));
1307
        registerBlock(50, "torch", (new BlockTorch()).setHardness(0.0F).setLightLevel(0.9375F).setStepSound(soundTypeWood).setUnlocalizedName("torch"));
1308
        registerBlock(51, "fire", (new BlockFire()).setHardness(0.0F).setLightLevel(1.0F).setStepSound(soundTypeCloth).setUnlocalizedName("fire").disableStats());
1309
        registerBlock(52, "mob_spawner", (new BlockMobSpawner()).setHardness(5.0F).setStepSound(soundTypeMetal).setUnlocalizedName("mobSpawner").disableStats());
1310
        registerBlock(53, "oak_stairs", (new BlockStairs(block1.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.OAK))).setUnlocalizedName("stairsWood"));
1311
        registerBlock(54, "chest", (new BlockChest(0)).setHardness(2.5F).setStepSound(soundTypeWood).setUnlocalizedName("chest"));
1312
        registerBlock(55, "redstone_wire", (new BlockRedstoneWire()).setHardness(0.0F).setStepSound(soundTypeStone).setUnlocalizedName("redstoneDust").disableStats());
1313
        registerBlock(56, "diamond_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("oreDiamond"));
1314
        registerBlock(57, "diamond_block", (new Block(Material.iron, MapColor.diamondColor)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundTypeMetal).setUnlocalizedName("blockDiamond").setCreativeTab(CreativeTabs.tabBlock));
1315
        registerBlock(58, "crafting_table", (new BlockWorkbench()).setHardness(2.5F).setStepSound(soundTypeWood).setUnlocalizedName("workbench"));
1316
        registerBlock(59, "wheat", (new BlockCrops()).setUnlocalizedName("crops"));
1317
        Block block6 = (new BlockFarmland()).setHardness(0.6F).setStepSound(soundTypeGravel).setUnlocalizedName("farmland");
1318
        registerBlock(60, "farmland", block6);
1319
        registerBlock(61, "furnace", (new BlockFurnace(false)).setHardness(3.5F).setStepSound(soundTypePiston).setUnlocalizedName("furnace").setCreativeTab(CreativeTabs.tabDecorations));
1320
        registerBlock(62, "lit_furnace", (new BlockFurnace(true)).setHardness(3.5F).setStepSound(soundTypePiston).setLightLevel(0.875F).setUnlocalizedName("furnace"));
1321
        registerBlock(63, "standing_sign", (new BlockStandingSign()).setHardness(1.0F).setStepSound(soundTypeWood).setUnlocalizedName("sign").disableStats());
1322
        registerBlock(64, "wooden_door", (new BlockDoor(Material.wood)).setHardness(3.0F).setStepSound(soundTypeWood).setUnlocalizedName("doorOak").disableStats());
1323
        registerBlock(65, "ladder", (new BlockLadder()).setHardness(0.4F).setStepSound(soundTypeLadder).setUnlocalizedName("ladder"));
1324
        registerBlock(66, "rail", (new BlockRail()).setHardness(0.7F).setStepSound(soundTypeMetal).setUnlocalizedName("rail"));
1325
        registerBlock(67, "stone_stairs", (new BlockStairs(block.getDefaultState())).setUnlocalizedName("stairsStone"));
1326
        registerBlock(68, "wall_sign", (new BlockWallSign()).setHardness(1.0F).setStepSound(soundTypeWood).setUnlocalizedName("sign").disableStats());
1327
        registerBlock(69, "lever", (new BlockLever()).setHardness(0.5F).setStepSound(soundTypeWood).setUnlocalizedName("lever"));
1328
        registerBlock(70, "stone_pressure_plate", (new BlockPressurePlate(Material.rock, BlockPressurePlate.Sensitivity.MOBS)).setHardness(0.5F).setStepSound(soundTypePiston).setUnlocalizedName("pressurePlateStone"));
1329
        registerBlock(71, "iron_door", (new BlockDoor(Material.iron)).setHardness(5.0F).setStepSound(soundTypeMetal).setUnlocalizedName("doorIron").disableStats());
1330
        registerBlock(72, "wooden_pressure_plate", (new BlockPressurePlate(Material.wood, BlockPressurePlate.Sensitivity.EVERYTHING)).setHardness(0.5F).setStepSound(soundTypeWood).setUnlocalizedName("pressurePlateWood"));
1331
        registerBlock(73, "redstone_ore", (new BlockRedstoneOre(false)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("oreRedstone").setCreativeTab(CreativeTabs.tabBlock));
1332
        registerBlock(74, "lit_redstone_ore", (new BlockRedstoneOre(true)).setLightLevel(0.625F).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("oreRedstone"));
1333
        registerBlock(75, "unlit_redstone_torch", (new BlockRedstoneTorch(false)).setHardness(0.0F).setStepSound(soundTypeWood).setUnlocalizedName("notGate"));
1334
        registerBlock(76, "redstone_torch", (new BlockRedstoneTorch(true)).setHardness(0.0F).setLightLevel(0.5F).setStepSound(soundTypeWood).setUnlocalizedName("notGate").setCreativeTab(CreativeTabs.tabRedstone));
1335
        registerBlock(77, "stone_button", (new BlockButtonStone()).setHardness(0.5F).setStepSound(soundTypePiston).setUnlocalizedName("button"));
1336
        registerBlock(78, "snow_layer", (new BlockSnow()).setHardness(0.1F).setStepSound(soundTypeSnow).setUnlocalizedName("snow").setLightOpacity(0));
1337
        registerBlock(79, "ice", (new BlockIce()).setHardness(0.5F).setLightOpacity(3).setStepSound(soundTypeGlass).setUnlocalizedName("ice"));
1338
        registerBlock(80, "snow", (new BlockSnowBlock()).setHardness(0.2F).setStepSound(soundTypeSnow).setUnlocalizedName("snow"));
1339
        registerBlock(81, "cactus", (new BlockCactus()).setHardness(0.4F).setStepSound(soundTypeCloth).setUnlocalizedName("cactus"));
1340
        registerBlock(82, "clay", (new BlockClay()).setHardness(0.6F).setStepSound(soundTypeGravel).setUnlocalizedName("clay"));
1341
        registerBlock(83, "reeds", (new BlockReed()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("reeds").disableStats());
1342
        registerBlock(84, "jukebox", (new BlockJukebox()).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("jukebox"));
1343
        registerBlock(85, "fence", (new BlockFence(Material.wood, BlockPlanks.EnumType.OAK.getMapColor())).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("fence"));
1344
        Block block7 = (new BlockPumpkin()).setHardness(1.0F).setStepSound(soundTypeWood).setUnlocalizedName("pumpkin");
1345
        registerBlock(86, "pumpkin", block7);
1346
        registerBlock(87, "netherrack", (new BlockNetherrack()).setHardness(0.4F).setStepSound(soundTypePiston).setUnlocalizedName("hellrock"));
1347
        registerBlock(88, "soul_sand", (new BlockSoulSand()).setHardness(0.5F).setStepSound(soundTypeSand).setUnlocalizedName("hellsand"));
1348
        registerBlock(89, "glowstone", (new BlockGlowstone(Material.glass)).setHardness(0.3F).setStepSound(soundTypeGlass).setLightLevel(1.0F).setUnlocalizedName("lightgem"));
1349
        registerBlock(90, "portal", (new BlockPortal()).setHardness(-1.0F).setStepSound(soundTypeGlass).setLightLevel(0.75F).setUnlocalizedName("portal"));
1350
        registerBlock(91, "lit_pumpkin", (new BlockPumpkin()).setHardness(1.0F).setStepSound(soundTypeWood).setLightLevel(1.0F).setUnlocalizedName("litpumpkin"));
1351
        registerBlock(92, "cake", (new BlockCake()).setHardness(0.5F).setStepSound(soundTypeCloth).setUnlocalizedName("cake").disableStats());
1352
        registerBlock(93, "unpowered_repeater", (new BlockRedstoneRepeater(false)).setHardness(0.0F).setStepSound(soundTypeWood).setUnlocalizedName("diode").disableStats());
1353
        registerBlock(94, "powered_repeater", (new BlockRedstoneRepeater(true)).setHardness(0.0F).setStepSound(soundTypeWood).setUnlocalizedName("diode").disableStats());
1354
        registerBlock(95, "stained_glass", (new BlockStainedGlass(Material.glass)).setHardness(0.3F).setStepSound(soundTypeGlass).setUnlocalizedName("stainedGlass"));
1355
        registerBlock(96, "trapdoor", (new BlockTrapDoor(Material.wood)).setHardness(3.0F).setStepSound(soundTypeWood).setUnlocalizedName("trapdoor").disableStats());
1356
        registerBlock(97, "monster_egg", (new BlockSilverfish()).setHardness(0.75F).setUnlocalizedName("monsterStoneEgg"));
1357
        Block block8 = (new BlockStoneBrick()).setHardness(1.5F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("stonebricksmooth");
1358
        registerBlock(98, "stonebrick", block8);
1359
        registerBlock(99, "brown_mushroom_block", (new BlockHugeMushroom(Material.wood, MapColor.dirtColor, block3)).setHardness(0.2F).setStepSound(soundTypeWood).setUnlocalizedName("mushroom"));
1360
        registerBlock(100, "red_mushroom_block", (new BlockHugeMushroom(Material.wood, MapColor.redColor, block4)).setHardness(0.2F).setStepSound(soundTypeWood).setUnlocalizedName("mushroom"));
1361
        registerBlock(101, "iron_bars", (new BlockPane(Material.iron, true)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundTypeMetal).setUnlocalizedName("fenceIron"));
1362
        registerBlock(102, "glass_pane", (new BlockPane(Material.glass, false)).setHardness(0.3F).setStepSound(soundTypeGlass).setUnlocalizedName("thinGlass"));
1363
        Block block9 = (new BlockMelon()).setHardness(1.0F).setStepSound(soundTypeWood).setUnlocalizedName("melon");
1364
        registerBlock(103, "melon_block", block9);
1365
        registerBlock(104, "pumpkin_stem", (new BlockStem(block7)).setHardness(0.0F).setStepSound(soundTypeWood).setUnlocalizedName("pumpkinStem"));
1366
        registerBlock(105, "melon_stem", (new BlockStem(block9)).setHardness(0.0F).setStepSound(soundTypeWood).setUnlocalizedName("pumpkinStem"));
1367
        registerBlock(106, "vine", (new BlockVine()).setHardness(0.2F).setStepSound(soundTypeGrass).setUnlocalizedName("vine"));
1368
        registerBlock(107, "fence_gate", (new BlockFenceGate(BlockPlanks.EnumType.OAK)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("fenceGate"));
1369
        registerBlock(108, "brick_stairs", (new BlockStairs(block5.getDefaultState())).setUnlocalizedName("stairsBrick"));
1370
        registerBlock(109, "stone_brick_stairs", (new BlockStairs(block8.getDefaultState().withProperty(BlockStoneBrick.VARIANT, BlockStoneBrick.EnumType.DEFAULT))).setUnlocalizedName("stairsStoneBrickSmooth"));
1371
        registerBlock(110, "mycelium", (new BlockMycelium()).setHardness(0.6F).setStepSound(soundTypeGrass).setUnlocalizedName("mycel"));
1372
        registerBlock(111, "waterlily", (new BlockLilyPad()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("waterlily"));
1373
        Block block10 = (new BlockNetherBrick()).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("netherBrick").setCreativeTab(CreativeTabs.tabBlock);
1374
        registerBlock(112, "nether_brick", block10);
1375
        registerBlock(113, "nether_brick_fence", (new BlockFence(Material.rock, MapColor.netherrackColor)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("netherFence"));
1376
        registerBlock(114, "nether_brick_stairs", (new BlockStairs(block10.getDefaultState())).setUnlocalizedName("stairsNetherBrick"));
1377
        registerBlock(115, "nether_wart", (new BlockNetherWart()).setUnlocalizedName("netherStalk"));
1378
        registerBlock(116, "enchanting_table", (new BlockEnchantmentTable()).setHardness(5.0F).setResistance(2000.0F).setUnlocalizedName("enchantmentTable"));
1379
        registerBlock(117, "brewing_stand", (new BlockBrewingStand()).setHardness(0.5F).setLightLevel(0.125F).setUnlocalizedName("brewingStand"));
1380
        registerBlock(118, "cauldron", (new BlockCauldron()).setHardness(2.0F).setUnlocalizedName("cauldron"));
1381
        registerBlock(119, "end_portal", (new BlockEndPortal(Material.portal)).setHardness(-1.0F).setResistance(6000000.0F));
1382
        registerBlock(120, "end_portal_frame", (new BlockEndPortalFrame()).setStepSound(soundTypeGlass).setLightLevel(0.125F).setHardness(-1.0F).setUnlocalizedName("endPortalFrame").setResistance(6000000.0F).setCreativeTab(CreativeTabs.tabDecorations));
1383
        registerBlock(121, "end_stone", (new Block(Material.rock, MapColor.sandColor)).setHardness(3.0F).setResistance(15.0F).setStepSound(soundTypePiston).setUnlocalizedName("whiteStone").setCreativeTab(CreativeTabs.tabBlock));
1384
        registerBlock(122, "dragon_egg", (new BlockDragonEgg()).setHardness(3.0F).setResistance(15.0F).setStepSound(soundTypePiston).setLightLevel(0.125F).setUnlocalizedName("dragonEgg"));
1385
        registerBlock(123, "redstone_lamp", (new BlockRedstoneLight(false)).setHardness(0.3F).setStepSound(soundTypeGlass).setUnlocalizedName("redstoneLight").setCreativeTab(CreativeTabs.tabRedstone));
1386
        registerBlock(124, "lit_redstone_lamp", (new BlockRedstoneLight(true)).setHardness(0.3F).setStepSound(soundTypeGlass).setUnlocalizedName("redstoneLight"));
1387
        registerBlock(125, "double_wooden_slab", (new BlockDoubleWoodSlab()).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("woodSlab"));
1388
        registerBlock(126, "wooden_slab", (new BlockHalfWoodSlab()).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("woodSlab"));
1389
        registerBlock(127, "cocoa", (new BlockCocoa()).setHardness(0.2F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("cocoa"));
1390
        registerBlock(128, "sandstone_stairs", (new BlockStairs(block2.getDefaultState().withProperty(BlockSandStone.TYPE, BlockSandStone.EnumType.SMOOTH))).setUnlocalizedName("stairsSandStone"));
1391
        registerBlock(129, "emerald_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("oreEmerald"));
1392
        registerBlock(130, "ender_chest", (new BlockEnderChest()).setHardness(22.5F).setResistance(1000.0F).setStepSound(soundTypePiston).setUnlocalizedName("enderChest").setLightLevel(0.5F));
1393
        registerBlock(131, "tripwire_hook", (new BlockTripWireHook()).setUnlocalizedName("tripWireSource"));
1394
        registerBlock(132, "tripwire", (new BlockTripWire()).setUnlocalizedName("tripWire"));
1395
        registerBlock(133, "emerald_block", (new Block(Material.iron, MapColor.emeraldColor)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundTypeMetal).setUnlocalizedName("blockEmerald").setCreativeTab(CreativeTabs.tabBlock));
1396
        registerBlock(134, "spruce_stairs", (new BlockStairs(block1.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.SPRUCE))).setUnlocalizedName("stairsWoodSpruce"));
1397
        registerBlock(135, "birch_stairs", (new BlockStairs(block1.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.BIRCH))).setUnlocalizedName("stairsWoodBirch"));
1398
        registerBlock(136, "jungle_stairs", (new BlockStairs(block1.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.JUNGLE))).setUnlocalizedName("stairsWoodJungle"));
1399
        registerBlock(137, "command_block", (new BlockCommandBlock()).setBlockUnbreakable().setResistance(6000000.0F).setUnlocalizedName("commandBlock"));
1400
        registerBlock(138, "beacon", (new BlockBeacon()).setUnlocalizedName("beacon").setLightLevel(1.0F));
1401
        registerBlock(139, "cobblestone_wall", (new BlockWall(block)).setUnlocalizedName("cobbleWall"));
1402
        registerBlock(140, "flower_pot", (new BlockFlowerPot()).setHardness(0.0F).setStepSound(soundTypeStone).setUnlocalizedName("flowerPot"));
1403
        registerBlock(141, "carrots", (new BlockCarrot()).setUnlocalizedName("carrots"));
1404
        registerBlock(142, "potatoes", (new BlockPotato()).setUnlocalizedName("potatoes"));
1405
        registerBlock(143, "wooden_button", (new BlockButtonWood()).setHardness(0.5F).setStepSound(soundTypeWood).setUnlocalizedName("button"));
1406
        registerBlock(144, "skull", (new BlockSkull()).setHardness(1.0F).setStepSound(soundTypePiston).setUnlocalizedName("skull"));
1407
        registerBlock(145, "anvil", (new BlockAnvil()).setHardness(5.0F).setStepSound(soundTypeAnvil).setResistance(2000.0F).setUnlocalizedName("anvil"));
1408
        registerBlock(146, "trapped_chest", (new BlockChest(1)).setHardness(2.5F).setStepSound(soundTypeWood).setUnlocalizedName("chestTrap"));
1409
        registerBlock(147, "light_weighted_pressure_plate", (new BlockPressurePlateWeighted(Material.iron, 15, MapColor.goldColor)).setHardness(0.5F).setStepSound(soundTypeWood).setUnlocalizedName("weightedPlate_light"));
1410
        registerBlock(148, "heavy_weighted_pressure_plate", (new BlockPressurePlateWeighted(Material.iron, 150)).setHardness(0.5F).setStepSound(soundTypeWood).setUnlocalizedName("weightedPlate_heavy"));
1411
        registerBlock(149, "unpowered_comparator", (new BlockRedstoneComparator(false)).setHardness(0.0F).setStepSound(soundTypeWood).setUnlocalizedName("comparator").disableStats());
1412
        registerBlock(150, "powered_comparator", (new BlockRedstoneComparator(true)).setHardness(0.0F).setLightLevel(0.625F).setStepSound(soundTypeWood).setUnlocalizedName("comparator").disableStats());
1413
        registerBlock(151, "daylight_detector", new BlockDaylightDetector(false));
1414
        registerBlock(152, "redstone_block", (new BlockCompressedPowered(Material.iron, MapColor.tntColor)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundTypeMetal).setUnlocalizedName("blockRedstone").setCreativeTab(CreativeTabs.tabRedstone));
1415
        registerBlock(153, "quartz_ore", (new BlockOre(MapColor.netherrackColor)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("netherquartz"));
1416
        registerBlock(154, "hopper", (new BlockHopper()).setHardness(3.0F).setResistance(8.0F).setStepSound(soundTypeMetal).setUnlocalizedName("hopper"));
1417
        Block block11 = (new BlockQuartz()).setStepSound(soundTypePiston).setHardness(0.8F).setUnlocalizedName("quartzBlock");
1418
        registerBlock(155, "quartz_block", block11);
1419
        registerBlock(156, "quartz_stairs", (new BlockStairs(block11.getDefaultState().withProperty(BlockQuartz.VARIANT, BlockQuartz.EnumType.DEFAULT))).setUnlocalizedName("stairsQuartz"));
1420
        registerBlock(157, "activator_rail", (new BlockRailPowered()).setHardness(0.7F).setStepSound(soundTypeMetal).setUnlocalizedName("activatorRail"));
1421
        registerBlock(158, "dropper", (new BlockDropper()).setHardness(3.5F).setStepSound(soundTypePiston).setUnlocalizedName("dropper"));
1422
        registerBlock(159, "stained_hardened_clay", (new BlockColored(Material.rock)).setHardness(1.25F).setResistance(7.0F).setStepSound(soundTypePiston).setUnlocalizedName("clayHardenedStained"));
1423
        registerBlock(160, "stained_glass_pane", (new BlockStainedGlassPane()).setHardness(0.3F).setStepSound(soundTypeGlass).setUnlocalizedName("thinStainedGlass"));
1424
        registerBlock(161, "leaves2", (new BlockNewLeaf()).setUnlocalizedName("leaves"));
1425
        registerBlock(162, "log2", (new BlockNewLog()).setUnlocalizedName("log"));
1426
        registerBlock(163, "acacia_stairs", (new BlockStairs(block1.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.ACACIA))).setUnlocalizedName("stairsWoodAcacia"));
1427
        registerBlock(164, "dark_oak_stairs", (new BlockStairs(block1.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.DARK_OAK))).setUnlocalizedName("stairsWoodDarkOak"));
1428
        registerBlock(165, "slime", (new BlockSlime()).setUnlocalizedName("slime").setStepSound(SLIME_SOUND));
1429
        registerBlock(166, "barrier", (new BlockBarrier()).setUnlocalizedName("barrier"));
1430
        registerBlock(167, "iron_trapdoor", (new BlockTrapDoor(Material.iron)).setHardness(5.0F).setStepSound(soundTypeMetal).setUnlocalizedName("ironTrapdoor").disableStats());
1431
        registerBlock(168, "prismarine", (new BlockPrismarine()).setHardness(1.5F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("prismarine"));
1432
        registerBlock(169, "sea_lantern", (new BlockSeaLantern(Material.glass)).setHardness(0.3F).setStepSound(soundTypeGlass).setLightLevel(1.0F).setUnlocalizedName("seaLantern"));
1433
        registerBlock(170, "hay_block", (new BlockHay()).setHardness(0.5F).setStepSound(soundTypeGrass).setUnlocalizedName("hayBlock").setCreativeTab(CreativeTabs.tabBlock));
1434
        registerBlock(171, "carpet", (new BlockCarpet()).setHardness(0.1F).setStepSound(soundTypeCloth).setUnlocalizedName("woolCarpet").setLightOpacity(0));
1435
        registerBlock(172, "hardened_clay", (new BlockHardenedClay()).setHardness(1.25F).setResistance(7.0F).setStepSound(soundTypePiston).setUnlocalizedName("clayHardened"));
1436
        registerBlock(173, "coal_block", (new Block(Material.rock, MapColor.blackColor)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("blockCoal").setCreativeTab(CreativeTabs.tabBlock));
1437
        registerBlock(174, "packed_ice", (new BlockPackedIce()).setHardness(0.5F).setStepSound(soundTypeGlass).setUnlocalizedName("icePacked"));
1438
        registerBlock(175, "double_plant", new BlockDoublePlant());
1439
        registerBlock(176, "standing_banner", (new BlockBanner.BlockBannerStanding()).setHardness(1.0F).setStepSound(soundTypeWood).setUnlocalizedName("banner").disableStats());
1440
        registerBlock(177, "wall_banner", (new BlockBanner.BlockBannerHanging()).setHardness(1.0F).setStepSound(soundTypeWood).setUnlocalizedName("banner").disableStats());
1441
        registerBlock(178, "daylight_detector_inverted", new BlockDaylightDetector(true));
1442
        Block block12 = (new BlockRedSandstone()).setStepSound(soundTypePiston).setHardness(0.8F).setUnlocalizedName("redSandStone");
1443
        registerBlock(179, "red_sandstone", block12);
1444
        registerBlock(180, "red_sandstone_stairs", (new BlockStairs(block12.getDefaultState().withProperty(BlockRedSandstone.TYPE, BlockRedSandstone.EnumType.SMOOTH))).setUnlocalizedName("stairsRedSandStone"));
1445
        registerBlock(181, "double_stone_slab2", (new BlockDoubleStoneSlabNew()).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("stoneSlab2"));
1446
        registerBlock(182, "stone_slab2", (new BlockHalfStoneSlabNew()).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("stoneSlab2"));
1447
        registerBlock(183, "spruce_fence_gate", (new BlockFenceGate(BlockPlanks.EnumType.SPRUCE)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("spruceFenceGate"));
1448
        registerBlock(184, "birch_fence_gate", (new BlockFenceGate(BlockPlanks.EnumType.BIRCH)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("birchFenceGate"));
1449
        registerBlock(185, "jungle_fence_gate", (new BlockFenceGate(BlockPlanks.EnumType.JUNGLE)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("jungleFenceGate"));
1450
        registerBlock(186, "dark_oak_fence_gate", (new BlockFenceGate(BlockPlanks.EnumType.DARK_OAK)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("darkOakFenceGate"));
1451
        registerBlock(187, "acacia_fence_gate", (new BlockFenceGate(BlockPlanks.EnumType.ACACIA)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("acaciaFenceGate"));
1452
        registerBlock(188, "spruce_fence", (new BlockFence(Material.wood, BlockPlanks.EnumType.SPRUCE.getMapColor())).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("spruceFence"));
1453
        registerBlock(189, "birch_fence", (new BlockFence(Material.wood, BlockPlanks.EnumType.BIRCH.getMapColor())).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("birchFence"));
1454
        registerBlock(190, "jungle_fence", (new BlockFence(Material.wood, BlockPlanks.EnumType.JUNGLE.getMapColor())).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("jungleFence"));
1455
        registerBlock(191, "dark_oak_fence", (new BlockFence(Material.wood, BlockPlanks.EnumType.DARK_OAK.getMapColor())).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("darkOakFence"));
1456
        registerBlock(192, "acacia_fence", (new BlockFence(Material.wood, BlockPlanks.EnumType.ACACIA.getMapColor())).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("acaciaFence"));
1457
        registerBlock(193, "spruce_door", (new BlockDoor(Material.wood)).setHardness(3.0F).setStepSound(soundTypeWood).setUnlocalizedName("doorSpruce").disableStats());
1458
        registerBlock(194, "birch_door", (new BlockDoor(Material.wood)).setHardness(3.0F).setStepSound(soundTypeWood).setUnlocalizedName("doorBirch").disableStats());
1459
        registerBlock(195, "jungle_door", (new BlockDoor(Material.wood)).setHardness(3.0F).setStepSound(soundTypeWood).setUnlocalizedName("doorJungle").disableStats());
1460
        registerBlock(196, "acacia_door", (new BlockDoor(Material.wood)).setHardness(3.0F).setStepSound(soundTypeWood).setUnlocalizedName("doorAcacia").disableStats());
1461
        registerBlock(197, "dark_oak_door", (new BlockDoor(Material.wood)).setHardness(3.0F).setStepSound(soundTypeWood).setUnlocalizedName("doorDarkOak").disableStats());
1462
        blockRegistry.validateKey();
1463
1464
        for (Block block13 : blockRegistry)
1465
        {
1466
            if (block13.blockMaterial == Material.air)
1467
            {
1468
                block13.useNeighborBrightness = false;
1469
            }
1470
            else
1471
            {
1472
                boolean flag = false;
1473
                boolean flag1 = block13 instanceof BlockStairs;
1474
                boolean flag2 = block13 instanceof BlockSlab;
1475
                boolean flag3 = block13 == block6;
1476
                boolean flag4 = block13.translucent;
1477
                boolean flag5 = block13.lightOpacity == 0;
1478
1479
                if (flag1 || flag2 || flag3 || flag4 || flag5)
1480
                {
1481
                    flag = true;
1482
                }
1483
1484
                block13.useNeighborBrightness = flag;
1485
            }
1486
        }
1487
1488
        for (Block block14 : blockRegistry)
1489
        {
1490
            for (IBlockState iblockstate : block14.getBlockState().getValidStates())
1491
            {
1492
                int i = blockRegistry.getIDForObject(block14) << 4 | block14.getMetaFromState(iblockstate);
1493
                BLOCK_STATE_IDS.put(iblockstate, i);
1494
            }
1495
        }
1496
    }
1497
1498
    private static void registerBlock(int id, ResourceLocation textualID, Block block_)
1499
    {
1500
        blockRegistry.register(id, textualID, block_);
1501
    }
1502
1503
    private static void registerBlock(int id, String textualID, Block block_)
1504
    {
1505
        registerBlock(id, new ResourceLocation(textualID), block_);
1506
    }
1507
1508
    public static enum EnumOffsetType
1509
    {
1510
        NONE,
1511
        XZ,
1512
        XYZ;
1513
    }
1514
1515
    public static class SoundType
1516
    {
1517
        public final String soundName;
1518
        public final float volume;
1519
        public final float frequency;
1520
1521
        public SoundType(String name, float volume, float frequency)
1522
        {
1523
            this.soundName = name;
1524
            this.volume = volume;
1525
            this.frequency = frequency;
1526
        }
1527
1528
        public float getVolume()
1529
        {
1530
            return this.volume;
1531
        }
1532
1533
        public float getFrequency()
1534
        {
1535
            return this.frequency;
1536
        }
1537
1538
        public String getBreakSound()
1539
        {
1540
            return "dig." + this.soundName;
1541
        }
1542
1543
        public String getStepSound()
1544
        {
1545
            return "step." + this.soundName;
1546
        }
1547
1548
        public String getPlaceSound()
1549
        {
1550
            return this.getBreakSound();
1551
        }
1552
    }
1553
}
1554

Deobfuscated MCP 1.8.9 source of Block from Marcelektro/MavenMCP-1.8.9 (net/minecraft/block/Block.java), stored verbatim.