-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef800f2
commit 4971ed1
Showing
5 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/main/java/moriyashiine/enchancement/mixin/bury/ShulkerEntityGoalMixin.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,32 @@ | ||
package moriyashiine.enchancement.mixin.bury; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyReturnValue; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import moriyashiine.enchancement.common.init.ModEntityComponents; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.mob.ShulkerEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin({ShulkerEntity.ShootBulletGoal.class, ShulkerEntity.PeekGoal.class}) | ||
public class ShulkerEntityGoalMixin { | ||
@Unique | ||
private ShulkerEntity cachedEntity = null; | ||
|
||
@WrapOperation(method = "canStart", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/mob/ShulkerEntity;getTarget()Lnet/minecraft/entity/LivingEntity;")) | ||
private LivingEntity enchancement$bury(ShulkerEntity instance, Operation<LivingEntity> original) { | ||
cachedEntity = instance; | ||
return original.call(instance); | ||
} | ||
|
||
@ModifyReturnValue(method = "canStart", at = @At("RETURN")) | ||
private boolean enchancement$bury(boolean original) { | ||
if (original && cachedEntity != null && ModEntityComponents.BURY.get(cachedEntity).getBuryPos() != null) { | ||
cachedEntity = null; | ||
return false; | ||
} | ||
return original; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/moriyashiine/enchancement/mixin/bury/ShulkerEntityMixin.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,30 @@ | ||
/* | ||
* All Rights Reserved (c) MoriyaShiine | ||
*/ | ||
|
||
package moriyashiine.enchancement.mixin.bury; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyReturnValue; | ||
import moriyashiine.enchancement.common.init.ModEntityComponents; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.mob.ShulkerEntity; | ||
import net.minecraft.util.math.Box; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(ShulkerEntity.class) | ||
public abstract class ShulkerEntityMixin extends Entity { | ||
public ShulkerEntityMixin(EntityType<?> type, World world) { | ||
super(type, world); | ||
} | ||
|
||
@ModifyReturnValue(method = "calculateBoundingBox()Lnet/minecraft/util/math/Box;", at = @At("RETURN")) | ||
private Box enchancement$bury(Box original) { | ||
if (age > 0 && ModEntityComponents.BURY.get(this).getBuryPos() != null) { | ||
return original.shrink(0, 0.5, 0); | ||
} | ||
return original; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/moriyashiine/enchancement/mixin/bury/client/ShulkerEntityRendererMixin.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,20 @@ | ||
package moriyashiine.enchancement.mixin.bury.client; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyReturnValue; | ||
import moriyashiine.enchancement.common.init.ModEntityComponents; | ||
import net.minecraft.client.render.entity.ShulkerEntityRenderer; | ||
import net.minecraft.entity.mob.ShulkerEntity; | ||
import net.minecraft.util.math.Vec3d; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(ShulkerEntityRenderer.class) | ||
public class ShulkerEntityRendererMixin { | ||
@ModifyReturnValue(method = "getPositionOffset(Lnet/minecraft/entity/mob/ShulkerEntity;F)Lnet/minecraft/util/math/Vec3d;", at = @At("RETURN")) | ||
private Vec3d enchancement$bury(Vec3d original, ShulkerEntity shulkerEntity) { | ||
if (ModEntityComponents.BURY.get(shulkerEntity).getBuryPos() != null) { | ||
return original.add(0, -0.5, 0); | ||
} | ||
return original; | ||
} | ||
} |
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
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