BlockStairs .java

net.minecraft.block.BlockStairs (class): members: setBaseCollisionBounds, field_150150_a, func_176304_i, func_176305_g, func_176306_h, func_176307_f, HALF.

net.minecraft.blockclass845 linescommonextends Block29.2 KB

API Surface (40)

void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
boolean isOpaqueCube()
boolean isFullCube()
void setBaseCollisionBounds(IBlockAccess worldIn, BlockPos pos)
boolean isBlockStairs(Block blockIn)
boolean isSameStair(IBlockAccess worldIn, BlockPos pos, IBlockState state)
int func_176307_f(IBlockAccess blockAccess, BlockPos pos)
int func_176305_g(IBlockAccess blockAccess, BlockPos pos)
boolean func_176306_h(IBlockAccess blockAccess, BlockPos pos)
boolean func_176304_i(IBlockAccess blockAccess, BlockPos pos)
void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity)
void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn)
void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state)
int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos)
float getExplosionResistance(Entity exploder)
EnumWorldBlockLayer getBlockLayer()
int tickRate(World worldIn)
AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos)
Vec3 modifyAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3 motion)
boolean isCollidable()
boolean canCollideCheck(IBlockState state, boolean hitIfLiquid)
boolean canPlaceBlockAt(World worldIn, BlockPos pos)
void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
void breakBlock(World worldIn, BlockPos pos, IBlockState state)
void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn)
void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn)
MapColor getMapColor(IBlockState state)
IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end)
IBlockState getStateFromMeta(int meta)
int getMetaFromState(IBlockState state)
IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
BlockState createBlockState()
String toString()
String getName()
String toString()
String getName()

Fields & Constants (8)

FACING
HALF
SHAPE
field_150150_a
modelBlock
modelState
hasRaytraced
rayTracePass

String literals (9)

"facing"
"half"
"shape"
"bottom"
"straight"
"inner_left"
"inner_right"
"outer_left"
"outer_right"

Full Source

BlockStairs.java845 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.block;
2
3
import java.util.Arrays;
4
import java.util.List;
5
import java.util.Random;
6
import net.minecraft.block.material.MapColor;
7
import net.minecraft.block.properties.IProperty;
8
import net.minecraft.block.properties.PropertyDirection;
9
import net.minecraft.block.properties.PropertyEnum;
10
import net.minecraft.block.state.BlockState;
11
import net.minecraft.block.state.IBlockState;
12
import net.minecraft.creativetab.CreativeTabs;
13
import net.minecraft.entity.Entity;
14
import net.minecraft.entity.EntityLivingBase;
15
import net.minecraft.entity.player.EntityPlayer;
16
import net.minecraft.init.Blocks;
17
import net.minecraft.util.AxisAlignedBB;
18
import net.minecraft.util.BlockPos;
19
import net.minecraft.util.EnumFacing;
20
import net.minecraft.util.EnumWorldBlockLayer;
21
import net.minecraft.util.IStringSerializable;
22
import net.minecraft.util.MovingObjectPosition;
23
import net.minecraft.util.Vec3;
24
import net.minecraft.world.Explosion;
25
import net.minecraft.world.IBlockAccess;
26
import net.minecraft.world.World;
27
28
public class BlockStairs extends Block
29
{
30
    public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
31
    public static final PropertyEnum<BlockStairs.EnumHalf> HALF = PropertyEnum.<BlockStairs.EnumHalf>create("half", BlockStairs.EnumHalf.class);
32
    public static final PropertyEnum<BlockStairs.EnumShape> SHAPE = PropertyEnum.<BlockStairs.EnumShape>create("shape", BlockStairs.EnumShape.class);
33
    private static final int[][] field_150150_a = new int[][] {{4, 5}, {5, 7}, {6, 7}, {4, 6}, {0, 1}, {1, 3}, {2, 3}, {0, 2}};
34
    private final Block modelBlock;
35
    private final IBlockState modelState;
36
    private boolean hasRaytraced;
37
    private int rayTracePass;
38
39
    protected BlockStairs(IBlockState modelState)
40
    {
41
        super(modelState.getBlock().blockMaterial);
42
        this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(HALF, BlockStairs.EnumHalf.BOTTOM).withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT));
43
        this.modelBlock = modelState.getBlock();
