Skip to content

Commit b9c7523

Browse files
committed
fix NPE on getting shulker's animation status
1 parent 945afd4 commit b9c7523

1 file changed

Lines changed: 76 additions & 0 deletions

File tree

patches/minecraft/net/minecraft/block/BlockShulkerBox.java.patch

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,79 @@
2323
p_190948_3_.add(String.format("%s x%d", itemstack.func_82833_r(), itemstack.func_190916_E()));
2424
}
2525
}
26+
@@ -345,42 +345,24 @@
27+
28+
public static Block func_190952_a(EnumDyeColor p_190952_0_)
29+
{
30+
- switch (p_190952_0_)
31+
- {
32+
- case WHITE:
33+
- return Blocks.field_190977_dl;
34+
- case ORANGE:
35+
- return Blocks.field_190978_dm;
36+
- case MAGENTA:
37+
- return Blocks.field_190979_dn;
38+
- case LIGHT_BLUE:
39+
- return Blocks.field_190980_do;
40+
- case YELLOW:
41+
- return Blocks.field_190981_dp;
42+
- case LIME:
43+
- return Blocks.field_190982_dq;
44+
- case PINK:
45+
- return Blocks.field_190983_dr;
46+
- case GRAY:
47+
- return Blocks.field_190984_ds;
48+
- case SILVER:
49+
- return Blocks.field_190985_dt;
50+
- case CYAN:
51+
- return Blocks.field_190986_du;
52+
- case PURPLE:
53+
- default:
54+
- return Blocks.field_190987_dv;
55+
- case BLUE:
56+
- return Blocks.field_190988_dw;
57+
- case BROWN:
58+
- return Blocks.field_190989_dx;
59+
- case GREEN:
60+
- return Blocks.field_190990_dy;
61+
- case RED:
62+
- return Blocks.field_190991_dz;
63+
- case BLACK:
64+
- return Blocks.field_190975_dA;
65+
- }
66+
+ return switch (p_190952_0_) {
67+
+ case WHITE -> Blocks.field_190977_dl;
68+
+ case ORANGE -> Blocks.field_190978_dm;
69+
+ case MAGENTA -> Blocks.field_190979_dn;
70+
+ case LIGHT_BLUE -> Blocks.field_190980_do;
71+
+ case YELLOW -> Blocks.field_190981_dp;
72+
+ case LIME -> Blocks.field_190982_dq;
73+
+ case PINK -> Blocks.field_190983_dr;
74+
+ case GRAY -> Blocks.field_190984_ds;
75+
+ case SILVER -> Blocks.field_190985_dt;
76+
+ case CYAN -> Blocks.field_190986_du;
77+
+ case BLUE -> Blocks.field_190988_dw;
78+
+ case BROWN -> Blocks.field_190989_dx;
79+
+ case GREEN -> Blocks.field_190990_dy;
80+
+ case RED -> Blocks.field_190991_dz;
81+
+ case BLACK -> Blocks.field_190975_dA;
82+
+ default -> Blocks.field_190987_dv;
83+
+ };
84+
}
85+
86+
@SideOnly(Side.CLIENT)
87+
@@ -411,8 +393,12 @@
88+
{
89+
p_193383_2_ = this.func_176221_a(p_193383_2_, p_193383_1_, p_193383_3_);
90+
EnumFacing enumfacing = p_193383_2_.func_177229_b(field_190957_a);
91+
- TileEntityShulkerBox.AnimationStatus tileentityshulkerbox$animationstatus = ((TileEntityShulkerBox)p_193383_1_.func_175625_s(p_193383_3_))
92+
- .func_190591_p();
93+
+ TileEntityShulkerBox te = (TileEntityShulkerBox) p_193383_1_.func_175625_s(p_193383_3_);
94+
+
95+
+ // CREF: getTileEntity may return null
96+
+ TileEntityShulkerBox.AnimationStatus tileentityshulkerbox$animationstatus =
97+
+ te == null ? TileEntityShulkerBox.AnimationStatus.CLOSED : te.func_190591_p();
98+
+
99+
return tileentityshulkerbox$animationstatus != TileEntityShulkerBox.AnimationStatus.CLOSED
100+
&& (
101+
tileentityshulkerbox$animationstatus != TileEntityShulkerBox.AnimationStatus.OPENED

0 commit comments

Comments
 (0)