-
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.
Improve several simulated block break actions of mods (#478)
Co-authored-by: glowredman <[email protected]>
- Loading branch information
1 parent
0d73124
commit af57067
Showing
5 changed files
with
143 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
34 changes: 34 additions & 0 deletions
34
src/main/java/com/mitchej123/hodgepodge/mixins/early/cofhcore/MixinBlockHelper.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,34 @@ | ||
package com.mitchej123.hodgepodge.mixins.early.cofhcore; | ||
|
||
import java.util.ArrayList; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.world.World; | ||
import net.minecraftforge.event.ForgeEventFactory; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import com.llamalad7.mixinextras.sugar.Local; | ||
|
||
import cofh.lib.util.helpers.BlockHelper; | ||
|
||
@Mixin(BlockHelper.class) | ||
public class MixinBlockHelper { | ||
|
||
@ModifyExpressionValue( | ||
at = @At( | ||
target = "Lnet/minecraft/block/Block;getDrops(Lnet/minecraft/world/World;IIIII)Ljava/util/ArrayList;", | ||
value = "INVOKE"), | ||
method = "breakBlock(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/EntityPlayer;IIILnet/minecraft/block/Block;IZZ)Ljava/util/List;", | ||
remap = false) | ||
private static ArrayList<ItemStack> hodgepodge$fireBlockHarvesting(ArrayList<ItemStack> drops, World world, | ||
EntityPlayer player, int x, int y, int z, Block block, int fortune, boolean var7, boolean silkTouch, | ||
@Local(ordinal = 6) int meta) { | ||
ForgeEventFactory.fireBlockHarvesting(drops, world, block, x, y, z, meta, fortune, 1.0f, silkTouch, player); | ||
return drops; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...om/mitchej123/hodgepodge/mixins/late/minefactoryreloaded/MixinTileEntityBlockBreaker.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,33 @@ | ||
package com.mitchej123.hodgepodge.mixins.late.minefactoryreloaded; | ||
|
||
import java.util.ArrayList; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.world.World; | ||
import net.minecraftforge.event.ForgeEventFactory; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import com.llamalad7.mixinextras.sugar.Local; | ||
|
||
import powercrystals.minefactoryreloaded.tile.machine.TileEntityBlockBreaker; | ||
|
||
@Mixin(TileEntityBlockBreaker.class) | ||
public class MixinTileEntityBlockBreaker { | ||
|
||
@ModifyExpressionValue( | ||
at = @At( | ||
target = "Lnet/minecraft/block/Block;getDrops(Lnet/minecraft/world/World;IIIII)Ljava/util/ArrayList;", | ||
value = "INVOKE"), | ||
method = "activateMachine", | ||
remap = false) | ||
private ArrayList<ItemStack> hodgepodge$fireBlockHarvesting(ArrayList<ItemStack> drops, | ||
@Local(ordinal = 0) World world, @Local(ordinal = 0) Block block, @Local(ordinal = 0) int x, | ||
@Local(ordinal = 1) int y, @Local(ordinal = 2) int z, @Local(ordinal = 3) int meta) { | ||
ForgeEventFactory.fireBlockHarvesting(drops, world, block, x, y, z, meta, 0, 1.0f, false, null); | ||
return drops; | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
...om/mitchej123/hodgepodge/mixins/late/minefactoryreloaded/MixinTileEntityBlockSmasher.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,51 @@ | ||
package com.mitchej123.hodgepodge.mixins.late.minefactoryreloaded; | ||
|
||
import java.util.ArrayList; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.item.ItemBlock; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraftforge.event.ForgeEventFactory; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import com.llamalad7.mixinextras.sugar.Local; | ||
|
||
import powercrystals.minefactoryreloaded.tile.machine.TileEntityBlockSmasher; | ||
import powercrystals.minefactoryreloaded.world.SmashingWorld; | ||
|
||
@Mixin(TileEntityBlockSmasher.class) | ||
public class MixinTileEntityBlockSmasher { | ||
|
||
@Shadow(remap = false) | ||
private int _fortune = 0; | ||
|
||
@Shadow(remap = false) | ||
private SmashingWorld _smashingWorld; | ||
|
||
@ModifyExpressionValue( | ||
at = @At( | ||
target = "powercrystals/minefactoryreloaded/world/SmashingWorld.smashBlock(Lnet/minecraft/item/ItemStack;Lnet/minecraft/block/Block;II)Ljava/util/ArrayList;", | ||
value = "INVOKE"), | ||
method = "getOutput", | ||
remap = false) | ||
private ArrayList<ItemStack> hodgepodge$fireBlockHarvesting(ArrayList<ItemStack> drops, ItemStack lastInputStack, | ||
@Local(ordinal = 0) Block block, @Local(ordinal = 0) ItemBlock lastInputItem) { | ||
ForgeEventFactory.fireBlockHarvesting( | ||
drops, | ||
this._smashingWorld, | ||
block, | ||
0, | ||
1, | ||
0, | ||
lastInputItem.getMetadata(lastInputStack.getItemDamage()), | ||
this._fortune, | ||
1.0f, | ||
false, | ||
null); | ||
return drops; | ||
} | ||
} |