44
        this.modelState = modelState;
45
        this.setHardness(this.modelBlock.blockHardness);
46
        this.setResistance(this.modelBlock.blockResistance / 3.0F);
47
        this.setStepSound(this.modelBlock.stepSound);
48
        this.setLightOpacity(255);
49
        this.setCreativeTab(CreativeTabs.tabBlock);
50
    }
51
52
    public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
53
    {
54
        if (this.hasRaytraced)
55
        {
56
            this.setBlockBounds(0.5F * (float)(this.rayTracePass % 2), 0.5F * (float)(this.rayTracePass / 4 % 2), 0.5F * (float)(this.rayTracePass / 2 % 2), 0.5F + 0.5F * (float)(this.rayTracePass % 2), 0.5F + 0.5F * (float)(this.rayTracePass / 4 % 2), 0.5F + 0.5F * (float)(this.rayTracePass / 2 % 2));
57
        }
58
        else
59
        {
60
            this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
61
        }
62
    }
63
64
    /**
65
     * Used to determine ambient occlusion and culling when rebuilding chunks for render
66
     */
67
    public boolean isOpaqueCube()
68
    {
69
        return false;
70
    }
71
72
    public boolean isFullCube()
73
    {
74
        return false;
75
    }
76
77
    /**
78
     * Set the block bounds as the collision bounds for the stairs at the given position
79
     */
80
    public void setBaseCollisionBounds(IBlockAccess worldIn, BlockPos pos)
81
    {
82
        if (worldIn.getBlockState(pos).getValue(HALF) == BlockStairs.EnumHalf.TOP)
83
        {
84
            this.setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
85
        }
86
        else
87
        {
88
            this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
89
        }
90
    }
91
92
    /**
93
     * Checks if a block is stairs
94
     */
95
    public static boolean isBlockStairs(Block blockIn)
96
    {
97
        return blockIn instanceof BlockStairs;
98
    }
99
100
    /**
101
     * Check whether there is a stair block at the given position and it has the same properties as the given BlockState
102
     */
103
    public static boolean isSameStair(IBlockAccess worldIn, BlockPos pos, IBlockState state)
104
    {
105
        IBlockState iblockstate = worldIn.getBlockState(pos);
106
        Block block = iblockstate.getBlock();
107
        return isBlockStairs(block) && iblockstate.getValue(HALF) == state.getValue(HALF) && iblockstate.getValue(FACING) == state.getValue(FACING);
108
    }
109
110
    public int func_176307_f(IBlockAccess blockAccess, BlockPos pos)
