generated from DragonsPlusMinecraft/CreateAddonTemplate
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
8 additions
and
13 deletions.
There are no files selected for viewing
21 changes: 8 additions & 13 deletions
21
...ava/plus/dragons/createcentralkitchen/foundation/mixin/common/create/BeltHelperMixin.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,26 +1,21 @@ | ||
package plus.dragons.createcentralkitchen.foundation.mixin.common.create; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import com.simibubi.create.AllTags; | ||
import com.simibubi.create.content.kinetics.belt.BeltHelper; | ||
import net.minecraft.world.item.ItemStack; | ||
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(value = BeltHelper.class, remap = false, priority = 900) | ||
public class BeltHelperMixin { | ||
|
||
/** | ||
* For improving the usage of tag create:upright_on_belt so items with containers inherits upright behavior from their containers. | ||
* | ||
* @param original If the item is in tag create:upright_on_belt | ||
* @param stack the item | ||
* @return if the item should be upright on belt | ||
* @author LimonBlaze | ||
*/ | ||
@ModifyExpressionValue(method = "isItemUpright", at = @At(value = "INVOKE", target = "Lcom/simibubi/create/AllTags$AllItemTags;matches(Lnet/minecraft/world/item/ItemStack;)Z")) | ||
private static boolean cck$isItemUpright(boolean original, ItemStack stack) { | ||
return original || (stack.hasContainerItem() && stack.getContainerItem().is(AllTags.AllItemTags.UPRIGHT_ON_BELT.tag)); | ||
|
||
@Inject(method = "isItemUpright", at = @At("RETURN"), cancellable = true) | ||
private static void cck$isItemUpright(ItemStack stack, CallbackInfoReturnable<Boolean> cir) { | ||
if(stack.hasContainerItem() && stack.getContainerItem().is(AllTags.AllItemTags.UPRIGHT_ON_BELT.tag)){ | ||
cir.setReturnValue(true); | ||
} | ||
} | ||
|
||
} |