mod done for 1.0.0
This commit is contained in:
parent
feb12855dc
commit
4b2c8703e6
|
@ -24,7 +24,7 @@ apply plugin: 'forge'
|
|||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
version = "0.0.1"
|
||||
version = "0.0.2"
|
||||
group = "xamora.gp_dbc" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "gp_dbc"
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ public class CommandGP implements ICommand {
|
|||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
gp.criminals.addCriminal(player, rate);
|
||||
error = gp.criminals.addCriminal(player, rate) != null ? 0 : 1;
|
||||
}
|
||||
else if (arg.equals(COMMANDS[6])) { // removeCriminal
|
||||
error = gp.criminals.removeCriminal(player.getUniqueID()) ? 0 : 1;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package xamora.gp_dbc.gui.CriminalTracker;
|
||||
|
||||
import xamora.gp_dbc.Main;
|
||||
import xamora.gp_dbc.config.ConfigManager;
|
||||
import xamora.gp_dbc.system.Criminal;
|
||||
import xamora.gp_dbc.utils.Pos;
|
||||
import xamora.gp_dbc.utils.TimeUtils;
|
||||
|
@ -12,7 +11,6 @@ import net.minecraft.util.ResourceLocation;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
import xamora.gp_dbc.utils.DrawGui;
|
||||
|
||||
import static xamora.gp_dbc.config.ConfigManager.*;
|
||||
import static xamora.gp_dbc.gui.CriminalTracker.GuiCriminalTracker.*;
|
||||
|
||||
public class GuiButtonCriminalTracker extends GuiButton {
|
||||
|
@ -76,7 +74,7 @@ public class GuiButtonCriminalTracker extends GuiButton {
|
|||
Pos pos = criminal.getLastPos();
|
||||
|
||||
long rate = criminal.getRate();
|
||||
int ratio = (int)((double)rate / ConfigManager.MAX_RATE_CRIMINAL * 255);
|
||||
int ratio = (int)((double)rate / MAX_RATE_CRIMINAL * 255);
|
||||
//int color = (0xff << 24) | (Math.min(ratio * 10, 255) << 16) | (Math.max(255 - ratio * 3, 0) << 8) | 0x00;
|
||||
//drawRect(xPosition, yPosition, xPosition + width, yPosition + height, color);
|
||||
GL11.glPushMatrix();
|
||||
|
|
|
@ -25,6 +25,10 @@ public class GuiCriminalTracker extends GuiScreen {
|
|||
public static int wdth;
|
||||
public static int hght;
|
||||
|
||||
public static long MAX_RATE_CRIMINAL;
|
||||
public static long RATE_TO_HAVE_POSITION;
|
||||
public static long RATE_CRIMINAL_NOT_SAFE;
|
||||
|
||||
public static List<Criminal> criminals;
|
||||
int gap_y = 2;
|
||||
int number_by_line = 3;
|
||||
|
@ -34,9 +38,12 @@ public class GuiCriminalTracker extends GuiScreen {
|
|||
|
||||
private GuiButtonCriminalTracker refresh_criminal;
|
||||
|
||||
public GuiCriminalTracker(List<Criminal> criminals) {
|
||||
public GuiCriminalTracker(List<Criminal> criminals, long[] config) {
|
||||
GuiCriminalTracker.criminals = criminals;
|
||||
scroll_y = 0;
|
||||
MAX_RATE_CRIMINAL = config[0];
|
||||
RATE_TO_HAVE_POSITION = config[1];
|
||||
RATE_CRIMINAL_NOT_SAFE = config[2];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,6 +15,8 @@ import net.minecraft.world.World;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import static xamora.gp_dbc.config.ConfigManager.*;
|
||||
|
||||
public class ItemCriminalTracker extends Item {
|
||||
|
||||
public ItemCriminalTracker()
|
||||
|
@ -42,7 +44,7 @@ public class ItemCriminalTracker extends Item {
|
|||
criminals += criminal.toStringWithoutPos() + "#";
|
||||
}
|
||||
|
||||
CommonProxy.network.sendTo(new NetworkCriminalTrackerC("open~" + criminals), (EntityPlayerMP) player);
|
||||
CommonProxy.network.sendTo(new NetworkCriminalTrackerC("open~" + criminals + "~" + MAX_RATE_CRIMINAL + "#" + RATE_TO_HAVE_POSITION + "#" + RATE_CRIMINAL_NOT_SAFE), (EntityPlayerMP) player);
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package xamora.gp_dbc.items;
|
|||
|
||||
import JinRyuu.JRMCore.JRMCoreH;
|
||||
import JinRyuu.JRMCore.server.JGPlayerMP;
|
||||
import com.forgeessentials.api.APIRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
|
|
@ -6,6 +6,7 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
|||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import xamora.gp_dbc.config.ConfigManager;
|
||||
import xamora.gp_dbc.gui.CriminalTracker.GuiCriminalTracker;
|
||||
import xamora.gp_dbc.system.Criminal;
|
||||
import xamora.gp_dbc.utils.Pos;
|
||||
|
@ -77,7 +78,19 @@ public class NetworkCriminalTrackerC implements IMessage {
|
|||
}
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().displayGuiScreen(new GuiCriminalTracker(criminals));
|
||||
String[] config = split[2].split("#");
|
||||
long MAX_RATE_CRIMINAL = ConfigManager.MAX_RATE_CRIMINAL;
|
||||
long RATE_TO_HAVE_POSITION = ConfigManager.RATE_TO_HAVE_POSITION;
|
||||
long RATE_CRIMINAL_NOT_SAFE = ConfigManager.RATE_CRIMINAL_NOT_SAFE;
|
||||
try {
|
||||
MAX_RATE_CRIMINAL = Long.parseLong(config[0]);
|
||||
RATE_TO_HAVE_POSITION = Long.parseLong(config[1]);
|
||||
RATE_CRIMINAL_NOT_SAFE = Long.parseLong(config[2]);
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().displayGuiScreen(new GuiCriminalTracker(criminals, new long[]{MAX_RATE_CRIMINAL, RATE_TO_HAVE_POSITION, RATE_CRIMINAL_NOT_SAFE}));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -12,6 +12,8 @@ import xamora.gp_dbc.proxy.CommonProxy;
|
|||
import xamora.gp_dbc.system.Criminal;
|
||||
import xamora.gp_dbc.utils.InputUtils;
|
||||
|
||||
import static xamora.gp_dbc.config.ConfigManager.*;
|
||||
|
||||
public class NetworkRefreshCriminalTracker implements IMessage {
|
||||
|
||||
private String toSend;
|
||||
|
@ -51,7 +53,7 @@ public class NetworkRefreshCriminalTracker implements IMessage {
|
|||
criminals += criminal.toStringWithoutPos() + "#";
|
||||
}
|
||||
|
||||
CommonProxy.network.sendTo(new NetworkCriminalTrackerC("open~" + criminals), player);
|
||||
CommonProxy.network.sendTo(new NetworkCriminalTrackerC("open~" + criminals + "~" + MAX_RATE_CRIMINAL + "#" + RATE_TO_HAVE_POSITION + "#" + RATE_CRIMINAL_NOT_SAFE), player);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class Criminal {
|
|||
|
||||
public Criminal(UUID uuid, String name, long rate, long last_time_pos, Pos pos) {
|
||||
this.uuid = uuid;
|
||||
this.rate = rate;
|
||||
setRate(rate);
|
||||
this.name = name;
|
||||
this.last_time_pos = last_time_pos;
|
||||
this.last_pos = pos;
|
||||
|
|
|
@ -75,6 +75,8 @@ public class Criminals {
|
|||
|
||||
|
||||
public Criminal addCriminal(EntityPlayer player, long rate) {
|
||||
if (gp.isInGalacticPatrol(player))
|
||||
return null;
|
||||
|
||||
Criminal criminal = null;
|
||||
if (isCriminal(player.getUniqueID())) {
|
||||
|
|
|
@ -31,4 +31,5 @@ error.is_not_criminal=He isn't a criminal
|
|||
error.banned_from_galactic_patrol=You are banned from the Galactic Patrol for
|
||||
error.banned_for_being_bad=For having bad alignment
|
||||
error.banned_for_killing_patrolman=For killing another patrolman
|
||||
error.criminal_try_join_galactic_patrol=You are a criminal
|
||||
error.criminal_try_join_galactic_patrol=You are a criminal
|
||||
error.cant_handcuff_dead=You can't handcuff a death
|
Loading…
Reference in a new issue