mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 19:46:42 +01:00
Fixed crash due to missing entity renderers/removed the rainbow spawner
This commit is contained in:
parent
5874162852
commit
03944f6015
5 changed files with 23 additions and 51 deletions
|
@ -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);
|
||||
|
|
|
@ -15,8 +15,8 @@ import com.minelittlepony.unicopia.util.WorldHelper;
|
|||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
public class CloudEntityRenderer extends LivingEntityRenderer<CloudEntity, CloudEntityModel> {
|
||||
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<CloudEntity, Cloud
|
|||
@Override
|
||||
public Identifier getTexture(CloudEntity entity) {
|
||||
if (entity.getIsRaining() && entity.getIsThundering()) {
|
||||
return rainCloud;
|
||||
return RAINING;
|
||||
}
|
||||
return cloud;
|
||||
return NORMAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,13 +18,12 @@ import net.minecraft.client.render.entity.EntityRenderer;
|
|||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class RainbowEntityRenderer extends EntityRenderer<RainbowEntity> {
|
||||
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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,38 +107,13 @@ public class RainbowEntity extends Entity implements InAnimate {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDataTracker() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readCustomDataFromTag(CompoundTag var1) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected 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<Spawner> 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();
|
||||
&& world.getEntities(RainbowEntity.class, bounds, null).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -148,18 +122,15 @@ public class RainbowEntity extends Entity implements InAnimate {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (!this.dead) {
|
||||
remove();
|
||||
trySpawnRainbow();
|
||||
}
|
||||
public void readCustomDataFromTag(CompoundTag var1) {
|
||||
}
|
||||
|
||||
public void trySpawnRainbow() {
|
||||
RainbowEntity rainbow = UEntities.RAINBOW.create(world);
|
||||
rainbow.setPos(getX(), getY(), getZ());
|
||||
world.spawnEntity(rainbow);
|
||||
}
|
||||
@Override
|
||||
public void writeCustomDataToTag(CompoundTag var1) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet<?> createSpawnPacket() {
|
||||
return Channel.SPAWN_RAINBOW.toPacket(new MsgSpawnRainbow(this));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ public interface UEntities {
|
|||
EntityType<ConstructionCloudEntity> CONSTRUCTION_CLOUD = register("construction_cloud", FabricEntityTypeBuilder.create(EntityCategory.CREATURE, ConstructionCloudEntity::new));
|
||||
|
||||
EntityType<RainbowEntity> RAINBOW = register("rainbow", FabricEntityTypeBuilder.create(EntityCategory.AMBIENT, RainbowEntity::new));
|
||||
EntityType<RainbowEntity.Spawner> RAINBOW_SPAWNER = register("rainbow_spawner", FabricEntityTypeBuilder.create(EntityCategory.MISC, RainbowEntity.Spawner::new));
|
||||
|
||||
EntityType<CuccoonEntity> CUCCOON = register("cuccoon", FabricEntityTypeBuilder.create(EntityCategory.MISC, CuccoonEntity::new).size(EntityDimensions.changing(1.5F, 1.6F)));
|
||||
|
||||
|
|
Loading…
Reference in a new issue