-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
36 changed files
with
702 additions
and
53 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
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
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: 11 additions & 0 deletions
11
src/main/java/com/github/wdawning/dawncraft/command/CommandLoader.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,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()); | ||
} | ||
} |
88 changes: 88 additions & 0 deletions
88
src/main/java/com/github/wdawning/dawncraft/command/CommandMagic.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,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; | ||
} | ||
} |
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
Oops, something went wrong.