111
    {
112
        IBlockState iblockstate = blockAccess.getBlockState(pos);
113
        EnumFacing enumfacing = (EnumFacing)iblockstate.getValue(FACING);
114
        BlockStairs.EnumHalf blockstairs$enumhalf = (BlockStairs.EnumHalf)iblockstate.getValue(HALF);
115
        boolean flag = blockstairs$enumhalf == BlockStairs.EnumHalf.TOP;
116
117
        if (enumfacing == EnumFacing.EAST)
118
        {
119
            IBlockState iblockstate1 = blockAccess.getBlockState(pos.east());
120
            Block block = iblockstate1.getBlock();
121
122
            if (isBlockStairs(block) && blockstairs$enumhalf == iblockstate1.getValue(HALF))
123
            {
124
                EnumFacing enumfacing1 = (EnumFacing)iblockstate1.getValue(FACING);
125
126
                if (enumfacing1 == EnumFacing.NORTH && !isSameStair(blockAccess, pos.south(), iblockstate))
127
                {
128
                    return flag ? 1 : 2;
129
                }
130
131
                if (enumfacing1 == EnumFacing.SOUTH && !isSameStair(blockAccess, pos.north(), iblockstate))
132
                {
133
                    return flag ? 2 : 1;
134
                }
135
            }
136
        }
137
        else if (enumfacing == EnumFacing.WEST)
138
        {
139
            IBlockState iblockstate2 = blockAccess.getBlockState(pos.west());
140
            Block block1 = iblockstate2.getBlock();
141
142
            if (isBlockStairs(block1) && blockstairs$enumhalf == iblockstate2.getValue(HALF))
143
            {
144
                EnumFacing enumfacing2 = (EnumFacing)iblockstate2.getValue(FACING);
145
146
                if (enumfacing2 == EnumFacing.NORTH && !isSameStair(blockAccess, pos.south(), iblockstate))
147
                {
148
                    return flag ? 2 : 1;
149
                }
150
151
                if (enumfacing2 == EnumFacing.SOUTH && !isSameStair(blockAccess, pos.north(), iblockstate))
152
                {
153
                    return flag ? 1 : 2;
154
                }
155
            }
156
        }
157
        else if (enumfacing == EnumFacing.SOUTH)
158
        {
159
            IBlockState iblockstate3 = blockAccess.getBlockState(pos.south());
160
            Block block2 = iblockstate3.getBlock();
161
162
            if (isBlockStairs(block2) && blockstairs$enumhalf == iblockstate3.getValue(HALF))
163
            {
164
                EnumFacing enumfacing3 = (EnumFacing)iblockstate3.getValue(FACING);
165
166
                if (enumfacing3 == EnumFacing.WEST && !isSameStair(blockAccess, pos.east(), iblockstate))
167
                {
168
                    return flag ? 2 : 1;
169
                }
170
171
                if (enumfacing3 == EnumFacing.EAST && !isSameStair(blockAccess, pos.west(), iblockstate))
172
                {
173
                    return flag ? 1 : 2;
174
                }
175
            }
176
        }
177
        else if (enumfacing == EnumFacing.NORTH)
178
        {
179
            IBlockState iblockstate4 = blockAccess.getBlockState(pos.north());
180
            Block block3 = iblockstate4.getBlock();
181
182
            if (isBlockStairs(block3) && blockstairs$enumhalf == iblockstate4.getValue(HALF))
183
            {
184
                EnumFacing enumfacing4 = (EnumFacing)iblockstate4.getValue(FACING);
185
186
                if (enumfacing4 == EnumFacing.WEST && !isSameStair(blockAccess, pos.east(), iblockstate))
187
                {
188
                    return flag ? 1 : 2;
189
                }
190
191
                if (enumfacing4 == EnumFacing.EAST && !isSameStair(blockAccess, pos.west(), iblockstate))
192
                {
193
                    return flag ? 2 : 1;
194
                }
195
            }
196
        }
197
198
        return 0;
199
    }
200
201
    public int func_176305_g(IBlockAccess blockAccess, BlockPos pos)
202
    {
203
        IBlockState iblockstate = blockAccess.getBlockState(pos);
204
        EnumFacing enumfacing = (EnumFacing)iblockstate.getValue(FACING);
205
        BlockStairs.EnumHalf blockstairs$enumhalf = (BlockStairs.EnumHalf)iblockstate.getValue(HALF);
206
        boolean flag = blockstairs$enumhalf == BlockStairs.EnumHalf.TOP;
207
208
        if (enumfacing == EnumFacing.EAST)
209
        {
210
            IBlockState iblockstate1 = blockAccess.getBlockState(pos.west());
211
            Block block = iblockstate1.getBlock();
212
213
            if (isBlockStairs(block) && blockstairs$enumhalf == iblockstate1.getValue(HALF))
214
            {
215
                EnumFacing enumfacing1 = (EnumFacing)iblockstate1.getValue(FACING);
216
217
                if (enumfacing1 == EnumFacing.NORTH && !isSameStair(blockAccess, pos.north(), iblockstate))
218
                {
219
                    return flag ? 1 : 2;
220
                }
221
222
                if (enumfacing1 == EnumFacing.SOUTH && !isSameStair(blockAccess, pos.south(), iblockstate))
223
                {
224
                    return flag ? 2 : 1;
225
                }
226
            }
227
        }
228
        else if (enumfacing == EnumFacing.WEST)
229
        {
230
            IBlockState iblockstate2 = blockAccess.getBlockState(pos.east());
231
            Block block1 = iblockstate2.getBlock();
232
233
            if (isBlockStairs(block1) && blockstairs$enumhalf == iblockstate2.getValue(HALF))
234
            {
235
                EnumFacing enumfacing2 = (EnumFacing)iblockstate2.getValue(FACING);
236
237
                if (enumfacing2 == EnumFacing.NORTH && !isSameStair(blockAccess, pos.north(), iblockstate))
238
                {
239
                    return flag ? 2 : 1;
240
                }
241
242
                if (enumfacing2 == EnumFacing.SOUTH && !isSameStair(blockAccess, pos.south(), iblockstate))
243
                {
244
                    return flag ? 1 : 2;
245
                }
246
            }
247
        }
248
        else if (enumfacing == EnumFacing.SOUTH)
249
        {
250
            IBlockState iblockstate3 = blockAccess.getBlockState(pos.north());
251
            Block block2 = iblockstate3.getBlock();
252
253
            if (isBlockStairs(block2) && blockstairs$enumhalf == iblockstate3.getValue(HALF))
254
            {
255
                EnumFacing enumfacing3 = (EnumFacing)iblockstate3.getValue(FACING);
256
257
                if (enumfacing3 == EnumFacing.WEST && !isSameStair(blockAccess, pos.west(), iblockstate))
258
                {
259
                    return flag ? 2 : 1;
260
                }
261
262
                if (enumfacing3 == EnumFacing.EAST && !isSameStair(blockAccess, pos.east(), iblockstate))
263
                {
264
                    return flag ? 1 : 2;
265
                }
266
            }
267
        }
268
        else if (enumfacing == EnumFacing.NORTH)
269
        {
270
            IBlockState iblockstate4 = blockAccess.getBlockState(pos.south());
271
            Block block3 = iblockstate4.getBlock();
272
273
            if (isBlockStairs(block3) && blockstairs$enumhalf == iblockstate4.getValue(HALF))
274
            {
275
                EnumFacing enumfacing4 = (EnumFacing)iblockstate4.getValue(FACING);
276
277
                if (enumfacing4 == EnumFacing.WEST && !isSameStair(blockAccess, pos.west(), iblockstate))
278
                {
279
                    return flag ? 1 : 2;
280
                }
281
282
                if (enumfacing4 == EnumFacing.EAST && !isSameStair(blockAccess, pos.east(), iblockstate))
283
                {
284
                    return flag ? 2 : 1;
285
                }
286
            }
287
        }
288
289
        return 0;
290
    }
