From b4508abb4a8c48d56d1c9132d5f57c9470c0717c Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 13 Nov 2018 01:27:47 +0100 Subject: [PATCH] finished the aura field creator --- .../naturesaura/blocks/BlockFieldCreator.java | 46 ++++++++++-- .../blocks/tiles/TileEntityFieldCreator.java | 8 +- .../blockstates/field_creator.json | 16 ++++ .../assets/naturesaura/lang/en_US.lang | 1 + .../models/block/field_creator.json | 69 ++++++++++++++++++ .../en_us/entries/using/field_creator.json | 25 +++++++ .../naturesaura/recipes/field_creator.json | 30 ++++++++ .../textures/blocks/field_creator.png | Bin 0 -> 284 bytes .../textures/blocks/field_creator_center.png | Bin 0 -> 256 bytes 9 files changed, 185 insertions(+), 10 deletions(-) create mode 100644 src/main/resources/assets/naturesaura/blockstates/field_creator.json create mode 100644 src/main/resources/assets/naturesaura/models/block/field_creator.json create mode 100644 src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/using/field_creator.json create mode 100644 src/main/resources/assets/naturesaura/recipes/field_creator.json create mode 100644 src/main/resources/assets/naturesaura/textures/blocks/field_creator.png create mode 100644 src/main/resources/assets/naturesaura/textures/blocks/field_creator_center.png diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java index 27538ff1..4e2b71a8 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java @@ -5,14 +5,17 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.blocks.tiles.TileEntityFieldCreator; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; +import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -76,15 +79,46 @@ public class BlockFieldCreator extends BlockContainerImpl { BlockPos connected = creator.getConnectedPos(); if (connected != null) NaturesAuraAPI.instance().spawnParticleStream( - pos.getX() + rand.nextFloat(), - pos.getY() + rand.nextFloat(), - pos.getZ() + rand.nextFloat(), - connected.getX() + rand.nextFloat(), - connected.getY() + rand.nextFloat(), - connected.getZ() + rand.nextFloat(), + pos.getX() + 0.25F + rand.nextFloat() * 0.5F, + pos.getY() + 0.25F + rand.nextFloat() * 0.5F, + pos.getZ() + 0.25F + rand.nextFloat() * 0.5F, + connected.getX() + 0.25F + rand.nextFloat() * 0.5F, + connected.getY() + 0.25F + rand.nextFloat() * 0.5F, + connected.getZ() + 0.25F + rand.nextFloat() * 0.5F, 0.65F, 0x4245f4, 1F ); } } } + + @Override + @SideOnly(Side.CLIENT) + public BlockRenderLayer getRenderLayer() { + return BlockRenderLayer.CUTOUT; + } + + @Override + public boolean isFullCube(IBlockState state) { + return false; + } + + @Override + public boolean isOpaqueCube(IBlockState state) { + return false; + } + + @Override + public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) { + return false; + } + + @Override + public boolean isSideSolid(IBlockState baseState, IBlockAccess world, BlockPos pos, EnumFacing side) { + return false; + } + + @Override + public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { + return BlockFaceShape.UNDEFINED; + } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFieldCreator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFieldCreator.java index 9ced3c8a..55b0d4e7 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFieldCreator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFieldCreator.java @@ -37,7 +37,7 @@ public class TileEntityFieldCreator extends TileEntityImpl implements ITickable return; BlockPos connectedPos = this.getConnectedPos(); - if (connectedPos == null) + if (connectedPos == null || !this.world.isBlockLoaded(connectedPos)) return; TileEntity other = this.world.getTileEntity(connectedPos); @@ -136,9 +136,9 @@ public class TileEntityFieldCreator extends TileEntityImpl implements ITickable p.getX() + (float) this.world.rand.nextGaussian() * 3F, p.getY() + 1 + this.world.rand.nextFloat() * 3F, p.getZ() + (float) this.world.rand.nextGaussian() * 3F, - p.getX() + this.world.rand.nextFloat(), - p.getY() + this.world.rand.nextFloat(), - p.getZ() + this.world.rand.nextFloat(), + p.getX() + 0.5F, + p.getY() + 0.5F, + p.getZ() + 0.5F, this.world.rand.nextFloat() * 0.07F + 0.07F, IAuraType.forWorld(this.world).getColor(), this.world.rand.nextFloat() + 0.5F )); } diff --git a/src/main/resources/assets/naturesaura/blockstates/field_creator.json b/src/main/resources/assets/naturesaura/blockstates/field_creator.json new file mode 100644 index 00000000..f7f363eb --- /dev/null +++ b/src/main/resources/assets/naturesaura/blockstates/field_creator.json @@ -0,0 +1,16 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "naturesaura:field_creator", + "textures": { + "texture": "naturesaura:blocks/field_creator", + "center": "naturesaura:blocks/field_creator_center", + "particle": "#texture" + }, + "transform": "forge:default-block" + }, + "variants": { + "normal": [{}], + "inventory": [{}] + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/lang/en_US.lang b/src/main/resources/assets/naturesaura/lang/en_US.lang index 9b94ad16..83cf5d6c 100644 --- a/src/main/resources/assets/naturesaura/lang/en_US.lang +++ b/src/main/resources/assets/naturesaura/lang/en_US.lang @@ -28,6 +28,7 @@ tile.naturesaura.infused_brick_slab_double.name=Infused Brick Double Slab tile.naturesaura.flower_generator.name=Herbivorous Absorber tile.naturesaura.placer.name=Imperceptible Builder tile.naturesaura.hopper_upgrade.name=Hopper Enhancement +tile.naturesaura.field_creator.name=Aura Field Creator item.naturesaura.eye.name=Environmental Eye item.naturesaura.gold_fiber.name=Brilliant Fiber diff --git a/src/main/resources/assets/naturesaura/models/block/field_creator.json b/src/main/resources/assets/naturesaura/models/block/field_creator.json new file mode 100644 index 00000000..63bc38f4 --- /dev/null +++ b/src/main/resources/assets/naturesaura/models/block/field_creator.json @@ -0,0 +1,69 @@ +{ + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "down": { + "uv": [0, 0, 16, 16], + "texture": "#texture", + "cullface": "down" + }, + "up": { + "uv": [0, 0, 16, 16], + "texture": "#texture", + "cullface": "up" + }, + "north": { + "uv": [0, 0, 16, 16], + "texture": "#texture", + "cullface": "north" + }, + "south": { + "uv": [0, 0, 16, 16], + "texture": "#texture", + "cullface": "south" + }, + "west": { + "uv": [0, 0, 16, 16], + "texture": "#texture", + "cullface": "west" + }, + "east": { + "uv": [0, 0, 16, 16], + "texture": "#texture", + "cullface": "east" + } + } + }, { + "from": [5, 5, 5], + "to": [11, 11, 11], + "faces": { + "down": { + "uv": [0, 0, 6, 6], + "texture": "#center" + }, + "up": { + "uv": [0, 0, 6, 6], + "texture": "#center" + }, + "north": { + "uv": [0, 0, 6, 6], + "texture": "#center" + }, + "south": { + "uv": [0, 0, 6, 6], + "texture": "#center" + }, + "west": { + "uv": [0, 0, 6, 6], + "texture": "#center" + }, + "east": { + "uv": [0, 0, 6, 6], + "texture": "#center" + } + } + } + ] +} diff --git a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/using/field_creator.json b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/using/field_creator.json new file mode 100644 index 00000000..60f8eda3 --- /dev/null +++ b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/using/field_creator.json @@ -0,0 +1,25 @@ +{ + "name": "Aura Field Creator", + "icon": "naturesaura:field_creator", + "category": "using", + "advancement": "naturesaura:aura_bottle_end", + "pages": [ + { + "type": "text", + "text": "One of the two activities mostly done by humans is $(thing)breaking$() blocks. This requires quite a bit of strengh and effort, and, if done for long amounts of time, can become quite tiring.$(br)The $(item)Aura Field Creator$() creates a dense field of moving $(aura) that is strong enough for it to $(thing)destroy blocks$() within it." + }, + { + "type": "text", + "text": "To set up a field like this, two $(item)Aura Field Creators$() need to be placed a couple of blocks apart. Then, interacting with one of them while sneaking and interacting with the other while not sneaking will cause a connection between the two to form.$(br)Once supplying one of them with a $(thing)redstone signal$(), and after a short channel time, the field will be created between the two, allowing any blocks being placed there to be broken and their items being dropped into the world." + }, + { + "type":"text", + "text":"Of course, breaking blocks and especially the initial channel time will require a bit of $(aura) from the environment. Additionally, while the field is active, a small amount is consumed as a sort of upkeep cost." + }, + { + "type": "crafting", + "text": "Creating two $(item)Aura Field Creators$()", + "recipe": "naturesaura:field_creator" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/recipes/field_creator.json b/src/main/resources/assets/naturesaura/recipes/field_creator.json new file mode 100644 index 00000000..8d5423a7 --- /dev/null +++ b/src/main/resources/assets/naturesaura/recipes/field_creator.json @@ -0,0 +1,30 @@ +{ + "type": "forge:ore_shaped", + "pattern": [ + "GIG", + "GPG", + "GEG" + ], + "key": { + "G": { + "item": "minecraft:glass" + }, + "I": { + "item": "naturesaura:infused_iron" + }, + "P": { + "item": "minecraft:piston" + }, + "E": { + "type": "minecraft:item_nbt", + "item": "naturesaura:aura_bottle", + "nbt": { + "stored_type": "naturesaura:end" + } + } + }, + "result": { + "item": "naturesaura:field_creator", + "count": 2 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/textures/blocks/field_creator.png b/src/main/resources/assets/naturesaura/textures/blocks/field_creator.png new file mode 100644 index 0000000000000000000000000000000000000000..6a753920784d75bf9f8049c4f89ed981203ba5cb GIT binary patch literal 284 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b z3=G`dAk3J{(y|>W$X?><>&kwYOO#(mTEq9`MWB#GiEBhjaDG}zd16s2LqTF@UWr~_ zYKel0o}r$JutUZXpqh417sn6_|G5)x^Bz#(aJ^eUSMPzy--hjOZQPYZ(ZE(yV_4@gTwoT^lR_$+%;)xP3J4z;-cFZ z@`|(Xme8MD2L!lvI6;>1s;*b z3=G`dAk3J{(y|>W$X?><>&kwYOO#(mTEq9`MWB#GiEBhjaDG}zd16s2LqTF@UWr~_ zYKel0o}r$JutUZXpqgw?7sn6_|EXsTxf%=vTrTdNu3#p2{+yTh!9&~?duFhNmHce% z`7kR#E!Xb7i0|#GpVDpbF{geJmERU2)Au^?XuIxyW;?lQw*MbHhVcKmaQqUZlsCJE gmH|5a=KYOfq4w+C1OMA~fz~p3y85}Sb4q9e05R52#Q*>R literal 0 HcmV?d00001