Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

Commit

Permalink
I finally added some slabs!
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Jelen committed Jun 30, 2018
1 parent da6b0a7 commit cb14d2b
Show file tree
Hide file tree
Showing 55 changed files with 698 additions and 53 deletions.
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,8 @@
Fixed a model bug with the vanilla and moss stone furnaces
Fixed the void furnace item showing up as a blank space
Added crafting recipe for black dye

1.2.2:
Added Cooked Eggs
The mod displays its correct version again (I'm always forgetting to update the mcmod.info file, dang it!)
Finally added slabs for end stone, compressed cactus, glowing obsidian, obsidian, void stone, and void stone bricks!
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Nether Noah's Paradise Mod is a mod I decided to make for the heck of it! I started from the idea of me adding my own custom things to minecraft just like I can create my own custom textures for it in my resource pack! My friends and I currently use it in our Minecraft worlds. I even restored some old features like glowing obsidian from Minecraft Pocket Edition and the brick pyramid from Indev!

Hopefully, having created this mod could help me get a high paying job in future since my brother told me that java programmers make about $100K USD per year!
Hopefully, having created this mod could help me get a high paying job in future since my brother told me that java programmers make about $100K USD per year!
66 changes: 66 additions & 0 deletions src/main/java/com/NetherNoah/ParadiseMod/DummyProperty.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//this class is based off of CJMinecraft's example mod
//https://github.com/CJMinecraft01/BitOfEverything
package com.NetherNoah.ParadiseMod;

import java.util.Collection;

import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;

import net.minecraft.block.properties.PropertyHelper;

/**
* Used purely for the slabs. Every slab requires a variant so this is a great
* class to use if you have no variant
*
* @author CJMinecraft
*
*/
public class DummyProperty extends PropertyHelper<Boolean> {

/**
* Initialise the dummy property
*
* @param name
* The name of the property
*/
protected DummyProperty(String name) {
super(name, Boolean.class);
}

/**
* Say that we only allow false as a valid value
*/
@Override
public Collection<Boolean> getAllowedValues() {
return ImmutableSet.<Boolean>of(Boolean.valueOf(false));
}

/**
* Parse a value. Will always be false
*/
@Override
public Optional<Boolean> parseValue(String value) {
return Optional.<Boolean>of(Boolean.valueOf(false));
}

/**
* The name from the value. Will always be false
*/
@Override
public String getName(Boolean value) {
return "false";
}

/**
* Create a new dummy property
*
* @param name
* The name of the property
* @return the new dummy property
*/
public static DummyProperty create(String name) {
return new DummyProperty(name);
}

}
2 changes: 2 additions & 0 deletions src/main/java/com/NetherNoah/ParadiseMod/ParadiseMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.NetherNoah.ParadiseMod.init.ModBlocks.Misc;
import com.NetherNoah.ParadiseMod.init.ModBlocks.Ores;
import com.NetherNoah.ParadiseMod.init.ModBlocks.Plates;
import com.NetherNoah.ParadiseMod.init.ModBlocks.Slabs;
import com.NetherNoah.ParadiseMod.init.ModBlocks.Stairs;
import com.NetherNoah.ParadiseMod.init.ModBlocks.Tables;
import com.NetherNoah.ParadiseMod.init.ModBlocks.Trapdoors;
Expand Down Expand Up @@ -209,6 +210,7 @@ public void preInit(FMLPreInitializationEvent event) {
Trapdoors.initAndRegister();
Fences.initAndRegister();
Gates.initAndRegister();
Slabs.initAndRegister();

//item categories
Tools.initAndRegister();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/NetherNoah/ParadiseMod/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static void regBlock(Block block) {
ForgeRegistries.ITEMS.register(item);
}
/**
*Registers an item model
*Registers a block model
*/
public static void regRender(Block block) {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0,
Expand Down
102 changes: 102 additions & 0 deletions src/main/java/com/NetherNoah/ParadiseMod/blocks/slabs/CactusSlab.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
//this class is based off of CJMinecraft's example mod
//https://github.com/CJMinecraft01/BitOfEverything
package com.NetherNoah.ParadiseMod.blocks.slabs;

import java.util.Random;

import com.NetherNoah.ParadiseMod.DummyProperty;
import com.NetherNoah.ParadiseMod.Reference;
import com.NetherNoah.ParadiseMod.init.ModBlocks.Slabs;

import net.minecraft.block.BlockSlab;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class CactusSlab extends BlockSlab {

public static final DummyProperty DUMMY_VARIANT = DummyProperty.create("dummy");

public CactusSlab(String name) {
super(Material.WOOD);
setUnlocalizedName(name);
setRegistryName(name);
setHardness(3);
setResistance(15);
setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
setSoundType(SoundType.WOOD);

IBlockState state = this.blockState.getBaseState();
if (!this.isDouble())
state = state.withProperty(HALF, EnumBlockHalf.BOTTOM);
setDefaultState(state);
this.useNeighborBrightness = true; // Makes it so that you don't get dark patches on the block
}

@Override
public String getUnlocalizedName(int meta) {
return this.getUnlocalizedName();
}

@Override
public IProperty<?> getVariantProperty() {
return DUMMY_VARIANT;
}

@Override
public Comparable<?> getTypeForItem(ItemStack stack) {
return false;
}

@Override
public int damageDropped(IBlockState state) {
return 0;
}

@Override
public IBlockState getStateFromMeta(int meta) {
if (!this.isDouble())
return this.getDefaultState().withProperty(HALF,
EnumBlockHalf.values()[meta % EnumBlockHalf.values().length]);
return this.getDefaultState();
}

@Override
public int getMetaFromState(IBlockState state) {
if (this.isDouble())
return 0;
return ((EnumBlockHalf) state.getValue(HALF)).ordinal() + 1;
}

@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return Item.getItemFromBlock(Slabs.end_slab);
}

@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] { HALF, DUMMY_VARIANT });
}

