From 394492849055071911c580933bd4ed79de6b9c1a Mon Sep 17 00:00:00 2001 From: FTC Geared Up 6347 Date: Tue, 15 Aug 2017 09:55:48 -0400 Subject: [PATCH 1/5] changed readme --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 3b6c401..68652c0 100644 --- a/README.md +++ b/README.md @@ -1,2 +1 @@ -# ModTutorials -Companion code for the modding tutorials at https://wiki.mcjty.eu/modding/index.php/Main_Page +Java class From cc10da52b9a3d1630a26eb29d53593a204b6fbb4 Mon Sep 17 00:00:00 2001 From: FTC Geared Up 6347 Date: Tue, 15 Aug 2017 14:49:17 -0400 Subject: [PATCH 2/5] N Letter --- .../mcjty/modtut/blocks/NLetterBlock.java | 26 ++++++++++++++++++ .../java/mcjty/modtut/proxy/CommonProxy.java | 1 + .../assets/modtut/blockstates/nletter.json | 10 +++++++ .../assets/modtut/models/block/nletter.json | 0 .../assets/modtut/textures/blocks/nletter.png | Bin 0 -> 400 bytes 5 files changed, 37 insertions(+) create mode 100644 src/main/java/mcjty/modtut/blocks/NLetterBlock.java create mode 100644 src/main/resources/assets/modtut/blockstates/nletter.json create mode 100644 src/main/resources/assets/modtut/models/block/nletter.json create mode 100644 src/main/resources/assets/modtut/textures/blocks/nletter.png diff --git a/src/main/java/mcjty/modtut/blocks/NLetterBlock.java b/src/main/java/mcjty/modtut/blocks/NLetterBlock.java new file mode 100644 index 0000000..7b180eb --- /dev/null +++ b/src/main/java/mcjty/modtut/blocks/NLetterBlock.java @@ -0,0 +1,26 @@ +package mcjty.modtut.blocks; + +import mcjty.modtut.ModTut; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.item.Item; +import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public class NLetterBlock extends Block { + + public NLetterBlock() { + super(Material.ROCK); + setUnlocalizedName(ModTut.MODID + ".nletter"); + setRegistryName("nletter"); + } + + @SideOnly(Side.CLIENT) + public void initModel() { + ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, + new ModelResourceLocation(getRegistryName(), "inventory")); + } + +} diff --git a/src/main/java/mcjty/modtut/proxy/CommonProxy.java b/src/main/java/mcjty/modtut/proxy/CommonProxy.java index d1be180..820ef39 100644 --- a/src/main/java/mcjty/modtut/proxy/CommonProxy.java +++ b/src/main/java/mcjty/modtut/proxy/CommonProxy.java @@ -77,6 +77,7 @@ public static void registerBlocks(RegistryEvent.Register event) { event.getRegistry().register(new DataBlock()); event.getRegistry().register(new ModelBlock()); event.getRegistry().register(new PedestalBlock()); + event.getRegistry().register(new NLetterBlock()); GameRegistry.registerTileEntity(BlinkingTileEntity.class, ModTut.MODID + "_blinkingblock"); GameRegistry.registerTileEntity(TestContainerTileEntity.class, ModTut.MODID + "_testcontainerblock"); diff --git a/src/main/resources/assets/modtut/blockstates/nletter.json b/src/main/resources/assets/modtut/blockstates/nletter.json new file mode 100644 index 0000000..b89c5c1 --- /dev/null +++ b/src/main/resources/assets/modtut/blockstates/nletter.json @@ -0,0 +1,10 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "modtut:nletter" + }, + "variants": { + "normal": [{}], + "inventory": [{}] + } +} diff --git a/src/main/resources/assets/modtut/models/block/nletter.json b/src/main/resources/assets/modtut/models/block/nletter.json new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/assets/modtut/textures/blocks/nletter.png b/src/main/resources/assets/modtut/textures/blocks/nletter.png new file mode 100644 index 0000000000000000000000000000000000000000..f9115aa71f0cd29f842993cb57467d00475bf998 GIT binary patch literal 400 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sDEfH31!Z9ZwBAX}2Ry9wy$|iKnkC`vXRHE@P>> zojbP!g=8~BB1)X|b8}PkNwc6x=<115)%-*@5EMJzX3_Ec}m7 zJ}B6%AmF-xUa;GjDO^dcQ4U@g7EfE`uGa7^JVG#7~#71`K))f_AwYnFrb@B_%H=dqga*6$tSj}w#?)M^b zp)AQu*sDEqAL|-iPUYM(ag&SA)4uhrC)ii5XfS$oL`y( Date: Tue, 15 Aug 2017 23:45:00 -0400 Subject: [PATCH 3/5] First Commit... --- src/main/java/mcjty/modtut/blocks/FirstBlock.java | 3 +++ src/main/java/mcjty/modtut/blocks/ModelBlock.java | 2 ++ src/main/java/mcjty/modtut/blocks/MultiTexturedBlock.java | 2 ++ src/main/java/mcjty/modtut/blocks/NLetterBlock.java | 2 ++ src/main/java/mcjty/modtut/blocks/SimpleTexturedBlock.java | 2 ++ src/main/java/mcjty/modtut/blocks/StateTexturedBlock.java | 2 ++ 6 files changed, 13 insertions(+) diff --git a/src/main/java/mcjty/modtut/blocks/FirstBlock.java b/src/main/java/mcjty/modtut/blocks/FirstBlock.java index 02b83be..1ca9184 100644 --- a/src/main/java/mcjty/modtut/blocks/FirstBlock.java +++ b/src/main/java/mcjty/modtut/blocks/FirstBlock.java @@ -1,6 +1,7 @@ package mcjty.modtut.blocks; import mcjty.modtut.ModTut; +import mcjty.modtut.MyNewTab; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemBlock; @@ -12,5 +13,7 @@ public FirstBlock() { super(Material.ROCK); setUnlocalizedName(ModTut.MODID + ".firstblock"); setRegistryName("firstblock"); + setCreativeTab(MyNewTab.modTab); + } } diff --git a/src/main/java/mcjty/modtut/blocks/ModelBlock.java b/src/main/java/mcjty/modtut/blocks/ModelBlock.java index 9bd7dad..077f06a 100644 --- a/src/main/java/mcjty/modtut/blocks/ModelBlock.java +++ b/src/main/java/mcjty/modtut/blocks/ModelBlock.java @@ -1,6 +1,7 @@ package mcjty.modtut.blocks; import mcjty.modtut.ModTut; +import mcjty.modtut.MyNewTab; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -19,6 +20,7 @@ public ModelBlock() { super(Material.ROCK); setUnlocalizedName(ModTut.MODID + ".modelblock"); setRegistryName("modelblock"); + setCreativeTab(MyNewTab.modTab); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/mcjty/modtut/blocks/MultiTexturedBlock.java b/src/main/java/mcjty/modtut/blocks/MultiTexturedBlock.java index df50523..ab53058 100644 --- a/src/main/java/mcjty/modtut/blocks/MultiTexturedBlock.java +++ b/src/main/java/mcjty/modtut/blocks/MultiTexturedBlock.java @@ -1,6 +1,7 @@ package mcjty.modtut.blocks; import mcjty.modtut.ModTut; +import mcjty.modtut.MyNewTab; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyDirection; @@ -25,6 +26,7 @@ public MultiTexturedBlock() { super(Material.ROCK); setUnlocalizedName(ModTut.MODID + ".multitexturedblock"); setRegistryName("multitexturedblock"); + setCreativeTab(MyNewTab.modTab); setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); } diff --git a/src/main/java/mcjty/modtut/blocks/NLetterBlock.java b/src/main/java/mcjty/modtut/blocks/NLetterBlock.java index 7b180eb..3e5a598 100644 --- a/src/main/java/mcjty/modtut/blocks/NLetterBlock.java +++ b/src/main/java/mcjty/modtut/blocks/NLetterBlock.java @@ -1,6 +1,7 @@ package mcjty.modtut.blocks; import mcjty.modtut.ModTut; +import mcjty.modtut.MyNewTab; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -15,6 +16,7 @@ public NLetterBlock() { super(Material.ROCK); setUnlocalizedName(ModTut.MODID + ".nletter"); setRegistryName("nletter"); + setCreativeTab(MyNewTab.modTab); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/mcjty/modtut/blocks/SimpleTexturedBlock.java b/src/main/java/mcjty/modtut/blocks/SimpleTexturedBlock.java index c69129e..043ec22 100644 --- a/src/main/java/mcjty/modtut/blocks/SimpleTexturedBlock.java +++ b/src/main/java/mcjty/modtut/blocks/SimpleTexturedBlock.java @@ -1,6 +1,7 @@ package mcjty.modtut.blocks; import mcjty.modtut.ModTut; +import mcjty.modtut.MyNewTab; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -15,6 +16,7 @@ public SimpleTexturedBlock() { super(Material.ROCK); setUnlocalizedName(ModTut.MODID + ".simpletexturedblock"); setRegistryName("simpletexturedblock"); + setCreativeTab(MyNewTab.modTab); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/mcjty/modtut/blocks/StateTexturedBlock.java b/src/main/java/mcjty/modtut/blocks/StateTexturedBlock.java index 4ff5eb5..bf67be6 100644 --- a/src/main/java/mcjty/modtut/blocks/StateTexturedBlock.java +++ b/src/main/java/mcjty/modtut/blocks/StateTexturedBlock.java @@ -1,6 +1,7 @@ package mcjty.modtut.blocks; import mcjty.modtut.ModTut; +import mcjty.modtut.MyNewTab; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyBool; @@ -28,6 +29,7 @@ public StateTexturedBlock() { super(Material.ROCK); setUnlocalizedName(ModTut.MODID + ".statetexturedblock"); setRegistryName("statetexturedblock"); + setCreativeTab(MyNewTab.modTab); setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); } From 6a385406c0c11927ebe58f80e0cce9c47e6f00e4 Mon Sep 17 00:00:00 2001 From: Michael B Date: Wed, 16 Aug 2017 10:10:41 -0400 Subject: [PATCH 4/5] commiting custom Inv. Tab --- src/main/java/mcjty/modtut/blocks/FirstBlock.java | 4 ++-- src/main/java/mcjty/modtut/blocks/ModelBlock.java | 4 ++-- src/main/java/mcjty/modtut/blocks/MultiTexturedBlock.java | 4 ++-- src/main/java/mcjty/modtut/blocks/NLetterBlock.java | 4 ++-- src/main/java/mcjty/modtut/blocks/SimpleTexturedBlock.java | 4 ++-- src/main/java/mcjty/modtut/blocks/StateTexturedBlock.java | 4 ++-- src/main/java/mcjty/modtut/items/FirstItem.java | 2 ++ src/main/java/mcjty/modtut/items/MultiModelItem.java | 2 ++ src/main/java/mcjty/modtut/items/SimpleTexturedItem.java | 2 ++ 9 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/main/java/mcjty/modtut/blocks/FirstBlock.java b/src/main/java/mcjty/modtut/blocks/FirstBlock.java index 1ca9184..0ea6209 100644 --- a/src/main/java/mcjty/modtut/blocks/FirstBlock.java +++ b/src/main/java/mcjty/modtut/blocks/FirstBlock.java @@ -1,7 +1,7 @@ package mcjty.modtut.blocks; +import mcjty.modtut.CreativeTab; import mcjty.modtut.ModTut; -import mcjty.modtut.MyNewTab; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemBlock; @@ -13,7 +13,7 @@ public FirstBlock() { super(Material.ROCK); setUnlocalizedName(ModTut.MODID + ".firstblock"); setRegistryName("firstblock"); - setCreativeTab(MyNewTab.modTab); + setCreativeTab(CreativeTab.tabMODTAB); } } diff --git a/src/main/java/mcjty/modtut/blocks/ModelBlock.java b/src/main/java/mcjty/modtut/blocks/ModelBlock.java index 077f06a..5044d7d 100644 --- a/src/main/java/mcjty/modtut/blocks/ModelBlock.java +++ b/src/main/java/mcjty/modtut/blocks/ModelBlock.java @@ -1,7 +1,7 @@ package mcjty.modtut.blocks; +import mcjty.modtut.CreativeTab; import mcjty.modtut.ModTut; -import mcjty.modtut.MyNewTab; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -20,7 +20,7 @@ public ModelBlock() { super(Material.ROCK); setUnlocalizedName(ModTut.MODID + ".modelblock"); setRegistryName("modelblock"); - setCreativeTab(MyNewTab.modTab); + setCreativeTab(CreativeTab.tabMODTAB); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/mcjty/modtut/blocks/MultiTexturedBlock.java b/src/main/java/mcjty/modtut/blocks/MultiTexturedBlock.java index ab53058..8eedbb5 100644 --- a/src/main/java/mcjty/modtut/blocks/MultiTexturedBlock.java +++ b/src/main/java/mcjty/modtut/blocks/MultiTexturedBlock.java @@ -1,7 +1,7 @@ package mcjty.modtut.blocks; +import mcjty.modtut.CreativeTab; import mcjty.modtut.ModTut; -import mcjty.modtut.MyNewTab; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyDirection; @@ -26,7 +26,7 @@ public MultiTexturedBlock() { super(Material.ROCK); setUnlocalizedName(ModTut.MODID + ".multitexturedblock"); setRegistryName("multitexturedblock"); - setCreativeTab(MyNewTab.modTab); + setCreativeTab(CreativeTab.tabMODTAB); setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); } diff --git a/src/main/java/mcjty/modtut/blocks/NLetterBlock.java b/src/main/java/mcjty/modtut/blocks/NLetterBlock.java index 3e5a598..ccc29ce 100644 --- a/src/main/java/mcjty/modtut/blocks/NLetterBlock.java +++ b/src/main/java/mcjty/modtut/blocks/NLetterBlock.java @@ -1,7 +1,7 @@ package mcjty.modtut.blocks; +import mcjty.modtut.CreativeTab; import mcjty.modtut.ModTut; -import mcjty.modtut.MyNewTab; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -16,7 +16,7 @@ public NLetterBlock() { super(Material.ROCK); setUnlocalizedName(ModTut.MODID + ".nletter"); setRegistryName("nletter"); - setCreativeTab(MyNewTab.modTab); + setCreativeTab(CreativeTab.tabMODTAB); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/mcjty/modtut/blocks/SimpleTexturedBlock.java b/src/main/java/mcjty/modtut/blocks/SimpleTexturedBlock.java index 043ec22..20ba964 100644 --- a/src/main/java/mcjty/modtut/blocks/SimpleTexturedBlock.java +++ b/src/main/java/mcjty/modtut/blocks/SimpleTexturedBlock.java @@ -1,7 +1,7 @@ package mcjty.modtut.blocks; +import mcjty.modtut.CreativeTab; import mcjty.modtut.ModTut; -import mcjty.modtut.MyNewTab; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -16,7 +16,7 @@ public SimpleTexturedBlock() { super(Material.ROCK); setUnlocalizedName(ModTut.MODID + ".simpletexturedblock"); setRegistryName("simpletexturedblock"); - setCreativeTab(MyNewTab.modTab); + setCreativeTab(CreativeTab.tabMODTAB); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/mcjty/modtut/blocks/StateTexturedBlock.java b/src/main/java/mcjty/modtut/blocks/StateTexturedBlock.java index bf67be6..d73b645 100644 --- a/src/main/java/mcjty/modtut/blocks/StateTexturedBlock.java +++ b/src/main/java/mcjty/modtut/blocks/StateTexturedBlock.java @@ -1,7 +1,7 @@ package mcjty.modtut.blocks; +import mcjty.modtut.CreativeTab; import mcjty.modtut.ModTut; -import mcjty.modtut.MyNewTab; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyBool; @@ -29,7 +29,7 @@ public StateTexturedBlock() { super(Material.ROCK); setUnlocalizedName(ModTut.MODID + ".statetexturedblock"); setRegistryName("statetexturedblock"); - setCreativeTab(MyNewTab.modTab); + setCreativeTab(CreativeTab.tabMODTAB); setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); } diff --git a/src/main/java/mcjty/modtut/items/FirstItem.java b/src/main/java/mcjty/modtut/items/FirstItem.java index 1648c58..646a254 100644 --- a/src/main/java/mcjty/modtut/items/FirstItem.java +++ b/src/main/java/mcjty/modtut/items/FirstItem.java @@ -1,5 +1,6 @@ package mcjty.modtut.items; +import mcjty.modtut.CreativeTab; import mcjty.modtut.ModTut; import net.minecraft.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry; @@ -9,6 +10,7 @@ public class FirstItem extends Item { public FirstItem() { setRegistryName("firstitem"); // The unique name (within your mod) that identifies this item setUnlocalizedName(ModTut.MODID + ".firstitem"); // Used for localization (en_US.lang) + setCreativeTab(CreativeTab.tabMODTAB); } } diff --git a/src/main/java/mcjty/modtut/items/MultiModelItem.java b/src/main/java/mcjty/modtut/items/MultiModelItem.java index b1cdec8..d3bf0d6 100644 --- a/src/main/java/mcjty/modtut/items/MultiModelItem.java +++ b/src/main/java/mcjty/modtut/items/MultiModelItem.java @@ -1,5 +1,6 @@ package mcjty.modtut.items; +import mcjty.modtut.CreativeTab; import mcjty.modtut.ModTut; import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -21,6 +22,7 @@ public class MultiModelItem extends Item { public MultiModelItem() { setRegistryName("multimodelitem"); setUnlocalizedName(ModTut.MODID + ".multimodelitem"); + setCreativeTab(CreativeTab.tabMODTAB); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/mcjty/modtut/items/SimpleTexturedItem.java b/src/main/java/mcjty/modtut/items/SimpleTexturedItem.java index e029f59..6110a3c 100644 --- a/src/main/java/mcjty/modtut/items/SimpleTexturedItem.java +++ b/src/main/java/mcjty/modtut/items/SimpleTexturedItem.java @@ -1,5 +1,6 @@ package mcjty.modtut.items; +import mcjty.modtut.CreativeTab; import mcjty.modtut.ModTut; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; @@ -13,6 +14,7 @@ public class SimpleTexturedItem extends Item { public SimpleTexturedItem() { setRegistryName("simpletextureditem"); setUnlocalizedName(ModTut.MODID + ".simpletextureditem"); + setCreativeTab(CreativeTab.tabMODTAB); } @SideOnly(Side.CLIENT) From 97f13cba17552baaf011331ebc7b265ed572d993 Mon Sep 17 00:00:00 2001 From: Michael B Date: Wed, 16 Aug 2017 13:11:57 -0400 Subject: [PATCH 5/5] added new multifaced block --- src/main/java/mcjty/modtut/ModBlocks.java | 3 +++ src/main/java/mcjty/modtut/proxy/CommonProxy.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/mcjty/modtut/ModBlocks.java b/src/main/java/mcjty/modtut/ModBlocks.java index 4f8a682..d0eb0b9 100644 --- a/src/main/java/mcjty/modtut/ModBlocks.java +++ b/src/main/java/mcjty/modtut/ModBlocks.java @@ -14,6 +14,9 @@ public class ModBlocks { @GameRegistry.ObjectHolder("modtut:firstblock") public static FirstBlock firstBlock; + + @GameRegistry.ObjectHolder("modtut:myblock") + public static MyBlock myblock; @GameRegistry.ObjectHolder("modtut:simpletexturedblock") public static SimpleTexturedBlock simpleTexturedBlock; diff --git a/src/main/java/mcjty/modtut/proxy/CommonProxy.java b/src/main/java/mcjty/modtut/proxy/CommonProxy.java index 820ef39..81288bf 100644 --- a/src/main/java/mcjty/modtut/proxy/CommonProxy.java +++ b/src/main/java/mcjty/modtut/proxy/CommonProxy.java @@ -78,7 +78,7 @@ public static void registerBlocks(RegistryEvent.Register event) { event.getRegistry().register(new ModelBlock()); event.getRegistry().register(new PedestalBlock()); event.getRegistry().register(new NLetterBlock()); - + event.getRegistry().register(new MyBlock()); GameRegistry.registerTileEntity(BlinkingTileEntity.class, ModTut.MODID + "_blinkingblock"); GameRegistry.registerTileEntity(TestContainerTileEntity.class, ModTut.MODID + "_testcontainerblock"); GameRegistry.registerTileEntity(DataTileEntity.class, ModTut.MODID + "_datablock"); @@ -101,6 +101,7 @@ public static void registerItems(RegistryEvent.Register event) { event.getRegistry().register(new ItemBlock(ModBlocks.dataBlock).setRegistryName(ModBlocks.dataBlock.getRegistryName())); event.getRegistry().register(new ItemBlock(ModBlocks.modelBlock).setRegistryName(ModBlocks.modelBlock.getRegistryName())); event.getRegistry().register(new ItemBlock(ModBlocks.pedestalBlock).setRegistryName(ModBlocks.pedestalBlock.getRegistryName())); + event.getRegistry().register(new ItemBlock(ModBlocks.myblock).setRegistryName(ModBlocks.myblock.getRegistryName())); } }