forked from TAIGA/TAIGA
general code cleanup
added new StateMatcher
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -126,6 +126,8 @@ local.properties
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
.idea/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
|
16
build.gradle
16
build.gradle
@@ -13,25 +13,13 @@ buildscript {
|
||||
}
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
repositories {
|
||||
maven {
|
||||
name "DVS1 Maven FS'"
|
||||
url 'http://dvs1.progwml6.com/files/maven'
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// for people who want stable - not yet functional for MC 1.8.8 - we require the forgegradle 2.1 snapshot
|
||||
//plugins {
|
||||
// id "net.minecraftforge.gradle.forge" version "2.0.2"
|
||||
//}
|
||||
*/
|
||||
version = "0.1"
|
||||
group= "com.sosnitzka.zcompression" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "zcompression"
|
||||
|
||||
minecraft {
|
||||
version = "1.9-12.16.0.1865-1.9"
|
||||
version = "1.9-12.16.0.1867-1.9"
|
||||
runDir = "run"
|
||||
|
||||
// the mappings can be changed at any time, and must be in the following format.
|
||||
@@ -64,7 +52,7 @@ dependencies {
|
||||
// for more info...
|
||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
compile "tconstruct:TConstruct:1.9-2.2.2.jenkins159:deobf"
|
||||
// compile "tconstruct:TConstruct:1.9-2.2.2.jenkins159:deobf"
|
||||
}
|
||||
|
||||
processResources
|
||||
|
@@ -3,14 +3,13 @@ package blocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BasicBlock extends Block{
|
||||
|
||||
public BasicBlock(String name, Material material, float hardness, float resistance) {
|
||||
super(material);
|
||||
setUnlocalizedName(name);
|
||||
setRegistryName(name);
|
||||
setHardness(hardness);
|
||||
setResistance(resistance);
|
||||
}
|
||||
public class BasicBlock extends Block {
|
||||
|
||||
public BasicBlock(String name, Material material, float hardness, float resistance) {
|
||||
super(material);
|
||||
setUnlocalizedName(name);
|
||||
setRegistryName(name);
|
||||
setHardness(hardness);
|
||||
setResistance(resistance);
|
||||
}
|
||||
}
|
||||
|
@@ -2,12 +2,9 @@ package blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockAdamantiteOre extends BasicBlock{
|
||||
|
||||
public BlockAdamantiteOre() {
|
||||
super("adamantite_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
|
||||
|
||||
public class BlockAdamantiteOre extends BasicBlock {
|
||||
|
||||
public BlockAdamantiteOre() {
|
||||
super("adamantite_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
}
|
||||
|
@@ -2,12 +2,9 @@ package blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockArcaniteOre extends BasicBlock{
|
||||
|
||||
public BlockArcaniteOre() {
|
||||
super("arcanite_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
|
||||
|
||||
public class BlockArcaniteOre extends BasicBlock {
|
||||
|
||||
public BlockArcaniteOre() {
|
||||
super("arcanite_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
}
|
||||
|
@@ -2,12 +2,9 @@ package blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockBasalt extends BasicBlock{
|
||||
|
||||
public BlockBasalt() {
|
||||
super("basalt", Material.ROCK, 12.0f, 2.0f);
|
||||
}
|
||||
|
||||
|
||||
public class BlockBasalt extends BasicBlock {
|
||||
|
||||
public BlockBasalt() {
|
||||
super("basalt", Material.ROCK, 12.0f, 2.0f);
|
||||
}
|
||||
}
|
||||
|
@@ -2,12 +2,9 @@ package blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockBismuthOre extends BasicBlock{
|
||||
|
||||
public BlockBismuthOre() {
|
||||
super("bismuth_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
|
||||
|
||||
public class BlockBismuthOre extends BasicBlock {
|
||||
|
||||
public BlockBismuthOre() {
|
||||
super("bismuth_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
}
|
||||
|
@@ -2,12 +2,9 @@ package blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockEterniteOre extends BasicBlock{
|
||||
|
||||
public BlockEterniteOre() {
|
||||
super("eternite_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
|
||||
|
||||
public class BlockEterniteOre extends BasicBlock {
|
||||
|
||||
public BlockEterniteOre() {
|
||||
super("eternite_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
}
|
||||
|
@@ -2,12 +2,9 @@ package blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockKarmesineOre extends BasicBlock{
|
||||
|
||||
public BlockKarmesineOre() {
|
||||
super("karmesine_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
|
||||
|
||||
public class BlockKarmesineOre extends BasicBlock {
|
||||
|
||||
public BlockKarmesineOre() {
|
||||
super("karmesine_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
}
|
||||
|
@@ -2,12 +2,9 @@ package blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockLigniteOre extends BasicBlock{
|
||||
|
||||
public BlockLigniteOre() {
|
||||
super("lignite_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
|
||||
|
||||
public class BlockLigniteOre extends BasicBlock {
|
||||
|
||||
public BlockLigniteOre() {
|
||||
super("lignite_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
}
|
||||
|
@@ -2,12 +2,9 @@ package blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockMeteoriteOre extends BasicBlock{
|
||||
|
||||
public BlockMeteoriteOre() {
|
||||
super("meteorite_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
|
||||
|
||||
public class BlockMeteoriteOre extends BasicBlock {
|
||||
|
||||
public BlockMeteoriteOre() {
|
||||
super("meteorite_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
}
|
||||
|
@@ -2,12 +2,9 @@ package blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockMindoriteOre extends BasicBlock{
|
||||
|
||||
public BlockMindoriteOre() {
|
||||
super("mindorite_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
|
||||
|
||||
public class BlockMindoriteOre extends BasicBlock {
|
||||
|
||||
public BlockMindoriteOre() {
|
||||
super("mindorite_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
}
|
||||
|
@@ -2,12 +2,9 @@ package blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockMythrilOre extends BasicBlock{
|
||||
|
||||
public BlockMythrilOre() {
|
||||
super("mythril_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
|
||||
|
||||
public class BlockMythrilOre extends BasicBlock {
|
||||
|
||||
public BlockMythrilOre() {
|
||||
super("mythril_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
}
|
||||
|
@@ -2,12 +2,9 @@ package blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockPalladiumOre extends BasicBlock{
|
||||
|
||||
public BlockPalladiumOre() {
|
||||
super("palladium_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
|
||||
|
||||
public class BlockPalladiumOre extends BasicBlock {
|
||||
|
||||
public BlockPalladiumOre() {
|
||||
super("palladium_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
}
|
||||
|
@@ -2,12 +2,9 @@ package blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockPrometheumOre extends BasicBlock{
|
||||
|
||||
public BlockPrometheumOre() {
|
||||
super("prometheum_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
|
||||
|
||||
public class BlockPrometheumOre extends BasicBlock {
|
||||
|
||||
public BlockPrometheumOre() {
|
||||
super("prometheum_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
}
|
||||
|
@@ -2,12 +2,9 @@ package blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockRottenGround extends BasicBlock{
|
||||
|
||||
public BlockRottenGround() {
|
||||
super("rotten_ground", Material.GROUND, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
|
||||
public class BlockRottenGround extends BasicBlock {
|
||||
|
||||
public BlockRottenGround() {
|
||||
super("rotten_ground", Material.GROUND, 1.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
@@ -2,12 +2,9 @@ package blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockSlagironOre extends BasicBlock{
|
||||
|
||||
public BlockSlagironOre() {
|
||||
super("slagiron_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
|
||||
|
||||
public class BlockSlagironOre extends BasicBlock {
|
||||
|
||||
public BlockSlagironOre() {
|
||||
super("slagiron_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
}
|
||||
|
@@ -2,12 +2,9 @@ package blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockTiberiumOre extends BasicBlock{
|
||||
|
||||
public BlockTiberiumOre() {
|
||||
super("tiberium_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
|
||||
|
||||
public class BlockTiberiumOre extends BasicBlock {
|
||||
|
||||
public BlockTiberiumOre() {
|
||||
super("tiberium_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
}
|
||||
|
@@ -2,12 +2,9 @@ package blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockVibraniumre extends BasicBlock{
|
||||
public class BlockVibraniumre extends BasicBlock {
|
||||
|
||||
public BlockVibraniumre() {
|
||||
super("vibranium_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
public BlockVibraniumre() {
|
||||
super("vibranium_ore", Material.ROCK, 3.0f, 5.0f);
|
||||
}
|
||||
}
|
@@ -2,11 +2,10 @@ package items;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class BasicItem extends Item{
|
||||
|
||||
public BasicItem(String name) {
|
||||
setUnlocalizedName(name);
|
||||
setRegistryName(name);
|
||||
}
|
||||
public class BasicItem extends Item {
|
||||
|
||||
BasicItem(String name) {
|
||||
setUnlocalizedName(name);
|
||||
setRegistryName(name);
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,8 @@
|
||||
package items;
|
||||
|
||||
public class ItemSlagiron extends BasicItem{
|
||||
|
||||
public ItemSlagiron() {
|
||||
super("slagiron");
|
||||
}
|
||||
|
||||
public class ItemSlagiron extends BasicItem {
|
||||
|
||||
public ItemSlagiron() {
|
||||
super("slagiron");
|
||||
}
|
||||
}
|
||||
|
@@ -32,83 +32,73 @@ import proxy.ServerProxy;
|
||||
@Mod(modid = ZCompression.MODID, version = ZCompression.VERSION)
|
||||
public class ZCompression {
|
||||
|
||||
public static final String MODID = "zcompression";
|
||||
public static final String VERSION = "1.0";
|
||||
|
||||
@SidedProxy(clientSide = "proxy.ClientProxy", serverSide = "proxy.ServerProxy")
|
||||
public static ServerProxy proxy;
|
||||
|
||||
// Items
|
||||
public static ItemSlagiron slagiron = new ItemSlagiron();
|
||||
|
||||
|
||||
//Blocks, esp. for tconstruct
|
||||
public static BlockAdamantiteOre adamantiteOre = new BlockAdamantiteOre();
|
||||
public static BlockArcaniteOre arcaniteOre = new BlockArcaniteOre();
|
||||
public static BlockBasalt basalt = new BlockBasalt();
|
||||
public static BlockBismuthOre bismuthOre = new BlockBismuthOre();
|
||||
public static BlockEterniteOre eterniteOre = new BlockEterniteOre();
|
||||
public static BlockKarmesineOre karmesineOre = new BlockKarmesineOre();
|
||||
public static BlockLigniteOre ligniteOre = new BlockLigniteOre();
|
||||
public static BlockMeteoriteOre meteoriteOre = new BlockMeteoriteOre();
|
||||
public static BlockMindoriteOre mindoriteOre = new BlockMindoriteOre();
|
||||
public static BlockMythrilOre mythrilOre = new BlockMythrilOre();
|
||||
public static BlockPalladiumOre palladiumOre = new BlockPalladiumOre();
|
||||
public static BlockPrometheumOre prometheumOre = new BlockPrometheumOre();
|
||||
public static BlockRottenGround rottenGround = new BlockRottenGround();
|
||||
public static BlockSlagironOre slagironOre = new BlockSlagironOre();
|
||||
public static BlockTiberiumOre tiberiumOre = new BlockTiberiumOre();
|
||||
public static BlockVibraniumre vibraniumOre = new BlockVibraniumre();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent e){
|
||||
GameRegistry.register(slagiron);
|
||||
registerBlock(adamantiteOre);
|
||||
registerBlock(arcaniteOre);
|
||||
registerBlock(basalt);
|
||||
registerBlock(bismuthOre);
|
||||
registerBlock(eterniteOre);
|
||||
registerBlock(karmesineOre);
|
||||
registerBlock(ligniteOre);
|
||||
registerBlock(meteoriteOre);
|
||||
registerBlock(mindoriteOre);
|
||||
registerBlock(mythrilOre);
|
||||
registerBlock(palladiumOre);
|
||||
registerBlock(prometheumOre);
|
||||
registerBlock(rottenGround);
|
||||
registerBlock(slagironOre);
|
||||
registerBlock(tiberiumOre);
|
||||
registerBlock(vibraniumOre);
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent e){
|
||||
proxy.registerClientStuff();
|
||||
GameRegistry.registerWorldGenerator(new ZWorldGen(), 100);
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent e){
|
||||
static final String MODID = "zcompression";
|
||||
static final String VERSION = "1.0";
|
||||
|
||||
@SidedProxy(clientSide = "proxy.ClientProxy", serverSide = "proxy.ServerProxy")
|
||||
private static ServerProxy proxy;
|
||||
|
||||
// Items
|
||||
public static ItemSlagiron slagiron = new ItemSlagiron();
|
||||
|
||||
|
||||
//Blocks, esp. for tconstruct
|
||||
public static BlockAdamantiteOre adamantiteOre = new BlockAdamantiteOre();
|
||||
public static BlockArcaniteOre arcaniteOre = new BlockArcaniteOre();
|
||||
public static BlockBasalt basalt = new BlockBasalt();
|
||||
public static BlockBismuthOre bismuthOre = new BlockBismuthOre();
|
||||
public static BlockEterniteOre eterniteOre = new BlockEterniteOre();
|
||||
public static BlockKarmesineOre karmesineOre = new BlockKarmesineOre();
|
||||
public static BlockLigniteOre ligniteOre = new BlockLigniteOre();
|
||||
public static BlockMeteoriteOre meteoriteOre = new BlockMeteoriteOre();
|
||||
public static BlockMindoriteOre mindoriteOre = new BlockMindoriteOre();
|
||||
public static BlockMythrilOre mythrilOre = new BlockMythrilOre();
|
||||
public static BlockPalladiumOre palladiumOre = new BlockPalladiumOre();
|
||||
public static BlockPrometheumOre prometheumOre = new BlockPrometheumOre();
|
||||
public static BlockRottenGround rottenGround = new BlockRottenGround();
|
||||
public static BlockSlagironOre slagironOre = new BlockSlagironOre();
|
||||
public static BlockTiberiumOre tiberiumOre = new BlockTiberiumOre();
|
||||
public static BlockVibraniumre vibraniumOre = new BlockVibraniumre();
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent e) {
|
||||
GameRegistry.register(slagiron);
|
||||
registerBlock(adamantiteOre);
|
||||
registerBlock(arcaniteOre);
|
||||
registerBlock(basalt);
|
||||
registerBlock(bismuthOre);
|
||||
registerBlock(eterniteOre);
|
||||
registerBlock(karmesineOre);
|
||||
registerBlock(ligniteOre);
|
||||
registerBlock(meteoriteOre);
|
||||
registerBlock(mindoriteOre);
|
||||
registerBlock(mythrilOre);
|
||||
registerBlock(palladiumOre);
|
||||
registerBlock(prometheumOre);
|
||||
registerBlock(rottenGround);
|
||||
registerBlock(slagironOre);
|
||||
registerBlock(tiberiumOre);
|
||||
registerBlock(vibraniumOre);
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent e) {
|
||||
proxy.registerClientStuff();
|
||||
GameRegistry.registerWorldGenerator(new ZWorldGen(), 100);
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent e) {
|
||||
|
||||
}
|
||||
|
||||
private static void registerBlock(BasicBlock block) {
|
||||
GameRegistry.register(block);
|
||||
GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void registerBlock(BasicBlock block){
|
||||
GameRegistry.register(block);
|
||||
GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -1,39 +1,33 @@
|
||||
package main.util;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.pattern.BlockMatcher;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenMinable;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class Generator {
|
||||
|
||||
public static void generateOre(IBlockState state, Random random, int x, int z, World world, int chance, int minY, int maxY, int minSize, int maxSize){
|
||||
generateOre(state, Blocks.STONE, random, x, z, world, chance, minY, maxY, minSize, maxSize);
|
||||
}
|
||||
|
||||
public static void generateNetherOre(IBlockState state, Random random, int x, int z, World world, int chance, int minY, int maxY, int minSize, int maxSize){
|
||||
generateOre(state, Blocks.NETHERRACK, random, x, z, world, chance, minY, maxY, minSize, maxSize);
|
||||
}
|
||||
|
||||
|
||||
public static void generateOre(IBlockState state, Block replace, Random random, int chunkX, int chunkZ, World world, int chance, int minY, int maxY, int minSize, int maxSize){
|
||||
int size = minSize + random.nextInt(maxSize - minSize);
|
||||
int height = maxY - minY;
|
||||
|
||||
for(int i = 0; i < chance; i++) {
|
||||
int posX = chunkX + random.nextInt(16);
|
||||
int posY = random.nextInt(height) + minY;
|
||||
int posZ = chunkZ + random.nextInt(16);
|
||||
new WorldGenMinable(state, size, BlockMatcher.forBlock(replace)).generate(world, random, new BlockPos(posX, posY, posZ));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void generateOre(IBlockState state, Random random, int x, int z, World world, int chance, int minY, int maxY, int minSize, int maxSize) {
|
||||
generateOre(state, Blocks.STONE.getDefaultState(), random, x, z, world, chance, minY, maxY, minSize, maxSize);
|
||||
}
|
||||
|
||||
public static void generateNetherOre(IBlockState state, Random random, int x, int z, World world, int chance, int minY, int maxY, int minSize, int maxSize) {
|
||||
generateOre(state, Blocks.NETHERRACK.getDefaultState(), random, x, z, world, chance, minY, maxY, minSize, maxSize);
|
||||
}
|
||||
|
||||
|
||||
public static void generateOre(IBlockState state, IBlockState replace, Random random, int chunkX, int chunkZ, World world, int chance, int minY, int maxY, int minSize, int maxSize) {
|
||||
int size = minSize + random.nextInt(maxSize - minSize);
|
||||
int height = maxY - minY;
|
||||
|
||||
for (int i = 0; i < chance; i++) {
|
||||
int posX = chunkX + random.nextInt(16);
|
||||
int posY = random.nextInt(height) + minY;
|
||||
int posZ = chunkZ + random.nextInt(16);
|
||||
new WorldGenMinable(state, size, StateMatcher.forState(replace)).generate(world, random, new BlockPos(posX, posY, posZ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
21
src/main/java/main/util/StateMatcher.java
Normal file
21
src/main/java/main/util/StateMatcher.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package main.util;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
||||
|
||||
public class StateMatcher implements Predicate<IBlockState> {
|
||||
private final IBlockState state;
|
||||
|
||||
private StateMatcher(IBlockState state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public static StateMatcher forState(IBlockState state) {
|
||||
return new StateMatcher(state);
|
||||
}
|
||||
|
||||
public boolean apply(IBlockState state) {
|
||||
return state != null && state.getBlock() == this.state.getBlock() && state.getMaterial() == this.state.getMaterial();
|
||||
}
|
||||
}
|
@@ -1,65 +1,56 @@
|
||||
package main.world;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
|
||||
import main.ZCompression;
|
||||
import main.util.Generator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraftforge.fml.common.IWorldGenerator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ZWorldGen implements IWorldGenerator {
|
||||
private void nether(Random random, int x, int z, World world) {
|
||||
Generator.generateNetherOre(ZCompression.adamantiteOre.getDefaultState(), random, x, z, world, 24, 1, 32, 2, 5);
|
||||
Generator.generateNetherOre(ZCompression.tiberiumOre.getDefaultState(), random, x, z, world, 60, 1, 128, 2, 10);
|
||||
Generator.generateNetherOre(ZCompression.palladiumOre.getDefaultState(), random, x, z, world, 15, 32, 64, 3, 6);
|
||||
Generator.generateOre(ZCompression.prometheumOre.getDefaultState(), random, x, z, world, 20, 48, 64, 2, 4);
|
||||
}
|
||||
|
||||
|
||||
private void nether(Random random, int x, int z, World world){
|
||||
Generator.generateNetherOre(ZCompression.adamantiteOre.getDefaultState(), random, x, z, world, 24, 1, 32, 2, 5);
|
||||
Generator.generateNetherOre(ZCompression.tiberiumOre.getDefaultState(), random, x, z, world, 60, 1, 128, 2, 10);
|
||||
Generator.generateNetherOre(ZCompression.palladiumOre.getDefaultState(), random, x, z, world, 15, 32, 64, 3, 6);
|
||||
Generator.generateOre(ZCompression.prometheumOre.getDefaultState(), random, x, z, world, 20, 48, 64, 2, 4);
|
||||
}
|
||||
|
||||
private void world(Random random, int x, int z, World world){
|
||||
// Regular
|
||||
Generator.generateOre(ZCompression.slagironOre.getDefaultState(), random, x, z, world, 40, 8, 96, 5, 16);
|
||||
Generator.generateOre(ZCompression.ligniteOre.getDefaultState(), random, x, z, world, 40, 8, 96, 5, 15);
|
||||
Generator.generateOre(Blocks.IRON_ORE.getDefaultState(),random, x, z, world, 40, 8, 96, 2, 10);
|
||||
Generator.generateOre(ZCompression.basalt.getDefaultState(), Blocks.LAVA, random, x, z, world, 20, 8, 24, 2, 5);
|
||||
Generator.generateOre(ZCompression.rottenGround.getDefaultState(), Blocks.DIRT, random, x, z, world, 25, 50, 70, 2, 15);
|
||||
|
||||
Generator.generateOre(ZCompression.vibraniumOre.getDefaultState(), random, x, z, world, 16, 48, 64, 2, 4);
|
||||
Generator.generateOre(ZCompression.mythrilOre.getDefaultState(), random, x, z, world, 16, 16, 32, 2, 4);
|
||||
Generator.generateOre(ZCompression.meteoriteOre.getDefaultState(), random, x, z, world, 25, 0, 32, 3, 6);
|
||||
Generator.generateOre(ZCompression.mindoriteOre.getDefaultState(), Blocks.STONE, random, x, z, world, 450, 32, 96, 3, 6);
|
||||
}
|
||||
private void world(Random random, int x, int z, World world) {
|
||||
Generator.generateOre(ZCompression.slagironOre.getDefaultState(), random, x, z, world, 40, 8, 96, 5, 16);
|
||||
Generator.generateOre(ZCompression.ligniteOre.getDefaultState(), random, x, z, world, 40, 8, 96, 5, 15);
|
||||
Generator.generateOre(Blocks.IRON_ORE.getDefaultState(), random, x, z, world, 40, 8, 96, 2, 10);
|
||||
Generator.generateOre(ZCompression.basalt.getDefaultState(), Blocks.LAVA.getDefaultState(), random, x, z, world, 20, 8, 24, 2, 5);
|
||||
Generator.generateOre(ZCompression.rottenGround.getDefaultState(), Blocks.DIRT.getDefaultState(), random, x, z, world, 25, 50, 70, 2, 15);
|
||||
|
||||
private void end(Random random, int x, int z, World world){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
|
||||
IChunkProvider chunkProvider) {
|
||||
int x = chunkX * 16;
|
||||
int z = chunkZ * 16;
|
||||
switch(world.provider.getDimension()) {
|
||||
case -1:
|
||||
nether(random, x, z, world);
|
||||
break;
|
||||
case 0:
|
||||
world(random, x, z, world);
|
||||
break;
|
||||
case 1:
|
||||
end(random, x, z, world);
|
||||
break;
|
||||
}
|
||||
Generator.generateOre(ZCompression.vibraniumOre.getDefaultState(), random, x, z, world, 16, 48, 64, 2, 4);
|
||||
Generator.generateOre(ZCompression.mythrilOre.getDefaultState(), random, x, z, world, 16, 16, 32, 2, 4);
|
||||
Generator.generateOre(ZCompression.meteoriteOre.getDefaultState(), random, x, z, world, 25, 0, 32, 3, 6);
|
||||
Generator.generateOre(ZCompression.mindoriteOre.getDefaultState(), Blocks.STONE.getDefaultState(), random, x, z, world, 450, 32, 96, 3, 6);
|
||||
}
|
||||
|
||||
}
|
||||
private void end(Random random, int x, int z, World world) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
|
||||
IChunkProvider chunkProvider) {
|
||||
int x = chunkX * 16;
|
||||
int z = chunkZ * 16;
|
||||
switch (world.provider.getDimension()) {
|
||||
case -1:
|
||||
nether(random, x, z, world);
|
||||
break;
|
||||
case 0:
|
||||
world(random, x, z, world);
|
||||
break;
|
||||
case 1:
|
||||
end(random, x, z, world);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,46 +1,42 @@
|
||||
package proxy;
|
||||
|
||||
import blocks.BasicBlock;
|
||||
import items.BasicItem;
|
||||
import main.ZCompression;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ClientProxy extends ServerProxy{
|
||||
|
||||
@Override
|
||||
public void registerClientStuff() {
|
||||
// Items
|
||||
registerItemModel(ZCompression.slagiron);
|
||||
|
||||
// Blocks
|
||||
registerBlockModel(ZCompression.adamantiteOre);
|
||||
registerBlockModel(ZCompression.arcaniteOre);
|
||||
registerBlockModel(ZCompression.basalt);
|
||||
registerBlockModel(ZCompression.bismuthOre);
|
||||
registerBlockModel(ZCompression.eterniteOre);
|
||||
registerBlockModel(ZCompression.karmesineOre);
|
||||
registerBlockModel(ZCompression.ligniteOre);
|
||||
registerBlockModel(ZCompression.meteoriteOre);
|
||||
registerBlockModel(ZCompression.mindoriteOre);
|
||||
registerBlockModel(ZCompression.mythrilOre);
|
||||
registerBlockModel(ZCompression.palladiumOre);
|
||||
registerBlockModel(ZCompression.prometheumOre);
|
||||
registerBlockModel(ZCompression.rottenGround);
|
||||
registerBlockModel(ZCompression.slagironOre);
|
||||
registerBlockModel(ZCompression.tiberiumOre);
|
||||
registerBlockModel(ZCompression.vibraniumOre);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void registerItemModel(Item item){
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
|
||||
}
|
||||
public class ClientProxy extends ServerProxy {
|
||||
|
||||
public static void registerBlockModel(Block block){
|
||||
registerItemModel(Item.getItemFromBlock(block));
|
||||
}
|
||||
@Override
|
||||
public void registerClientStuff() {
|
||||
// Items
|
||||
registerItemModel(ZCompression.slagiron);
|
||||
|
||||
// Blocks
|
||||
registerBlockModel(ZCompression.adamantiteOre);
|
||||
registerBlockModel(ZCompression.arcaniteOre);
|
||||
registerBlockModel(ZCompression.basalt);
|
||||
registerBlockModel(ZCompression.bismuthOre);
|
||||
registerBlockModel(ZCompression.eterniteOre);
|
||||
registerBlockModel(ZCompression.karmesineOre);
|
||||
registerBlockModel(ZCompression.ligniteOre);
|
||||
registerBlockModel(ZCompression.meteoriteOre);
|
||||
registerBlockModel(ZCompression.mindoriteOre);
|
||||
registerBlockModel(ZCompression.mythrilOre);
|
||||
registerBlockModel(ZCompression.palladiumOre);
|
||||
registerBlockModel(ZCompression.prometheumOre);
|
||||
registerBlockModel(ZCompression.rottenGround);
|
||||
registerBlockModel(ZCompression.slagironOre);
|
||||
registerBlockModel(ZCompression.tiberiumOre);
|
||||
registerBlockModel(ZCompression.vibraniumOre);
|
||||
}
|
||||
|
||||
private static void registerBlockModel(Block block) {
|
||||
registerItemModel(Item.getItemFromBlock(block));
|
||||
}
|
||||
|
||||
private static void registerItemModel(Item item) {
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
package proxy;
|
||||
|
||||
public class ServerProxy {
|
||||
|
||||
public void registerClientStuff() {}
|
||||
|
||||
|
||||
public void registerClientStuff() {
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user