Skip to content

Commit

Permalink
Fixed carry-on being able to pickup latexes, allowing transfurred pla…
Browse files Browse the repository at this point in the history
…yers to pickup their type.
  • Loading branch information
LtxProgrammer committed Oct 23, 2024
1 parent 245971d commit 8df3137
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
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));
}
}
1 change: 1 addition & 0 deletions src/main/resources/changed.compatibility.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"client": [
"BeyondEarth.OxygenSystemMixin",
"CarryOn.HoldEntityAnimatorMixin",
"CarryOn.PickupHandlerMixin",
"CarryOn.RenderEventsMixin",
"CGM.AdvancedHumanoidRendererMixin",
"CGM.HumanoidAnimatorMixin",
Expand Down

0 comments on commit 8df3137

Please sign in to comment.