From ab2b8612cd3a78a20bd9806cd2998d32b219cb0e Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 21 Nov 2018 01:05:50 +0100 Subject: [PATCH] finished the offering table --- .../api/recipes/ing/AmountIngredient.java | 12 +++- .../blocks/tiles/TileEntityOfferingTable.java | 17 ++++-- .../tiles/render/RenderOfferingTable.java | 2 +- .../compat/jei/JEINaturesAuraPlugin.java | 14 ++++- .../compat/jei/offering/OfferingCategory.java | 56 ++++++++++++++++++ .../compat/jei/offering/OfferingWrapper.java | 25 ++++++++ .../ellpeck/naturesaura/items/ModItems.java | 2 + .../naturesaura/packet/PacketParticles.java | 22 +++++++ .../naturesaura/recipes/ModRecipes.java | 6 +- .../assets/naturesaura/lang/en_US.lang | 3 + .../models/item/calling_spirit.json | 6 ++ .../naturesaura/models/item/sky_ingot.json | 6 ++ .../naturesaura/textures/gui/jei/offering.png | Bin 0 -> 1780 bytes .../textures/items/calling_spirit.png | Bin 0 -> 607 bytes .../naturesaura/textures/items/sky_ingot.png | Bin 0 -> 491 bytes 15 files changed, 159 insertions(+), 12 deletions(-) create mode 100644 src/main/java/de/ellpeck/naturesaura/compat/jei/offering/OfferingCategory.java create mode 100644 src/main/java/de/ellpeck/naturesaura/compat/jei/offering/OfferingWrapper.java create mode 100644 src/main/resources/assets/naturesaura/models/item/calling_spirit.json create mode 100644 src/main/resources/assets/naturesaura/models/item/sky_ingot.json create mode 100644 src/main/resources/assets/naturesaura/textures/gui/jei/offering.png create mode 100644 src/main/resources/assets/naturesaura/textures/items/calling_spirit.png create mode 100644 src/main/resources/assets/naturesaura/textures/items/sky_ingot.png diff --git a/src/main/java/de/ellpeck/naturesaura/api/recipes/ing/AmountIngredient.java b/src/main/java/de/ellpeck/naturesaura/api/recipes/ing/AmountIngredient.java index 32315f87..625f404b 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/recipes/ing/AmountIngredient.java +++ b/src/main/java/de/ellpeck/naturesaura/api/recipes/ing/AmountIngredient.java @@ -8,6 +8,7 @@ public class AmountIngredient extends Ingredient { public final Ingredient delegate; public final int amount; + private ItemStack[] matchingStacks; public AmountIngredient(Ingredient delegate, int amount) { super(0); @@ -21,7 +22,16 @@ public class AmountIngredient extends Ingredient { @Override public ItemStack[] getMatchingStacks() { - return this.delegate.getMatchingStacks(); + if (this.matchingStacks == null) { + ItemStack[] delegate = this.delegate.getMatchingStacks(); + this.matchingStacks = new ItemStack[delegate.length]; + for (int i = 0; i < delegate.length; i++) { + ItemStack copy = delegate[i].copy(); + copy.setCount(this.amount); + this.matchingStacks[i] = copy; + } + } + return this.matchingStacks; } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java index a477bc7f..57782782 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java @@ -3,6 +3,8 @@ package de.ellpeck.naturesaura.blocks.tiles; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.recipes.OfferingRecipe; import de.ellpeck.naturesaura.blocks.multi.Multiblocks; +import de.ellpeck.naturesaura.packet.PacketHandler; +import de.ellpeck.naturesaura.packet.PacketParticles; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; @@ -20,7 +22,12 @@ import java.util.List; import java.util.Queue; public class TileEntityOfferingTable extends TileEntityImpl implements ITickable { - public final ItemStackHandler items = new ItemStackHandlerNA(1, this, true); + public final ItemStackHandler items = new ItemStackHandlerNA(1, this, true) { + @Override + public int getSlotLimit(int slot) { + return 16; + } + }; private final Queue itemsToSpawn = new ArrayDeque<>(); @Override @@ -62,15 +69,17 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable this.itemsToSpawn.add(recipe.output.copy()); this.world.addWeatherEffect(new EntityLightningBolt(this.world, this.pos.getX(), this.pos.getY(), this.pos.getZ(), true)); + PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles( + (float) item.posX, (float) item.posY, (float) item.posZ, 13, + this.pos.getX(), this.pos.getY(), this.pos.getZ())); + break; } } else if (this.world.getTotalWorldTime() % 3 == 0) { if (!this.itemsToSpawn.isEmpty()) this.world.spawnEntity(new EntityItem( this.world, - this.pos.getX() + 0.5F + this.world.rand.nextGaussian() * 3F, - 256, - this.pos.getZ() + 0.5F + this.world.rand.nextGaussian() * 3F, + this.pos.getX() + 0.5F, 256, this.pos.getZ() + 0.5F, this.itemsToSpawn.remove())); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderOfferingTable.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderOfferingTable.java index 8bfd6437..814e37ce 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderOfferingTable.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderOfferingTable.java @@ -22,7 +22,7 @@ public class RenderOfferingTable extends TileEntitySpecialRenderer { + + private final IDrawable background; + + public OfferingCategory(IGuiHelper helper) { + this.background = helper.createDrawable(new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/jei/offering.png"), 0, 0, 87, 36); + } + + @Override + public String getUid() { + return JEINaturesAuraPlugin.OFFERING; + } + + @Override + public String getTitle() { + return I18n.format("container." + JEINaturesAuraPlugin.OFFERING + ".name"); + } + + @Override + public String getModName() { + return NaturesAura.MOD_NAME; + } + + @Override + public IDrawable getBackground() { + return this.background; + } + + @Override + public void setRecipe(IRecipeLayout recipeLayout, OfferingWrapper recipeWrapper, IIngredients ingredients) { + IGuiItemStackGroup group = recipeLayout.getItemStacks(); + OfferingRecipe recipe = recipeWrapper.recipe; + group.init(0, true, 0, 14); + group.set(0, Arrays.asList(recipe.input.getMatchingStacks())); + group.init(1, false, 65, 14); + group.set(1, recipe.output); + group.init(2, true, 27, 0); + group.set(2, Arrays.asList(recipe.startItem.getMatchingStacks())); + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/compat/jei/offering/OfferingWrapper.java b/src/main/java/de/ellpeck/naturesaura/compat/jei/offering/OfferingWrapper.java new file mode 100644 index 00000000..9b4d30c6 --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/compat/jei/offering/OfferingWrapper.java @@ -0,0 +1,25 @@ +package de.ellpeck.naturesaura.compat.jei.offering; + +import com.google.common.collect.ImmutableList; +import de.ellpeck.naturesaura.api.recipes.OfferingRecipe; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; +import mezz.jei.api.recipe.IRecipeWrapper; +import net.minecraft.item.ItemStack; + +public class OfferingWrapper implements IRecipeWrapper { + + public final OfferingRecipe recipe; + + public OfferingWrapper(OfferingRecipe recipe) { + this.recipe = recipe; + } + + @Override + public void getIngredients(IIngredients ingredients) { + ingredients.setInputs(VanillaTypes.ITEM, ImmutableList.builder() + .add(this.recipe.input.getMatchingStacks()) + .add(this.recipe.startItem.getMatchingStacks()).build()); + ingredients.setOutput(VanillaTypes.ITEM, this.recipe.output); + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/items/ModItems.java b/src/main/java/de/ellpeck/naturesaura/items/ModItems.java index 17125894..32000e4c 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ModItems.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ModItems.java @@ -29,4 +29,6 @@ public final class ModItems { public static final Item BOTTLE_TWO = new ItemImpl("bottle_two_the_rebottling"); public static final Item AURA_BOTTLE = new ItemAuraBottle(); public static final Item FARMING_STENCIL = new ItemImpl("farming_stencil"); + public static final Item SKY_INGOT = new ItemImpl("sky_ingot"); + public static final Item CALLING_SPIRIT = new ItemImpl("calling_spirit"); } diff --git a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java index 14b84f20..b5de7429 100644 --- a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java +++ b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java @@ -232,6 +232,28 @@ public class PacketParticles implements IMessage { world.rand.nextFloat() * 0.04F + 0.04F, world.rand.nextGaussian() * 0.03F, 0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 60, 0F, false, true); + break; + case 13: // Offering table + int genX = message.data[0]; + int genY = message.data[1]; + int genZ = message.data[2]; + for (int i = world.rand.nextInt(20) + 10; i >= 0; i--) + NaturesAuraAPI.instance().spawnMagicParticle( + message.posX, message.posY + 0.5F, message.posZ, + world.rand.nextGaussian() * 0.02F, + world.rand.nextFloat() * 0.25F, + world.rand.nextGaussian() * 0.02F, + 0xffadfd, 1.5F, 40, 0F, false, true); + for (int i = world.rand.nextInt(50) + 30; i >= 0; i--) + NaturesAuraAPI.instance().spawnMagicParticle( + genX + 0.5F + world.rand.nextGaussian() * 2.5F, + genY + 0.1F, + genZ + 0.5F + world.rand.nextGaussian() * 2.5F, + world.rand.nextGaussian() * 0.01F, + world.rand.nextFloat() * 0.01F, + world.rand.nextGaussian() * 0.01F, + 0xd3e4ff, 1.5F, 150, 0F, false, true); + break; } } }); diff --git a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java index 2c50e4a8..34fe06d7 100644 --- a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java +++ b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java @@ -83,10 +83,10 @@ public final class ModRecipes { Ingredient.fromItem(Items.ROTTEN_FLESH), new ItemStack(Items.LEATHER), Helper.blockIng(ModBlocks.CONVERSION_CATALYST), 400, 50).register(); - new OfferingRecipe(new ResourceLocation(NaturesAura.MOD_ID, "test"), + new OfferingRecipe(new ResourceLocation(NaturesAura.MOD_ID, "sky_ingot"), new AmountIngredient(new ItemStack(ModItems.INFUSED_IRON, 3)), - Ingredient.fromItem(Items.DIAMOND), - new ItemStack(Blocks.DIRT)).register(); + Ingredient.fromItem(ModItems.CALLING_SPIRIT), + new ItemStack(ModItems.SKY_INGOT)).register(); NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.put( Blocks.COBBLESTONE.getDefaultState(), diff --git a/src/main/resources/assets/naturesaura/lang/en_US.lang b/src/main/resources/assets/naturesaura/lang/en_US.lang index bab03d5d..06d0128d 100644 --- a/src/main/resources/assets/naturesaura/lang/en_US.lang +++ b/src/main/resources/assets/naturesaura/lang/en_US.lang @@ -54,9 +54,12 @@ item.naturesaura.aura_bottle.naturesaura:end.name=Bottled Darkness item.naturesaura.aura_bottle.naturesaura:other.name=Bottled Substance item.naturesaura.farming_stencil.name=Farming Stencil item.naturesaura.bottle_two_the_rebottling.name=Bottle and Cork +item.naturesaura.sky_ingot.name=Ingot of the Skies +item.naturesaura.calling_spirit.name=Spirit of Calling container.naturesaura.tree_ritual.name=Ritual of the Forest container.naturesaura.altar.name=Natural Altar Infusion +container.naturesaura.offering.name=Offering to the Gods info.naturesaura.aura_in_area=Aura Around info.naturesaura.book.landing=$(aura) is a complicated matter, and creating, collecting and making use of it can be difficult.$(br)The $(item)Book of Natural Aura$() contains all the information one requires to do so. diff --git a/src/main/resources/assets/naturesaura/models/item/calling_spirit.json b/src/main/resources/assets/naturesaura/models/item/calling_spirit.json new file mode 100644 index 00000000..85d8bda1 --- /dev/null +++ b/src/main/resources/assets/naturesaura/models/item/calling_spirit.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "naturesaura:items/calling_spirit" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/models/item/sky_ingot.json b/src/main/resources/assets/naturesaura/models/item/sky_ingot.json new file mode 100644 index 00000000..6d3d3f36 --- /dev/null +++ b/src/main/resources/assets/naturesaura/models/item/sky_ingot.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "naturesaura:items/sky_ingot" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/textures/gui/jei/offering.png b/src/main/resources/assets/naturesaura/textures/gui/jei/offering.png new file mode 100644 index 0000000000000000000000000000000000000000..5668e12d14affdfd81c5f79c15ce2b45ba2a4e67 GIT binary patch literal 1780 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G$6&2?&#~tz_78O`%fY(kk47* z5n0T@z_$;C8DBYVJOC7wC~=J_3C>R|DNig)Whh9@%q!8$OD$0_(KFOD5q8Kp!oa{* z7mJ-`|(_ z|N8m)`TXy%udn~H`~Hpnbt}?Rmxz~#&6odBZnfn8-(!8^uBO_`dv|OuVp!n?mf~Xw zUD@;H(YaHM3$&(AjJp$Q$q=&C=u)?}HhaUWl4;k@WbA;-&RuG1ETsq4o1S^Lr_Edc z-5ME&RhJ^8j2AxyYFWKqhT(YenRn+mAG2R{?Y++0nHLLQGS9sFy#3=`zL(|yeU;}e zzAFE*f5lg8@9Z>_m|qTQPZ=&;wpD#=3)IhU1hjJAJDs&VU#%;7-_vGo*Y>__&xe=J z*57x2vzEQ|{@-jj8~4@rkK_Z-mrlDDQyRXj-0iUK&p<1NFC{?tgqAO@PB)2J%KYF* z<*vGOj2rynf_EmfA9#N2z1RNVFFsdZI=}B3!;R&ew>(?5`_f)xsdp!t6UyS}YySOX z%znTQ=*#fCQ{TTFZeOb8I6lfeQ zB7$szoQo6eCcLs_`1aEG(&w)xA-^0}JqL!Gx##)omjhlhue>*%zhv7F_AAAEJ*)Q3 zYx9!!2(6m@rN)+bs@a59U({aytdi2oRS1RZzU8p$((EPAUuUk^(ipN7Vn`OB?Pcz@@myi2sGZs5fUZEB&NZ6+owy-b!Y^bB33$m_dGh&MAMXljOs z^W;@urfm7%vCMn6S7?>jt!kIcOMRDWfr4Vu%S+3Grp}x6P3~ezX7EZcf6wavj9pt+ zhAdsaWUsqP?5&Vhmx3?dQ=X-ls}=fEGxNQm?{u@N)G-c^b6uRJW`(FqUAnMDi;&L- zrP9o!FD9^Qu9c9zq_9+Uv9r{YElDLF%~Qg9_%bJ4>bj`N8x&<|wZzd&+pXQi16lFa zMZr?bwnUY99i9@_?Uy;@Qr1OH-ry)*tEGuvt6i6y_+)Nh2%Q~loCIEBp9&-Qy literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/naturesaura/textures/items/calling_spirit.png b/src/main/resources/assets/naturesaura/textures/items/calling_spirit.png new file mode 100644 index 0000000000000000000000000000000000000000..6ff6529a3c04688d23d309d4e0f52be6e52fab25 GIT binary patch literal 607 zcmV-l0-*hgP)N2bZe?^J zG%hhNG!sB*!~g&R-AP12R5(v%lSywAK@f%eS99Qm5F`R5AV8cbK#+_?7M3gsf`E{) zBp^G^f*{HQ;_jP~Ju{ve&x5a872~g|f{BqM?R?6O=)He=9c_}}CqeD< zq0pz>?ZyCnaC#Q@VDpvqY^u`77tvRir3Imig}XXw#nirbep`pzkqF*AO||k+TAr4k zOqN<*=-ZhGd2}lgHa-(?>dH_3*n^|cT$Sc)xfbt9=rVIdn!PCzlyd@bh7IgP3n=X) zT3agY^4yp-JyNOh7QU?S)`!fhV&CuggQ@v$K90>bpuEHTa@tWay zJW+^1RI=ZU0qL2{RLE4&>GX3p4gBFaooS tojdk3@sJ?+%W^<=9k|R0Pjg~Yg+JW?AeA75O*sGn002ovPDHLkV1j~&53T?J literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/naturesaura/textures/items/sky_ingot.png b/src/main/resources/assets/naturesaura/textures/items/sky_ingot.png new file mode 100644 index 0000000000000000000000000000000000000000..16beb8d80b66a4615577cf49e3e20a3ef7a9d857 GIT binary patch literal 491 zcmVN2bZe?^J zG%hhNG!sB*!~g&RX-PyuR5(v)0ohHVXc zQr2i~VK6ETEFJZnj=!XxwzSukc018plYF;}QB(mfPbNlj>m$>CFOm?l`lW{~*wBF82q2>d zDJZq4cfk4CFrwZ~)f!D2P{6qLepFyb2mlrGr+%6f-xwkmLDr-`On@r8qDqo|Er&hm zq@hux@6;SlF842rgbUpMjAV9Qdr^o1dvCs{`ASU6RMafoCGiq@5KsV#LnZ(afvvOg z250)pLH<>7A&_W5Ge}Ga(Tc5h?w3fyMuTX1JA;I8*1p!f2=Fr%e;|maWU=|yC^$wk h0