Skip to content

Commit

Permalink
Main changes
Browse files Browse the repository at this point in the history
  • Loading branch information
exys228 authored Jun 4, 2017
1 parent 2048692 commit 6a5488c
Show file tree
Hide file tree
Showing 10 changed files with 314 additions and 303 deletions.
29 changes: 2 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ buildscript {
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "Modmuss50"
url = "http://maven.modmuss50.me/"
}
}
dependencies {
Expand All @@ -21,31 +17,15 @@ apply plugin: 'maven-publish'
sourceCompatibility = 1.8
targetCompatibility = 1.8


repositories {
maven {
name = "Modmuss50"
url = "http://maven.modmuss50.me/"
}
}


repositories {
maven {
name = "Modmuss50"
url = "http://maven.modmuss50.me/"
}
}

version = "1.1.0"
version = "1.1.2-fix"

def ENV = System.getenv()
if (ENV.BUILD_NUMBER) {
version = version + "." + "${System.getenv().BUILD_NUMBER}"
}

minecraft {
version = "1.10.2-12.18.2.2121"
version = "1.11.2-13.20.0.2312"
mappings = "stable_29"
replace "@MODVERSION@", project.version
runDir = "run"
Expand All @@ -54,11 +34,6 @@ minecraft {

group = 'SimpleVoidWorld'


dependencies {
deobfCompile 'RebornCore:RebornCore-1.10.2:+:universal'
}

processResources
{
from(sourceSets.main.resources.srcDirs) {
Expand Down
37 changes: 19 additions & 18 deletions src/main/java/me/modmuss50/svw/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,30 @@

import java.io.File;

/**
* Created by modmuss50 on 01/12/16.
*/
public class Config {
public class Config
{

public static Configuration config;
public static String CATEGORY_IDS = "IDs";
public static String CATEGORY_TWEAKS = "TWEAKS";
public static Configuration config;
public static String CATEGORY_IDS = "IDs";
public static String CATEGORY_TWEAKS = "TWEAKS";

public static int dimID = 43;
public static boolean darkSky = true;
public static boolean eternalDay = true;
public static int dimID = 43;
public static boolean darkSky = false;
public static boolean eternalDay = false;
public static boolean canMobsSpawn = false;

public static void load(File configFile) {
config = new Configuration(configFile);
config.load();
public static void load(File configFile)
{
config = new Configuration(configFile);
config.load();

dimID = config.get(CATEGORY_IDS, "Dim id", 43, "This is the id of the dimension in the mod, this should be unique to Simple Void World").getInt();
dimID = config.get(CATEGORY_IDS, "dim_id", dimID, "This is the id of the dimension in the mod, this should be unique to Simple Void World").getInt();

darkSky = config.get(CATEGORY_TWEAKS, "Dark mode", false, "When set to true the sky and fog color are black this creates a seamless skybox").getBoolean();
eternalDay = config.get(CATEGORY_TWEAKS, "Its High Noon", false, "When true this locks the at noon and creates an eternal day").getBoolean();
darkSky = config.get(CATEGORY_TWEAKS, "dark_fog", darkSky, "When true the sky and fog color are black. This creates a seamless skybox").getBoolean();
eternalDay = config.get(CATEGORY_TWEAKS, "time", eternalDay, "-1 = always night; 0 = normal; 1 = always day;").getBoolean();
canMobsSpawn = config.get(CATEGORY_TWEAKS, "mobs_spawning", canMobsSpawn, "Can mobs spawn in void or not").getBoolean();

config.save();
}
config.save();
}

}
93 changes: 46 additions & 47 deletions src/main/java/me/modmuss50/svw/SimpleVoidWorld.java
Original file line number Diff line number Diff line change
@@ -1,63 +1,62 @@
package me.modmuss50.svw;

import me.modmuss50.svw.blocks.BlockPortal;
import me.modmuss50.svw.proxy.ClientProxy;
import me.modmuss50.svw.proxy.CommonProxy;
import me.modmuss50.svw.world.VoidWorldProvider;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.DimensionType;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import reborncore.RebornRegistry;
import reborncore.common.util.CraftingHelper;

@Mod(modid = "simplevoidworld", name = "SimpleVoidWorld", version = "@MODVERSION@", dependencies = "required-after:reborncore")
public class SimpleVoidWorld {

public static Block portal;
public static VoidTab creativeTab;

@SidedProxy(clientSide = "me.modmuss50.svw.proxy.ClientProxy", serverSide = "me.modmuss50.svw.proxy.CommonProxy")
public static CommonProxy proxy;
public static DimensionType type;

@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event){
Config.load(event.getSuggestedConfigurationFile());

creativeTab = new VoidTab();
portal = new BlockPortal();
RebornRegistry.registerBlock(portal, "simplevoidworld:portal");

proxy.init();

type = DimensionType.register("simplevoidworld", "void", Config.dimID, VoidWorldProvider.class, false);
DimensionManager.registerDimension(Config.dimID, type);
}

@Mod.EventHandler
public void init(FMLInitializationEvent event) {
CraftingHelper.addShapedOreRecipe(new ItemStack(portal), "OEO", "EDE", "OEO", 'O',
Blocks.OBSIDIAN, 'E', Items.ENDER_EYE, 'D', Blocks.DIAMOND_BLOCK);
}

public static class VoidTab extends CreativeTabs {

public VoidTab() {
super("simplevoidworld.creative.tab");
}

@Override
public Item getTabIconItem() {
return Item.getItemFromBlock(portal);
}
}
import net.minecraftforge.fml.common.registry.GameRegistry;

@Mod(modid = SimpleVoidWorld.MOD_ID, name = "SimpleVoidWorld", version = "@MODVERSION@")
public class SimpleVoidWorld
{
public static BlockPortal portal;

public static final String MOD_ID = "simplevoidworld";

@SidedProxy(clientSide = "me.modmuss50.svw.proxy.ClientProxy", serverSide = "me.modmuss50.svw.proxy.CommonProxy")
public static CommonProxy proxy;
public static DimensionType type;

@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
Config.load(event.getSuggestedConfigurationFile());

portal = new BlockPortal();
this.RegisterBlock(portal);

proxy.init();

type = DimensionType.register(MOD_ID, "void", Config.dimID, VoidWorldProvider.class, false);
DimensionManager.registerDimension(Config.dimID, type);
}

@Mod.EventHandler
public void init(FMLInitializationEvent event)
{
GameRegistry.addShapedRecipe(new ItemStack(portal),
"OEO",
"EDE",
"OEO",

'O', Blocks.OBSIDIAN,
'E', Items.ENDER_EYE,
'D', Blocks.DIAMOND_BLOCK);
}

public void RegisterBlock(Block block)
{
GameRegistry.register(block);
GameRegistry.register(new ItemBlock(block), block.getRegistryName());
}
}
77 changes: 42 additions & 35 deletions src/main/java/me/modmuss50/svw/blocks/BlockPortal.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
Expand All @@ -19,40 +18,48 @@

import javax.annotation.Nullable;

/**
* Created by modmuss50 on 01/12/16.
*/
public class BlockPortal extends Block {
public BlockPortal() {
super(Material.PORTAL);
setCreativeTab(CreativeTabs.MISC);
setUnlocalizedName("simplevoidworld:portal");
setCreativeTab(SimpleVoidWorld.creativeTab);
setHardness(5.0F);
setResistance(2000.0F);
setSoundType(SoundType.STONE);
}
public class BlockPortal extends Block
{
private static final String prefix = ":";

@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand,
@Nullable
ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
if (!worldIn.isRemote && !playerIn.isSneaking()) {
if (worldIn.provider.getDimension() != Config.dimID) {
FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().transferPlayerToDimension((EntityPlayerMP) playerIn, Config.dimID, new WorldTeleporter(playerIn.getServer().worldServerForDimension(Config.dimID), pos));
} else {
FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().transferPlayerToDimension((EntityPlayerMP) playerIn, 0, new WorldTeleporter(playerIn.getServer().worldServerForDimension(0), pos));
}
return true;
}
return super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ);
}
public BlockPortal()
{
super(Material.PORTAL);
setCreativeTab(CreativeTabs.MISC);
String name = SimpleVoidWorld.MOD_ID + prefix + "portal";
setUnlocalizedName(name);
setRegistryName(name);
setHardness(5.0F);
setResistance(2000.0F);
setSoundType(SoundType.STONE);
}

@Override
public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) {
if(worldIn.provider.getDimension() == Config.dimID){
return 1000F;
}
return super.getBlockHardness(blockState, worldIn, pos);
}
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable EnumFacing heldItem, float side, float hitX, float hitY)
{
if (!worldIn.isRemote && !playerIn.isSneaking())
{
if (worldIn.provider.getDimension() != Config.dimID)
{
FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().transferPlayerToDimension((EntityPlayerMP) playerIn, Config.dimID, new WorldTeleporter(playerIn.getServer().worldServerForDimension(Config.dimID), pos));
}
else
{
FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().transferPlayerToDimension((EntityPlayerMP) playerIn, 0, new WorldTeleporter(playerIn.getServer().worldServerForDimension(0), pos));
}
return true;
}
return super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY);
}

// TODO: Find another way to make portal block unbreakable in void world.
@Override
public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos)
{
if (worldIn.provider.getDimension() == Config.dimID)
{
return -1.0F;
}
return super.getBlockHardness(blockState, worldIn, pos);
}
}
28 changes: 13 additions & 15 deletions src/main/java/me/modmuss50/svw/proxy/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,18 @@
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;

/**
* Created by modmuss50 on 02/12/16.
*/
public class ClientProxy extends CommonProxy {

@Override
public void init() {
super.init();
registerItemModel(Item.getItemFromBlock(SimpleVoidWorld.portal), 0);
}

static void registerItemModel(Item item, int meta) {
ResourceLocation loc = item.getRegistryName();
ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(loc, "inventory"));
}
public class ClientProxy extends CommonProxy
{
@Override
public void init()
{
super.init();
registerItemModel(Item.getItemFromBlock(SimpleVoidWorld.portal), 0);
}

static void registerItemModel(Item item, int meta)
{
ResourceLocation loc = item.getRegistryName();
ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(loc, "inventory"));
}
}
13 changes: 5 additions & 8 deletions src/main/java/me/modmuss50/svw/proxy/CommonProxy.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package me.modmuss50.svw.proxy;

/**
* Created by modmuss50 on 02/12/16.
*/
public class CommonProxy {

public void init(){

}
public class CommonProxy
{
public void init()
{

}
}
Loading

0 comments on commit 6a5488c

Please sign in to comment.