@Override
public boolean isDouble() {
return false;
}

//@Override
//public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
//{
// return false;
//}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//this class is based off of CJMinecraft's example mod
//https://github.com/CJMinecraft01/BitOfEverything
package com.NetherNoah.ParadiseMod.blocks.slabs;

import com.NetherNoah.ParadiseMod.init.ModBlocks.Slabs;

import net.minecraft.block.SoundType;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;

public class CactusSlabDouble extends CactusSlab {

public CactusSlabDouble() {
super("double_cactus_slab");
setSoundType(SoundType.WOOD);
}

@Override
public boolean isDouble() {
return true;
}
@Override
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
{
return new ItemStack(Slabs.cactus_slab);
}

}
99 changes: 99 additions & 0 deletions src/main/java/com/NetherNoah/ParadiseMod/blocks/slabs/EndSlab.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
//this class is based off of CJMinecraft's example mod
//https://github.com/CJMinecraft01/BitOfEverything
package com.NetherNoah.ParadiseMod.blocks.slabs;

import java.util.Random;

import com.NetherNoah.ParadiseMod.DummyProperty;
import com.NetherNoah.ParadiseMod.Reference;
import com.NetherNoah.ParadiseMod.init.ModBlocks.Slabs;

import net.minecraft.block.BlockSlab;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class EndSlab extends BlockSlab {

public static final DummyProperty DUMMY_VARIANT = DummyProperty.create("dummy");

public EndSlab(String name) {
super(Material.ROCK);
setUnlocalizedName(name);
setRegistryName(name);
setHardness(3);
setResistance(15);
setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
IBlockState state = this.blockState.getBaseState();
if (!this.isDouble())
state = state.withProperty(HALF, EnumBlockHalf.BOTTOM);
setDefaultState(state);
this.useNeighborBrightness = true; // Makes it so that you don't get dark patches on the block
}

@Override
public String getUnlocalizedName(int meta) {
return this.getUnlocalizedName();
}

@Override
public IProperty<?> getVariantProperty() {
return DUMMY_VARIANT;
}

@Override
public Comparable<?> getTypeForItem(ItemStack stack) {
return false;
}

@Override
public int damageDropped(IBlockState state) {
return 0;
}

@Override
public IBlockState getStateFromMeta(int meta) {
if (!this.isDouble())
return this.getDefaultState().withProperty(HALF,
EnumBlockHalf.values()[meta % EnumBlockHalf.values().length]);
return this.getDefaultState();
}

@Override
public int getMetaFromState(IBlockState state) {
if (this.isDouble())
return 0;
return ((EnumBlockHalf) state.getValue(HALF)).ordinal() + 1;
}

@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return Item.getItemFromBlock(Slabs.end_slab);
}

@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] { HALF, DUMMY_VARIANT });
}

@Override
public boolean isDouble() {
return false;
}

//@Override
//public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
//{
// return false;
//}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//this class is based off of CJMinecraft's example mod
//https://github.com/CJMinecraft01/BitOfEverything
package com.NetherNoah.ParadiseMod.blocks.slabs;

import com.NetherNoah.ParadiseMod.init.ModBlocks.Slabs;

import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;

public class EndSlabDouble extends EndSlab {

public EndSlabDouble() {
super("double_end_slab");
}

@Override
public boolean isDouble() {
return true;
}
@Override
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
{
return new ItemStack(Slabs.end_slab);
}

}
Loading

0 comments on commit cb14d2b

Please sign in to comment.