forked from BRNSystems/RegexingHoppers
Fix cooldowns
This commit is contained in:
parent
21a99b5143
commit
d1f812ed8b
@ -0,0 +1,15 @@
|
|||||||
|
package systems.brn.regexinghoppers.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.block.entity.HopperBlockEntity;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
|
@Mixin(HopperBlockEntity.class)
|
||||||
|
interface HopperBlockEntityAccessor {
|
||||||
|
@Accessor("transferCooldown")
|
||||||
|
int getTransferCooldown();
|
||||||
|
|
||||||
|
@Accessor("transferCooldown")
|
||||||
|
void setTransferCooldown(int cooldown);
|
||||||
|
}
|
@ -1,11 +0,0 @@
|
|||||||
package systems.brn.regexinghoppers.mixin;
|
|
||||||
|
|
||||||
import net.minecraft.block.entity.HopperBlockEntity;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
|
||||||
|
|
||||||
@Mixin(HopperBlockEntity.class)
|
|
||||||
interface HopperBlockEntityInvoker {
|
|
||||||
@Invoker("setTransferCooldown")
|
|
||||||
void setTransferCooldown(int transferCooldown);
|
|
||||||
}
|
|
@ -5,10 +5,7 @@ import net.minecraft.inventory.Inventory;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import org.spongepowered.asm.mixin.Debug;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
|
||||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
@ -26,7 +23,7 @@ public class RegexingHopperMixin {
|
|||||||
if (RegexingHoppers.shouldNotMove(from, itemName)) {
|
if (RegexingHoppers.shouldNotMove(from, itemName)) {
|
||||||
cir.setReturnValue(stack);
|
cir.setReturnValue(stack);
|
||||||
if(from instanceof HopperBlockEntity) {
|
if(from instanceof HopperBlockEntity) {
|
||||||
((HopperBlockEntityInvoker) from).setTransferCooldown(8);
|
((HopperBlockEntityAccessor) from).setTransferCooldown(8);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -35,7 +32,7 @@ public class RegexingHopperMixin {
|
|||||||
if (RegexingHoppers.shouldNotMove(_to, itemName)) {
|
if (RegexingHoppers.shouldNotMove(_to, itemName)) {
|
||||||
cir.setReturnValue(stack);
|
cir.setReturnValue(stack);
|
||||||
if(_to instanceof HopperBlockEntity) {
|
if(_to instanceof HopperBlockEntity) {
|
||||||
((HopperBlockEntityInvoker) _to).setTransferCooldown(8);
|
((HopperBlockEntityAccessor) _to).setTransferCooldown(8);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
"package": "systems.brn.regexinghoppers.mixin",
|
"package": "systems.brn.regexinghoppers.mixin",
|
||||||
"compatibilityLevel": "JAVA_21",
|
"compatibilityLevel": "JAVA_21",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"RegexingHopperMixin"
|
"RegexingHopperMixin",
|
||||||
|
"HopperBlockEntityAccessor"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user