From c9c0a6e31ef38e0e00dc6a572bb3d1b7f865190c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Wed, 15 Jun 2016 20:45:36 +0200 Subject: [PATCH] Started working on new materials + iron nuggets + copper ore --- TODO.txt | 16 +- ore.xcf | Bin 0 -> 2659 bytes src/java/mmm/materials/DOre.java | 155 ++++++++++++++++++ src/java/mmm/materials/MItem.java | 21 +++ src/java/mmm/materials/Materials.java | 48 ++++++ src/java/mmm/proxy/PCommon.java | 3 + .../blockstates/materials/ores/copper.json | 5 + src/resources/assets/mmm/lang/en_US.lang | 5 + .../models/block/materials/ores/copper.json | 6 + .../models/item/materials/iron_nugget.json | 6 + .../models/item/materials/ores/copper.json | 3 + .../textures/blocks/materials/ores/copper.png | Bin 0 -> 294 bytes .../textures/items/materials/iron_nugget.png | Bin 0 -> 134 bytes 13 files changed, 262 insertions(+), 6 deletions(-) create mode 100644 ore.xcf create mode 100644 src/java/mmm/materials/DOre.java create mode 100644 src/java/mmm/materials/MItem.java create mode 100644 src/java/mmm/materials/Materials.java create mode 100644 src/resources/assets/mmm/blockstates/materials/ores/copper.json create mode 100644 src/resources/assets/mmm/models/block/materials/ores/copper.json create mode 100644 src/resources/assets/mmm/models/item/materials/iron_nugget.json create mode 100644 src/resources/assets/mmm/models/item/materials/ores/copper.json create mode 100644 src/resources/assets/mmm/textures/blocks/materials/ores/copper.png create mode 100644 src/resources/assets/mmm/textures/items/materials/iron_nugget.png 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 0000000000000000000000000000000000000000..e38298b9f7c434f4e7a718a3e1c9a0e10ea74ee8 GIT binary patch literal 2659 zcmeHIJ#Q015ZyiBosAs~5e`B!5+{LB9LdNbMG$35Ku}OZV}k9oNaD!1ActmqD3-tB zjxzo`ZbC)LSI`~rt@nZ>j1WSiK&_1;%*?`pbZn zFc*N*)*B%Rj2hqr5pdD@%v(YJWz6S$DBJAswtJmsZ`gkdN+2%9YN8HyI#Dv%=|63h zSG&FK!Omb9t=g$M>^*5mts5;n7C7rJ)WFs!3%2I*=;sc%j*|WMc7LxIt>@1Id9a9d zT=V%}Uq$`B?YNV0|DfAVI_l(r-2EdpV@_}7J-8uX;|lK!5x&Y9%x8fmfOqLX7XtWgzz}b3W_lJfD;M=isw0YkEKtV2tlPf6oDYH@r>fvQ}R%)W8`ec;W(}~eie~I;Utd*yv301+Q3fxgPRXT=IMrYH>WUTdMY>d{* zS80sg57SA^64}&vCQ#{gEXQEAQ4?cStc)}TZA(dWjQU0e>iyJ~G768=N{z=#3;q8< z`WH9ki8K>|kQuQ8ctAn;nZ#TLeBg{IAdbXkEQ%tq!2*1C&xwApox*$VgU*nw4UqxZ zTz}Hcto*BHMv5JIGjowQGtb~gfU^W|vB*`A>q{=^xL}p*&BJu-uufB<@o5@|a;r?I z2B!*GcI|L8Nna*)nhK3i(@5mYGMyTnDqz{QWOE}OZPaNhG(JsZLypRHYH+H6W!E;e zwD*>uwPJ5K+HEJ#c*5Vk+A8+&Rq#4lvH)P@w{&H;qz$jbAyLMcreBMx1pR(g6)Eq#L%KtyMPY0H0{6HQOsolZGFQ8`VlA)ZGw@r2~g>n9&8 zwQmo03{B-v`Wl1uH1u5m|FQq-o4uN)BBRQefI8p-q5X2DsKMvo!xFyY5)(<3@&7=w I09?zy0h$CTb^rhX literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..3500615010253d4e595a196a084110177ae7b402 GIT binary patch literal 294 zcmV+>0oneEP)!MqmJj2)vVC^zN4wPGq0`{GM$KA~;`#z7en;uIXiHLy_^U2bPriIW5d!2R*D16AN7-;7neI0Vi*mSboxh9Z$ zZ_T#a`7Z~wAq7?rwK^m`9L8I=71GzPD%udAJZX!=Oi7@@44$rjF6*2UngG|;E@A)x literal 0 HcmV?d00001