forked from SlimeKnights/TinkersConstruct
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from K0LALA/1.20.1
Fixed wearing a brute/zombified piglin head causes the game to crash
- Loading branch information
Showing
4 changed files
with
46 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/slimeknights/tconstruct/mixin/SkullBlockMixins.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package slimeknights.tconstruct.mixin; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.block.AbstractSkullBlock; | ||
import net.minecraft.world.level.block.SkullBlock; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.phys.shapes.CollisionContext; | ||
import net.minecraft.world.phys.shapes.VoxelShape; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
import slimeknights.tconstruct.world.TinkerHeadType; | ||
|
||
@Mixin(SkullBlock.class) | ||
public class SkullBlockMixins extends AbstractSkullBlock { | ||
|
||
@Shadow | ||
@Final | ||
protected static VoxelShape PIGLIN_SHAPE; | ||
|
||
public SkullBlockMixins(SkullBlock.Type type, Properties properties) { | ||
super(type, properties); | ||
} | ||
|
||
@Inject(method = "getShape", at = @At("TAIL"), cancellable = true) | ||
private void getCustomShape(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, CollisionContext collisionContext, CallbackInfoReturnable<VoxelShape> cir) { | ||
if (this.getType() == TinkerHeadType.PIGLIN_BRUTE || this.getType() == TinkerHeadType.ZOMBIFIED_PIGLIN) { | ||
cir.setReturnValue(PIGLIN_SHAPE); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
"maxShiftBy": 5 | ||
}, | ||
"mixins": [ | ||
"DataFixersMixin" | ||
"DataFixersMixin", | ||
"SkullBlockMixins" | ||
] | ||
} |