From 5a7d099413e7fbbb99fe34117814795ef960d4e6 Mon Sep 17 00:00:00 2001 From: shartte Date: Sun, 14 Aug 2016 13:27:36 +0200 Subject: [PATCH] Added active state for vibration chamber and corresponding models. (#40) --- .../block/misc/BlockVibrationChamber.java | 24 +++++++++++++++++- .../tile.BlockVibrationChamber.json | 6 +++++ .../block/tile.BlockVibrationChamber.off.json | 9 +++++++ .../block/tile.BlockVibrationChamber.on.json | 6 +++++ .../item/tile.BlockVibrationChamber.json | 3 +++ .../textures/blocks/BlockVibrationChamber.png | Bin 0 -> 442 bytes .../blocks/BlockVibrationChamberFront.png | Bin 0 -> 548 bytes .../blocks/BlockVibrationChamberFrontOn.png | Bin 0 -> 579 bytes 8 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/assets/appliedenergistics2/blockstates/tile.BlockVibrationChamber.json create mode 100644 src/main/resources/assets/appliedenergistics2/models/block/tile.BlockVibrationChamber.off.json create mode 100644 src/main/resources/assets/appliedenergistics2/models/block/tile.BlockVibrationChamber.on.json create mode 100644 src/main/resources/assets/appliedenergistics2/models/item/tile.BlockVibrationChamber.json create mode 100644 src/main/resources/assets/appliedenergistics2/textures/blocks/BlockVibrationChamber.png create mode 100644 src/main/resources/assets/appliedenergistics2/textures/blocks/BlockVibrationChamberFront.png create mode 100644 src/main/resources/assets/appliedenergistics2/textures/blocks/BlockVibrationChamberFrontOn.png diff --git a/src/main/java/appeng/block/misc/BlockVibrationChamber.java b/src/main/java/appeng/block/misc/BlockVibrationChamber.java index 4da37d99d..9dacb715d 100644 --- a/src/main/java/appeng/block/misc/BlockVibrationChamber.java +++ b/src/main/java/appeng/block/misc/BlockVibrationChamber.java @@ -21,10 +21,11 @@ package appeng.block.misc; import java.util.EnumSet; import java.util.Random; - import javax.annotation.Nullable; import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -32,6 +33,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import appeng.api.util.AEPartLocation; @@ -47,12 +49,32 @@ import appeng.util.Platform; public final class BlockVibrationChamber extends AEBaseTileBlock { + // Indicates that the vibration chamber is currently working + private static final PropertyBool ACTIVE = PropertyBool.create( "active" ); + public BlockVibrationChamber() { super( Material.IRON ); this.setTileEntity( TileVibrationChamber.class ); this.setHardness( 4.2F ); this.setFeature( EnumSet.of( AEFeature.PowerGen ) ); + this.setDefaultState( getDefaultState().withProperty( ACTIVE, false ) ); + } + + @Override + public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos ) + { + TileVibrationChamber te = this.getTileEntity( world, pos ); + boolean active = te != null && te.isOn; + + return super.getActualState( state, world, pos ) + .withProperty( ACTIVE, active ); + } + + @Override + protected IProperty[] getAEStates() + { + return new IProperty[]{ AE_BLOCK_FORWARD, AE_BLOCK_UP, ACTIVE }; } @Override diff --git a/src/main/resources/assets/appliedenergistics2/blockstates/tile.BlockVibrationChamber.json b/src/main/resources/assets/appliedenergistics2/blockstates/tile.BlockVibrationChamber.json new file mode 100644 index 000000000..676b9081d --- /dev/null +++ b/src/main/resources/assets/appliedenergistics2/blockstates/tile.BlockVibrationChamber.json @@ -0,0 +1,6 @@ +{ + "variants": { + "active=false": { "model": "appliedenergistics2:tile.BlockVibrationChamber.off" }, + "active=true": { "model": "appliedenergistics2:tile.BlockVibrationChamber.on" } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/appliedenergistics2/models/block/tile.BlockVibrationChamber.off.json b/src/main/resources/assets/appliedenergistics2/models/block/tile.BlockVibrationChamber.off.json new file mode 100644 index 000000000..7901c0b88 --- /dev/null +++ b/src/main/resources/assets/appliedenergistics2/models/block/tile.BlockVibrationChamber.off.json @@ -0,0 +1,9 @@ +{ + "parent": "appliedenergistics2:block/cube/cube_AE_machine", + "textures": { + "front": "appliedenergistics2:blocks/BlockVibrationChamberFront", + "side": "appliedenergistics2:blocks/BlockVibrationChamber", + "top": "appliedenergistics2:blocks/BlockVibrationChamber", + "bottom": "appliedenergistics2:blocks/BlockVibrationChamber" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/appliedenergistics2/models/block/tile.BlockVibrationChamber.on.json b/src/main/resources/assets/appliedenergistics2/models/block/tile.BlockVibrationChamber.on.json new file mode 100644 index 000000000..4c1e37767 --- /dev/null +++ b/src/main/resources/assets/appliedenergistics2/models/block/tile.BlockVibrationChamber.on.json @@ -0,0 +1,6 @@ +{ + "parent": "appliedenergistics2:block/tile.BlockVibrationChamber.off", + "textures": { + "front": "appliedenergistics2:blocks/BlockVibrationChamberFrontOn" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/appliedenergistics2/models/item/tile.BlockVibrationChamber.json b/src/main/resources/assets/appliedenergistics2/models/item/tile.BlockVibrationChamber.json new file mode 100644 index 000000000..19fd2abbc --- /dev/null +++ b/src/main/resources/assets/appliedenergistics2/models/item/tile.BlockVibrationChamber.json @@ -0,0 +1,3 @@ +{ + "parent": "appliedenergistics2:block/tile.BlockVibrationChamber.off" +} \ No newline at end of file diff --git a/src/main/resources/assets/appliedenergistics2/textures/blocks/BlockVibrationChamber.png b/src/main/resources/assets/appliedenergistics2/textures/blocks/BlockVibrationChamber.png new file mode 100644 index 0000000000000000000000000000000000000000..4381c6f139288b436aa668428157dd71a2d99d9a GIT binary patch literal 442 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7SkfJR9T^xl_H+M9WMyDr z;4JWnEM{QfTL!|6?RQq@GcYhnmAFQf1m~xflqVLYG6W=M=9TFAxrQi|8S9zq85+8O zb~0yRU^Me|aSXBWkDctvcf^2$<@1`DMKPP+2VVPM-x8>}wSA`Z@dn?^3F@am-#N8u z%OVY)*`~MNB)T8@Ea?{-YSyN8uyt~UPq)Cn9G3l^??zJklc z&g^;MRE{ZUmc=bv_4=2I@PWE251vQ+l}rT txFcijeqlYGB7YOc)I$ztaD0e0sy*7tndH; literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/appliedenergistics2/textures/blocks/BlockVibrationChamberFront.png b/src/main/resources/assets/appliedenergistics2/textures/blocks/BlockVibrationChamberFront.png new file mode 100644 index 0000000000000000000000000000000000000000..0ec54535154709b2543e252c9685c2530cf5d22d GIT binary patch literal 548 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7SkfJR9T^xl_H+M9WMyDr z;4JWnEM{QfTL!|6?RQq@GcYhnmAFQf1m~xflqVLYG6W=M=9TFAxrQi|8S9zq85+8O zb~0yRU|ito;uvD#A3Mo?-Jt}Ymd(!u?kKo7UQk@1^I~p*P!~gC$>RJ8i}!5b@bBP_ z$CB2Li!W}tn2}N_BfaDP`~L?$Cvlk1KKtnFFO4o83BGnSx&GYkw{O<%-~P2KxBc+J zw9PYpmj`=az9QG(Zad%qcHVZg`RCtO*xY(qBIIcx!80XBZ@SXW9J4H?0|J3Q!P8O? zegAzoZ~JVKQ%o#JvbF|Y{#g^o>{X$-tTFB0>#wUOw8pJpE-xauA(`2F`e|4F-X{vq zl1FYh)?Rp7GUda`6$=_4nE#vjPAuTV&zd)1tN!X-$=cd9F-h&h372n^p6~pWcku1U zr2PR7%A7SDW7jlJJh}9Q;Y4F6zX|+5nu`}UG<@Hyl#b^9I z*RMOUO;N*NOZZPX8{_>Bjv1$%B6vEpwyrub|8dyr(1h>-SP~_)6w1yl zm2p16_rq+(L{=3gd8WAIPdG&a-1`!Ynip$q(wDmR|Ga+1d=mx+1_n=8KbLh*2~7YY CZtfNU literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/appliedenergistics2/textures/blocks/BlockVibrationChamberFrontOn.png b/src/main/resources/assets/appliedenergistics2/textures/blocks/BlockVibrationChamberFrontOn.png new file mode 100644 index 0000000000000000000000000000000000000000..9257adb779b6f2cc136eb4f277f69374cb1b0d26 GIT binary patch literal 579 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7SkfJR9T^xl_H+M9WMyDr z;4JWnEM{QfTL!|6?RQq@GcYhnmAFQf1m~xflqVLYG6W=M=9TFAxrQi|8S9zq85+8O zb~0yRVBGKN;uvD#pE@ZrkI9k8<#&_8o7F!O?n{1iZLo-);(AJTQcUubGpm=mcYR9S zs`;j9s_nV}jfmZMx20{)eDbyGum8Q5B~!$^kG|pk8YnU|du!CSw`I8-BW@J!-14#{ zYxUJrY|V{df7fl&))FyY%+ID-bRKOu_Ltc~5a{cbDI#;qx|1Rigkd?l1^KDsG zCQCC0m_ZQ7xBmV@VuJ2x>q&MMZ7TgSj?{owWjH?avFH5?Vre0~cWtPGk? f^7Jh_QO6kh*DUw`2cNAB3=9mOu6{1-oD!M<{ju^> literal 0 HcmV?d00001