From 0b9a74c73801219e0d948195e375adf401da6f63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Tue, 12 Jul 2016 22:50:12 +0200 Subject: [PATCH] Smelting recipes for trap blocks --- src/java/mmm/materials/traps/MMud.java | 12 +++++++++++- src/java/mmm/materials/traps/MQuicksand.java | 13 ++++++++++++- src/java/mmm/materials/traps/MSwampPit.java | 10 ++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/java/mmm/materials/traps/MMud.java b/src/java/mmm/materials/traps/MMud.java index 22ff4af..36eef8f 100644 --- a/src/java/mmm/materials/traps/MMud.java +++ b/src/java/mmm/materials/traps/MMud.java @@ -2,6 +2,7 @@ package mmm.materials.traps; import mmm.core.CRegistry; +import mmm.core.api.I_RecipeRegistrar; import mmm.core.api.blocks.I_TrapBlock; import mmm.utils.UMaths; import net.minecraft.block.Block; @@ -11,15 +12,17 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraftforge.fml.common.registry.GameRegistry; public class MMud extends Block - implements I_TrapBlock + implements I_TrapBlock , I_RecipeRegistrar { private static final AxisAlignedBB MUD_AABB = UMaths.makeBlockAABB( 0 , 0 , 0 , 16 , 15 , 16 ); @@ -67,4 +70,11 @@ public class MMud entityIn.motionZ *= .1; } + + @Override + public void registerRecipes( ) + { + GameRegistry.addSmelting( this , new ItemStack( Blocks.DIRT ) , .01f ); + } + } diff --git a/src/java/mmm/materials/traps/MQuicksand.java b/src/java/mmm/materials/traps/MQuicksand.java index 4479377..4b104d9 100644 --- a/src/java/mmm/materials/traps/MQuicksand.java +++ b/src/java/mmm/materials/traps/MQuicksand.java @@ -2,6 +2,7 @@ package mmm.materials.traps; import mmm.core.CRegistry; +import mmm.core.api.I_RecipeRegistrar; import mmm.core.api.blocks.I_TrapBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockFalling; @@ -11,18 +12,20 @@ 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.item.ItemStack; 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; +import net.minecraftforge.fml.common.registry.GameRegistry; public class MQuicksand extends BlockFalling - implements I_TrapBlock + implements I_TrapBlock , I_RecipeRegistrar { public final IBlockState forType; @@ -98,4 +101,12 @@ public class MQuicksand } } + + @Override + public void registerRecipes( ) + { + final Block block = this.forType.getBlock( ); + GameRegistry.addSmelting( this , new ItemStack( block , 1 , block.getMetaFromState( this.forType ) ) , .01f ); + } + } diff --git a/src/java/mmm/materials/traps/MSwampPit.java b/src/java/mmm/materials/traps/MSwampPit.java index 5ac394b..019cd8c 100644 --- a/src/java/mmm/materials/traps/MSwampPit.java +++ b/src/java/mmm/materials/traps/MSwampPit.java @@ -3,6 +3,7 @@ package mmm.materials.traps; import mmm.core.api.blocks.I_TintedBlock; import mmm.core.api.items.I_TintedItem; +import net.minecraft.block.BlockDirt; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IItemColor; @@ -14,6 +15,7 @@ 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.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -85,4 +87,12 @@ public class MSwampPit }; } + + @Override + public void registerRecipes( ) + { + GameRegistry.addSmelting( this , + new ItemStack( Blocks.DIRT , 1 , BlockDirt.DirtType.COARSE_DIRT.getMetadata( ) ) , .01f ); + } + }