mirror of
https://github.com/Pridecraft-Studios/joy.git
synced 2025-08-03 06:26:00 -04:00
parent
d826b925be
commit
6d40ecea86
@ -2,7 +2,10 @@ package gay.pridecraft.joy.entity;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.passive.BeeEntity;
|
||||
import net.minecraft.entity.passive.PassiveEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class CustomBeeEntity extends BeeEntity {
|
||||
|
||||
@ -10,6 +13,12 @@ public class CustomBeeEntity extends BeeEntity {
|
||||
super(entityType, world);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BeeEntity createChild(final ServerWorld serverWorld, final PassiveEntity passiveEntity) {
|
||||
return (BeeEntity) this.getType().create(serverWorld);
|
||||
}
|
||||
|
||||
public static class BiiEntity extends CustomBeeEntity {
|
||||
public BiiEntity(EntityType<? extends BiiEntity> entityType, World world) {
|
||||
super(entityType, world);
|
||||
|
@ -2,13 +2,26 @@ package gay.pridecraft.joy.entity;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.passive.FoxEntity;
|
||||
import net.minecraft.entity.passive.PassiveEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class CustomFoxEntity extends FoxEntity {
|
||||
public CustomFoxEntity(EntityType<? extends FoxEntity> entityType, World world) {
|
||||
super(entityType, world);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public FoxEntity createChild(final ServerWorld serverWorld, final PassiveEntity passiveEntity) {
|
||||
final var fox = (FoxEntity) this.getType().create(serverWorld);
|
||||
if (fox != null) {
|
||||
fox.setVariant(this.random.nextBoolean() ? this.getVariant() : ((FoxEntity) passiveEntity).getVariant());
|
||||
}
|
||||
return fox;
|
||||
}
|
||||
|
||||
public static class SockFoxEntity extends CustomFoxEntity {
|
||||
public SockFoxEntity(EntityType<? extends SockFoxEntity> entityType, World world) {
|
||||
super(entityType, world);
|
||||
|
@ -1,15 +1,29 @@
|
||||
package gay.pridecraft.joy.entity;
|
||||
|
||||
import gay.pridecraft.joy.mixin.minecraft.AccessorFrogBrain;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.passive.AnimalEntity;
|
||||
import net.minecraft.entity.passive.FrogEntity;
|
||||
import net.minecraft.entity.passive.PassiveEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class CustomFrogEntity extends FrogEntity {
|
||||
public CustomFrogEntity(EntityType<? extends AnimalEntity> entityType, World world) {
|
||||
super(entityType, world);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public FrogEntity createChild(final ServerWorld serverWorld, final PassiveEntity passiveEntity) {
|
||||
final var frog = (FrogEntity) this.getType().create(serverWorld);
|
||||
if (frog != null) {
|
||||
AccessorFrogBrain.invokeCoolDownLongJump(frog, serverWorld.getRandom());
|
||||
}
|
||||
return frog;
|
||||
}
|
||||
|
||||
public static class FrogEntity extends CustomFrogEntity {
|
||||
public FrogEntity(EntityType<? extends FrogEntity> entityType, World world) {
|
||||
super(entityType, world);
|
||||
|
@ -2,8 +2,11 @@ package gay.pridecraft.joy.entity;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.passive.AnimalEntity;
|
||||
import net.minecraft.entity.passive.PassiveEntity;
|
||||
import net.minecraft.entity.passive.SnifferEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class CustomSnifferEntity extends SnifferEntity {
|
||||
|
||||
@ -11,6 +14,12 @@ public class CustomSnifferEntity extends SnifferEntity {
|
||||
super(entityType, world);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public SnifferEntity createChild(final ServerWorld serverWorld, final PassiveEntity passiveEntity) {
|
||||
return (SnifferEntity) this.getType().create(serverWorld);
|
||||
}
|
||||
|
||||
public static class SnifferEntity extends CustomSnifferEntity {
|
||||
public SnifferEntity(EntityType<? extends SnifferEntity> entityType, World world) {
|
||||
super(entityType, world);
|
||||
|
@ -0,0 +1,19 @@
|
||||
package gay.pridecraft.joy.mixin.minecraft;
|
||||
|
||||
import net.minecraft.entity.passive.FrogBrain;
|
||||
import net.minecraft.entity.passive.FrogEntity;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
/**
|
||||
* @author Ampflower
|
||||
* @since 1.0.0
|
||||
**/
|
||||
@Mixin(FrogBrain.class)
|
||||
public interface AccessorFrogBrain {
|
||||
@Invoker
|
||||
static void invokeCoolDownLongJump(FrogEntity frog, Random random) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
"refmap": "joy.refmap.json",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"mixins": [
|
||||
"AllayEntityMixin", "LivingEntityMixin", "PaintingVariantsMixin",
|
||||
"AllayEntityMixin", "LivingEntityMixin", "PaintingVariantsMixin", "minecraft.AccessorFrogBrain",
|
||||
"minecraft.AccessorPoi", "minecraft.MixinLivingEntity", "minecraft.MixinPlayerEntity"
|
||||
],
|
||||
"injectors": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user