-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nasty fix to the jockeys clipping in walls (every ride tick)
- Loading branch information
Cam
authored
Jan 16, 2022
1 parent
986fbd5
commit d236d97
Showing
2 changed files
with
34 additions
and
14 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,42 @@ | ||
package jockeyCreator.mixin; | ||
|
||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.SpawnReason; | ||
import net.minecraft.entity.mob.ZombieEntity; | ||
import net.minecraft.entity.passive.ChickenEntity; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.Items; | ||
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.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
import java.util.Objects; | ||
|
||
import static net.minecraft.entity.EntityType.CHICKEN; | ||
import static net.minecraft.item.Items.EGG; | ||
|
||
@Mixin(ZombieEntity.class) | ||
public class ZombieEntityMixin { | ||
@Inject(method= "canPickupItem(Lnet/minecraft/item/ItemStack;)Z", at = @At("HEAD"), cancellable = true) | ||
private void createJokey(ItemStack stack, CallbackInfoReturnable<Boolean> cir){ | ||
ZombieEntity zzz = (ZombieEntity)(Object)this; | ||
if(stack.isOf(Items.EGG) && zzz.isBaby() && !zzz.hasVehicle()) | ||
if(stack.isOf(EGG) && zzz.isBaby() && !zzz.hasVehicle()) | ||
{ | ||
stack.decrement(1); | ||
ChickenEntity ccc = EntityType.CHICKEN.create(zzz.getWorld()); | ||
ccc.refreshPositionAndAngles(zzz.getX(), zzz.getY(), zzz.getZ(), zzz.getYaw(), 0.0f); | ||
ccc.initialize(zzz.getServer().getWorld(zzz.getEntityWorld().getRegistryKey()), zzz.getEntityWorld().getLocalDifficulty(zzz.getBlockPos()), SpawnReason.JOCKEY, null, null); | ||
ccc.setHasJockey(true); | ||
ccc.setSprinting(true); | ||
zzz.noClip=true; | ||
zzz.startRiding(ccc); | ||
zzz.getWorld().spawnEntity(ccc); | ||
ChickenEntity ccc = CHICKEN.create(zzz.getWorld()); | ||
if (ccc != null) { | ||
ccc.refreshPositionAndAngles(zzz.getX(), zzz.getY(), zzz.getZ(), zzz.getYaw(), 0.0f); | ||
ccc.initialize(Objects.requireNonNull(zzz.getServer()).getWorld(zzz.getEntityWorld().getRegistryKey()), zzz.getEntityWorld().getLocalDifficulty(zzz.getBlockPos()), SpawnReason.JOCKEY, null, null); | ||
ccc.setHasJockey(true); | ||
ccc.setSprinting(true); | ||
zzz.noClip=true; //stop zombies from clipping | ||
zzz.startRiding(ccc); | ||
zzz.getWorld().spawnEntity(ccc); | ||
} | ||
|
||
cir.setReturnValue(false); | ||
} | ||
} | ||
|
||
|
||
} |