Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My branch #32

Open
wants to merge 5 commits into
base: 1.12
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# ModTutorials
Companion code for the modding tutorials at https://wiki.mcjty.eu/modding/index.php/Main_Page
Java class
3 changes: 3 additions & 0 deletions src/main/java/mcjty/modtut/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/mcjty/modtut/blocks/FirstBlock.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package mcjty.modtut.blocks;

import mcjty.modtut.CreativeTab;
import mcjty.modtut.ModTut;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
Expand All @@ -12,5 +13,7 @@ public FirstBlock() {
super(Material.ROCK);
setUnlocalizedName(ModTut.MODID + ".firstblock");
setRegistryName("firstblock");
setCreativeTab(CreativeTab.tabMODTAB);

}
}
2 changes: 2 additions & 0 deletions src/main/java/mcjty/modtut/blocks/ModelBlock.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package mcjty.modtut.blocks;

import mcjty.modtut.CreativeTab;
import mcjty.modtut.ModTut;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
Expand All @@ -19,6 +20,7 @@ public ModelBlock() {
super(Material.ROCK);
setUnlocalizedName(ModTut.MODID + ".modelblock");
setRegistryName("modelblock");
setCreativeTab(CreativeTab.tabMODTAB);
}

@SideOnly(Side.CLIENT)
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/mcjty/modtut/blocks/MultiTexturedBlock.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package mcjty.modtut.blocks;

import mcjty.modtut.CreativeTab;
import mcjty.modtut.ModTut;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
Expand All @@ -25,6 +26,7 @@ public MultiTexturedBlock() {
super(Material.ROCK);
setUnlocalizedName(ModTut.MODID + ".multitexturedblock");
setRegistryName("multitexturedblock");
setCreativeTab(CreativeTab.tabMODTAB);

setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
}
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/mcjty/modtut/blocks/NLetterBlock.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package mcjty.modtut.blocks;

import mcjty.modtut.CreativeTab;
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");
setCreativeTab(CreativeTab.tabMODTAB);
}

@SideOnly(Side.CLIENT)
public void initModel() {
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0,
new ModelResourceLocation(getRegistryName(), "inventory"));
}

}
2 changes: 2 additions & 0 deletions src/main/java/mcjty/modtut/blocks/SimpleTexturedBlock.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package mcjty.modtut.blocks;

import mcjty.modtut.CreativeTab;
import mcjty.modtut.ModTut;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
Expand All @@ -15,6 +16,7 @@ public SimpleTexturedBlock() {
super(Material.ROCK);
setUnlocalizedName(ModTut.MODID + ".simpletexturedblock");
setRegistryName("simpletexturedblock");
setCreativeTab(CreativeTab.tabMODTAB);
}

@SideOnly(Side.CLIENT)
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/mcjty/modtut/blocks/StateTexturedBlock.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package mcjty.modtut.blocks;

import mcjty.modtut.CreativeTab;
import mcjty.modtut.ModTut;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
Expand Down Expand Up @@ -28,6 +29,7 @@ public StateTexturedBlock() {
super(Material.ROCK);
setUnlocalizedName(ModTut.MODID + ".statetexturedblock");
setRegistryName("statetexturedblock");
setCreativeTab(CreativeTab.tabMODTAB);

setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/mcjty/modtut/items/FirstItem.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}

}
2 changes: 2 additions & 0 deletions src/main/java/mcjty/modtut/items/MultiModelItem.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -21,6 +22,7 @@ public class MultiModelItem extends Item {
public MultiModelItem() {
setRegistryName("multimodelitem");
setUnlocalizedName(ModTut.MODID + ".multimodelitem");
setCreativeTab(CreativeTab.tabMODTAB);
}

@SideOnly(Side.CLIENT)
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/mcjty/modtut/items/SimpleTexturedItem.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -13,6 +14,7 @@ public class SimpleTexturedItem extends Item {
public SimpleTexturedItem() {
setRegistryName("simpletextureditem");
setUnlocalizedName(ModTut.MODID + ".simpletextureditem");
setCreativeTab(CreativeTab.tabMODTAB);
}

@SideOnly(Side.CLIENT)
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/mcjty/modtut/proxy/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public static void registerBlocks(RegistryEvent.Register<Block> event) {
event.getRegistry().register(new DataBlock());
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");
Expand All @@ -100,6 +101,7 @@ public static void registerItems(RegistryEvent.Register<Item> 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()));
}

}
10 changes: 10 additions & 0 deletions src/main/resources/assets/modtut/blockstates/nletter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"forge_marker": 1,
"defaults": {
"model": "modtut:nletter"
},
"variants": {
"normal": [{}],
"inventory": [{}]
}
}
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.