From cffe5b67283cacbc4d14b8063b09d71b3536e698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Sun, 10 Jul 2016 12:56:45 +0200 Subject: [PATCH] Quicksand --- src/java/mmm/materials/MQuicksand.java | 82 ++++++++++++++++++ src/java/mmm/materials/MTraps.java | 25 ++++++ src/java/mmm/materials/Materials.java | 2 + src/java/mmm/world/World.java | 2 +- .../blockstates/materials/trap/red_sand.json | 5 ++ .../mmm/blockstates/materials/trap/sand.json | 5 ++ src/resources/assets/mmm/lang/en_US.lang | 3 + .../models/block/materials/trap/red_sand.json | 6 ++ .../mmm/models/block/materials/trap/sand.json | 6 ++ .../models/item/materials/trap/red_sand.json | 3 + .../mmm/models/item/materials/trap/sand.json | 3 + .../blocks/materials/trap/red_sand.png | Bin 0 -> 794 bytes .../textures/blocks/materials/trap/sand.png | Bin 0 -> 791 bytes 13 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 src/java/mmm/materials/MQuicksand.java create mode 100644 src/java/mmm/materials/MTraps.java create mode 100644 src/resources/assets/mmm/blockstates/materials/trap/red_sand.json create mode 100644 src/resources/assets/mmm/blockstates/materials/trap/sand.json create mode 100644 src/resources/assets/mmm/models/block/materials/trap/red_sand.json create mode 100644 src/resources/assets/mmm/models/block/materials/trap/sand.json create mode 100644 src/resources/assets/mmm/models/item/materials/trap/red_sand.json create mode 100644 src/resources/assets/mmm/models/item/materials/trap/sand.json create mode 100644 src/resources/assets/mmm/textures/blocks/materials/trap/red_sand.png create mode 100644 src/resources/assets/mmm/textures/blocks/materials/trap/sand.png diff --git a/src/java/mmm/materials/MQuicksand.java b/src/java/mmm/materials/MQuicksand.java new file mode 100644 index 0000000..837d200 --- /dev/null +++ b/src/java/mmm/materials/MQuicksand.java @@ -0,0 +1,82 @@ +package mmm.materials; + + +import mmm.utils.URegistry; +import net.minecraft.block.Block; +import net.minecraft.block.BlockFalling; +import net.minecraft.block.SoundType; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.IPlantable; + + + +public class MQuicksand + extends BlockFalling +{ + public final IBlockState forType; + + + public MQuicksand( String name , IBlockState forType ) + { + super( Material.SAND ); + this.forType = forType; + this.setHardness( .6f ); + this.setSoundType( SoundType.SAND ); + this.setCreativeTab( CreativeTabs.BUILDING_BLOCKS ); + URegistry.setIdentifiers( this , "materials" , "trap" , name ); + } + + + @Override + public MapColor getMapColor( IBlockState state ) + { + return this.forType.getMapColor( ); + } + + + @Override + public AxisAlignedBB getCollisionBoundingBox( final IBlockState blockState , final World worldIn , + final BlockPos pos ) + { + return Block.NULL_AABB; + } + + + @Override + public void onEntityCollidedWithBlock( final World worldIn , final BlockPos pos , final IBlockState state , + final Entity entityIn ) + { + entityIn.setInWeb( ); + } + + + @Override + public boolean canSustainPlant( IBlockState state , IBlockAccess world , BlockPos pos , EnumFacing direction , + IPlantable plantable ) + { + switch ( plantable.getPlantType( world , pos.offset( direction ) ) ) { + + case Desert: + return true; + + case Beach: + return world.getBlockState( pos.east( ) ).getMaterial( ) == Material.WATER + || world.getBlockState( pos.west( ) ).getMaterial( ) == Material.WATER + || world.getBlockState( pos.north( ) ).getMaterial( ) == Material.WATER + || world.getBlockState( pos.south( ) ).getMaterial( ) == Material.WATER; + + default: + return false; + } + } + +} diff --git a/src/java/mmm/materials/MTraps.java b/src/java/mmm/materials/MTraps.java new file mode 100644 index 0000000..4ac2568 --- /dev/null +++ b/src/java/mmm/materials/MTraps.java @@ -0,0 +1,25 @@ +package mmm.materials; + + +import mmm.utils.URegistry; +import net.minecraft.block.BlockSand; +import net.minecraft.init.Blocks; + + + +public class MTraps +{ + public final MQuicksand QUICKSAND; + public final MQuicksand RED_QUICKSAND; + + + MTraps( ) + { + URegistry.addBlock( QUICKSAND = new MQuicksand( "sand" , // + Blocks.SAND.getDefaultState( ) // + .withProperty( BlockSand.VARIANT , BlockSand.EnumType.SAND ) ) ); + URegistry.addBlock( RED_QUICKSAND = new MQuicksand( "red_sand" , // + Blocks.SAND.getDefaultState( ) // + .withProperty( BlockSand.VARIANT , BlockSand.EnumType.RED_SAND ) ) ); + } +} diff --git a/src/java/mmm/materials/Materials.java b/src/java/mmm/materials/Materials.java index cf1bab7..4ad84e7 100644 --- a/src/java/mmm/materials/Materials.java +++ b/src/java/mmm/materials/Materials.java @@ -19,6 +19,7 @@ public class Materials public static final MTrees TREE; public static final MItems ITEM; public static final MOres ORE; + public static final MTraps TRAP; static { ROCK = new MRocks( ); @@ -27,6 +28,7 @@ public class Materials TREE = new MTrees( ); ITEM = new MItems( ); ORE = new MOres( ); + TRAP = new MTraps( ); } diff --git a/src/java/mmm/world/World.java b/src/java/mmm/world/World.java index 94e512e..d45bff6 100644 --- a/src/java/mmm/world/World.java +++ b/src/java/mmm/world/World.java @@ -71,7 +71,7 @@ public class World .setElevation( -.2f , .1f ) // .setWeather( .95f , .95f ) // .setWaterColor( 0xe0ffae ) // Same as vanilla swamps - .setType( BiomeType.WARM , 3 ) // + .setType( BiomeType.WARM , 40 ) // FIXME .register( ); } diff --git a/src/resources/assets/mmm/blockstates/materials/trap/red_sand.json b/src/resources/assets/mmm/blockstates/materials/trap/red_sand.json new file mode 100644 index 0000000..5bce288 --- /dev/null +++ b/src/resources/assets/mmm/blockstates/materials/trap/red_sand.json @@ -0,0 +1,5 @@ +{ + "variants": { + "normal": { "model": "mmm:materials/trap/red_sand" } + } +} diff --git a/src/resources/assets/mmm/blockstates/materials/trap/sand.json b/src/resources/assets/mmm/blockstates/materials/trap/sand.json new file mode 100644 index 0000000..d211f5e --- /dev/null +++ b/src/resources/assets/mmm/blockstates/materials/trap/sand.json @@ -0,0 +1,5 @@ +{ + "variants": { + "normal": { "model": "mmm:materials/trap/sand" } + } +} diff --git a/src/resources/assets/mmm/lang/en_US.lang b/src/resources/assets/mmm/lang/en_US.lang index 5dbd437..d40620e 100644 --- a/src/resources/assets/mmm/lang/en_US.lang +++ b/src/resources/assets/mmm/lang/en_US.lang @@ -74,6 +74,9 @@ tile.mmm.materials.log.bamboo.name=Bamboo tile.mmm.materials.leaves.bamboo.name=Bamboo Leaves tile.mmm.materials.planks.bamboo.name=Bamboo Wood Planks +tile.mmm.materials.trap.sand.name=Quicksand +tile.mmm.materials.trap.red_sand.name=Red Quicksand + tile.mmm.tech.base.alloy_furnace.inactive.name=Alloy Furnace container.mmm.alloy_furnace.contents=Furnace Contents diff --git a/src/resources/assets/mmm/models/block/materials/trap/red_sand.json b/src/resources/assets/mmm/models/block/materials/trap/red_sand.json new file mode 100644 index 0000000..a2d8fd5 --- /dev/null +++ b/src/resources/assets/mmm/models/block/materials/trap/red_sand.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "mmm:blocks/materials/trap/red_sand" + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/block/materials/trap/sand.json b/src/resources/assets/mmm/models/block/materials/trap/sand.json new file mode 100644 index 0000000..050f28d --- /dev/null +++ b/src/resources/assets/mmm/models/block/materials/trap/sand.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "mmm:blocks/materials/trap/sand" + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/item/materials/trap/red_sand.json b/src/resources/assets/mmm/models/item/materials/trap/red_sand.json new file mode 100644 index 0000000..68fd854 --- /dev/null +++ b/src/resources/assets/mmm/models/item/materials/trap/red_sand.json @@ -0,0 +1,3 @@ +{ + "parent": "mmm:block/materials/trap/red_sand" +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/item/materials/trap/sand.json b/src/resources/assets/mmm/models/item/materials/trap/sand.json new file mode 100644 index 0000000..6c4c389 --- /dev/null +++ b/src/resources/assets/mmm/models/item/materials/trap/sand.json @@ -0,0 +1,3 @@ +{ + "parent": "mmm:block/materials/trap/sand" +} \ No newline at end of file diff --git a/src/resources/assets/mmm/textures/blocks/materials/trap/red_sand.png b/src/resources/assets/mmm/textures/blocks/materials/trap/red_sand.png new file mode 100644 index 0000000000000000000000000000000000000000..a5d90cf802d5a44316fdc0043030e560a8a89eb4 GIT binary patch literal 794 zcmV+#1LgdQP)3wySf&h zNB#EeqFhfZ3J^=Av6e1o#!|2ftWgvcF&3miOo`3)guib0Oua@HQ^zGov=-*R=JRtP zM2KVJGA2YE9>w=>mteq%=5Bjp)i`FgK`g?&_N*Gi^SNg}RVWg*)l^0^#z3TSe}AM^ zmY5-wLKh=*XEEDLpw60o50w#4Lt;{Ex*;)fhJPM9Hj4@^k=hyNjfSE*hQRM%4#;|9 zLBUn+hy`w@HC}0!-r}{eo;pHIWQ0l#`*Y;qZO5|lI3vjR9C4y}JPmxvyQwi@k9`6k)2-{2G&-)`%3d5LKG!w2Gi#RRR z#^Ec&%otQslu|H7@#Qhl_mLkz%sBQ5?=>M65^(A|PGi8_?s^uDL;6gYBL%3n;prSu z8obebx;?OLEmJ4#az-l%DKl>zax<%_l<@KHNNX&oF0!0dw2i?l&AP2vPaU(?ug4Zyz?IXJ`^23{kkTQSYy^xFIX*VL@ zT(t~2@p_KDf8#+EITy6R%kjeQ6w$d*Qs(35BegcnjU^{o%_`(LMjC5~rSQksj_#7c zYPw70r_GG3%CPhfZw+m2u(og*N7i$X6ouHL*bj+HG^<)@L{I@Lt9iWyUiu3UecIbHkH>-k Y0l6kx2i;bgNdN!<07*qoM6N<$f;8u7BLDyZ literal 0 HcmV?d00001 diff --git a/src/resources/assets/mmm/textures/blocks/materials/trap/sand.png b/src/resources/assets/mmm/textures/blocks/materials/trap/sand.png new file mode 100644 index 0000000000000000000000000000000000000000..4947be17997716104507ab612f2d33a20a255dcf GIT binary patch literal 791 zcmV+y1L*vTP)^jv^j8 zk{B71upxskVxuwE&G_y8J*VyB<#;^L^ZR<9R~eCEw5%nZnL*S_)9BbMs1~P@PmRIK zPoY(R2iu&7mG#0Y`BBd;;P!hSCx^qR$R^$?>>#X6ju_`vBJ5Qj_8$l@` z`oAYnr?Mu`tTB$X;WAQ%nVds>e-QoiFcR^XP-(5evF5d`QSI|ud|$O!z-;VXQ0!dy zw#CX(ZLhRLc5jpA{3EW z(5bFTx&)#Bi^dY}ZVudB4&7j>j`?t6{a#9dRI{=u3cj9&^%&RDEQX|zjQqcpngagh z5!-zx>uBP$3(6`rQqAZc0J`5xdxCvSWj5;bOSQkbqgyE?>8bebWV5&`b+dfJlvTb=3=vGKwQAaO7vo*5h& zxm0|Y-&z@d$3+znbK2V)fZ`Uih`zsFZc0e`q+a2wACZrbVMK@S!MxH$`6SFHMkEi_ zumX}MH*#zBkra`EfH&O(N&Lr^dmm`GZTs)1wvJL_*1Zdso~Nm0XEbV~5Y!*sJ8-7= z;W+k6FWMsZwg>(