291
292
    public boolean func_176306_h(IBlockAccess blockAccess, BlockPos pos)
293
    {
294
        IBlockState iblockstate = blockAccess.getBlockState(pos);
295
        EnumFacing enumfacing = (EnumFacing)iblockstate.getValue(FACING);
296
        BlockStairs.EnumHalf blockstairs$enumhalf = (BlockStairs.EnumHalf)iblockstate.getValue(HALF);
297
        boolean flag = blockstairs$enumhalf == BlockStairs.EnumHalf.TOP;
298
        float f = 0.5F;
299
        float f1 = 1.0F;
300
301
        if (flag)
302
        {
303
            f = 0.0F;
304
            f1 = 0.5F;
305
        }
306
307
        float f2 = 0.0F;
308
        float f3 = 1.0F;
309
        float f4 = 0.0F;
310
        float f5 = 0.5F;
311
        boolean flag1 = true;
312
313
        if (enumfacing == EnumFacing.EAST)
314
        {
315
            f2 = 0.5F;
316
            f5 = 1.0F;
317
            IBlockState iblockstate1 = blockAccess.getBlockState(pos.east());
318
            Block block = iblockstate1.getBlock();
319
320
            if (isBlockStairs(block) && blockstairs$enumhalf == iblockstate1.getValue(HALF))
321
            {
322
                EnumFacing enumfacing1 = (EnumFacing)iblockstate1.getValue(FACING);
323
324
                if (enumfacing1 == EnumFacing.NORTH && !isSameStair(blockAccess, pos.south(), iblockstate))
325
                {
326
                    f5 = 0.5F;
327
                    flag1 = false;
328
                }
329
                else if (enumfacing1 == EnumFacing.SOUTH && !isSameStair(blockAccess, pos.north(), iblockstate))
330
                {
331
                    f4 = 0.5F;
332
                    flag1 = false;
333
                }
334
            }
335
        }
336
        else if (enumfacing == EnumFacing.WEST)
337
        {
338
            f3 = 0.5F;
339
            f5 = 1.0F;
340
            IBlockState iblockstate2 = blockAccess.getBlockState(pos.west());
341
            Block block1 = iblockstate2.getBlock();
342
343
            if (isBlockStairs(block1) && blockstairs$enumhalf == iblockstate2.getValue(HALF))
344
            {
345
                EnumFacing enumfacing2 = (EnumFacing)iblockstate2.getValue(FACING);
346
347
                if (enumfacing2 == EnumFacing.NORTH && !isSameStair(blockAccess, pos.south(), iblockstate))
348
                {
349
                    f5 = 0.5F;
350
                    flag1 = false;
351
                }
352
                else if (enumfacing2 == EnumFacing.SOUTH && !isSameStair(blockAccess, pos.north(), iblockstate))
353
                {
354
                    f4 = 0.5F;
355
                    flag1 = false;
356
                }
357
            }
358
        }
359
        else if (enumfacing == EnumFacing.SOUTH)
360
        {
361
            f4 = 0.5F;
362
            f5 = 1.0F;
363
            IBlockState iblockstate3 = blockAccess.getBlockState(pos.south());
364
            Block block2 = iblockstate3.getBlock();
365
366
            if (isBlockStairs(block2) && blockstairs$enumhalf == iblockstate3.getValue(HALF))
367
            {
368
                EnumFacing enumfacing3 = (EnumFacing)iblockstate3.getValue(FACING);
369
370
                if (enumfacing3 == EnumFacing.WEST && !isSameStair(blockAccess, pos.east(), iblockstate))
371
                {
372
                    f3 = 0.5F;
373
                    flag1 = false;
374
                }
375
                else if (enumfacing3 == EnumFacing.EAST && !isSameStair(blockAccess, pos.west(), iblockstate))
376
                {
377
                    f2 = 0.5F;
378
                    flag1 = false;
379
                }
380
            }
381
        }
382
        else if (enumfacing == EnumFacing.NORTH)
383
        {
384
            IBlockState iblockstate4 = blockAccess.getBlockState(pos.north());
385
            Block block3 = iblockstate4.getBlock();
386
387
            if (isBlockStairs(block3) && blockstairs$enumhalf == iblockstate4.getValue(HALF))
388
            {
389
                EnumFacing enumfacing4 = (EnumFacing)iblockstate4.getValue(FACING);
390
391
                if (enumfacing4 == EnumFacing.WEST && !isSameStair(blockAccess, pos.east(), iblockstate))
392
                {
393
                    f3 = 0.5F;
394
                    flag1 = false;
395
                }
396
                else if (enumfacing4 == EnumFacing.EAST && !isSameStair(blockAccess, pos.west(), iblockstate))
397
                {
398
                    f2 = 0.5F;
399
                    flag1 = false;
400
                }
401
            }
402
        }
403
404
        this.setBlockBounds(f2, f, f4, f3, f1, f5);
405
        return flag1;
406
    }
