New build.gradle, handcuff but not finish
This commit is contained in:
parent
04fd937429
commit
fd78039b62
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -9,4 +9,5 @@
|
||||||
/eclipse
|
/eclipse
|
||||||
/gradlew
|
/gradlew
|
||||||
/gradlew.bat
|
/gradlew.bat
|
||||||
/output
|
/output
|
||||||
|
/run
|
86
build.gradle
86
build.gradle
|
@ -3,37 +3,34 @@ buildscript {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven {
|
maven {
|
||||||
name = "forge"
|
name = "forge"
|
||||||
url = "https://repo.spongepowered.org/repository/forge-proxy/"
|
url = "https://maven.minecraftforge.net/"
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name = "sunproject"
|
|
||||||
url = "http://mvn.sunproject.xyz/releases"
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name = "sonatype"
|
|
||||||
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
|
classpath ('com.anatawa12.forge:ForgeGradle:1.2-1.1.+') {
|
||||||
|
changing = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id 'java-library'
|
||||||
|
id 'maven-publish'
|
||||||
|
}
|
||||||
|
|
||||||
apply plugin: 'forge'
|
apply plugin: 'forge'
|
||||||
|
|
||||||
compileJava.options.encoding = 'UTF-8'
|
// These settings allow you to choose what version of Java you want to be compatible with. Forge 1.7.10 runs on Java 6 to 8.
|
||||||
|
sourceCompatibility = 1.8
|
||||||
|
targetCompatibility = 1.8
|
||||||
|
|
||||||
version = "0.0.0"
|
version = "4.2.1.4"
|
||||||
group = "xamora.gp_dbc" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
group = "hedaox.ninjinmod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
archivesBaseName = "gp_dbc"
|
archivesBaseName = "ninjinmod"
|
||||||
sourceCompatibility = targetCompatibility = "1.8"
|
|
||||||
compileJava {
|
|
||||||
sourceCompatibility = targetCompatibility = "1.8"
|
|
||||||
}
|
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
version = "1.7.10-10.13.4.1614-1.7.10"
|
version = "1.7.10-10.13.4.1614-1.7.10"
|
||||||
runDir = "eclipse"
|
runDir = "run"
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -72,18 +69,41 @@ processResources
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets
|
// Ensures that the encoding of source files is set to UTF-8, see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||||
{
|
tasks.withType(JavaCompile) {
|
||||||
main
|
options.encoding = "UTF-8"
|
||||||
{
|
}
|
||||||
output.resourcesDir = output.classesDir
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
idea
|
// This task creates a .jar file containing the source code of this mod.
|
||||||
{
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||||
module
|
classifier = "sources"
|
||||||
{
|
from sourceSets.main.allSource
|
||||||
inheritOutputDirs = true
|
}
|
||||||
}
|
|
||||||
}
|
// This task creates a .jar file containing a deobfuscated version of this mod, for other developers to use in a development environment.
|
||||||
|
task devJar(type: Jar) {
|
||||||
|
classifier = "dev"
|
||||||
|
from sourceSets.main.output
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creates the listed artifacts on building the mod.
|
||||||
|
artifacts {
|
||||||
|
archives sourcesJar
|
||||||
|
archives devJar
|
||||||
|
}
|
||||||
|
|
||||||
|
// This block configures any maven publications you want to make.
|
||||||
|
publishing.publications {
|
||||||
|
mavenJava(MavenPublication) {
|
||||||
|
// Add any other artifacts here that you would like to publish!
|
||||||
|
artifact(jar) {
|
||||||
|
builtBy build
|
||||||
|
}
|
||||||
|
artifact(sourcesJar) {
|
||||||
|
builtBy sourcesJar
|
||||||
|
}
|
||||||
|
artifact(devJar) {
|
||||||
|
builtBy devJar
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -60,7 +60,7 @@ public class Main
|
||||||
public static CreativeTabs tabGP = new CreativeTabs("tabGP"){
|
public static CreativeTabs tabGP = new CreativeTabs("tabGP"){
|
||||||
@Override
|
@Override
|
||||||
public Item getTabIconItem() {
|
public Item getTabIconItem() {
|
||||||
return Items.poisonous_potato;
|
return ItemsGP.jail_manager;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,8 @@ public class ConfigManager {
|
||||||
public static String MSG_INMATE_GOING_TO_JAIL = "You are in jail for ";
|
public static String MSG_INMATE_GOING_TO_JAIL = "You are in jail for ";
|
||||||
public static int FORMAT_TIME_JAIL = 4;
|
public static int FORMAT_TIME_JAIL = 4;
|
||||||
|
|
||||||
|
public static String ERROR_ALREADY_HANDCUFFED = "Already handcuffed";
|
||||||
|
|
||||||
static public int SEC_TO_BE_IN_JAIL = 120; // second
|
static public int SEC_TO_BE_IN_JAIL = 120; // second
|
||||||
static public String POS_EXIT_JAIL = ""; //"-247 66 275 20";
|
static public String POS_EXIT_JAIL = ""; //"-247 66 275 20";
|
||||||
static public Pos pos_exit_jail;
|
static public Pos pos_exit_jail;
|
||||||
|
@ -149,6 +151,9 @@ public class ConfigManager {
|
||||||
ERROR_NOT_IN_JAIL = addVariableConfig(orderError, CATEGORY_GPE, "ERROR_NOT_IN_JAIL",
|
ERROR_NOT_IN_JAIL = addVariableConfig(orderError, CATEGORY_GPE, "ERROR_NOT_IN_JAIL",
|
||||||
"Error text when a inmate is release but he's already free. [default: \"There is already a cell here\"]", "There is already a cell here").getString();
|
"Error text when a inmate is release but he's already free. [default: \"There is already a cell here\"]", "There is already a cell here").getString();
|
||||||
|
|
||||||
|
ERROR_ALREADY_HANDCUFFED = addVariableConfig(orderError, CATEGORY_GPE, "ERROR_ALREADY_HANDCUFFED",
|
||||||
|
"Error text when a player try to handcuffed a players already handcuffed. [default: \"Already handcuffed\"]", "Already handcuffed").getString();
|
||||||
|
|
||||||
config.setCategoryPropertyOrder(CATEGORY_GPE, orderError);
|
config.setCategoryPropertyOrder(CATEGORY_GPE, orderError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import gp_dbc.Main;
|
import gp_dbc.Main;
|
||||||
import gp_dbc.config.ConfigManager;
|
import gp_dbc.config.ConfigManager;
|
||||||
|
import gp_dbc.system.Handcuff;
|
||||||
import gp_dbc.utils.EntityUtils;
|
import gp_dbc.utils.EntityUtils;
|
||||||
import gp_dbc.utils.RayTrace;
|
import gp_dbc.utils.RayTrace;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
@ -17,6 +18,7 @@ import net.minecraft.util.ChatComponentText;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import org.lwjgl.Sys;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -24,35 +26,46 @@ public class ItemGPHandcuff extends Item {
|
||||||
|
|
||||||
public ItemGPHandcuff()
|
public ItemGPHandcuff()
|
||||||
{
|
{
|
||||||
super();
|
|
||||||
setUnlocalizedName(Main.MODID +".gp_handcuff");
|
setUnlocalizedName(Main.MODID +".gp_handcuff");
|
||||||
GameRegistry.registerItem(this, getUnlocalizedName());
|
GameRegistry.registerItem(this, getUnlocalizedName());
|
||||||
setCreativeTab(Main.tabGP);
|
setCreativeTab(Main.tabGP);
|
||||||
setTextureName(Main.MODID + ":gp_handcuff");
|
setTextureName(Main.MODID + ":gp_handcuff");
|
||||||
setMaxStackSize(2);
|
setMaxStackSize(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//@SideOnly(Side.SERVER)
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
@SideOnly(Side.SERVER)
|
||||||
|
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int par4) {
|
||||||
|
int timeUse = getMaxItemUseDuration(stack) - par4;
|
||||||
|
System.out.println(timeUse);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.SERVER)
|
||||||
|
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
||||||
Entity entity = EntityUtils.getEntityLookedAt(player, 5);
|
Entity entity = EntityUtils.getEntityLookedAt(player, 5);
|
||||||
if (entity instanceof EntityPlayer) {
|
if (entity instanceof EntityPlayer) {
|
||||||
EntityPlayer jailer = (EntityPlayer) entity;
|
EntityPlayer jailer = (EntityPlayer) entity;
|
||||||
|
|
||||||
NBTTagCompound nbtPlayer = JRMCoreH.nbt(jailer, "pres");
|
NBTTagCompound nbtPlayer = JRMCoreH.nbt(jailer, "pres");
|
||||||
boolean ko = nbtPlayer.getInteger("jrmcHar4va") > 0;
|
boolean ko = nbtPlayer.getInteger("jrmcHar4va") > 0;
|
||||||
if (ko) {
|
if (ko) {
|
||||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
if (Handcuff.putHandcuff(player))
|
||||||
if (!world.isRemote)
|
player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(this, itemStack.stackSize - 1));
|
||||||
Main.gp.jail.putPlayerInJail(player, jailer, 20, true);
|
}
|
||||||
}
|
else {
|
||||||
|
//if (Handcuff.putHandcuff(player))
|
||||||
|
//player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(this, itemStack.stackSize - 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
player.setItemInUse(itemStack, getMaxItemUseDuration(itemStack));
|
||||||
|
|
||||||
|
//System.out.println(itemStack.stackSize);
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
|
@Override
|
||||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||||
par3List.add("Right Click to put in jail");
|
par3List.add("Right Click to put in jail");
|
||||||
}
|
}
|
||||||
|
|
37
src/main/java/gp_dbc/system/Handcuff.java
Normal file
37
src/main/java/gp_dbc/system/Handcuff.java
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
package gp_dbc.system;
|
||||||
|
|
||||||
|
import JinRyuu.JRMCore.JRMCoreH;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import gp_dbc.Main;
|
||||||
|
import gp_dbc.config.ConfigManager;
|
||||||
|
import gp_dbc.utils.EntityUtils;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.ChatComponentText;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import org.lwjgl.Sys;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class Handcuff {
|
||||||
|
|
||||||
|
// UUID~StartTimeHandcuffed
|
||||||
|
@SideOnly(Side.SERVER)
|
||||||
|
public static HashMap<UUID, Long>handcuffed = new HashMap<UUID, Long>();
|
||||||
|
|
||||||
|
@SideOnly(Side.SERVER)
|
||||||
|
public static boolean putHandcuff(EntityPlayer player) {
|
||||||
|
if (handcuffed.get(player.getUniqueID()) != null) {
|
||||||
|
player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + ConfigManager.ERROR_ALREADY_HANDCUFFED));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
handcuffed.put(player.getUniqueID(), System.currentTimeMillis());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue