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 0000000..a5d90cf Binary files /dev/null and b/src/resources/assets/mmm/textures/blocks/materials/trap/red_sand.png differ 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 0000000..4947be1 Binary files /dev/null and b/src/resources/assets/mmm/textures/blocks/materials/trap/sand.png differ