407
408
    public boolean func_176304_i(IBlockAccess blockAccess, BlockPos pos)
409
    {
410
        IBlockState iblockstate = blockAccess.getBlockState(pos);
411
        EnumFacing enumfacing = (EnumFacing)iblockstate.getValue(FACING);
412
        BlockStairs.EnumHalf blockstairs$enumhalf = (BlockStairs.EnumHalf)iblockstate.getValue(HALF);
413
        boolean flag = blockstairs$enumhalf == BlockStairs.EnumHalf.TOP;
414
        float f = 0.5F;
415
        float f1 = 1.0F;
416
417
        if (flag)
418
        {
419
            f = 0.0F;
420
            f1 = 0.5F;
421
        }
422
423
        float f2 = 0.0F;
424
        float f3 = 0.5F;
425
        float f4 = 0.5F;
426
        float f5 = 1.0F;
427
        boolean flag1 = false;
428
429
        if (enumfacing == EnumFacing.EAST)
430
        {
431
            IBlockState iblockstate1 = blockAccess.getBlockState(pos.west());
432
            Block block = iblockstate1.getBlock();
433
434
            if (isBlockStairs(block) && blockstairs$enumhalf == iblockstate1.getValue(HALF))
435
            {
436
                EnumFacing enumfacing1 = (EnumFacing)iblockstate1.getValue(FACING);
437
438
                if (enumfacing1 == EnumFacing.NORTH && !isSameStair(blockAccess, pos.north(), iblockstate))
439
                {
440
                    f4 = 0.0F;
441
                    f5 = 0.5F;
442
                    flag1 = true;
443
                }
444
                else if (enumfacing1 == EnumFacing.SOUTH && !isSameStair(blockAccess, pos.south(), iblockstate))
445
                {
446
                    f4 = 0.5F;
447
                    f5 = 1.0F;
448
                    flag1 = true;
449
                }
450
            }
451
        }
452
        else if (enumfacing == EnumFacing.WEST)
453
        {
454
            IBlockState iblockstate2 = blockAccess.getBlockState(pos.east());
455
            Block block1 = iblockstate2.getBlock();
456
457
            if (isBlockStairs(block1) && blockstairs$enumhalf == iblockstate2.getValue(HALF))
458
            {
459
                f2 = 0.5F;
460
                f3 = 1.0F;
461
                EnumFacing enumfacing2 = (EnumFacing)iblockstate2.getValue(FACING);
462
463
                if (enumfacing2 == EnumFacing.NORTH && !isSameStair(blockAccess, pos.north(), iblockstate))
464
                {
465
                    f4 = 0.0F;
466
                    f5 = 0.5F;
467
                    flag1 = true;
468
                }
469
                else if (enumfacing2 == EnumFacing.SOUTH && !isSameStair(blockAccess, pos.south(), iblockstate))
470
                {
471
                    f4 = 0.5F;
472
                    f5 = 1.0F;
473
                    flag1 = true;
474
                }
475
            }
476
        }
477
        else if (enumfacing == EnumFacing.SOUTH)
478
        {
479
            IBlockState iblockstate3 = blockAccess.getBlockState(pos.north());
480
            Block block2 = iblockstate3.getBlock();
481
482
            if (isBlockStairs(block2) && blockstairs$enumhalf == iblockstate3.getValue(HALF))
483
            {
484
                f4 = 0.0F;
485
                f5 = 0.5F;
486
                EnumFacing enumfacing3 = (EnumFacing)iblockstate3.getValue(FACING);
487
488
                if (enumfacing3 == EnumFacing.WEST && !isSameStair(blockAccess, pos.west(), iblockstate))
489
                {
490
                    flag1 = true;
491
                }
492
                else if (enumfacing3 == EnumFacing.EAST && !isSameStair(blockAccess, pos.east(), iblockstate))
493
                {
494
                    f2 = 0.5F;
495
                    f3 = 1.0F;
496
                    flag1 = true;
497
                }
498
            }
499
        }
500
        else if (enumfacing == EnumFacing.NORTH)
501
        {
502
            IBlockState iblockstate4 = blockAccess.getBlockState(pos.south());
503
            Block block3 = iblockstate4.getBlock();
504
505
            if (isBlockStairs(block3) && blockstairs$enumhalf == iblockstate4.getValue(HALF))
506
            {
507
                EnumFacing enumfacing4 = (EnumFacing)iblockstate4.getValue(FACING);
508
509
                if (enumfacing4 == EnumFacing.WEST && !isSameStair(blockAccess, pos.west(), iblockstate))
510
                {
511
                    flag1 = true;
512
                }
513
                else if (enumfacing4 == EnumFacing.EAST && !isSameStair(blockAccess, pos.east(), iblockstate))
514
                {
515
                    f2 = 0.5F;
516
                    f3 = 1.0F;
517
                    flag1 = true;
518
                }
519
            }
520
        }
521
522
        if (flag1)
523
        {
524
            this.setBlockBounds(f2, f, f4, f3, f1, f5);
525
        }
526
527
        return flag1;
528
    }
