mirror of
https://codeberg.org/moonleay/Gimbal.git
synced 2024-11-25 22:22:10 +00:00
WIP: started working on ForcePlace
This commit is contained in:
parent
14f2021748
commit
ff77e2b576
4 changed files with 63 additions and 1 deletions
|
@ -0,0 +1,19 @@
|
|||
package net.moonleay.gimble.mixin;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.pattern.CachedBlockPosition;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(ItemStack.class)
|
||||
public class AlwaysAllowBlock {
|
||||
|
||||
@Redirect(method = "useOnBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;canPlaceOn(Lnet/minecraft/util/registry/Registry;Lnet/minecraft/block/pattern/CachedBlockPosition;)Z"))
|
||||
private boolean func(ItemStack instance, Registry<Block> blockRegistry, CachedBlockPosition pos) {
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
22
src/main/java/net/moonleay/gimble/mixin/ForcePlaceMixin.java
Normal file
22
src/main/java/net/moonleay/gimble/mixin/ForcePlaceMixin.java
Normal file
|
@ -0,0 +1,22 @@
|
|||
package net.moonleay.gimble.mixin;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.network.ServerPlayerInteractionManager;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(ServerPlayerInteractionManager.class)
|
||||
public class ForcePlaceMixin {
|
||||
|
||||
@Inject(method = "interactBlock", at = @At("HEAD"))
|
||||
private void func(ServerPlayerEntity player, World world, ItemStack stack, Hand hand, BlockHitResult hitResult, CallbackInfoReturnable<ActionResult> cir) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package net.moonleay.gimble.mixin;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(World.class)
|
||||
public class WorldSetBlockStateMixin {
|
||||
|
||||
@Inject(method = "setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;II)Z", at = @At("HEAD"))
|
||||
private void func(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, CallbackInfoReturnable<Boolean> cir) {
|
||||
System.out.println("setBlockState was run");
|
||||
}
|
||||
}
|
|
@ -4,7 +4,10 @@
|
|||
"package": "net.moonleay.gimble.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
"NoClipMixin"
|
||||
"AlwaysAllowBlock",
|
||||
"ForcePlaceMixin",
|
||||
"NoClipMixin",
|
||||
"WorldSetBlockStateMixin"
|
||||
],
|
||||
"client": [
|
||||
"HudMixin",
|
||||
|
|
Loading…
Reference in a new issue