Mud trap for swamps and tropical swamps
This commit is contained in:
parent
d1aa93b171
commit
ae03058d20
12 changed files with 103 additions and 9 deletions
63
src/java/mmm/materials/MMud.java
Normal file
63
src/java/mmm/materials/MMud.java
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
package mmm.materials;
|
||||||
|
|
||||||
|
|
||||||
|
import mmm.utils.I_UTrapBlock;
|
||||||
|
import mmm.utils.UMaths;
|
||||||
|
import mmm.utils.URegistry;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.SoundType;
|
||||||
|
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.init.Blocks;
|
||||||
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class MMud
|
||||||
|
extends Block
|
||||||
|
implements I_UTrapBlock
|
||||||
|
{
|
||||||
|
private static final AxisAlignedBB MUD_AABB = UMaths.makeBlockAABB( 0 , 0 , 0 , 16 , 15 , 16 );
|
||||||
|
|
||||||
|
|
||||||
|
public MMud( )
|
||||||
|
{
|
||||||
|
super( Material.GROUND );
|
||||||
|
this.setHardness( 0.6f );
|
||||||
|
this.setHarvestLevel( "shovel" , 0 );
|
||||||
|
this.setSoundType( SoundType.GROUND );
|
||||||
|
this.setCreativeTab( CreativeTabs.BUILDING_BLOCKS );
|
||||||
|
URegistry.setIdentifiers( this , "materials" , "trap" , "mud" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBlockState[] getReplacedBlocks( )
|
||||||
|
{
|
||||||
|
return new IBlockState[] {
|
||||||
|
Blocks.DIRT.getDefaultState( ) , Blocks.GRASS.getDefaultState( )
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AxisAlignedBB getCollisionBoundingBox( final IBlockState blockState , final World worldIn ,
|
||||||
|
final BlockPos pos )
|
||||||
|
{
|
||||||
|
return MMud.MUD_AABB;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEntityCollidedWithBlock( final World worldIn , final BlockPos pos , final IBlockState state ,
|
||||||
|
final Entity entityIn )
|
||||||
|
{
|
||||||
|
entityIn.motionX *= .1;
|
||||||
|
entityIn.motionZ *= .1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -34,14 +34,17 @@ public class MQuicksand
|
||||||
this.setHardness( .6f );
|
this.setHardness( .6f );
|
||||||
this.setSoundType( SoundType.SAND );
|
this.setSoundType( SoundType.SAND );
|
||||||
this.setCreativeTab( CreativeTabs.BUILDING_BLOCKS );
|
this.setCreativeTab( CreativeTabs.BUILDING_BLOCKS );
|
||||||
|
this.setHarvestLevel( "shovel" , 0 );
|
||||||
URegistry.setIdentifiers( this , "materials" , "trap" , name );
|
URegistry.setIdentifiers( this , "materials" , "trap" , name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getReplacedBlock( )
|
public IBlockState[] getReplacedBlocks( )
|
||||||
{
|
{
|
||||||
return this.forType;
|
return new IBlockState[] {
|
||||||
|
this.forType
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,15 +11,18 @@ public class MTraps
|
||||||
{
|
{
|
||||||
public final MQuicksand QUICKSAND;
|
public final MQuicksand QUICKSAND;
|
||||||
public final MQuicksand RED_QUICKSAND;
|
public final MQuicksand RED_QUICKSAND;
|
||||||
|
public final MMud MUD;
|
||||||
|
|
||||||
|
|
||||||
MTraps( )
|
MTraps( )
|
||||||
{
|
{
|
||||||
URegistry.addBlock( QUICKSAND = new MQuicksand( "sand" , //
|
// FIXME recipes to convert quicksand into sand or mud into dirt
|
||||||
|
URegistry.addBlock( this.QUICKSAND = new MQuicksand( "sand" , //
|
||||||
Blocks.SAND.getDefaultState( ) //
|
Blocks.SAND.getDefaultState( ) //
|
||||||
.withProperty( BlockSand.VARIANT , BlockSand.EnumType.SAND ) ) );
|
.withProperty( BlockSand.VARIANT , BlockSand.EnumType.SAND ) ) );
|
||||||
URegistry.addBlock( RED_QUICKSAND = new MQuicksand( "red_sand" , //
|
URegistry.addBlock( this.RED_QUICKSAND = new MQuicksand( "red_sand" , //
|
||||||
Blocks.SAND.getDefaultState( ) //
|
Blocks.SAND.getDefaultState( ) //
|
||||||
.withProperty( BlockSand.VARIANT , BlockSand.EnumType.RED_SAND ) ) );
|
.withProperty( BlockSand.VARIANT , BlockSand.EnumType.RED_SAND ) ) );
|
||||||
|
URegistry.addBlock( this.MUD = new MMud( ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,6 @@ import net.minecraft.block.state.IBlockState;
|
||||||
public interface I_UTrapBlock
|
public interface I_UTrapBlock
|
||||||
{
|
{
|
||||||
|
|
||||||
public IBlockState getReplacedBlock( );
|
public IBlockState[] getReplacedBlocks( );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,9 @@ public enum UTrapBlocks {
|
||||||
|
|
||||||
public void register( final I_UTrapBlock block )
|
public void register( final I_UTrapBlock block )
|
||||||
{
|
{
|
||||||
this.replacements.put( block.getReplacedBlock( ) , ( (Block) block ).getDefaultState( ) );
|
for ( IBlockState state : block.getReplacedBlocks( ) ) {
|
||||||
|
this.replacements.put( state , ( (Block) block ).getDefaultState( ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ import net.minecraft.world.gen.feature.WorldGenerator;
|
||||||
|
|
||||||
public class WBTropicalSwamp
|
public class WBTropicalSwamp
|
||||||
extends Biome
|
extends Biome
|
||||||
implements I_WBiomeWithOres
|
implements I_WBiomeWithOres , I_WBTrappedBiome
|
||||||
{
|
{
|
||||||
private static final IBlockState OAK_LOG = Blocks.LOG.getDefaultState( ) //
|
private static final IBlockState OAK_LOG = Blocks.LOG.getDefaultState( ) //
|
||||||
.withProperty( BlockOldLog.VARIANT , BlockPlanks.EnumType.OAK );
|
.withProperty( BlockOldLog.VARIANT , BlockPlanks.EnumType.OAK );
|
||||||
|
@ -173,4 +173,11 @@ public class WBTropicalSwamp
|
||||||
return BlockFlower.EnumFlowerType.BLUE_ORCHID;
|
return BlockFlower.EnumFlowerType.BLUE_ORCHID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getTrapBlockChance( )
|
||||||
|
{
|
||||||
|
return .05f;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,11 +46,12 @@ public class WGTrapBlocks
|
||||||
final int minDepth = Math.max( 0 , worldIn.getSeaLevel( ) - 20 );
|
final int minDepth = Math.max( 0 , worldIn.getSeaLevel( ) - 20 );
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
while ( check.getY( ) > minDepth ) {
|
while ( check.getY( ) > minDepth ) {
|
||||||
final Material material = worldIn.getBlockState( check ).getMaterial( );
|
IBlockState bs = worldIn.getBlockState( check );
|
||||||
|
final Material material = bs.getMaterial( );
|
||||||
if ( material.isLiquid( ) ) {
|
if ( material.isLiquid( ) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ( material != Material.AIR ) {
|
if ( material != Material.AIR && material != Material.WOOD && material != Material.PLANTS ) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"normal": { "model": "mmm:materials/trap/mud" }
|
||||||
|
}
|
||||||
|
}
|
|
@ -76,6 +76,7 @@ tile.mmm.materials.planks.bamboo.name=Bamboo Wood Planks
|
||||||
|
|
||||||
tile.mmm.materials.trap.sand.name=Quicksand
|
tile.mmm.materials.trap.sand.name=Quicksand
|
||||||
tile.mmm.materials.trap.red_sand.name=Red Quicksand
|
tile.mmm.materials.trap.red_sand.name=Red Quicksand
|
||||||
|
tile.mmm.materials.trap.mud.name=Mud
|
||||||
|
|
||||||
|
|
||||||
tile.mmm.tech.base.alloy_furnace.inactive.name=Alloy Furnace
|
tile.mmm.tech.base.alloy_furnace.inactive.name=Alloy Furnace
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:block/cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "mmm:blocks/materials/trap/mud"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "mmm:block/materials/trap/mud"
|
||||||
|
}
|
BIN
src/resources/assets/mmm/textures/blocks/materials/trap/mud.png
Normal file
BIN
src/resources/assets/mmm/textures/blocks/materials/trap/mud.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 422 B |
Reference in a new issue