529
530
    /**
531
     * Add all collision boxes of this Block to the list that intersect with the given mask.
532
     */
533
    public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity)
534
    {
535
        this.setBaseCollisionBounds(worldIn, pos);
536
        super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
537
        boolean flag = this.func_176306_h(worldIn, pos);
538
        super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
539
540
        if (flag && this.func_176304_i(worldIn, pos))
541
        {
542
            super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
543
        }
544
545
        this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
546
    }
547
548
    public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
549
    {
550
        this.modelBlock.randomDisplayTick(worldIn, pos, state, rand);
551
    }
552
553
    public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn)
554
    {
555
        this.modelBlock.onBlockClicked(worldIn, pos, playerIn);
556
    }
557
558
    /**
559
     * Called when a player destroys this Block
560
     */
561
    public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state)
562
    {
563
        this.modelBlock.onBlockDestroyedByPlayer(worldIn, pos, state);
564
    }
565
566
    public int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos)
567
    {
568
        return this.modelBlock.getMixedBrightnessForBlock(worldIn, pos);
569
    }
570
571
    /**
572
     * Returns how much this block can resist explosions from the passed in entity.
573
     */
574
    public float getExplosionResistance(Entity exploder)
575
    {
576
        return this.modelBlock.getExplosionResistance(exploder);
577
    }
