-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed carry-on being able to pickup latexes, allowing transfurred pla…
…yers to pickup their type.
- Loading branch information
1 parent
245971d
commit 8df3137
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/main/java/net/ltxprogrammer/changed/mixin/compatibility/CarryOn/PickupHandlerMixin.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,26 @@ | ||
package net.ltxprogrammer.changed.mixin.compatibility.CarryOn; | ||
|
||
import net.ltxprogrammer.changed.entity.ChangedEntity; | ||
import net.ltxprogrammer.changed.process.ProcessTransfur; | ||
import net.minecraft.server.level.ServerPlayer; | ||
import net.minecraft.world.entity.Entity; | ||
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; | ||
import tschipp.carryon.common.config.Configs; | ||
import tschipp.carryon.common.handler.PickupHandler; | ||
|
||
@Mixin(PickupHandler.class) | ||
public class PickupHandlerMixin { | ||
@Inject(method = "canPlayerPickUpEntity", at = @At("HEAD"), cancellable = true) | ||
private static void handleChangedEntities(ServerPlayer player, Entity toPickUp, CallbackInfoReturnable<Boolean> cir) { | ||
if (!(toPickUp instanceof ChangedEntity changedEntity)) return; | ||
if (Configs.Settings.pickupHostileMobs.get()) return; | ||
|
||
ProcessTransfur.ifPlayerTransfurred(player, variant -> { | ||
if (variant.getLatexType() != changedEntity.getLatexType()) | ||
cir.setReturnValue(false); | ||
}, () -> cir.setReturnValue(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