diff --git a/TODO.txt b/TODO.txt index 34674bf..a33cd1f 100644 --- a/TODO.txt +++ b/TODO.txt @@ -3,14 +3,18 @@ Part ASM? Description deco No Armchairs deco No Thrones ------------------------------------------------------------------------------------------------------- -plants No Tomatoes -plants No Turnips -plants No Cabbages -plants No Zucchinis -plants No Sweet pepper -plants No Eggplant +plants No? Tomatoes +plants No? Turnips +plants No? Cabbages +plants No? Zucchinis +plants No? Sweet pepper +plants No? Eggplant +plants No? Strawberries ------------------------------------------------------------------------------------------------------- ores ??? Rock salt +ores ??? Native copper (copper) +ores ??? Malachite (copper) +ores ??? Cuprite (copper) ------------------------------------------------------------------------------------------------------- animals ??? Goats ------------------------------------------------------------------------------------------------------- diff --git a/ore.xcf b/ore.xcf new file mode 100644 index 0000000..e38298b Binary files /dev/null and b/ore.xcf differ diff --git a/src/java/mmm/materials/DOre.java b/src/java/mmm/materials/DOre.java new file mode 100644 index 0000000..e934f85 --- /dev/null +++ b/src/java/mmm/materials/DOre.java @@ -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 ); + } +} diff --git a/src/java/mmm/materials/MItem.java b/src/java/mmm/materials/MItem.java new file mode 100644 index 0000000..d92af12 --- /dev/null +++ b/src/java/mmm/materials/MItem.java @@ -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 ); + } + +} diff --git a/src/java/mmm/materials/Materials.java b/src/java/mmm/materials/Materials.java new file mode 100644 index 0000000..4144ee4 --- /dev/null +++ b/src/java/mmm/materials/Materials.java @@ -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 ); + } +} diff --git a/src/java/mmm/proxy/PCommon.java b/src/java/mmm/proxy/PCommon.java index 4a09194..d745e78 100644 --- a/src/java/mmm/proxy/PCommon.java +++ b/src/java/mmm/proxy/PCommon.java @@ -3,6 +3,7 @@ package mmm.proxy; import mmm.Mmm; import mmm.deco.DecorativeBlocks; +import mmm.materials.Materials; import mmm.utils.UAccessors; import mmm.utils.URegistry; import mmm.utils.USeat; @@ -19,6 +20,8 @@ public abstract class PCommon UAccessors.preInit( ); DecorativeBlocks.preInit( ); + Materials.preInit( ); + URegistry.registerRecipes( ); } diff --git a/src/resources/assets/mmm/blockstates/materials/ores/copper.json b/src/resources/assets/mmm/blockstates/materials/ores/copper.json new file mode 100644 index 0000000..18f3ab5 --- /dev/null +++ b/src/resources/assets/mmm/blockstates/materials/ores/copper.json @@ -0,0 +1,5 @@ +{ + "variants": { + "normal": { "model": "mmm:materials/ores/copper" } + } +} diff --git a/src/resources/assets/mmm/lang/en_US.lang b/src/resources/assets/mmm/lang/en_US.lang index 90cc950..6fb65dc 100644 --- a/src/resources/assets/mmm/lang/en_US.lang +++ b/src/resources/assets/mmm/lang/en_US.lang @@ -19,3 +19,8 @@ tile.mmm.deco.chair.spruce.name=Spruce Chair tile.mmm.deco.chair.acacia.name=Acacia Chair tile.mmm.deco.chair.jungle.name=Jungle Wood 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 \ No newline at end of file diff --git a/src/resources/assets/mmm/models/block/materials/ores/copper.json b/src/resources/assets/mmm/models/block/materials/ores/copper.json new file mode 100644 index 0000000..d1067f1 --- /dev/null +++ b/src/resources/assets/mmm/models/block/materials/ores/copper.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "mmm:blocks/materials/ores/copper" + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/item/materials/iron_nugget.json b/src/resources/assets/mmm/models/item/materials/iron_nugget.json new file mode 100644 index 0000000..4be20b6 --- /dev/null +++ b/src/resources/assets/mmm/models/item/materials/iron_nugget.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "mmm:items/materials/iron_nugget" + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/item/materials/ores/copper.json b/src/resources/assets/mmm/models/item/materials/ores/copper.json new file mode 100644 index 0000000..ff8efd6 --- /dev/null +++ b/src/resources/assets/mmm/models/item/materials/ores/copper.json @@ -0,0 +1,3 @@ +{ + "parent": "mmm:block/materials/ores/copper" +} \ No newline at end of file diff --git a/src/resources/assets/mmm/textures/blocks/materials/ores/copper.png b/src/resources/assets/mmm/textures/blocks/materials/ores/copper.png new file mode 100644 index 0000000..3500615 Binary files /dev/null and b/src/resources/assets/mmm/textures/blocks/materials/ores/copper.png differ diff --git a/src/resources/assets/mmm/textures/items/materials/iron_nugget.png b/src/resources/assets/mmm/textures/items/materials/iron_nugget.png new file mode 100644 index 0000000..0d8de43 Binary files /dev/null and b/src/resources/assets/mmm/textures/items/materials/iron_nugget.png differ