-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix GT bug that spawns a water source when breaking ice with a saw/ch… (
#103) * fix GT bug that spawns a water source when breaking ice with a saw/chainsaw * added config option and moved target to GT5U * typo
- Loading branch information
Showing
4 changed files
with
54 additions
and
0 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
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
43 changes: 43 additions & 0 deletions
43
src/main/java/com/mitchej123/hodgepodge/mixins/minecraft/MixinBlockIce.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,43 @@ | ||
package com.mitchej123.hodgepodge.mixins.minecraft; | ||
|
||
import gregtech.api.items.GT_MetaGenerated_Tool; | ||
import gregtech.common.tools.GT_Tool_Saw; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockIce; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(BlockIce.class) | ||
public class MixinBlockIce { | ||
|
||
/** | ||
* Fixes the gregtech bug where breaking an ice block with a saw or chainsaw drops the block and spawns a water source | ||
*/ | ||
@Redirect( | ||
method = "harvestBlock", | ||
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlock(IIILnet/minecraft/block/Block;)Z")) | ||
public boolean hodgepodge$fixWaterSpawnWithGTSaw( | ||
World instance, | ||
int x, | ||
int y, | ||
int z, | ||
Block block, | ||
World p_149636_1_, | ||
EntityPlayer p_149636_2_, | ||
int p_149636_3_, | ||
int p_149636_4_, | ||
int p_149636_5_, | ||
int p_149636_6_) { | ||
final ItemStack itemStack = p_149636_2_.getCurrentEquippedItem(); | ||
if (itemStack == null | ||
|| !(itemStack.getItem() instanceof GT_MetaGenerated_Tool) | ||
|| !(((GT_MetaGenerated_Tool) itemStack.getItem()).getToolStats(itemStack) instanceof GT_Tool_Saw)) { | ||
return instance.setBlock(x, y, z, block); | ||
} | ||
return false; | ||
} | ||
} |