diff --git a/src/main/java/com/minelittlepony/unicopia/client/URenderers.java b/src/main/java/com/minelittlepony/unicopia/client/URenderers.java index b30dde8f..47264fd2 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/URenderers.java +++ b/src/main/java/com/minelittlepony/unicopia/client/URenderers.java @@ -22,6 +22,9 @@ import net.minecraft.client.render.entity.FlyingItemEntityRenderer; public interface URenderers { static void bootstrap() { EntityRendererRegistry.INSTANCE.register(UEntities.CLOUD, CloudEntityRenderer::new); + EntityRendererRegistry.INSTANCE.register(UEntities.WILD_CLOUD, CloudEntityRenderer::new); + EntityRendererRegistry.INSTANCE.register(UEntities.CONSTRUCTION_CLOUD, CloudEntityRenderer::new); + EntityRendererRegistry.INSTANCE.register(UEntities.RACING_CLOUD, CloudEntityRenderer::new); EntityRendererRegistry.INSTANCE.register(UEntities.MAGIC_SPELL, SpellcastEntityRenderer::new); EntityRendererRegistry.INSTANCE.register(UEntities.THROWN_ITEM, (manager, context) -> new FlyingItemEntityRenderer<>(manager, context.getItemRenderer())); EntityRendererRegistry.INSTANCE.register(UEntities.SPELLBOOK, SpellbookEntityRender::new); diff --git a/src/main/java/com/minelittlepony/unicopia/client/render/CloudEntityRenderer.java b/src/main/java/com/minelittlepony/unicopia/client/render/CloudEntityRenderer.java index 8b0f5f52..66b8f883 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/render/CloudEntityRenderer.java +++ b/src/main/java/com/minelittlepony/unicopia/client/render/CloudEntityRenderer.java @@ -15,8 +15,8 @@ import com.minelittlepony.unicopia.util.WorldHelper; import com.mojang.blaze3d.platform.GlStateManager; public class CloudEntityRenderer extends LivingEntityRenderer { - private static final Identifier cloud = new Identifier("unicopia", "textures/entity/clouds.png"); - private static final Identifier rainCloud = new Identifier("unicopia", "textures/entity/clouds_storm.png"); + private static final Identifier NORMAL = new Identifier("unicopia", "textures/entity/clouds.png"); + private static final Identifier RAINING = new Identifier("unicopia", "textures/entity/clouds_storm.png"); public CloudEntityRenderer(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) { super(manager, new CloudEntityModel(), 1f); @@ -58,9 +58,9 @@ public class CloudEntityRenderer extends LivingEntityRenderer { + private static final Identifier TEXTURE = new Identifier("unicopia", "textures/environment/rainbow.png"); public RainbowEntityRenderer(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) { super(manager); } - private static final Identifier TEXTURE = new Identifier("unicopia", "textures/environment/rainbow.png"); - @Override public Identifier getTexture(RainbowEntity entity) { return TEXTURE; diff --git a/src/main/java/com/minelittlepony/unicopia/entity/RainbowEntity.java b/src/main/java/com/minelittlepony/unicopia/entity/RainbowEntity.java index d81e2187..60abec5f 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/RainbowEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/RainbowEntity.java @@ -19,9 +19,9 @@ import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraft.world.biome.Biome.SpawnEntry; -public class RainbowEntity extends Entity implements InAnimate { +public class RainbowEntity extends MobEntity implements InAnimate { - public static final SpawnEntry SPAWN_ENTRY = new SpawnEntry(UEntities.RAINBOW_SPAWNER, 1, 1, 1); + public static final SpawnEntry SPAWN_ENTRY = new SpawnEntry(UEntities.RAINBOW, 1, 1, 1); private int ticksAlive; @@ -98,7 +98,6 @@ public class RainbowEntity extends Entity implements InAnimate { Box bounds = SPAWN_COLLISSION_RADIUS.offset(getPos()); world.getEntities(RainbowEntity.class, bounds, null).forEach(this::attackCompetitor); - world.getEntities(RainbowEntity.Spawner.class, bounds, null).forEach(this::attackCompetitor); } } @@ -109,57 +108,29 @@ public class RainbowEntity extends Entity implements InAnimate { } @Override - protected void initDataTracker() { + public boolean canSpawn(IWorld world, SpawnType type) { + + Box bounds = SPAWN_COLLISSION_RADIUS.offset(getPos()); + + return super.canSpawn(world, type) + && world.getEntities(RainbowEntity.class, bounds, null).isEmpty(); } @Override - protected void readCustomDataFromTag(CompoundTag var1) { + public int getLimitPerChunk() { + return 1; } @Override - protected void writeCustomDataToTag(CompoundTag var1) { + public void readCustomDataFromTag(CompoundTag var1) { + } + + @Override + public void writeCustomDataToTag(CompoundTag var1) { } @Override public Packet createSpawnPacket() { return Channel.SPAWN_RAINBOW.toPacket(new MsgSpawnRainbow(this)); } - - public static class Spawner extends MobEntity { - - public Spawner(EntityType type, World world) { - super(type, world); - this.setInvisible(true); - } - - @Override - public boolean canSpawn(IWorld world, SpawnType type) { - - Box bounds = SPAWN_COLLISSION_RADIUS.offset(getPos()); - - return super.canSpawn(world, type) - && world.getEntities(RainbowEntity.class, bounds, null).isEmpty() - && world.getEntities(RainbowEntity.Spawner.class, bounds, null).isEmpty(); - } - - @Override - public int getLimitPerChunk() { - return 1; - } - - @Override - public void tick() { - super.tick(); - if (!this.dead) { - remove(); - trySpawnRainbow(); - } - } - - public void trySpawnRainbow() { - RainbowEntity rainbow = UEntities.RAINBOW.create(world); - rainbow.setPos(getX(), getY(), getZ()); - world.spawnEntity(rainbow); - } - } } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/UEntities.java b/src/main/java/com/minelittlepony/unicopia/entity/UEntities.java index 98ec3ff6..5379081f 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/UEntities.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/UEntities.java @@ -28,7 +28,6 @@ public interface UEntities { EntityType CONSTRUCTION_CLOUD = register("construction_cloud", FabricEntityTypeBuilder.create(EntityCategory.CREATURE, ConstructionCloudEntity::new)); EntityType RAINBOW = register("rainbow", FabricEntityTypeBuilder.create(EntityCategory.AMBIENT, RainbowEntity::new)); - EntityType RAINBOW_SPAWNER = register("rainbow_spawner", FabricEntityTypeBuilder.create(EntityCategory.MISC, RainbowEntity.Spawner::new)); EntityType CUCCOON = register("cuccoon", FabricEntityTypeBuilder.create(EntityCategory.MISC, CuccoonEntity::new).size(EntityDimensions.changing(1.5F, 1.6F)));