From a90bd955fb7e4412019866cc9d3fc6fa24f6eb8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Sat, 9 Jul 2016 01:01:15 +0200 Subject: [PATCH] Leaves, partial Logic is hopefully there, rendering is incorrect (it needs a color handler). Also, shit is going to happen w.r.t. "fancy graphics". --- graphics/hevea_leaves.xcf | Bin 0 -> 8957 bytes src/java/mmm/materials/MLeaves.java | 112 ++++++++++++++++++ .../materials/{MWoodLog.java => MLog.java} | 6 +- .../{MWoodPlanks.java => MPlanks.java} | 6 +- src/java/mmm/materials/MWood.java | 49 +++++++- .../blockstates/materials/leaves/hevea.json | 8 ++ .../models/block/materials/leaves/hevea.json | 6 + .../models/item/materials/leaves/hevea.json | 3 + .../blocks/materials/leaves/hevea.png | Bin 0 -> 603 bytes 9 files changed, 180 insertions(+), 10 deletions(-) create mode 100644 graphics/hevea_leaves.xcf create mode 100644 src/java/mmm/materials/MLeaves.java rename src/java/mmm/materials/{MWoodLog.java => MLog.java} (95%) rename src/java/mmm/materials/{MWoodPlanks.java => MPlanks.java} (88%) create mode 100644 src/resources/assets/mmm/blockstates/materials/leaves/hevea.json create mode 100644 src/resources/assets/mmm/models/block/materials/leaves/hevea.json create mode 100644 src/resources/assets/mmm/models/item/materials/leaves/hevea.json create mode 100644 src/resources/assets/mmm/textures/blocks/materials/leaves/hevea.png diff --git a/graphics/hevea_leaves.xcf b/graphics/hevea_leaves.xcf new file mode 100644 index 0000000000000000000000000000000000000000..591d20507c6a228db7c7b4961728a730a2e70bc1 GIT binary patch literal 8957 zcmeHMO>7fK6n#X(iUX!8${{MkEkr_9e}E*!+3ok%Gx4rt5Qoa5 ztw);py*Iz#ym>p{OuA#ccB^~4qG~kO8zH2C$SkixcDeAU3EA`dXGENlg2+|KZOH3{ z%=Ma4eE7h-&aPNrx2nmpU>q!E6t?y~eX*1p>+9MX zNpkymG@6X0Rwl@;SDW${XH#AWkz8LBDTj!vdx*Tx5H-vZ`6s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bY0q&f;YJ1;q8z8KPsy z@6)g6&e5T%X`&y`(wE=<0OU)T>6=S9F^z*bj+ZjWzc>cPb#Zy(J2cHrP2YW-I^oxV z1-wM#1Iygk}9=Tv89A4Hd$HN@W8&ah8@;O`1 z8;)N8v?vs|^%k?NIQo$t{XDN<*&-T8_A onSheared( final ItemStack item , final IBlockAccess world , final BlockPos pos , + final int fortune ) + { + return Arrays.asList( new ItemStack( this ) ); + } + + + @Override + public BlockPlanks.EnumType getWoodType( final int meta ) + { + // Fuck you and fuck this useless fuckery. For fuck's sake. + return null; + } + + + @Override + protected BlockStateContainer createBlockState( ) + { + return new BlockStateContainer( this , new IProperty[] { + BlockLeaves.CHECK_DECAY , BlockLeaves.DECAYABLE + } ); + } + + + @Override + public IBlockState getStateFromMeta( final int meta ) + { + return this.getDefaultState( ) // + .withProperty( BlockLeaves.DECAYABLE , Boolean.valueOf( ( meta & 4 ) == 0 ) ) // + .withProperty( BlockLeaves.CHECK_DECAY , Boolean.valueOf( ( meta & 8 ) > 0 ) ); + } + + + @Override + public int getMetaFromState( final IBlockState state ) + { + int meta = 0; + if ( !state.getValue( BlockLeaves.DECAYABLE ) ) { + meta |= 4; + } + if ( state.getValue( BlockLeaves.CHECK_DECAY ) ) { + meta |= 8; + } + return meta; + } + +} diff --git a/src/java/mmm/materials/MWoodLog.java b/src/java/mmm/materials/MLog.java similarity index 95% rename from src/java/mmm/materials/MWoodLog.java rename to src/java/mmm/materials/MLog.java index ce8a817..e68e885 100644 --- a/src/java/mmm/materials/MWoodLog.java +++ b/src/java/mmm/materials/MLog.java @@ -10,14 +10,14 @@ import net.minecraft.block.state.IBlockState; -public class MWoodLog +public class MLog extends BlockLog { - private final MWood wood; + public final MWood wood; - public MWoodLog( final MWood wood ) + public MLog( final MWood wood ) { super( ); this.wood = wood; diff --git a/src/java/mmm/materials/MWoodPlanks.java b/src/java/mmm/materials/MPlanks.java similarity index 88% rename from src/java/mmm/materials/MWoodPlanks.java rename to src/java/mmm/materials/MPlanks.java index 4ed71e6..9a4b079 100644 --- a/src/java/mmm/materials/MWoodPlanks.java +++ b/src/java/mmm/materials/MPlanks.java @@ -10,14 +10,14 @@ import net.minecraft.creativetab.CreativeTabs; -public class MWoodPlanks +public class MPlanks extends Block { - private MWood wood; + public final MWood wood; - public MWoodPlanks( MWood wood ) + public MPlanks( final MWood wood ) { super( Material.WOOD ); this.wood = wood; diff --git a/src/java/mmm/materials/MWood.java b/src/java/mmm/materials/MWood.java index 3e5a243..50f5aac 100644 --- a/src/java/mmm/materials/MWood.java +++ b/src/java/mmm/materials/MWood.java @@ -6,6 +6,7 @@ import mmm.utils.URegistry; import net.minecraft.block.material.MapColor; import net.minecraft.init.Blocks; import net.minecraft.init.Items; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.registry.GameRegistry; @@ -16,20 +17,25 @@ public class MWood { public final String NAME; - public final MWoodLog LOG; - public final MWoodPlanks PLANKS; + public final MLeaves LEAVES; + public final MLog LOG; + public final MPlanks PLANKS; private MapColor barkColor = MapColor.WOOD; private MapColor plankColor = MapColor.WOOD; private int baseFireEncouragement = 5; private int baseFlammability = 5; + private int saplingDropChance = 20; + private int fruitDropChance = 0; + private Item fruit = null; public MWood( final String name ) { this.NAME = name; - this.LOG = new MWoodLog( this ); - this.PLANKS = new MWoodPlanks( this ); + this.LEAVES = new MLeaves( this ); + this.LOG = new MLog( this ); + this.PLANKS = new MPlanks( this ); } @@ -47,6 +53,21 @@ public class MWood } + public MWood setSaplingDropChance( final int chance ) + { + this.saplingDropChance = chance; + return this; + } + + + public MWood setFruit( final Item fruit , final float dropChance ) + { + this.fruit = fruit; + this.fruitDropChance = (int) ( 200 * dropChance ); + return this; + } + + public MWood setBaseFireInfo( final int encouragement , final int flammability ) { this.baseFireEncouragement = encouragement; @@ -61,6 +82,8 @@ public class MWood Blocks.FIRE.setFireInfo( this.LOG , this.baseFireEncouragement , this.baseFlammability ); URegistry.addBlock( this.PLANKS ); Blocks.FIRE.setFireInfo( this.PLANKS , this.baseFireEncouragement , this.baseFlammability * 4 ); + URegistry.addBlock( this.LEAVES ); + Blocks.FIRE.setFireInfo( this.LEAVES , this.baseFireEncouragement * 6 , this.baseFlammability * 12 ); URegistry.addRecipeRegistrar( this ); return this; @@ -79,6 +102,24 @@ public class MWood } + public int getSaplingDropChance( ) + { + return this.saplingDropChance; + } + + + public int getFruitDropChance( ) + { + return this.fruitDropChance; + } + + + public Item getFruit( ) + { + return this.fruit; + } + + @Override public void registerRecipes( ) { diff --git a/src/resources/assets/mmm/blockstates/materials/leaves/hevea.json b/src/resources/assets/mmm/blockstates/materials/leaves/hevea.json new file mode 100644 index 0000000..80839a8 --- /dev/null +++ b/src/resources/assets/mmm/blockstates/materials/leaves/hevea.json @@ -0,0 +1,8 @@ +{ + "variants": { + "check_decay=false,decayable=false": { "model": "mmm:materials/leaves/hevea" } , + "check_decay=false,decayable=true": { "model": "mmm:materials/leaves/hevea" } , + "check_decay=true,decayable=false": { "model": "mmm:materials/leaves/hevea" } , + "check_decay=true,decayable=true": { "model": "mmm:materials/leaves/hevea" } + } +} diff --git a/src/resources/assets/mmm/models/block/materials/leaves/hevea.json b/src/resources/assets/mmm/models/block/materials/leaves/hevea.json new file mode 100644 index 0000000..a724ebd --- /dev/null +++ b/src/resources/assets/mmm/models/block/materials/leaves/hevea.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/leaves", + "textures": { + "all": "mmm:blocks/materials/leaves/hevea" + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/item/materials/leaves/hevea.json b/src/resources/assets/mmm/models/item/materials/leaves/hevea.json new file mode 100644 index 0000000..654fd44 --- /dev/null +++ b/src/resources/assets/mmm/models/item/materials/leaves/hevea.json @@ -0,0 +1,3 @@ +{ + "parent": "mmm:block/materials/leaves/hevea" +} \ No newline at end of file diff --git a/src/resources/assets/mmm/textures/blocks/materials/leaves/hevea.png b/src/resources/assets/mmm/textures/blocks/materials/leaves/hevea.png new file mode 100644 index 0000000000000000000000000000000000000000..a9548648d94fd220d70091119871c40b39e8a5fa GIT binary patch literal 603 zcmV-h0;K(kP)cr{BK! zadme+*?W8T+H0@1{$8)wllOOAE*B*d2?c{ex7Y1<6^%wkPdc5}&(Dv}=d%`z#rupm zpU*`j^XK!a)9IvGET-4%rB0`#Kp>!0Dy2f9pxf;x`n}I_yHL!))@K&1Rig z(Endp=CEiso38TtyaV$L3EFG`kjv$q+8i=b&6!4{p|7tmH|H5%y4}`%o3i>dk4@b;afVc!Pz2osH3TmL!zyWMyFgHiA6x#u} zV0qPQRpas4r3++kp%LpSa|1gm0|(GOfo23Uk)Ue+e|il&bAn*e1CzH+2t~8e%7}G}6i%?L5+D34;=evp>xpyB*=m