Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split code up into Nether, Worldgen, and Overworld. Add Stairs (unloc…
…alized currently), slabs, tainted soil, and glass.
- Loading branch information
alexbegt
committed
Sep 2, 2016
1 parent
c7f5d52
commit 909a59c
Showing
68 changed files
with
2,218 additions
and
501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...natura/world/block/logs/BlockEnumLog.java → ...ml6/natura/common/block/BlockEnumLog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 7 additions & 4 deletions
11
...ld/client/colorizers/LeavesColorizer.java → ...natura/common/client/LeavesColorizer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...l6/natura/world/item/ItemBlockLeaves.java → ...6/natura/common/item/ItemBlockLeaves.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
src/main/java/com/progwml6/natura/nether/NaturaNether.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
package com.progwml6.natura.nether; | ||
|
||
import org.apache.logging.log4j.Logger; | ||
|
||
import com.google.common.eventbus.Subscribe; | ||
import com.progwml6.natura.common.CommonProxy; | ||
import com.progwml6.natura.common.NaturaPulse; | ||
import com.progwml6.natura.common.item.ItemBlockLeaves; | ||
import com.progwml6.natura.library.Util; | ||
import com.progwml6.natura.nether.block.glass.BlockNetherGlass; | ||
import com.progwml6.natura.nether.block.leaves.BlockNetherLeaves; | ||
import com.progwml6.natura.nether.block.leaves.BlockNetherLeaves2; | ||
import com.progwml6.natura.nether.block.logs.BlockNetherLog; | ||
import com.progwml6.natura.nether.block.planks.BlockNetherPlanks; | ||
import com.progwml6.natura.nether.block.sand.BlockHeatSand; | ||
import com.progwml6.natura.nether.block.saplings.BlockNetherSapling; | ||
import com.progwml6.natura.nether.block.slabs.BlockNetherSlab; | ||
import com.progwml6.natura.nether.block.soil.BlockTaintedSoil; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraftforge.fml.common.SidedProxy; | ||
import net.minecraftforge.fml.common.event.FMLInitializationEvent; | ||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; | ||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; | ||
import slimeknights.mantle.item.ItemBlockMeta; | ||
import slimeknights.mantle.pulsar.pulse.Pulse; | ||
|
||
@Pulse(id = NaturaNether.PulseId, description = "All of the nether blocks including trees") | ||
public class NaturaNether extends NaturaPulse | ||
{ | ||
public static final String PulseId = "NaturaNether"; | ||
|
||
static final Logger log = Util.getLogger(PulseId); | ||
|
||
@SidedProxy(clientSide = "com.progwml6.natura.nether.NetherClientProxy", serverSide = "com.progwml6.natura.common.CommonProxy") | ||
public static CommonProxy proxy; | ||
|
||
//@formatter:off | ||
public static BlockNetherLog netherLog; | ||
public static BlockNetherLeaves netherLeaves; | ||
public static BlockNetherLeaves2 netherLeaves2; | ||
public static BlockNetherSapling netherSapling; | ||
public static BlockNetherPlanks netherPlanks; | ||
public static Block netherSlab; | ||
|
||
public static BlockHeatSand netherHeatSand; | ||
public static BlockTaintedSoil netherTaintedSoil; | ||
|
||
public static BlockNetherGlass netherGlass; | ||
|
||
public static Block netherStairsGhostwood; | ||
public static Block netherStairsBloodwood; | ||
public static Block netherStairsDarkwood; | ||
public static Block netherStairsFusewood; | ||
//@formatter:on | ||
|
||
@Subscribe | ||
public void preInit(FMLPreInitializationEvent event) | ||
{ | ||
netherLog = registerEnumBlock(new BlockNetherLog(), "nether_logs"); | ||
|
||
netherLeaves = registerBlock(new ItemBlockLeaves(new BlockNetherLeaves()), "nether_leaves"); | ||
ItemBlockMeta.setMappingProperty(netherLeaves, BlockNetherLeaves.TYPE); | ||
netherLeaves2 = registerBlock(new ItemBlockLeaves(new BlockNetherLeaves2()), "nether_leaves2"); | ||
ItemBlockMeta.setMappingProperty(netherLeaves2, BlockNetherLeaves2.TYPE); | ||
|
||
netherSapling = registerBlock(new BlockNetherSapling(), "nether_sapling", BlockNetherSapling.FOLIAGE); | ||
|
||
netherPlanks = registerEnumBlock(new BlockNetherPlanks(), "nether_planks"); | ||
|
||
netherSlab = registerEnumBlockSlab(new BlockNetherSlab(), "nether_slab"); | ||
|
||
netherHeatSand = registerBlock(new BlockHeatSand(), "nether_heat_sand"); | ||
netherTaintedSoil = registerEnumBlock(new BlockTaintedSoil(), "nether_tainted_soil"); | ||
|
||
netherGlass = registerEnumBlock(new BlockNetherGlass(), "nether_glass"); | ||
|
||
netherStairsGhostwood = registerBlockStairsFrom(netherPlanks, BlockNetherPlanks.PlankType.GHOSTWOOD, "nether_stairs_ghostwood"); | ||
netherStairsBloodwood = registerBlockStairsFrom(netherPlanks, BlockNetherPlanks.PlankType.BLOODWOOD, "nether_stairs_bloodwood"); | ||
netherStairsDarkwood = registerBlockStairsFrom(netherPlanks, BlockNetherPlanks.PlankType.DARKWOOD, "nether_stairs_darkwood"); | ||
netherStairsFusewood = registerBlockStairsFrom(netherPlanks, BlockNetherPlanks.PlankType.FUSEWOOD, "nether_stairs_fusewood"); | ||
|
||
proxy.preInit(); | ||
} | ||
|
||
@Subscribe | ||
public void init(FMLInitializationEvent event) | ||
{ | ||
proxy.init(); | ||
} | ||
|
||
@Subscribe | ||
public void postInit(FMLPostInitializationEvent event) | ||
{ | ||
proxy.postInit(); | ||
} | ||
} |
135 changes: 135 additions & 0 deletions
135
src/main/java/com/progwml6/natura/nether/NetherClientProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
package com.progwml6.natura.nether; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
import com.progwml6.natura.common.ClientProxy; | ||
import com.progwml6.natura.common.client.LeavesColorizer; | ||
import com.progwml6.natura.library.Util; | ||
import com.progwml6.natura.nether.block.leaves.BlockNetherLeaves; | ||
import com.progwml6.natura.nether.block.leaves.BlockNetherLeaves2; | ||
import com.progwml6.natura.nether.block.logs.BlockNetherLog; | ||
import com.progwml6.natura.nether.block.saplings.BlockNetherSapling; | ||
|
||
import net.minecraft.block.BlockLeaves; | ||
import net.minecraft.block.BlockSapling; | ||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||
import net.minecraft.client.renderer.block.statemap.StateMap; | ||
import net.minecraft.client.renderer.color.BlockColors; | ||
import net.minecraft.client.renderer.color.IBlockColor; | ||
import net.minecraft.client.renderer.color.IItemColor; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemBlock; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.IBlockAccess; | ||
import net.minecraftforge.client.model.ModelLoader; | ||
|
||
public class NetherClientProxy extends ClientProxy | ||
{ | ||
public static Minecraft minecraft = Minecraft.getMinecraft(); | ||
|
||
@Override | ||
public void preInit() | ||
{ | ||
super.preInit(); | ||
} | ||
|
||
@Override | ||
public void init() | ||
{ | ||
final BlockColors blockColors = minecraft.getBlockColors(); | ||
|
||
blockColors.registerBlockColorHandler(new IBlockColor() | ||
{ | ||
@Override | ||
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess access, BlockPos pos, int tintIndex) | ||
{ | ||
return LeavesColorizer.noColor; | ||
} | ||
}, NaturaNether.netherLeaves); | ||
|
||
blockColors.registerBlockColorHandler(new IBlockColor() | ||
{ | ||
@Override | ||
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess access, BlockPos pos, int tintIndex) | ||
{ | ||
return LeavesColorizer.noColor; | ||
} | ||
}, NaturaNether.netherLeaves2); | ||
|
||
minecraft.getItemColors().registerItemColorHandler(new IItemColor() | ||
{ | ||
@Override | ||
public int getColorFromItemstack(@Nonnull ItemStack stack, int tintIndex) | ||
{ | ||
@SuppressWarnings("deprecation") | ||
IBlockState iblockstate = ((ItemBlock) stack.getItem()).getBlock().getStateFromMeta(stack.getMetadata()); | ||
return blockColors.colorMultiplier(iblockstate, null, null, tintIndex); | ||
} | ||
}, NaturaNether.netherLeaves, NaturaNether.netherLeaves2); | ||
|
||
super.init(); | ||
} | ||
|
||
@Override | ||
protected void registerModels() | ||
{ | ||
// blocks | ||
ModelLoader.setCustomStateMapper(NaturaNether.netherLeaves, (new StateMap.Builder()).ignore(BlockLeaves.CHECK_DECAY, BlockLeaves.DECAYABLE).build()); | ||
ModelLoader.setCustomStateMapper(NaturaNether.netherLeaves2, (new StateMap.Builder()).ignore(BlockLeaves.CHECK_DECAY, BlockLeaves.DECAYABLE).build()); | ||
|
||
ModelLoader.setCustomStateMapper(NaturaNether.netherSapling, (new StateMap.Builder()).ignore(BlockNetherSapling.STAGE, BlockSapling.TYPE).build()); | ||
|
||
this.registerItemBlockMeta(NaturaNether.netherPlanks); | ||
this.registerItemBlockMeta(NaturaNether.netherTaintedSoil); | ||
|
||
this.registerItemBlockMeta(NaturaNether.netherGlass); | ||
|
||
this.registerItemBlockMeta(NaturaNether.netherSlab); | ||
|
||
this.registerItemModel(NaturaNether.netherStairsGhostwood); | ||
this.registerItemModel(NaturaNether.netherStairsBloodwood); | ||
this.registerItemModel(NaturaNether.netherStairsDarkwood); | ||
this.registerItemModel(NaturaNether.netherStairsFusewood); | ||
|
||
Item heatSandItem = Item.getItemFromBlock(NaturaNether.netherHeatSand); | ||
ModelLoader.setCustomModelResourceLocation(heatSandItem, 0, new ModelResourceLocation(Util.resource("nether_heat_sand"), "normal")); | ||
|
||
Item nether_log = Item.getItemFromBlock(NaturaNether.netherLog); | ||
for (BlockNetherLog.LogType type : BlockNetherLog.LogType.values()) | ||
{ | ||
String variant = String.format("%s=%s,%s=%s", BlockNetherLog.LOG_AXIS.getName(), | ||
BlockNetherLog.LOG_AXIS.getName(BlockNetherLog.EnumAxis.Y), BlockNetherLog.TYPE.getName(), | ||
BlockNetherLog.TYPE.getName(type)); | ||
ModelLoader.setCustomModelResourceLocation(nether_log, type.meta, new ModelResourceLocation(nether_log.getRegistryName(), variant)); | ||
} | ||
|
||
// leaves | ||
Item nether_leaves = Item.getItemFromBlock(NaturaNether.netherLeaves); | ||
for (BlockNetherLeaves.LeavesType type : BlockNetherLeaves.LeavesType.values()) | ||
{ | ||
String variant = String.format("%s=%s", BlockNetherLeaves.TYPE.getName(), BlockNetherLeaves.TYPE.getName(type)); | ||
ModelLoader.setCustomModelResourceLocation(nether_leaves, type.getMeta(), new ModelResourceLocation(nether_leaves.getRegistryName(), variant)); | ||
} | ||
|
||
Item nether_leaves2 = Item.getItemFromBlock(NaturaNether.netherLeaves2); | ||
for (BlockNetherLeaves2.LeavesType type : BlockNetherLeaves2.LeavesType.values()) | ||
{ | ||
String variant = String.format("%s=%s", BlockNetherLeaves2.TYPE.getName(), BlockNetherLeaves2.TYPE.getName(type)); | ||
ModelLoader.setCustomModelResourceLocation(nether_leaves2, type.getMeta(), new ModelResourceLocation(nether_leaves2.getRegistryName(), variant)); | ||
} | ||
|
||
// saplings | ||
|
||
ItemStack stack = new ItemStack(Item.getItemFromBlock(NaturaNether.netherSapling), 1, NaturaNether.netherSapling.getMetaFromState(NaturaNether.netherSapling.getDefaultState().withProperty(BlockNetherSapling.FOLIAGE, BlockNetherSapling.SaplingType.GHOSTWOOD))); | ||
this.registerItemModel(stack, "nether_sapling_ghostwood"); | ||
stack = new ItemStack(Item.getItemFromBlock(NaturaNether.netherSapling), 1, NaturaNether.netherSapling.getMetaFromState(NaturaNether.netherSapling.getDefaultState().withProperty(BlockNetherSapling.FOLIAGE, BlockNetherSapling.SaplingType.BLOODWOOD))); | ||
this.registerItemModel(stack, "nether_sapling_bloodwood"); | ||
stack = new ItemStack(Item.getItemFromBlock(NaturaNether.netherSapling), 1, NaturaNether.netherSapling.getMetaFromState(NaturaNether.netherSapling.getDefaultState().withProperty(BlockNetherSapling.FOLIAGE, BlockNetherSapling.SaplingType.FUSEWOOD))); | ||
this.registerItemModel(stack, "nether_sapling_fusewood"); | ||
stack = new ItemStack(Item.getItemFromBlock(NaturaNether.netherSapling), 1, NaturaNether.netherSapling.getMetaFromState(NaturaNether.netherSapling.getDefaultState().withProperty(BlockNetherSapling.FOLIAGE, BlockNetherSapling.SaplingType.DARKWOOD))); | ||
this.registerItemModel(stack, "nether_sapling_darkwood"); | ||
} | ||
} |
Oops, something went wrong.