Started working on new materials

+ iron nuggets
+ copper ore
This commit is contained in:
Emmanuel BENOîT 2016-06-15 20:45:36 +02:00
parent 04b59c76e0
commit c9c0a6e31e
13 changed files with 262 additions and 6 deletions

View file

@ -3,14 +3,18 @@ Part ASM? Description
deco No Armchairs deco No Armchairs
deco No Thrones deco No Thrones
------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------
plants No Tomatoes plants No? Tomatoes
plants No Turnips plants No? Turnips
plants No Cabbages plants No? Cabbages
plants No Zucchinis plants No? Zucchinis
plants No Sweet pepper plants No? Sweet pepper
plants No Eggplant plants No? Eggplant
plants No? Strawberries
------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------
ores ??? Rock salt ores ??? Rock salt
ores ??? Native copper (copper)
ores ??? Malachite (copper)
ores ??? Cuprite (copper)
------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------
animals ??? Goats animals ??? Goats
------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------

BIN
ore.xcf Normal file

Binary file not shown.

View file

@ -0,0 +1,155 @@
package mmm.materials;
import java.util.Random;
import javax.annotation.Nullable;
import mmm.utils.URegistry;
import net.minecraft.block.Block;
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.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class DOre
extends Block
{
private int dropMin , dropMax;
private Item dropItems;
private int dropMeta;
private int expMin , expMax;
public DOre( final String name , final int harvestLevel )
{
this( name , harvestLevel , Material.ROCK.getMaterialMapColor( ) );
}
public DOre( final String name , final int harvestLevel , final MapColor color )
{
super( Material.ROCK , color );
this.setCreativeTab( CreativeTabs.BUILDING_BLOCKS );
this.setSoundType( SoundType.STONE );
this.setHardness( 3.0f );
this.setResistance( 5.0f );
this.setHarvestLevel( "pickaxe" , harvestLevel );
URegistry.setIdentifiers( this , "materials" , "ores" , name );
this.dropMin = this.dropMax = 1;
this.expMin = this.expMax = 0;
}
public DOre setDrops( final Item item )
{
return this.setDrops( item , 0 , 1 , 1 );
}
public DOre setDrops( final Item item , final int meta )
{
return this.setDrops( item , meta , 1 , 1 );
}
public DOre setDrops( final Item item , final int dropMin , final int dropMax )
{
return this.setDrops( item , 0 , dropMin , dropMax );
}
public DOre setDrops( final Item item , final int meta , final int dropMin , final int dropMax )
{
assert dropMin <= dropMax;
assert dropMin > 0;
this.dropMin = dropMin;
this.dropMax = dropMax;
this.dropItems = item;
this.dropMeta = meta;
return this;
}
public DOre setExperience( final int value )
{
return this.setExperience( value , value );
}
public DOre setExperience( final int min , final int max )
{
assert min <= max;
assert min >= 0;
this.expMin = min;
this.expMax = max;
return this;
}
@Override
@Nullable
public Item getItemDropped( final IBlockState state , final Random rand , final int fortune )
{
return this.dropItems == null ? Item.getItemFromBlock( this ) : this.dropItems;
}
@Override
public int damageDropped( final IBlockState state )
{
return this.dropItems == null ? 0 : this.dropMeta;
}
@Override
public int quantityDropped( final Random random )
{
if ( this.dropMax == this.dropMin ) {
return this.dropMin;
}
return this.dropMin + random.nextInt( 1 + this.dropMax - this.dropMin );
}
@Override
public int quantityDroppedWithBonus( final int fortune , final Random random )
{
int dropped = this.quantityDropped( random );
if ( fortune > 0 && this.dropItems != null ) {
dropped += Math.max( 0 , random.nextInt( fortune + 2 ) - 1 );
}
return dropped;
}
@Override
public int getExpDrop( final IBlockState state , final IBlockAccess world , final BlockPos pos , final int fortune )
{
final Random rand = world instanceof World ? ( (World) world ).rand : Block.RANDOM;
if ( this.dropItems != null ) {
if ( this.expMin == this.expMax ) {
return this.expMin;
}
return MathHelper.getRandomIntegerInRange( rand , this.expMin , this.expMax );
}
return 0;
}
@Override
public ItemStack getItem( final World worldIn , final BlockPos pos , final IBlockState state )
{
return new ItemStack( this );
}
}

View file

@ -0,0 +1,21 @@
package mmm.materials;
import mmm.utils.URegistry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
public class MItem
extends Item
{
public MItem( String name )
{
super( );
this.setCreativeTab( CreativeTabs.MATERIALS );
URegistry.setIdentifiers( this , "materials" , name );
}
}

View file

@ -0,0 +1,48 @@
package mmm.materials;
import mmm.utils.I_URecipeRegistrar;
import mmm.utils.URegistry;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class Materials
implements I_URecipeRegistrar
{
public static final DOre ORE_COPPER;
public static final MItem NUGGET_IRON;
static {
URegistry.addBlock( ORE_COPPER = new DOre( "copper" , 1 ) );
URegistry.addItem( NUGGET_IRON = new MItem( "iron_nugget" ) );
URegistry.addRecipeRegistrar( new Materials( ) );
}
public static void preInit( )
{
// EMPTY
}
private Materials( )
{
// EMPTY
}
@Override
public void registerRecipes( )
{
GameRegistry.addShapelessRecipe( new ItemStack( Materials.NUGGET_IRON , 9 ) , Items.IRON_INGOT );
GameRegistry.addRecipe( new ItemStack( Items.IRON_INGOT ) , //
"NNN" , "NNN" , "NNN" , //
'N' , Materials.NUGGET_IRON );
}
}

View file

@ -3,6 +3,7 @@ package mmm.proxy;
import mmm.Mmm; import mmm.Mmm;
import mmm.deco.DecorativeBlocks; import mmm.deco.DecorativeBlocks;
import mmm.materials.Materials;
import mmm.utils.UAccessors; import mmm.utils.UAccessors;
import mmm.utils.URegistry; import mmm.utils.URegistry;
import mmm.utils.USeat; import mmm.utils.USeat;
@ -19,6 +20,8 @@ public abstract class PCommon
UAccessors.preInit( ); UAccessors.preInit( );
DecorativeBlocks.preInit( ); DecorativeBlocks.preInit( );
Materials.preInit( );
URegistry.registerRecipes( ); URegistry.registerRecipes( );
} }

View file

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

View file

@ -19,3 +19,8 @@ tile.mmm.deco.chair.spruce.name=Spruce Chair
tile.mmm.deco.chair.acacia.name=Acacia Chair tile.mmm.deco.chair.acacia.name=Acacia Chair
tile.mmm.deco.chair.jungle.name=Jungle Wood Chair tile.mmm.deco.chair.jungle.name=Jungle Wood Chair
tile.mmm.deco.chair.dark_oak.name=Dark Oak Chair tile.mmm.deco.chair.dark_oak.name=Dark Oak Chair
tile.mmm.materials.ores.copper.name=Native Copper
item.mmm.materials.iron_nugget.name=Iron Nugget

View file

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

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "mmm:items/materials/iron_nugget"
}
}

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B