Quicksand

This commit is contained in:
Emmanuel BENOîT 2016-07-10 12:56:45 +02:00
parent bba4e3f3b1
commit cffe5b6728
13 changed files with 141 additions and 1 deletions

View file

@ -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;
}
}
}

View file

@ -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 ) ) );
}
}

View file

@ -19,6 +19,7 @@ public class Materials
public static final MTrees TREE; public static final MTrees TREE;
public static final MItems ITEM; public static final MItems ITEM;
public static final MOres ORE; public static final MOres ORE;
public static final MTraps TRAP;
static { static {
ROCK = new MRocks( ); ROCK = new MRocks( );
@ -27,6 +28,7 @@ public class Materials
TREE = new MTrees( ); TREE = new MTrees( );
ITEM = new MItems( ); ITEM = new MItems( );
ORE = new MOres( ); ORE = new MOres( );
TRAP = new MTraps( );
} }

View file

@ -71,7 +71,7 @@ public class World
.setElevation( -.2f , .1f ) // .setElevation( -.2f , .1f ) //
.setWeather( .95f , .95f ) // .setWeather( .95f , .95f ) //
.setWaterColor( 0xe0ffae ) // Same as vanilla swamps .setWaterColor( 0xe0ffae ) // Same as vanilla swamps
.setType( BiomeType.WARM , 3 ) // .setType( BiomeType.WARM , 40 ) // FIXME
.register( ); .register( );
} }

View file

@ -0,0 +1,5 @@
{
"variants": {
"normal": { "model": "mmm:materials/trap/red_sand" }
}
}

View file

@ -0,0 +1,5 @@
{
"variants": {
"normal": { "model": "mmm:materials/trap/sand" }
}
}

View file

@ -74,6 +74,9 @@ tile.mmm.materials.log.bamboo.name=Bamboo
tile.mmm.materials.leaves.bamboo.name=Bamboo Leaves tile.mmm.materials.leaves.bamboo.name=Bamboo Leaves
tile.mmm.materials.planks.bamboo.name=Bamboo Wood Planks 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 tile.mmm.tech.base.alloy_furnace.inactive.name=Alloy Furnace
container.mmm.alloy_furnace.contents=Furnace Contents container.mmm.alloy_furnace.contents=Furnace Contents

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "mmm:blocks/materials/trap/red_sand"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "mmm:blocks/materials/trap/sand"
}
}

View file

@ -0,0 +1,3 @@
{
"parent": "mmm:block/materials/trap/red_sand"
}

View file

@ -0,0 +1,3 @@
{
"parent": "mmm:block/materials/trap/sand"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 B