forked from AppliedEnergistics/Applied-Energistics-2
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08078e6
commit 28f113d
Showing
10 changed files
with
66 additions
and
33 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
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
19 changes: 19 additions & 0 deletions
19
src/main/java/starry/refabricated/ae2/mixin/MultiPlayerGameModeMixin.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,19 @@ | ||
package starry.refabricated.ae2.mixin; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import net.minecraft.client.multiplayer.MultiPlayerGameMode; | ||
import net.minecraft.client.player.LocalPlayer; | ||
import net.minecraft.core.BlockPos; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyVariable; | ||
|
||
@Mixin(MultiPlayerGameMode.class) | ||
public class MultiPlayerGameModeMixin { | ||
|
||
@ModifyVariable(method = "performUseItemOn", at = @At(value = "STORE"), ordinal = 1) | ||
private boolean injected(boolean x, @Local(argsOnly = true) LocalPlayer player, @Local BlockPos blockpos) { | ||
return x && !(player.getMainHandItem().doesSneakBypassUse(player.level(), blockpos, player) && player.getOffhandItem().doesSneakBypassUse(player.level(), blockpos, player)); | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/starry/refabricated/ae2/mixin/ServerPlayerGameModeMixin.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,20 @@ | ||
package starry.refabricated.ae2.mixin; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.server.level.ServerPlayer; | ||
import net.minecraft.server.level.ServerPlayerGameMode; | ||
import net.minecraft.world.level.Level; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyVariable; | ||
|
||
@Mixin(ServerPlayerGameMode.class) | ||
public class ServerPlayerGameModeMixin { | ||
|
||
@ModifyVariable(method = "useItemOn", at = @At(value = "STORE"), ordinal = 1) | ||
private boolean injected(boolean x, @Local(argsOnly = true) ServerPlayer player, @Local(argsOnly = true) Level level, @Local BlockPos blockpos) { | ||
return x && !(player.getMainHandItem().doesSneakBypassUse(level, blockpos, player) && player.getOffhandItem().doesSneakBypassUse(level, blockpos, player)); | ||
} | ||
|
||
} |
10 changes: 6 additions & 4 deletions
10
src/main/java/starry/refabricated/ae2/patches/IItemExtended.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 |
---|---|---|
@@ -1,17 +1,19 @@ | ||
package starry.refabricated.ae2.patches; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.InteractionResult; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.context.UseOnContext; | ||
|
||
public interface IItemExtended { | ||
|
||
default InteractionResult onItemUseFirst(ItemStack stack, UseOnContext context) { | ||
return InteractionResult.PASS; | ||
} | ||
|
||
default boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { | ||
return !oldStack.equals(newStack); // !ItemStack.areItemStacksEqual(oldStack, newStack); | ||
} | ||
|
||
default boolean doesSneakBypassUse(ItemStack stack, net.minecraft.world.level.LevelReader level, BlockPos pos, Player player) { | ||
return false; | ||
} | ||
|
||
} |
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