578
579
    public EnumWorldBlockLayer getBlockLayer()
580
    {
581
        return this.modelBlock.getBlockLayer();
582
    }
583
584
    /**
585
     * How many world ticks before ticking
586
     */
587
    public int tickRate(World worldIn)
588
    {
589
        return this.modelBlock.tickRate(worldIn);
590
    }
591
592
    public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos)
593
    {
594
        return this.modelBlock.getSelectedBoundingBox(worldIn, pos);
595
    }
596
597
    public Vec3 modifyAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3 motion)
598
    {
599
        return this.modelBlock.modifyAcceleration(worldIn, pos, entityIn, motion);
600
    }
601
602
    /**
603
     * Returns if this block is collidable (only used by Fire). Args: x, y, z
604
     */
605
    public boolean isCollidable()
606
    {
607
        return this.modelBlock.isCollidable();
608
    }
609
610
    public boolean canCollideCheck(IBlockState state, boolean hitIfLiquid)
611
    {
612
        return this.modelBlock.canCollideCheck(state, hitIfLiquid);
613
    }
614
615
    public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
616
    {
617
        return this.modelBlock.canPlaceBlockAt(worldIn, pos);
618
    }
619
620
    public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
621
    {
622
        this.onNeighborBlockChange(worldIn, pos, this.modelState, Blocks.air);
623
        this.modelBlock.onBlockAdded(worldIn, pos, this.modelState);
624
    }
625
626
    public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
627
    {
628
        this.modelBlock.breakBlock(worldIn, pos, this.modelState);
629
    }
630
631
    /**
632
     * Triggered whenever an entity collides with this block (enters into the block)
633
     */
634
    public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn)
635
    {
636
        this.modelBlock.onEntityCollidedWithBlock(worldIn, pos, entityIn);
637
    }
638
639
    public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
640
    {
641
        this.modelBlock.updateTick(worldIn, pos, state, rand);
642
    }
643
644
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
645
    {
646
        return this.modelBlock.onBlockActivated(worldIn, pos, this.modelState, playerIn, EnumFacing.DOWN, 0.0F, 0.0F, 0.0F);
647
    }
648
649
    /**
650
     * Called when this Block is destroyed by an Explosion
651
     */
652
    public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn)
653
    {
654
        this.modelBlock.onBlockDestroyedByExplosion(worldIn, pos, explosionIn);
655
    }
656
657
    /**
658
     * Get the MapColor for this Block and the given BlockState
659
     */
660
    public MapColor getMapColor(IBlockState state)
661
    {
662
        return this.modelBlock.getMapColor(this.modelState);
663
    }
664
665
    /**
666
     * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
667
     * IBlockstate
668
     */
669
    public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
670
    {
671
        IBlockState iblockstate = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
672
        iblockstate = iblockstate.withProperty(FACING, placer.getHorizontalFacing()).withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT);
673
        return facing != EnumFacing.DOWN && (facing == EnumFacing.UP || (double)hitY <= 0.5D) ? iblockstate.withProperty(HALF, BlockStairs.EnumHalf.BOTTOM) : iblockstate.withProperty(HALF, BlockStairs.EnumHalf.TOP);
674
    }
675
676
    /**
677
     * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit.
678
     */
679
    public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end)
