From 7b1d30ac854296338d7b4a74d7dad0b49dd89bf2 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 31 Mar 2019 23:53:53 +0200 Subject: [PATCH] finish the projectile generator --- .../blocks/BlockProjectileGenerator.java | 33 ++++++++++- .../render/RenderProjectileGenerator.java | 55 ++++++++++++++++++ .../naturesaura/packet/PacketParticles.java | 20 +++++++ .../assets/naturesaura/lang/en_US.lang | 1 + .../creating/projectile_generator.json | 21 +++++++ .../en_us/entries/using/chunk_loader.json | 2 +- .../recipes/projectile_generator.json | 31 ++++++++++ .../textures/blocks/dimension_rail_end.png | Bin 347 -> 384 bytes .../textures/blocks/dimension_rail_nether.png | Bin 346 -> 406 bytes .../blocks/dimension_rail_overworld.png | Bin 349 -> 406 bytes .../textures/blocks/projectile_generator.png | Bin 0 -> 484 bytes .../blocks/projectile_generator_top.png | Bin 0 -> 590 bytes .../models/projectile_generator_overlay.png | Bin 0 -> 439 bytes 13 files changed, 161 insertions(+), 2 deletions(-) create mode 100644 src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderProjectileGenerator.java create mode 100644 src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/projectile_generator.json create mode 100644 src/main/resources/assets/naturesaura/recipes/projectile_generator.json create mode 100644 src/main/resources/assets/naturesaura/textures/blocks/projectile_generator.png create mode 100644 src/main/resources/assets/naturesaura/textures/blocks/projectile_generator_top.png create mode 100644 src/main/resources/assets/naturesaura/textures/models/projectile_generator_overlay.png diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java index 25663ef1..4dbd16a5 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java @@ -3,19 +3,30 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.blocks.tiles.TileEntityProjectileGenerator; +import de.ellpeck.naturesaura.blocks.tiles.render.RenderProjectileGenerator; +import de.ellpeck.naturesaura.packet.PacketHandler; +import de.ellpeck.naturesaura.packet.PacketParticles; +import de.ellpeck.naturesaura.reg.ITESRProvider; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; +import net.minecraft.init.SoundEvents; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.Tuple; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.ProjectileImpactEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; -public class BlockProjectileGenerator extends BlockContainerImpl { +public class BlockProjectileGenerator extends BlockContainerImpl implements ITESRProvider { public BlockProjectileGenerator() { super(Material.ROCK, "projectile_generator", TileEntityProjectileGenerator.class, "projectile_generator"); this.setSoundType(SoundType.STONE); @@ -47,10 +58,30 @@ public class BlockProjectileGenerator extends BlockContainerImpl { BlockPos spot = IAuraChunk.getLowestSpot(entity.world, pos, 35, pos); IAuraChunk.getAuraChunk(entity.world, spot).storeAura(spot, amount); + PacketHandler.sendToAllAround(entity.world, pos, 32, + new PacketParticles((float) entity.posX, (float) entity.posY, (float) entity.posZ, 26, pos.getX(), pos.getY(), pos.getZ())); + entity.world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ENTITY_ENDEREYE_LAUNCH, SoundCategory.BLOCKS, 0.8F, 1F); + generator.nextSide = generator.nextSide.rotateY(); generator.sendToClients(); entity.setDead(); event.setCanceled(true); } + + @Override + public boolean isFullCube(IBlockState state) { + return false; + } + + @Override + public boolean isOpaqueCube(IBlockState state) { + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public Tuple getTESR() { + return new Tuple<>(TileEntityProjectileGenerator.class, new RenderProjectileGenerator()); + } } 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 new file mode 100644 index 00000000..58117597 --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderProjectileGenerator.java @@ -0,0 +1,55 @@ +package de.ellpeck.naturesaura.blocks.tiles.render; + +import de.ellpeck.naturesaura.NaturesAura; +import de.ellpeck.naturesaura.blocks.tiles.TileEntityProjectileGenerator; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class RenderProjectileGenerator extends TileEntitySpecialRenderer { + private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/projectile_generator_overlay.png"); + private final ModelOverlay model = new ModelOverlay(); + + @Override + public void render(TileEntityProjectileGenerator te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { + GlStateManager.pushMatrix(); + GlStateManager.translate(x, y, z); + if (te.nextSide == EnumFacing.NORTH) { + GlStateManager.rotate(270, 0, 1, 0); + GlStateManager.translate(-0.001F, 0, -1); + } else if (te.nextSide == EnumFacing.EAST) { + GlStateManager.rotate(180, 0, 1, 0); + GlStateManager.translate(-1.001F, 0, -1); + } else if (te.nextSide == EnumFacing.SOUTH) { + GlStateManager.rotate(90, 0, 1, 0); + GlStateManager.translate(-1.001F, 0, 0); + } else { + GlStateManager.translate(-0.001F, 0, 0); + } + this.bindTexture(RES); + this.model.render(); + GlStateManager.popMatrix(); + } + + private static class ModelOverlay extends ModelBase { + + private final ModelRenderer box; + + public ModelOverlay() { + this.box = new ModelRenderer(this, 0, 0); + this.box.setTextureSize(64, 64); + this.box.addBox(0, 0, 0, 16, 16, 16); + } + + public void render() { + this.box.render(1 / 16F); + } + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java index 2faff5f9..c1487915 100644 --- a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java +++ b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java @@ -7,6 +7,7 @@ import de.ellpeck.naturesaura.blocks.multi.Multiblocks; import io.netty.buffer.ByteBuf; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; +import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -414,6 +415,25 @@ public class PacketParticles implements IMessage { message.posZ + world.rand.nextFloat() * depth, 0F, 0F, 0F, 0xd60cff, 1F + world.rand.nextFloat(), 60, 0F, false, true); break; + case 26: // Projectile generator + int x = message.data[0]; + int y = message.data[1]; + int z = message.data[2]; + for (int i = world.rand.nextInt(10) + 5; i >= 0; i--) + NaturesAuraAPI.instance().spawnMagicParticle( + x + 0.25F + world.rand.nextFloat() * 0.5F, + y + 1.01F, + z + 0.25F + world.rand.nextFloat() * 0.5F, + world.rand.nextGaussian() * 0.01F, + world.rand.nextFloat() * 0.04F + 0.02F, + world.rand.nextGaussian() * 0.01F, + 0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true); + for (int i = world.rand.nextInt(10) + 10; i >= 0; i--) + world.spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, + message.posX, message.posY, message.posZ, + world.rand.nextGaussian() * 0.03F, + world.rand.nextGaussian() * 0.03F, + world.rand.nextGaussian() * 0.03F); } } }); diff --git a/src/main/resources/assets/naturesaura/lang/en_US.lang b/src/main/resources/assets/naturesaura/lang/en_US.lang index 1b5548bb..36a081b9 100644 --- a/src/main/resources/assets/naturesaura/lang/en_US.lang +++ b/src/main/resources/assets/naturesaura/lang/en_US.lang @@ -52,6 +52,7 @@ tile.naturesaura.chunk_loader.name=World Eye tile.naturesaura.dimension_rail_overworld.name=Rail of the Overworld tile.naturesaura.dimension_rail_end.name=Rail of the End tile.naturesaura.dimension_rail_nether.name=Rail of the Nether +tile.naturesaura.projectile_generator.name=Shooting Mark item.naturesaura.eye.name=Environmental Eye item.naturesaura.eye_improved.name=Environmental Ocular diff --git a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/projectile_generator.json b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/projectile_generator.json new file mode 100644 index 00000000..458b66a9 --- /dev/null +++ b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/projectile_generator.json @@ -0,0 +1,21 @@ +{ + "name": "Shooting Mark", + "icon": "naturesaura:projectile_generator", + "category": "creating", + "advancement": "naturesaura:sky_ingot", + "pages": [ + { + "type": "text", + "text": "The strength of any shot $(thing)projectiles$() is, in some instances, strong enough to pierce living beings and even move them around by way of teleportation. However, this power can be used to create $(aura) as well: The $(item)Shooting Mark$() converts the energy of any projectiles shot at it into $(aura) that it spreads into the environment." + }, + { + "type": "text", + "text": "For this, different kinds of projectiles produce different amounts - a $(item)snowball$() is much less rich in energy than, say, an $(item)ender pearl$().$(p)There is a caveat, however: Projectiles need to be shot at the four sides $(thing)in order$(), starting on the north face. Projectiles that hit on any non-active side will not cause any $(aura) to be produced." + }, + { + "type": "crafting", + "recipe": "naturesaura:projectile_generator", + "text": "Creating the $(item)Shooting Mark$()" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/using/chunk_loader.json b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/using/chunk_loader.json index ec2fe2cf..08594850 100644 --- a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/using/chunk_loader.json +++ b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/using/chunk_loader.json @@ -11,7 +11,7 @@ }, { "type": "text", - "text": "$(aura) to maintain its sight.$(p)To set it up, simply place it down and provide it with a $(thing)redstone signal$() - the stronger the signal, the higher its range in blocks will be. Due to the nature of how observation in this manner seems to function, the range isn't always met exactly, meaning that sometimes, the areas that will be loaded are $(thing)slightly bigger$() than the range that is shown - it's a bit $(thing)chunky$(), to say the least." + "text": "$(aura) to maintain its sight.$(p)To set it up, simply place it down and provide it with a $(thing)redstone signal$() - the stronger the signal, the higher its radius in blocks will be, with about 30 being the maximum. Due to the nature of how observation in this manner seems to function, the range isn't always met exactly, meaning that sometimes, the areas that will be loaded are $(thing)slightly bigger$() than the expected range." }, { "type": "crafting", diff --git a/src/main/resources/assets/naturesaura/recipes/projectile_generator.json b/src/main/resources/assets/naturesaura/recipes/projectile_generator.json new file mode 100644 index 00000000..b3b62166 --- /dev/null +++ b/src/main/resources/assets/naturesaura/recipes/projectile_generator.json @@ -0,0 +1,31 @@ +{ + "type": "forge:ore_shaped", + "pattern": [ + "SFI", + "TXT", + "ILS" + ], + "key": { + "F": { + "item": "minecraft:feather" + }, + "L": { + "item": "minecraft:flint" + }, + "S": { + "item": "naturesaura:infused_stone" + }, + "T": { + "item": "naturesaura:token_rage" + }, + "I": { + "item": "naturesaura:sky_ingot" + }, + "X": { + "item": "minecraft:compass" + } + }, + "result": { + "item": "naturesaura:projectile_generator" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/textures/blocks/dimension_rail_end.png b/src/main/resources/assets/naturesaura/textures/blocks/dimension_rail_end.png index 8f0ecbcf142371b9dd9b81c1845c336d45a8f088..ec9892e07ac08a86bec299fa37a9084d7062adfc 100644 GIT binary patch delta 298 zcmV+_0oDH70)PXMJPN-601m$aI0aKAkwzzf{z*hZR5(wSlDi55F%U)b1D0YZf|VdP zf|VA&8d+QGEd%0T?SDp3GIw`YR?!Q?&P?W>O+tdyG);;zCM!RR8D_04+HG#R$s+k_ zTj#IB*8-56J%rWb&;sVObsO{vUkgBO_96kS%vw(CL|B<6fR&xz0T|gj;UR+nh6Esg zACF#Jo>b|wk2%Qc`8#0F?EO37Zy2uUM>bc-dk%W634q7!MSchRGe$syu_l1oItjqA zhj=sjAb>>y*e2&?m>md2&mZCIJMa*hxr4vn0T2Pmt^NBuKp4Fl4Fdcf=*<)K6{-d3 w-2vwjKyRKPSEwfdx!H>Zu=1k>C{+j*PkK#W!hl|pB>(^b07*qoM6N<$f?wN!-~a#s delta 260 zcmV+f0sH=d1KR?SJPN=701m(bYSxJfkwzzf*-1n}R5(x7lCcT`F%U%a1D0YZf|VdP zf|WLMrM2~y`LO(F%u9C8Bp4ej2bP=J?9OGEI3a`(z4y`N5Y$j>vfy@k<|K#k={o1H zqSi8iTf1|o!+kN>@6Jn*Cu%JNw6zz=z~m4zF!{z$2Fxe}_%Z-GH-?1{BDEIhnUN=y&k-9dKPO zk`Vuscff3ldI!=nXm-FnGJrE{eh-N&l#>D6+6!c0atIj|<=hLuKt0983rQFN0000< KMNUMnLSTXl;B|cf diff --git a/src/main/resources/assets/naturesaura/textures/blocks/dimension_rail_nether.png b/src/main/resources/assets/naturesaura/textures/blocks/dimension_rail_nether.png index 8a36ea01893bf31e4389546677470c68a59f1292..44575fccc3a7164717ede6b6f411a1f0ace2f189 100644 GIT binary patch delta 321 zcmV-H0lxm)0+s`iJPN-601m$aI0aKAkwzwe0Tf9@K~y+TjgrAi12GVW^8$i5FH%Yc zLE76wsk9(giaivMo;}Gz>BVQ-_l*4}^QW`2OZ{QknMwX{Ga*Upx-PeEo4p(rd)Vt` z(f7KsCX3`h+m(G4u@->b?J0dM9xGroo7A9B#99Dqw-*WErRnQok_j(O0(g1RUx1l^ zUp6HIWDvlN0$^xvZ}Q>(F1Nc^3vzm&&&xUj9=G@JfWKil?RREAzQ0+}V@&`&ZZC=_ z(4R2^63o^d;I@kdU~_~-v*km8-W{Be$-Hdl1Om~EBaFU-W;*RbWabXG^QQ{9`VN59 z<_Y==)dKV^?tpm&(3>a773v87QzdFUqSkK1x;1}0000< KMNUMnLSTX;8E{?z diff --git a/src/main/resources/assets/naturesaura/textures/blocks/dimension_rail_overworld.png b/src/main/resources/assets/naturesaura/textures/blocks/dimension_rail_overworld.png index 3effb52272060a829bd86148439897e5b9f61666..28f258438e8ec1d4e40db1da140dd3b051d3414d 100644 GIT binary patch delta 321 zcmV-H0lxm-0+s`iJPN-601m$aI0aKAkwzwe0Tf9@K~y+Tjgrx7!axv3_Xqmyixk19 zBD94-K~P97zDS`|q4;JHgh25F`ak*4m9slHP9(uz7&0@v_he_;AT>=B>$;9s4vIbO zwK8jSeo0Lh$-n=K^i}v;0CKa3FyBpEz;iingFfMF0jSNMC4iMl+v+hARwfBxhFS3t%g<3f)bA3#jYwIkp$d-o3b8-~+)oy^DIj}-J+69A9d zv-}D4XN-UZV@&|FT_pgUJ;a;Idjb9qI41M5nG*;^&yO(p4ql5%2O=|fuv|U0fV=Mi zhydi){{K5b7`++w0{k85%@gz$ss-pQ+yV0lpf^vDE7TK!-0WEbSUD&Gauvb_Vj*d8 T4rgxR00000NkvXXu0mjfaI}t0 delta 263 zcmV+i0r>uw1Kk3UJPN=701m(bYSxJfkwzwe0NY7KK~y+T)si6&0znK#$Dj~g07tMO zNJwxf1j!1*CDtI2T!K@~J%_xR{-rZvFerY~@Y`)4+h&6lV@%^XCQG}bhh9sI&bMtY z@(_P{?DDU|=K|nuJcPq_H32rq}O5hc$34pipA^|MzN`R7u@B-K;NP>X&0~`PV N002ovPDHLkV1oaCaf$!{ diff --git a/src/main/resources/assets/naturesaura/textures/blocks/projectile_generator.png b/src/main/resources/assets/naturesaura/textures/blocks/projectile_generator.png new file mode 100644 index 0000000000000000000000000000000000000000..4529a25cfd61500941272620d69a78c35cd0e3f9 GIT binary patch literal 484 zcmVQ3`P6@Kfo$C zTmS(TMRwVDSp>HiU;LIhCswS?IP!2iT}kdux;q`p>$zM%O{6#Vn}t-iOUaJ90uN4Lxg0#oQS(8v!;W0^+lu?$Dh7Pyk#p8<%5kfz1p`Yd z5dp4gtVa9eKEZQmVHV4V)~5C!GB2}X*oJbsPK$w2_DH9 zGoyD5n!zK4j7`7b}dFUg2DTlTDs-|Li1y%9puM7Iq$Xp5Ihl3 z8FC?-f$Gaz0zV7^IsgO^GlGH7L#J3Kmts0d++_XjSu&Ao<9!?Z&VV>y7g#J86`*i& aK9X;e>_OoGHHs_%0000xxa#OS*=;Fi=d3Ex=BeV~?YGaw#5)byx8Tj=qO2A&60?Av`muyh%Cc20 z$yzC=IsSvitmZZFKngI9r&wa$hsfjV7q@?WwOz%hNmy`c_w-z2Hig|j^> zfMe!@iBtg^f(Xe`!f2?=;gIPqut5oK4#o-aI_fqI^NfAofVvpI3%=P4!lvI6;>1s;*b z3=DjGK$vmro+3}6phSslL`iUdT1k0gQ7S`0VrE{6US4X6f{C7?o@t7E1khwgQ%@Ji zkczmcmp0}eHjrRVyuK=?y5-G&m$VNGTA~vU=-UK}e|;i4UuS+Q)A^IHE%;1()FgZj zW+j*$%xJpEvY69N7*pWv_vfEyznCd{$BFme_rFP3#j|$#MI;Dfjklwq+kTf1CSpgXCOu%XRO9zkQnpHtT&LUYTN-~lKlyO=n7PDksXebg;B+!!Pr+2YDBSap;o-WPGy6_lu>uA%gQu&X%Q~lo FCIH)Py3YUr literal 0 HcmV?d00001