Skip to content

Commit

Permalink
Update to B0.13.
Browse files Browse the repository at this point in the history
A large update.
Add some items about magic.
Add a gui about magic and move the air gui.
Add a command to test magic.
Add mana gui in game.
Fix IEEP and add Network support about that.
Remove Lua test.
Add Server support!!!!!!!!!!!
Add version.json and update log.
Update mcmod.info.
  • Loading branch information
DawningW committed Aug 21, 2016
1 parent 3066e11 commit 98633d8
Show file tree
Hide file tree
Showing 36 changed files with 702 additions and 53 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
!gradlew.bat
!build.gradle
!gradle.properties
!version.json
!updatelog.txt

# include markdowns
!LICENSE
Expand Down
10 changes: 8 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ buildscript {
apply plugin: 'forge'

version = mod_version
group= mod_group // http://maven.apache.org/guides/mini/guide-naming-conventions.html
url = mod_url
updateurl = mod_updateurl
updatejson = mod_updatejson
group = mod_group // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = mod_id

[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
Expand Down Expand Up @@ -60,13 +63,16 @@ processResources
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
inputs.property "url", project.url
inputs.property "updateurl", project.updateurl
inputs.property "updatejson", project.updatejson

// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'

// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
expand 'version':project.version, 'mcversion':project.minecraft.version, 'url':project.url, 'updateurl':project.updateurl, 'updatejson':project.updatejson
}

// copy everything else, thats not the mcmod.info
Expand Down
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Mod Information
mod_id = dawncraft
mod_version = B0.12.1
mod_version = B0.13
mod_group = wdawning
mod_url = https://github.com/Wdawning/Dawn-Craft-Mod
mod_updateurl = https://github.com/Wdawning/Dawn-Craft-Mod/releases
mod_updatejson = https://raw.githubusercontent.com/Wdawning/Dawn-Craft-Mod/master/version.json

# Minecraft & Forge
minecraft_version = 1.8
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/github/wdawning/dawncraft/LuaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class LuaTest
{
public LuaTest()
{
/*
ConfigLoader.logger().info("Lua Loader Started.");
String script = "assets/dawncraft/lua/hello.lua";
Expand All @@ -23,5 +24,6 @@ public LuaTest()
chunk.call( LuaValue.valueOf(script) );
ConfigLoader.logger().info("Lua Loader Stopped.");
*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.github.wdawning.dawncraft.creativetab.CreativeTabsLoader;

import net.minecraft.block.Block;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package com.github.wdawning.dawncraft.client;

import com.github.wdawning.dawncraft.common.CommonProxy;
import com.github.wdawning.dawncraft.common.GuiEventLoader;
import com.github.wdawning.dawncraft.gui.GuiLoader;

import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;


public class ClientProxy extends CommonProxy
{
@Override
Expand All @@ -23,6 +24,7 @@ public void init(FMLInitializationEvent event)
new KeyLoader();
new ItemRenderLoader();
new EntityRenderLoader();
new GuiEventLoader();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
public class KeyLoader
{
public static KeyBinding aim;
public static KeyBinding showTime;
public static KeyBinding magic;

public KeyLoader()
{
KeyLoader.aim = new KeyBinding("key." + dawncraft.MODID + ".aim", Keyboard.KEY_F, "key.categories." + dawncraft.MODID);
KeyLoader.showTime = new KeyBinding("key." + dawncraft.MODID + ".showTime", Keyboard.KEY_H, "key.categories." + dawncraft.MODID);
KeyLoader.magic = new KeyBinding("key." + dawncraft.MODID + ".magic", Keyboard.KEY_R, "key.categories." + dawncraft.MODID);

ClientRegistry.registerKeyBinding(KeyLoader.aim);
ClientRegistry.registerKeyBinding(KeyLoader.showTime);
ClientRegistry.registerKeyBinding(KeyLoader.magic);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.github.wdawning.dawncraft.command;

import net.minecraftforge.fml.common.event.FMLServerStartingEvent;

public class CommandLoader
{
public CommandLoader(FMLServerStartingEvent event)
{
event.registerServerCommand(new CommandMagic());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package com.github.wdawning.dawncraft.command;

import java.util.List;

import com.github.wdawning.dawncraft.extend.ExtendedPlayer;
import com.github.wdawning.dawncraft.network.MessageMagic;
import com.github.wdawning.dawncraft.network.NetworkLoader;

import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;

public class CommandMagic extends CommandBase
{
@Override
public String getCommandName()
{
return "magic";
}

@Override
public String getCommandUsage(ICommandSender sender) {
return "commands.magic.usage";
}

@Override
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
if(args.length > 0)
{
EntityPlayerMP entityPlayerMP = CommandBase.getCommandSenderAsPlayer(sender);

if(args[0].equals("view"))
{
entityPlayerMP.addChatMessage(new ChatComponentTranslation("commands.magic.view",
ExtendedPlayer.get(entityPlayerMP).getMana()));
}
else if(args[0].equals("set"))
{
int i = parseInt(args[1], 0);
if(i >= 0 && i <= 20)
{
ExtendedPlayer.get(entityPlayerMP).setMana(i);
entityPlayerMP.addChatMessage(new ChatComponentTranslation("commands.magic.set",
ExtendedPlayer.get(entityPlayerMP).getMana()));

NetworkLoader.instance.sendTo(new MessageMagic(i), entityPlayerMP);
}
else
{
throw new WrongUsageException("commands.magic.usage", new Object[0]);
}
}
else if(args[0].equals("reset"))
{
ExtendedPlayer.get(entityPlayerMP).replenishMana();
entityPlayerMP.addChatMessage(new ChatComponentTranslation("commands.magic.reset"));

NetworkLoader.instance.sendTo(new MessageMagic(20), entityPlayerMP);
}
else
{
throw new WrongUsageException("commands.magic.usage", new Object[0]);
}
}
else
{
throw new WrongUsageException("commands.magic.usage", new Object[0]);
}
}

@Override
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos)
{
if (args.length == 1)
{
return getListOfStringsMatchingLastWord(args, new String[] {"view", "set", "reset"});
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.wdawning.dawncraft.achievement.AchievementLoader;
import com.github.wdawning.dawncraft.block.BlockLoader;
import com.github.wdawning.dawncraft.command.CommandLoader;
import com.github.wdawning.dawncraft.crafting.CraftingLoader;
import com.github.wdawning.dawncraft.creativetab.CreativeTabsLoader;
import com.github.wdawning.dawncraft.enchantment.EnchantmentLoader;
Expand All @@ -10,6 +11,7 @@
import com.github.wdawning.dawncraft.gui.ContainerEleHeatGenerator;
import com.github.wdawning.dawncraft.gui.GuiLoader;
import com.github.wdawning.dawncraft.item.ItemLoader;
import com.github.wdawning.dawncraft.network.NetworkLoader;
import com.github.wdawning.dawncraft.potion.PotionLoader;
import com.github.wdawning.dawncraft.tileentity.TileEntityEleHeatGenerator;
import com.github.wdawning.dawncraft.tileentity.TileEntityLoader;
Expand All @@ -18,6 +20,7 @@
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;

public class CommonProxy
{
Expand All @@ -32,6 +35,7 @@ public void preInit(FMLPreInitializationEvent event)
new PotionLoader(event);
new TileEntityLoader(event);
new GuiLoader(event);
new NetworkLoader(event);
}

public void init(FMLInitializationEvent event)
Expand All @@ -48,4 +52,9 @@ public void postInit(FMLPostInitializationEvent event)
{

}

public void serverStarting(FMLServerStartingEvent event)
{
new CommandLoader(event);
}
}
Loading

0 comments on commit 98633d8

Please sign in to comment.