680
    {
681
        MovingObjectPosition[] amovingobjectposition = new MovingObjectPosition[8];
682
        IBlockState iblockstate = worldIn.getBlockState(pos);
683
        int i = ((EnumFacing)iblockstate.getValue(FACING)).getHorizontalIndex();
684
        boolean flag = iblockstate.getValue(HALF) == BlockStairs.EnumHalf.TOP;
685
        int[] aint = field_150150_a[i + (flag ? 4 : 0)];
686
        this.hasRaytraced = true;
687
688
        for (int j = 0; j < 8; ++j)
689
        {
690
            this.rayTracePass = j;
691
692
            if (Arrays.binarySearch(aint, j) < 0)
693
            {
694
                amovingobjectposition[j] = super.collisionRayTrace(worldIn, pos, start, end);
695
            }
696
        }
697
698
        for (int k : aint)
699
        {
700
            amovingobjectposition[k] = null;
701
        }
702
703
        MovingObjectPosition movingobjectposition1 = null;
704
        double d1 = 0.0D;
705
706
        for (MovingObjectPosition movingobjectposition : amovingobjectposition)
707
        {
708
            if (movingobjectposition != null)
709
            {
710
                double d0 = movingobjectposition.hitVec.squareDistanceTo(end);
711
712
                if (d0 > d1)
713
                {
714
                    movingobjectposition1 = movingobjectposition;
715
                    d1 = d0;
716
                }
717
            }
718
        }
719
720
        return movingobjectposition1;
721
    }
722
723
    /**
724
     * Convert the given metadata into a BlockState for this Block
725
     */
726
    public IBlockState getStateFromMeta(int meta)
727
    {
728
        IBlockState iblockstate = this.getDefaultState().withProperty(HALF, (meta & 4) > 0 ? BlockStairs.EnumHalf.TOP : BlockStairs.EnumHalf.BOTTOM);
729
        iblockstate = iblockstate.withProperty(FACING, EnumFacing.getFront(5 - (meta & 3)));
730
        return iblockstate;
731
    }
732
733
    /**
734
     * Convert the BlockState into the correct metadata value
735
     */
736
    public int getMetaFromState(IBlockState state)
737
    {
738
        int i = 0;
739
740
        if (state.getValue(HALF) == BlockStairs.EnumHalf.TOP)
741
        {
742
            i |= 4;
743
        }
744
745
        i = i | 5 - ((EnumFacing)state.getValue(FACING)).getIndex();
746
        return i;
747
    }
748
749
    /**
750
     * Get the actual Block state of this Block at the given position. This applies properties not visible in the
751
     * metadata, such as fence connections.
752
     */
753
    public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
754
    {
755
        if (this.func_176306_h(worldIn, pos))
756
        {
757
            switch (this.func_176305_g(worldIn, pos))
758
            {
759
                case 0:
760
                    state = state.withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT);
761
                    break;
762
763
                case 1:
764
                    state = state.withProperty(SHAPE, BlockStairs.EnumShape.INNER_RIGHT);
765
                    break;
766
767
                case 2:
768
                    state = state.withProperty(SHAPE, BlockStairs.EnumShape.INNER_LEFT);
769
            }
770
        }
771
        else
772
        {
773
            switch (this.func_176307_f(worldIn, pos))
774
            {
775
                case 0:
776
                    state = state.withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT);
777
                    break;
778
779
                case 1:
780
                    state = state.withProperty(SHAPE, BlockStairs.EnumShape.OUTER_RIGHT);
781
                    break;
782
783
                case 2:
784
                    state = state.withProperty(SHAPE, BlockStairs.EnumShape.OUTER_LEFT);
785
            }
786
        }
787
788
        return state;
789
    }
790
791
    protected BlockState createBlockState()
792
    {
793
        return new BlockState(this, new IProperty[] {FACING, HALF, SHAPE});
794
    }
795
796
    public static enum EnumHalf implements IStringSerializable
797
    {
798
        TOP("top"),
799
        BOTTOM("bottom");
800
801
        private final String name;
802
803
        private EnumHalf(String name)
804
        {
805
            this.name = name;
806
        }
807
808
        public String toString()
809
        {
810
            return this.name;
811
        }
812
813
        public String getName()
814
        {
815
            return this.name;
816
        }
817
    }
818
819
    public static enum EnumShape implements IStringSerializable
820
    {
821
        STRAIGHT("straight"),
822
        INNER_LEFT("inner_left"),
823
        INNER_RIGHT("inner_right"),
824
        OUTER_LEFT("outer_left"),
825
        OUTER_RIGHT("outer_right");
826
827
        private final String name;
828
829
        private EnumShape(String name)
830
        {
831
            this.name = name;
832
        }
833
834
        public String toString()
835
        {
836
            return this.name;
837
        }
838
839
        public String getName()
840
        {
841
            return this.name;
842
        }
843
    }
844
}
845

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