This repository has been archived by the owner on Jul 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
206868d
commit 0ccd60a
Showing
11 changed files
with
242 additions
and
7 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
src/main/java/me/roryclaasen/rorysmod/command/CommandBase.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,51 @@ | ||
/* | ||
* Copyright 2017 Rory Claasen | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package me.roryclaasen.rorysmod.command; | ||
|
||
import java.util.List; | ||
|
||
import net.minecraft.command.ICommand; | ||
import net.minecraft.command.ICommandSender; | ||
|
||
public abstract class CommandBase extends net.minecraft.command.CommandBase { | ||
|
||
protected final List<String> aliases; | ||
|
||
public CommandBase(List<String> aliases) { | ||
this.aliases = aliases; | ||
} | ||
|
||
public int compareTo(Object o) { | ||
return super.compareTo((ICommand) o); | ||
} | ||
|
||
@Override | ||
public int getRequiredPermissionLevel() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public abstract String getCommandName(); | ||
|
||
@Override | ||
public abstract String getCommandUsage(ICommandSender sender); | ||
|
||
@SuppressWarnings("rawtypes") | ||
@Override | ||
public List getCommandAliases() { | ||
return this.aliases; | ||
} | ||
|
||
@Override | ||
public abstract void processCommand(ICommandSender sender, String[] args); | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/me/roryclaasen/rorysmod/command/CommandPing.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,39 @@ | ||
/* | ||
* Copyright 2017 Rory Claasen | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package me.roryclaasen.rorysmod.command; | ||
|
||
import net.minecraft.command.ICommandSender; | ||
import net.minecraft.util.ChatComponentText; | ||
|
||
public class CommandPing extends CommandBase { | ||
|
||
public CommandPing() { | ||
super(null); | ||
} | ||
|
||
@Override | ||
public String getCommandName() { | ||
return "ping"; | ||
} | ||
|
||
@Override | ||
public String getCommandUsage(ICommandSender sender) { | ||
return "/ping"; | ||
} | ||
|
||
@Override | ||
public void processCommand(ICommandSender sender, String[] args) { | ||
if (sender.getEntityWorld().isRemote) return; | ||
sender.addChatMessage(new ChatComponentText("pong")); | ||
} | ||
} |
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
63 changes: 63 additions & 0 deletions
63
src/main/java/me/roryclaasen/rorysmod/core/init/ModAchievements.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,63 @@ | ||
/* | ||
* Copyright 2017 Rory Claasen | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package me.roryclaasen.rorysmod.core.init; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import cpw.mods.fml.common.event.FMLInitializationEvent; | ||
import cpw.mods.fml.common.event.FMLPostInitializationEvent; | ||
import cpw.mods.fml.common.event.FMLPreInitializationEvent; | ||
import me.roryclaasen.rorysmod.core.RorysGlobal; | ||
import me.roryclaasen.rorysmod.core.RorysMod; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.stats.Achievement; | ||
import net.minecraftforge.common.AchievementPage; | ||
|
||
public class ModAchievements implements ModInterface { | ||
|
||
public AchievementPage page; | ||
private static final String BASE_ID = "achievement."; | ||
|
||
private List<Achievement> all; | ||
|
||
public Achievement solderDust, solderArmor, solderArmorFull; | ||
|
||
@Override | ||
public void preInit(FMLPreInitializationEvent event) { | ||
all = new ArrayList<Achievement>(); | ||
} | ||
|
||
@Override | ||
public void init(FMLInitializationEvent event) { | ||
solderDust = createAchievement("solder_dust", 1, -3, RorysMod.items.solderDust, null); | ||
solderArmor = createAchievement("solder_arm", 2, -4, RorysMod.items.solderChest, solderDust); | ||
solderArmorFull = createAchievement("solder_armFull", 4, -4, RorysMod.items.solderHelm, solderArmor).setSpecial(); | ||
|
||
page = new AchievementPage(RorysGlobal.NAME, (Achievement[]) all.toArray(new Achievement[] {})); | ||
AchievementPage.registerAchievementPage(page); | ||
} | ||
|
||
@Override | ||
public void postinit(FMLPostInitializationEvent event) {} | ||
|
||
private Achievement createAchievement(String name, int x, int y, Item item, Achievement parent) { | ||
Achievement temp = new Achievement(BASE_ID + name, name, x, y, item, parent); | ||
all.add(temp); | ||
return temp; | ||
} | ||
|
||
public List<Achievement> getAllAchivements() { | ||
return page.getAchievements(); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/me/roryclaasen/rorysmod/core/init/ModCommands.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,23 @@ | ||
/* | ||
* Copyright 2017 Rory Claasen | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package me.roryclaasen.rorysmod.core.init; | ||
|
||
import cpw.mods.fml.common.event.FMLServerStartingEvent; | ||
import me.roryclaasen.rorysmod.command.CommandPing; | ||
|
||
public class ModCommands { | ||
|
||
public void serverLoad(FMLServerStartingEvent event) { | ||
event.registerServerCommand(new CommandPing()); | ||
} | ||
} |
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