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 4da37d99..9dacb715 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 00000000..676b9081 --- /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 00000000..7901c0b8 --- /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 00000000..4c1e3776 --- /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 00000000..19fd2abb --- /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 zcmV;r0Y(0aP)N2bPDNB8 zb~7$DE-^7j^FlWO00A~hL_t(IPhFEq4#Y4B1oNz1qFl1?QP%%|gi#^2hnYjifKAh2 zC(HBP%CfYgC=8o5+U#LR#Pbym3^K>Y_EQ`(a>_iz%ZQDAO zEHVJex~@Msj>GnScNN}3-}gTxRES_71thaV0K5fQ2&y7B3DY#$wr#!&B9!k6_$XP` zbPzy@Tmk=mUq@;|1owS=5>g=os2~Z%IY5?Lh!xcah{-Av;R?8luIo||8zQa=K*AcU zqZIfxB7+K200Fl_Vg!lL^EfDk?=A4rgApL$!EmKan;1TQU)Pn82sogjspqH)NIo{_ zQI!ak%%)zVs_XhR6Tp6YNDSh?BFR8KD^dFppeFqb1gXX>=#`%fpIIN2bPDNB8 zb~7$DE-^7j^FlWO00E#$L_t(IPhFBnuEJmpgtO)l+#pAR&>^5K=$%j!iU4tRqi>L- zytlCa!Pw&&J3*t-u+eB_aU2`C-|zpyNs7TpHJIvw>F>8?RY%e>2wlFFc=J!TrQU)*=#myBES$)OjDL+ z!uR{#Znv8h$^rz$YPC|+`FvIbN_Zirfo9(8^{SACUazMg6cMmv13Q2#Fv$*7=#;5Yt}?iNt+`F!m4di^ZaYPEuqVkXeYMD~*Bx$pgGMQ+3Wd-G_-EOzQ)W6?v?M6EwfuF@#VHhePcFd(5L%N2bPDNB8 zb~7$DE-^7j^FlWO00F;AL_t(IPi2x>ZUR9JMEim;?5p@--x>BrfH+;0Mam_TTw~~fVou23jgyWO^CvuWh@di_t{>2#DAi^c2>^-&a=YqeU|?RIUkSlDv8 zwCQwetJTT|gMsz?eT(DRE|-g4uUDJT=QbP;ZM|OGX0s8AYcv`H$K$a`X0w@^2y%!h zrfI+5D?gvlb~>G;P!=E{CXTpooAS8`#2i+ literal 0 HcmV?d00001