diff --git a/src/java/mmm/materials/MSwampPit.java b/src/java/mmm/materials/MSwampPit.java new file mode 100644 index 0000000..7531bad --- /dev/null +++ b/src/java/mmm/materials/MSwampPit.java @@ -0,0 +1,88 @@ +package mmm.materials; + + +import mmm.utils.I_UTintedBlock; +import mmm.utils.I_UTintedItem; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.color.IBlockColor; +import net.minecraft.client.renderer.color.IItemColor; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.ColorizerGrass; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.biome.BiomeColorHelper; +import net.minecraftforge.common.IPlantable; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + + + +public class MSwampPit + extends MQuicksand + implements I_UTintedBlock , I_UTintedItem +{ + + public MSwampPit( ) + { + super( "swamp_pit" , Blocks.GRASS.getDefaultState( ) ); + } + + + @Override + public IBlockState[] getReplacedBlocks( ) + { + return new IBlockState[] { + this.forType , Blocks.DIRT.getDefaultState( ) + }; + } + + + @Override + public boolean canSustainPlant( IBlockState state , IBlockAccess world , BlockPos pos , EnumFacing direction , + IPlantable plantable ) + { + return false; + } + + + @Override + @SideOnly( Side.CLIENT ) + public IBlockColor getBlockTint( ) + { + return new IBlockColor( ) { + + @Override + public int colorMultiplier( final IBlockState state , final IBlockAccess worldIn , final BlockPos pos , + final int tintIndex ) + { + final boolean inWorld = worldIn != null && pos != null; + final int baseTint = inWorld + ? BiomeColorHelper.getGrassColorAtPos( worldIn , pos ) + : ColorizerGrass.getGrassColor( .5f , .5f ); + return baseTint; + } + + }; + } + + + @Override + @SideOnly( Side.CLIENT ) + public IItemColor getItemTint( ) + { + final IBlockColor bTint = this.getBlockTint( ); + final IBlockState ds = this.getDefaultState( ); + return new IItemColor( ) { + + @Override + public int getColorFromItemstack( final ItemStack stack , final int tintIndex ) + { + return bTint.colorMultiplier( ds , null , null , tintIndex ); + } + + }; + } + +} diff --git a/src/java/mmm/materials/MTraps.java b/src/java/mmm/materials/MTraps.java index 6f1b2df..7ddd265 100644 --- a/src/java/mmm/materials/MTraps.java +++ b/src/java/mmm/materials/MTraps.java @@ -11,6 +11,7 @@ public class MTraps { public final MQuicksand QUICKSAND; public final MQuicksand RED_QUICKSAND; + public final MSwampPit SWAMP_PIT; public final MMud MUD; @@ -23,6 +24,7 @@ public class MTraps URegistry.addBlock( this.RED_QUICKSAND = new MQuicksand( "red_sand" , // Blocks.SAND.getDefaultState( ) // .withProperty( BlockSand.VARIANT , BlockSand.EnumType.RED_SAND ) ) ); + URegistry.addBlock( this.SWAMP_PIT = new MSwampPit( ) ); URegistry.addBlock( this.MUD = new MMud( ) ); } } diff --git a/src/resources/assets/mmm/blockstates/materials/trap/swamp_pit.json b/src/resources/assets/mmm/blockstates/materials/trap/swamp_pit.json new file mode 100644 index 0000000..57c5d4d --- /dev/null +++ b/src/resources/assets/mmm/blockstates/materials/trap/swamp_pit.json @@ -0,0 +1,5 @@ +{ + "variants": { + "normal": { "model": "mmm:materials/trap/swamp_pit" } + } +} diff --git a/src/resources/assets/mmm/models/block/materials/trap/swamp_pit.json b/src/resources/assets/mmm/models/block/materials/trap/swamp_pit.json new file mode 100644 index 0000000..0632966 --- /dev/null +++ b/src/resources/assets/mmm/models/block/materials/trap/swamp_pit.json @@ -0,0 +1,21 @@ +{ + "parent": "minecraft:block/grass", + "textures": { + "particle": "minecraft:blocks/dirt", + "all": "mmm:blocks/materials/trap/swamp_pit" + } , + "elements": [ + { + "from": [ 0, 0, 0 ], + "to": [ 16, 16, 16 ], + "faces": { + "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#all", "cullface": "down", "tintindex": 0 }, + "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#all", "cullface": "up", "tintindex": 0 }, + "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#all", "cullface": "north", "tintindex": 0 }, + "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#all", "cullface": "south", "tintindex": 0 }, + "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#all", "cullface": "west", "tintindex": 0 }, + "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#all", "cullface": "east", "tintindex": 0 } + } + } + ] +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/item/materials/trap/swamp_pit.json b/src/resources/assets/mmm/models/item/materials/trap/swamp_pit.json new file mode 100644 index 0000000..96df940 --- /dev/null +++ b/src/resources/assets/mmm/models/item/materials/trap/swamp_pit.json @@ -0,0 +1,3 @@ +{ + "parent": "mmm:block/materials/trap/swamp_pit" +} \ No newline at end of file diff --git a/src/resources/assets/mmm/textures/blocks/materials/trap/swamp_pit.png b/src/resources/assets/mmm/textures/blocks/materials/trap/swamp_pit.png new file mode 100644 index 0000000..049004d Binary files /dev/null and b/src/resources/assets/mmm/textures/blocks/materials/trap/swamp_pit.png differ