diff --git a/src/main/java/de/ellpeck/naturesaura/NaturesAura.java b/src/main/java/de/ellpeck/naturesaura/NaturesAura.java index 98b2652c..e136e6f9 100644 --- a/src/main/java/de/ellpeck/naturesaura/NaturesAura.java +++ b/src/main/java/de/ellpeck/naturesaura/NaturesAura.java @@ -61,10 +61,6 @@ public final class NaturesAura { } }; - public static ResourceLocation createRes(String resource) { - return new ResourceLocation(MOD_ID, resource); - } - public void setup(FMLCommonSetupEvent event) { ModConfig.instance.apply(); diff --git a/src/main/java/de/ellpeck/naturesaura/api/recipes/AnimalSpawnerRecipe.java b/src/main/java/de/ellpeck/naturesaura/api/recipes/AnimalSpawnerRecipe.java index 46221b44..9421b64d 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/recipes/AnimalSpawnerRecipe.java +++ b/src/main/java/de/ellpeck/naturesaura/api/recipes/AnimalSpawnerRecipe.java @@ -9,17 +9,16 @@ import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; -import net.minecraftforge.registries.ForgeRegistries; public class AnimalSpawnerRecipe { public final ResourceLocation name; public final Ingredient[] ingredients; - public final ResourceLocation entity; + public final EntityType entity; public final int aura; public final int time; - public AnimalSpawnerRecipe(ResourceLocation name, ResourceLocation entity, int aura, int time, Ingredient... ingredients) { + public AnimalSpawnerRecipe(ResourceLocation name, EntityType entity, int aura, int time, Ingredient... ingredients) { this.name = name; this.ingredients = ingredients; this.entity = entity; @@ -28,10 +27,7 @@ public class AnimalSpawnerRecipe { } public Entity makeEntity(World world, double x, double y, double z) { - EntityType entry = ForgeRegistries.ENTITIES.getValue(this.entity); - if (entry == null) - return null; - Entity entity = entry.create(world); + Entity entity = this.entity.create(world); if (x == 0 && y == 0 && z == 0) return entity; entity.setLocationAndAngles(x, y, z, MathHelper.wrapDegrees(world.rand.nextFloat() * 360F), 0F); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFireworkGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFireworkGenerator.java index 172e2b58..c71b750b 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFireworkGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFireworkGenerator.java @@ -126,8 +126,8 @@ public class TileEntityFireworkGenerator extends TileEntityImpl implements ITick this.toRelease -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, this.toRelease); } - /* PacketHandler.sendToAllLoaded(this.world, this.pos, - new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 8));*/ + PacketHandler.sendToAllLoaded(this.world, this.pos, + new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 8)); } } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderProjectileGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderProjectileGenerator.java index f7df9515..e7e50cf7 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderProjectileGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderProjectileGenerator.java @@ -1,8 +1,10 @@ package de.ellpeck.naturesaura.blocks.tiles.render; +import com.mojang.blaze3d.platform.GLX; import com.mojang.blaze3d.platform.GlStateManager; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.blocks.tiles.TileEntityProjectileGenerator; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.entity.model.RendererModel; import net.minecraft.client.renderer.model.Model; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; @@ -19,6 +21,10 @@ public class RenderProjectileGenerator extends TileEntityRenderer { private final IDrawable background; + private final Map entityCache = new HashMap<>(); public AnimalSpawnerCategory(IGuiHelper helper) { this.background = helper.createDrawable(new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/jei/animal_spawner.png"), 0, 0, 72, 86); @@ -59,9 +66,7 @@ public class AnimalSpawnerCategory implements IRecipeCategory VERSION, VERSION::equals, VERSION::equals); + network = NetworkRegistry.newSimpleChannel(new ResourceLocation(NaturesAura.MOD_ID, "network"), () -> VERSION, VERSION::equals, VERSION::equals); network.registerMessage(0, PacketParticleStream.class, PacketParticleStream::toBytes, PacketParticleStream::fromBytes, PacketParticleStream::onMessage); network.registerMessage(1, PacketParticles.class, PacketParticles::toBytes, PacketParticles::fromBytes, PacketParticles::onMessage); network.registerMessage(2, PacketAuraChunk.class, PacketAuraChunk::toBytes, PacketAuraChunk::fromBytes, PacketAuraChunk::onMessage); diff --git a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java index d8d3b0cd..af502a79 100644 --- a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java +++ b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java @@ -223,9 +223,8 @@ public final class ModRecipes { if (block instanceof FlowerBlock) NaturesAuraAPI.FLOWERS.addAll(block.getStateContainer().getValidStates()); - spawner("cow", "minecraft:cow", 50000, 60, ing(Items.BEEF), ing(Items.LEATHER)); for (DyeColor color : DyeColor.values()) - new AnimalSpawnerRecipe(res("sheep_" + color.getName()), new ResourceLocation("minecraft:sheep"), + new AnimalSpawnerRecipe(res("sheep_" + color.getName()), EntityType.SHEEP, 500, 60, ing(ModItems.BIRTH_SPIRIT), ing(Items.MUTTON), ing(Helper.getWool(color))) { @Override @@ -235,39 +234,40 @@ public final class ModRecipes { return sheep; } }.register(); - spawner("chicken", "minecraft:chicken", 30000, 40, ing(Items.FEATHER), ing(Items.EGG)); - spawner("pig", "minecraft:pig", 50000, 60, ing(Items.PORKCHOP)); - spawner("blaze", "minecraft:blaze", 150000, 120, ing(Items.BLAZE_ROD), ing(Items.BLAZE_POWDER)); - spawner("ghast", "minecraft:ghast", 120000, 150, ing(Items.GUNPOWDER), ing(Items.GHAST_TEAR)); - spawner("ocelot", "minecraft:ocelot", 80000, 60, ing(Items.COD), ing(ItemTags.WOOL)); - spawner("mule", "minecraft:mule", 100000, 100, ing(Items.LEATHER), ing(Blocks.CHEST), ing(Items.APPLE)); - spawner("bat", "minecraft:bat", 30000, 40, ing(Items.FEATHER)); - spawner("endermite", "minecraft:endermite", 30000, 40, ing(Items.ENDER_PEARL), ing(Blocks.STONE)); - spawner("parrot", "minecraft:parrot", 50000, 60, ing(Items.FEATHER), ing(Items.COOKIE)); - spawner("slime", "minecraft:slime", 30000, 40, ing(Items.SLIME_BALL)); - spawner("spider", "minecraft:spider", 100000, 120, ing(Items.STRING), ing(Items.SPIDER_EYE)); - spawner("skeleton", "minecraft:skeleton", 100000, 120, ing(Items.BONE), ing(Items.ARROW)); - spawner("enderman", "minecraft:enderman", 120000, 120, ing(Items.ENDER_PEARL)); - spawner("silverfish", "minecraft:silverfish", 30000, 40, ing(Blocks.STONE)); - spawner("squid", "minecraft:squid", 50000, 40, ing(Items.INK_SAC)); - spawner("stray", "minecraft:stray", 100000, 120, ing(Items.BONE), ing(Blocks.ICE)); - spawner("shulker", "minecraft:shulker", 150000, 100, ing(Items.SHULKER_SHELL)); - spawner("husk", "minecraft:husk", 100000, 120, ing(Items.ROTTEN_FLESH), ing(Blocks.SAND)); - spawner("llama", "minecraft:llama", 60000, 80, ing(ItemTags.WOOL)); - spawner("rabbit", "minecraft:rabbit", 30000, 40, ing(Items.RABBIT_HIDE)); - spawner("magma_cube", "minecraft:magma_cube", 100000, 100, ing(Items.MAGMA_CREAM)); - spawner("zombie_pigman", "minecraft:zombie_pigman", 120000, 150, ing(Items.ROTTEN_FLESH), ing(Items.GOLD_NUGGET)); - spawner("polar_bear", "minecraft:polar_bear", 50000, 60, ing(Items.COD), ing(Blocks.ICE)); - spawner("mooshroom", "minecraft:mooshroom", 40000, 60, ing(Items.LEATHER), ing(Blocks.RED_MUSHROOM)); - spawner("guardian", "minecraft:guardian", 150000, 150, ing(Items.PRISMARINE_SHARD), ing(Items.PRISMARINE_CRYSTALS)); - spawner("horse", "minecraft:horse", 100000, 100, ing(Items.LEATHER)); - spawner("donkey", "minecraft:donkey", 100000, 100, ing(Items.LEATHER), ing(Blocks.CHEST)); - spawner("cave_spider", "minecraft:cave_spider", 100000, 120, ing(Items.STRING), ing(Items.FERMENTED_SPIDER_EYE)); - spawner("creeper", "minecraft:creeper", 100000, 120, ing(Items.GUNPOWDER)); - spawner("witch", "minecraft:witch", 150000, 150, ing(Items.GLASS_BOTTLE), ing(Items.GLOWSTONE_DUST)); - spawner("wither_skeleton", "minecraft:wither_skeleton", 150000, 150, ing(Items.BONE), ing(Blocks.OBSIDIAN)); - spawner("wolf", "minecraft:wolf", 50000, 60, ing(Items.LEATHER), ing(Items.BONE)); - spawner("zombie", "minecraft:zombie", 100000, 100, ing(Items.ROTTEN_FLESH)); + spawner("cow", EntityType.COW, 50000, 60, ing(Items.BEEF), ing(Items.LEATHER)); + spawner("chicken", EntityType.CHICKEN, 30000, 40, ing(Items.FEATHER), ing(Items.EGG)); + spawner("pig", EntityType.PIG, 50000, 60, ing(Items.PORKCHOP)); + spawner("blaze", EntityType.BLAZE, 150000, 120, ing(Items.BLAZE_ROD), ing(Items.BLAZE_POWDER)); + spawner("ghast", EntityType.GHAST, 120000, 150, ing(Items.GUNPOWDER), ing(Items.GHAST_TEAR)); + spawner("ocelot", EntityType.OCELOT, 80000, 60, ing(Items.COD), ing(ItemTags.WOOL)); + spawner("mule", EntityType.MULE, 100000, 100, ing(Items.LEATHER), ing(Blocks.CHEST), ing(Items.APPLE)); + spawner("bat", EntityType.BAT, 30000, 40, ing(Items.FEATHER)); + spawner("endermite", EntityType.ENDERMITE, 30000, 40, ing(Items.ENDER_PEARL), ing(Blocks.STONE)); + spawner("parrot", EntityType.PARROT, 50000, 60, ing(Items.FEATHER), ing(Items.COOKIE)); + spawner("slime", EntityType.SLIME, 30000, 40, ing(Items.SLIME_BALL)); + spawner("spider", EntityType.SPIDER, 100000, 120, ing(Items.STRING), ing(Items.SPIDER_EYE)); + spawner("skeleton", EntityType.SKELETON, 100000, 120, ing(Items.BONE), ing(Items.ARROW)); + spawner("enderman", EntityType.ENDERMAN, 120000, 120, ing(Items.ENDER_PEARL)); + spawner("silverfish", EntityType.SILVERFISH, 30000, 40, ing(Blocks.STONE)); + spawner("squid", EntityType.SQUID, 50000, 40, ing(Items.INK_SAC)); + spawner("stray", EntityType.STRAY, 100000, 120, ing(Items.BONE), ing(Blocks.ICE)); + spawner("shulker", EntityType.SHULKER, 150000, 100, ing(Items.SHULKER_SHELL)); + spawner("husk", EntityType.HUSK, 100000, 120, ing(Items.ROTTEN_FLESH), ing(Blocks.SAND)); + spawner("llama", EntityType.LLAMA, 60000, 80, ing(ItemTags.WOOL)); + spawner("rabbit", EntityType.RABBIT, 30000, 40, ing(Items.RABBIT_HIDE)); + spawner("magma_cube", EntityType.MAGMA_CUBE, 100000, 100, ing(Items.MAGMA_CREAM)); + spawner("zombie_pigman", EntityType.ZOMBIE_PIGMAN, 120000, 150, ing(Items.ROTTEN_FLESH), ing(Items.GOLD_NUGGET)); + spawner("polar_bear", EntityType.POLAR_BEAR, 50000, 60, ing(Items.COD), ing(Blocks.ICE)); + spawner("mooshroom", EntityType.MOOSHROOM, 40000, 60, ing(Items.LEATHER), ing(Blocks.RED_MUSHROOM)); + spawner("guardian", EntityType.GUARDIAN, 150000, 150, ing(Items.PRISMARINE_SHARD), ing(Items.PRISMARINE_CRYSTALS)); + spawner("horse", EntityType.HORSE, 100000, 100, ing(Items.LEATHER)); + spawner("donkey", EntityType.DONKEY, 100000, 100, ing(Items.LEATHER), ing(Blocks.CHEST)); + spawner("cave_spider", EntityType.CAVE_SPIDER, 100000, 120, ing(Items.STRING), ing(Items.FERMENTED_SPIDER_EYE)); + spawner("creeper", EntityType.CREEPER, 100000, 120, ing(Items.GUNPOWDER)); + spawner("witch", EntityType.WITCH, 150000, 150, ing(Items.GLASS_BOTTLE), ing(Items.GLOWSTONE_DUST)); + spawner("wither_skeleton", EntityType.WITHER_SKELETON, 150000, 150, ing(Items.BONE), ing(Blocks.OBSIDIAN)); + spawner("wolf", EntityType.WOLF, 50000, 60, ing(Items.LEATHER), ing(Items.BONE)); + spawner("zombie", EntityType.ZOMBIE, 100000, 100, ing(Items.ROTTEN_FLESH)); NaturesAuraAPI.OVERWORLD_ORES.add(new WeightedOre(Tags.Blocks.ORES_COAL, 5000)); NaturesAuraAPI.OVERWORLD_ORES.add(new WeightedOre(Tags.Blocks.ORES_IRON, 3000)); @@ -336,11 +336,11 @@ public final class ModRecipes { NaturesAuraAPI.PROJECTILE_GENERATIONS.put(EntityType.TRIDENT, 3000000); } - private static void spawner(String name, String entity, int aura, int time, Ingredient... ings) { + private static void spawner(String name, EntityType entity, int aura, int time, Ingredient... ings) { Ingredient[] actualIngs = new Ingredient[ings.length + 1]; actualIngs[0] = ing(ModItems.BIRTH_SPIRIT); System.arraycopy(ings, 0, actualIngs, 1, ings.length); - new AnimalSpawnerRecipe(res(name), new ResourceLocation(entity), aura, time, actualIngs).register(); + new AnimalSpawnerRecipe(res(name), entity, aura, time, actualIngs).register(); } private static Ingredient ing(Block... blocks) { diff --git a/src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/effects/breathlessness.json b/src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/effects/breathlessness.json index 9b84b5aa..05bc2248 100644 --- a/src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/effects/breathlessness.json +++ b/src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/effects/breathlessness.json @@ -1,6 +1,6 @@ { "name": "Breathlessness", - "icon": "minecraft:wool", + "icon": "minecraft:white_wool", "category": "effects", "advancement": "naturesaura:negative_imbalance", "pages": [ diff --git a/src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/intro/botany.json b/src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/intro/botany.json index 3692c149..c79883de 100644 --- a/src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/intro/botany.json +++ b/src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/intro/botany.json @@ -1,6 +1,6 @@ { "name": "Magical Botany", - "icon": "minecraft:sapling", + "icon": "minecraft:oak_sapling", "category": "intro", "pages": [ {