Skip to content

Commit

Permalink
Split code up into Nether, Worldgen, and Overworld. Add Stairs (unloc…
Browse files Browse the repository at this point in the history
…alized currently), slabs, tainted soil, and glass.
  • Loading branch information
alexbegt committed Sep 2, 2016
1 parent c7f5d52 commit 909a59c
Show file tree
Hide file tree
Showing 68 changed files with 2,218 additions and 501 deletions.
12 changes: 6 additions & 6 deletions build.properties
Expand Up @@ -2,12 +2,12 @@ mod_version=4.0.0

minecraft_version=1.10.2

forge_version=12.18.1.2056
mappings=snapshot_20160812
forge_version=12.18.1.2075
mappings=snapshot_20160828

mantle_version=0.10.4.jenkins163
tconstruct_version=2.4.0.jenkins322
mantle_version=0.10.4.jenkins165
tconstruct_version=2.4.0.jenkins330

jei_version=3.8.0.241
jei_version=3.9.0.246
waila_version=1.7.0-B3
mcmultipart_version=1.2.1_77
mcmultipart_version=1.3.0_82
5 changes: 5 additions & 0 deletions src/main/java/com/progwml6/natura/Natura.java
Expand Up @@ -7,6 +7,8 @@
import com.progwml6.natura.common.config.Config;
import com.progwml6.natura.entities.NaturaEntities;
import com.progwml6.natura.library.Util;
import com.progwml6.natura.nether.NaturaNether;
import com.progwml6.natura.overworld.NaturaOverworld;
import com.progwml6.natura.plugin.waila.Waila;
import com.progwml6.natura.shared.NaturaCommons;
import com.progwml6.natura.world.NaturaWorld;
Expand Down Expand Up @@ -40,7 +42,10 @@ public class Natura
static
{
pulseManager.registerPulse(new NaturaCommons());
pulseManager.registerPulse(new NaturaOverworld());
pulseManager.registerPulse(new NaturaNether());
pulseManager.registerPulse(new NaturaEntities());

pulseManager.registerPulse(new NaturaWorld());

pulseManager.registerPulse(new Waila());
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/com/progwml6/natura/common/NaturaPulse.java
Expand Up @@ -5,6 +5,8 @@
import com.progwml6.natura.Natura;
import com.progwml6.natura.entities.NaturaEntities;
import com.progwml6.natura.library.Util;
import com.progwml6.natura.nether.NaturaNether;
import com.progwml6.natura.overworld.NaturaOverworld;
import com.progwml6.natura.world.NaturaWorld;

import net.minecraft.block.Block;
Expand Down Expand Up @@ -41,6 +43,16 @@ protected static boolean isWorldLoaded()
return Natura.pulseManager.isPulseLoaded(NaturaWorld.PulseId);
}

protected static boolean isOverworldLoaded()
{
return Natura.pulseManager.isPulseLoaded(NaturaOverworld.PulseId);
}

protected static boolean isNetherLoaded()
{
return Natura.pulseManager.isPulseLoaded(NaturaNether.PulseId);
}

/**
* Sets the correct unlocalized name and registers the item.
*/
Expand Down
@@ -1,4 +1,4 @@
package com.progwml6.natura.world.block.logs;
package com.progwml6.natura.common.block;

import com.progwml6.natura.library.NaturaRegistry;

Expand Down
@@ -1,12 +1,12 @@
package com.progwml6.natura.world.client.colorizers;
package com.progwml6.natura.common.client;

import java.io.IOException;

import javax.annotation.Nonnull;

import com.progwml6.natura.Natura;
import com.progwml6.natura.library.Util;
import com.progwml6.natura.world.block.grass.BlockColoredGrass;
import com.progwml6.natura.overworld.block.grass.BlockColoredGrass;

import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.client.resources.IResourceManager;
Expand All @@ -17,7 +17,10 @@
import net.minecraft.world.ColorizerGrass;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class GrassColorizer implements IResourceManagerReloadListener
{
private static int[] colorBufferBlue = new int[65536];
Expand Down
@@ -1,13 +1,16 @@
package com.progwml6.natura.world.client.colorizers;
package com.progwml6.natura.common.client;

import com.progwml6.natura.world.block.leaves.overworld.BlockRedwoodLeaves;
import com.progwml6.natura.world.block.logs.overworld.BlockOverworldLog;
import com.progwml6.natura.world.block.logs.overworld.BlockOverworldLog2;
import com.progwml6.natura.overworld.block.leaves.BlockRedwoodLeaves;
import com.progwml6.natura.overworld.block.logs.BlockOverworldLog;
import com.progwml6.natura.overworld.block.logs.BlockOverworldLog2;

import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.biome.BiomeColorHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class LeavesColorizer
{
public static int mapleColor = 0xcc5718;
Expand Down
@@ -1,4 +1,4 @@
package com.progwml6.natura.world.item;
package com.progwml6.natura.common.item;

import net.minecraft.block.Block;
import slimeknights.mantle.item.ItemBlockMeta;
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/com/progwml6/natura/library/NaturaRegistry.java
@@ -1,8 +1,5 @@
package com.progwml6.natura.library;

import com.progwml6.natura.world.material.CloudMaterial;

import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
Expand All @@ -21,10 +18,4 @@ private NaturaRegistry()
public static CreativeTab tabGeneral = new CreativeTab("NaturaGeneral", new ItemStack(Item.getItemFromBlock(Blocks.SLIME_BLOCK)));

public static CreativeTab tabWorld = new CreativeTab("NaturaWorld", new ItemStack(Item.getItemFromBlock(Blocks.SLIME_BLOCK)));

/*---------------------------------------------------------------------------
| MATERIALS |
---------------------------------------------------------------------------*/

public static Material cloud = new CloudMaterial();
}
97 changes: 97 additions & 0 deletions src/main/java/com/progwml6/natura/nether/NaturaNether.java
@@ -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 src/main/java/com/progwml6/natura/nether/NetherClientProxy.java
@@ -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");
}
}

0 comments on commit 909a59c

Please sign in to comment.