diff --git a/.gitignore b/.gitignore index 41830b52..c4f7aa18 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,6 @@ ## gradle /.gradle /build -/gradle -/gradlew -/gradlew.bat ## ForgeGradle /run diff --git a/build.gradle b/build.gradle index 231fc180..6b22bb69 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ repositories { apply plugin: 'forge' -version = "1.7.10-v1.0.0" //Version System A.B.C A=Minecraft version (increments with each new minecraft version) B=Major mod change (Will break saves) C=Release Number (Increments with each public release) +version = "1.7.10-v1.0.0c-SkullFix" //Version System A.B.CD A=Minecraft version (increments with each new minecraft version) B=Major mod change (Will break saves) C=Release Number (Increments with each public release) D=Bugfix version (a-z) group= "com.brandon3055.draconicevolution" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "Draconic-Evolution" diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..0087cd3b Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..662430a8 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Tue May 06 21:57:37 CEST 2014 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-bin.zip diff --git a/gradlew b/gradlew new file mode 100644 index 00000000..91a7e269 --- /dev/null +++ b/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..8a0b282a --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/TeleporterStand.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/TeleporterStand.java index 5a080f2e..56246598 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/TeleporterStand.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/TeleporterStand.java @@ -70,8 +70,8 @@ public class TeleporterStand extends BlockCustomDrop { return true; } - if(tile.getStackInSlot(0) != null && !player.isSneaking()){ - tile.getStackInSlot(0).useItemRightClick(world, player); + if(tile.getStackInSlot(0) != null && !player.isSneaking() && tile.getStackInSlot(0).getItem() instanceof TeleporterMKI){ + ((TeleporterMKI)tile.getStackInSlot(0).getItem()).getLocation(tile.getStackInSlot(0)).sendEntityToCoords(player); return true; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDraconicArrow.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDraconicArrow.java index d7d9cdd7..85413fb7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDraconicArrow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDraconicArrow.java @@ -253,7 +253,7 @@ public class EntityDraconicArrow extends EntityArrow { } movingobjectposition.entityHit.hurtResistantTime = 0; - if (movingobjectposition.entityHit instanceof EntityDragonPart) + if (movingobjectposition.entityHit instanceof EntityDragonPart && ((EntityDragonPart)movingobjectposition.entityHit).entityDragonObj instanceof EntityDragon) { ((EntityDragon)((EntityDragonPart)movingobjectposition.entityHit).entityDragonObj).hurtResistantTime = 0; } @@ -314,7 +314,6 @@ public class EntityDraconicArrow extends EntityArrow { this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); this.inGround = true; this.arrowShake = 7; - this.setIsCritical(false); if (this.field_145790_g.getMaterial() != Material.air) { this.field_145790_g.onEntityCollidedWithBlock(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f, this); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/FMLEventHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/FMLEventHandler.java index 066272d2..4983aba4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/FMLEventHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/FMLEventHandler.java @@ -12,10 +12,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.PlayerCapabilities; import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.WeakHashMap; +import java.util.*; public class FMLEventHandler { @@ -45,7 +42,10 @@ public class FMLEventHandler { walkSpeed.setFloat(player.capabilities, 0.1f); } catch (IllegalAccessException e) { - LogHelper.error(e); + e.printStackTrace(); + } + catch (ConcurrentModificationException e) { + e.printStackTrace(); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java index 51a0e15e..0f0e7246 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java @@ -10,6 +10,7 @@ import com.brandon3055.draconicevolution.common.entity.EntityDragonHeart; import com.brandon3055.draconicevolution.common.entity.ExtendedPlayer; import com.brandon3055.draconicevolution.common.items.armor.ArmorEffectHandler; import com.brandon3055.draconicevolution.common.network.MountUpdatePacket; +import com.brandon3055.draconicevolution.common.tileentities.TileGrinder; import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.common.utills.LogHelper; import cpw.mods.fml.common.eventhandler.SubscribeEvent; @@ -47,6 +48,7 @@ import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.entity.player.PlayerUseItemEvent; +import net.minecraftforge.event.world.WorldEvent; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -61,10 +63,11 @@ public class MinecraftForgeEventHandler { @SubscribeEvent public void onLivingJumpEvent(LivingEvent.LivingJumpEvent event) { - if (!(event.entityLiving instanceof EntityPlayer))return; - EntityPlayer player = (EntityPlayer)event.entityLiving; + if (!(event.entityLiving instanceof EntityPlayer)) return; + EntityPlayer player = (EntityPlayer) event.entityLiving; - if (ArmorEffectHandler.getHasJumpBoost(player)) { + if (ArmorEffectHandler.getHasJumpBoost(player)) + { int i = ArmorEffectHandler.getJumpLevel(player); event.entityLiving.motionY += (0.1f) * (2 + i); } @@ -72,42 +75,47 @@ public class MinecraftForgeEventHandler { @SubscribeEvent public void onEntityDamaged(LivingAttackEvent event) { - if (!(event.entityLiving instanceof EntityPlayer))return; + if (!(event.entityLiving instanceof EntityPlayer)) return; - EntityPlayer player = (EntityPlayer)event.entityLiving; - if (event.source.isFireDamage() && ArmorEffectHandler.getFireImunity(player)) { + EntityPlayer player = (EntityPlayer) event.entityLiving; + if (event.source.isFireDamage() && ArmorEffectHandler.getFireImunity(player)) + { event.setCanceled(true); event.entityLiving.extinguish(); } - if (event.source.damageType.equals("fall") && ArmorEffectHandler.getHasJumpBoost(player)) { - if (event.ammount < (ArmorEffectHandler.getJumpLevel(player)+1)*2) event.setCanceled(true); + if (event.source.damageType.equals("fall") && ArmorEffectHandler.getHasJumpBoost(player)) + { + if (event.ammount < (ArmorEffectHandler.getJumpLevel(player) + 1) * 2) event.setCanceled(true); } - if ((event.source.damageType.equals("inWall") || event.source.damageType.equals("drown")) && (ArmorEffectHandler.isWyvernArmor(player, 4) || ArmorEffectHandler.isDraconicArmor(player, 4))) { - if (event.ammount <= 2f) event.setCanceled(true); + if ((event.source.damageType.equals("inWall") || event.source.damageType.equals("drown")) && (ArmorEffectHandler.isWyvernArmor(player, 4) || ArmorEffectHandler.isDraconicArmor(player, 4))) + { + if (event.ammount <= 2f) event.setCanceled(true); } } @SubscribeEvent public void onDropEvent(LivingDropsEvent event) { - if (event.entity instanceof EntityDragon && !event.entity.worldObj.isRemote) { + + if (!event.entity.worldObj.isRemote && ((event.entity instanceof EntityDragon) || (EntityList.getEntityString(event.entity) != null && !EntityList.getEntityString(event.entity).isEmpty() && EntityList.getEntityString(event.entity).equals("HardcoreEnderExpansion.Dragon")))) + { EntityItem item = new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, new ItemStack(ModItems.dragonHeart)); - //event.entity.worldObj.spawnEntityInWorld(item); event.entity.worldObj.spawnEntityInWorld(new EntityDragonHeart(event.entity.worldObj, ((int) event.entity.posX) + 0.5, event.entity.posY, ((int) event.entity.posZ) + 0.5)); if (event.entity instanceof EntityCustomDragon && ((EntityCustomDragon) event.entity).getIsUber()) - event.entity.worldObj.spawnEntityInWorld(new EntityDragonHeart(event.entity.worldObj, event.entity.posX, event.entity.posY+2, event.entity.posZ)); - //event.entity.worldObj.spawnEntityInWorld(item); + event.entity.worldObj.spawnEntityInWorld(new EntityDragonHeart(event.entity.worldObj, event.entity.posX, event.entity.posY + 2, event.entity.posZ)); for (Object o : event.entity.worldObj.playerEntities) { LogHelper.info(o); - if (o instanceof EntityPlayer) ((EntityPlayer)o).addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("msg.de.dragonDeath.txt"))); + if (o instanceof EntityPlayer) + ((EntityPlayer) o).addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("msg.de.dragonDeath.txt"))); } int count = 30 + event.entity.worldObj.rand.nextInt(30); - for (int i = 0; i < count; i++) { + for (int i = 0; i < count; i++) + { float mm = 0.3F; EntityItem item2 = new EntityItem(event.entity.worldObj, event.entity.posX - 2 + event.entity.worldObj.rand.nextInt(4), event.entity.posY - 2 + event.entity.worldObj.rand.nextInt(4), event.entity.posZ - 2 + event.entity.worldObj.rand.nextInt(4), new ItemStack(ModItems.draconiumDust)); item.motionX = mm * ((((float) event.entity.worldObj.rand.nextInt(100)) / 100F) - 0.5F); @@ -117,14 +125,16 @@ public class MinecraftForgeEventHandler { } } - if (event.entity.worldObj.isRemote || !(event.source.damageType.equals("player") || event.source.damageType.equals("arrow")) || !isValidEntity(event.entityLiving)) { + if (event.entity.worldObj.isRemote || !(event.source.damageType.equals("player") || event.source.damageType.equals("arrow")) || !isValidEntity(event.entityLiving)) + { return; } EntityLivingBase entity = event.entityLiving; Entity attacker = event.source.getEntity(); - if (attacker == null || !(attacker instanceof EntityPlayer)) { + if (attacker == null || !(attacker instanceof EntityPlayer)) + { return; } @@ -137,41 +147,49 @@ public class MinecraftForgeEventHandler { int rand2 = random.nextInt(Math.max(ConfigHandler.passiveSoulDropChance / dropChanceModifier, 1)); boolean isAnimal = entity instanceof EntityAnimal; - if ((rand == 0 && !isAnimal) || (rand2 == 0 && isAnimal)) { + if ((rand == 0 && !isAnimal) || (rand2 == 0 && isAnimal)) + { ItemStack soul = new ItemStack(ModItems.mobSoul); String name = EntityList.getEntityString(entity); ItemNBTHelper.setString(soul, "Name", name); - if (entity instanceof EntitySkeleton) ItemNBTHelper.setInteger(soul, "SkeletonType", ((EntitySkeleton)entity).getSkeletonType()); + if (entity instanceof EntitySkeleton) + ItemNBTHelper.setInteger(soul, "SkeletonType", ((EntitySkeleton) entity).getSkeletonType()); world.spawnEntityInWorld(new EntityItem(world, entity.posX, entity.posY, entity.posZ, soul)); Achievements.triggerAchievement((EntityPlayer) attacker, "draconicevolution.soul"); } } - private int getDropChanceFromItem(ItemStack stack){ + private int getDropChanceFromItem(ItemStack stack) { int chance = 0; if (stack == null) return 0; if (stack.getItem().equals(ModItems.wyvernBow) || stack.getItem().equals(ModItems.wyvernSword)) chance++; - if (stack.getItem().equals(ModItems.draconicSword) || stack.getItem().equals(ModItems.draconicBow)) chance+=2; - if (stack.getItem().equals(ModItems.draconicDestructionStaff)) chance+=3; + if (stack.getItem().equals(ModItems.draconicSword) || stack.getItem().equals(ModItems.draconicBow)) chance += 2; + if (stack.getItem().equals(ModItems.draconicDestructionStaff)) chance += 3; chance += EnchantmentHelper.getEnchantmentLevel(ConfigHandler.reaperEnchantID, stack); return chance; } private boolean isValidEntity(EntityLivingBase entity) { - if (entity instanceof IBossDisplayData) { + if (entity instanceof IBossDisplayData) + { return false; } - for (int i = 0; i < ConfigHandler.spawnerList.length; i++) { - if (ConfigHandler.spawnerList[i].equals(entity.getCommandSenderName()) && ConfigHandler.spawnerListType) { + for (int i = 0; i < ConfigHandler.spawnerList.length; i++) + { + if (ConfigHandler.spawnerList[i].equals(entity.getCommandSenderName()) && ConfigHandler.spawnerListType) + { return true; - } else if (ConfigHandler.spawnerList[i].equals(entity.getCommandSenderName()) && !ConfigHandler.spawnerListType) { + } else if (ConfigHandler.spawnerList[i].equals(entity.getCommandSenderName()) && !ConfigHandler.spawnerListType) + { return false; } } - if (ConfigHandler.spawnerListType) { + if (ConfigHandler.spawnerListType) + { return false; - } else { + } else + { return true; } } @@ -220,7 +238,8 @@ public class MinecraftForgeEventHandler { @SubscribeEvent public void stopUsingEvent(PlayerUseItemEvent.Start event) { if (!ConfigHandler.pigmenBloodRage || event.item == null || event.item.getItem() == null) return; - if (event.item.getItem() == Items.porkchop || event.item.getItem() == Items.cooked_porkchop) { + if (event.item.getItem() == Items.porkchop || event.item.getItem() == Items.cooked_porkchop) + { World world = event.entityPlayer.worldObj; if (world.isRemote) return; EntityPlayer player = event.entityPlayer; @@ -231,7 +250,8 @@ public class MinecraftForgeEventHandler { boolean flag = false; - for (Object o : list) { + for (Object o : list) + { if (o instanceof EntityPigZombie) { EntityPigZombie zombie = (EntityPigZombie) o; @@ -254,7 +274,8 @@ public class MinecraftForgeEventHandler { e.printStackTrace(); } - if (Math.abs(zombie.posX - player.posX) < 14 && Math.abs(zombie.posY - player.posY) < 14 && Math.abs(zombie.posZ - player.posZ) < 14) flag = true; + if (Math.abs(zombie.posX - player.posX) < 14 && Math.abs(zombie.posY - player.posY) < 14 && Math.abs(zombie.posZ - player.posZ) < 14) + flag = true; zombie.addPotionEffect(new PotionEffect(5, 10000, 3)); zombie.addPotionEffect(new PotionEffect(11, 10000, 2)); } @@ -266,15 +287,16 @@ public class MinecraftForgeEventHandler { @SideOnly(Side.CLIENT) @SubscribeEvent - public void joinWorld(EntityJoinWorldEvent event){ - if (event.entity instanceof EntityPlayerSP) { + public void joinWorld(EntityJoinWorldEvent event) { + if (event.entity instanceof EntityPlayerSP) + { DraconicEvolution.network.sendToServer(new MountUpdatePacket(0)); } } @SubscribeEvent - public void getBreakSpeed(PlayerEvent.BreakSpeed event){ - if (event.entityPlayer != null ) + public void getBreakSpeed(PlayerEvent.BreakSpeed event) { + if (event.entityPlayer != null) { float newDigSpeed = event.originalSpeed; if (event.entityPlayer.isInsideOfMaterial(Material.water)) @@ -288,4 +310,9 @@ public class MinecraftForgeEventHandler { event.newSpeed = newDigSpeed; } } + + @SubscribeEvent + public void worldUnload(WorldEvent.Unload e) { + TileGrinder.fakePlayer = null; + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java b/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java index 619fd781..c8a58854 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java @@ -20,7 +20,9 @@ public class Tclogo extends ItemDE { //this.setCreativeTab(draconicevolution.getCreativeTab()); ModItems.register(this); } - + + + @Override public int getMaxItemUseDuration(ItemStack par1ItemStack) { @@ -73,6 +75,7 @@ public class Tclogo extends ItemDE { public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + if (!player.isSneaking()) { player.capabilities.allowFlying = true; @@ -82,19 +85,20 @@ public class Tclogo extends ItemDE { player.noClip = !player.noClip; } - else{ + else + { int xi = (int)player.posX; int yi = (int)player.posY; int zi = (int)player.posZ; int rad = 100; - for (int x = xi-rad; x < xi+rad; x++){ - for (int y = yi-10; y < yi+30; y++){ - for (int z = zi-rad; z < zi+rad; z++){ - world.markBlockForUpdate(x, y, z); + for (int x = xi-rad; x < xi+rad; x++){ + for (int y = yi-10; y < yi+30; y++){ + for (int z = zi-rad; z < zi+rad; z++){ + world.markBlockForUpdate(x, y, z); + } } } - } world.markBlockRangeForRenderUpdate(xi-rad, yi-20, zi-rad, xi+rad, yi+20, zi+rad); @@ -163,10 +167,10 @@ public class Tclogo extends ItemDE { @Override public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer player) { - LogHelper.info(player.worldObj.getBlock(X, Y, Z).getMaterial()); + LogHelper.info(player.worldObj.getBlock(X, Y, Z).getHarvestLevel(player.worldObj.getBlockMetadata(X, Y, Z))); //player.worldObj.scheduleBlockUpdate(X, Y, Z, player.worldObj.getBlock(X, Y, Z), 10); - return true; + return false; } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/AdminSpawnEgg.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/AdminSpawnEgg.java index 5735378b..605273ba 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/AdminSpawnEgg.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/AdminSpawnEgg.java @@ -63,7 +63,7 @@ public class AdminSpawnEgg extends ItemDE { if (ItemNBTHelper.getBoolean(stack1, "IsSet", false)) return true; NBTTagCompound compound = ItemNBTHelper.getCompound(stack1); entity.writeToNBT(compound); - compound.setString("EntityName", EntityList.getEntityString(entity)); + if (EntityList.getEntityString(entity) != null)compound.setString("EntityName", EntityList.getEntityString(entity)); stack1.setTagCompound(compound); ItemNBTHelper.setBoolean(stack1, "IsSet", true); entity.setDead(); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java index 4a57f299..130d1efa 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java @@ -65,9 +65,9 @@ public class DraconicDistructionStaff extends ItemTool implements IEnergyContain super(0F, ModItems.DRACONIUM_T3, minableBlocks); this.setUnlocalizedName(Strings.draconicDStaffName); this.setCreativeTab(DraconicEvolution.tabToolsWeapons); - this.setHarvestLevel("pickaxe", 4); - this.setHarvestLevel("shovel", 4); - this.setHarvestLevel("axe", 4); + this.setHarvestLevel("pickaxe", 10); + this.setHarvestLevel("shovel", 10); + this.setHarvestLevel("axe", 10); GameRegistry.registerItem(this, Strings.draconicDStaffName); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java b/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java index 2ea2c380..c8259418 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java @@ -3,7 +3,7 @@ package com.brandon3055.draconicevolution.common.lib; public final class References { public static final String MODID = "DraconicEvolution"; public static final String MODNAME = "Draconic Evolution"; - public static final String VERSION = "1.0.0"; + public static final String VERSION = "1.0.0c"; public static final String MCVERSION = "1.7.10"; public static final String CLIENTPROXYLOCATION = "com.brandon3055.draconicevolution.client.ClientProxy"; public static final String COMMONPROXYLOCATION = "com.brandon3055.draconicevolution.common.CommonProxy"; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGenerator.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGenerator.java index cb0bb3de..70aa00bb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGenerator.java @@ -72,10 +72,13 @@ public class TileGenerator extends TileObjectSync implements ISidedInventory, IE int itemBurnTime = getItemBurnTime(items[0]); if (itemBurnTime > 0) { - decrStackSize(0, 1); + --items[0].stackSize; + if (this.items[0].stackSize == 0) + { + this.items[0] = items[0].getItem().getContainerItem(items[0]); + } burnTime = itemBurnTime; burnTimeRemaining = itemBurnTime; - //LogHelper.info(itemBurnTime); } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGrinder.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGrinder.java index 6d458c16..d44c2e55 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGrinder.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGrinder.java @@ -3,16 +3,15 @@ package com.brandon3055.draconicevolution.common.tileentities; import cofh.api.energy.IEnergyHandler; import com.brandon3055.draconicevolution.common.network.ObjectPacket; import com.brandon3055.draconicevolution.common.utills.EnergyStorage; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.mojang.authlib.GameProfile; import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.ReflectionHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -24,10 +23,14 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; +import net.minecraft.world.WorldServer; +import net.minecraftforge.common.util.FakePlayer; +import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.common.util.ForgeDirection; import java.lang.reflect.Field; import java.util.List; +import java.util.UUID; public class TileGrinder extends TileObjectSync implements ISidedInventory, IEnergyHandler { //########### variables #############// @@ -50,6 +53,7 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne public EnergyStorage externalInputBuffer = new EnergyStorage(100000, 32000, 0); public int energyPerKill = 1000; private static Field recentlyHit; + public static FakePlayer fakePlayer; public void updateVariables() { if (meta == -1) meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); @@ -133,7 +137,11 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne int itemBurnTime = getItemBurnTime(items[0]); if (itemBurnTime > 0) { - decrStackSize(0, 1); + --items[0].stackSize; + if (this.items[0].stackSize == 0) + { + this.items[0] = items[0].getItem().getContainerItem(items[0]); + } burnTime = itemBurnTime; burnTimeRemaining = itemBurnTime; } @@ -143,6 +151,7 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne @SuppressWarnings("unchecked") public boolean killNextEntity() { if (worldObj.isRemote) return false; + if (fakePlayer == null) fakePlayer = FakePlayerFactory.get((WorldServer) worldObj, new GameProfile(UUID.randomUUID(), "[Draconic-Evolution]")); killBox = AxisAlignedBB.getBoundingBox(centreX - 4.5, centreY - 4.5, centreZ - 4.5, centreX + 4.5, centreY + 4.5, centreZ + 4.5); killList = worldObj.getEntitiesWithinAABB(EntityLiving.class, killBox); @@ -151,18 +160,26 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne EntityLiving mob = killList.get(worldObj.rand.nextInt(killList.size())); if (mob instanceof EntityCreature) { if (mob.isEntityAlive()) { - if (recentlyHit == null) { - recentlyHit = ReflectionHelper.findField(EntityLivingBase.class, "recentlyHit", "field_70718_bc"); - recentlyHit.setAccessible(true); - } - try { - recentlyHit.setInt(mob, 60); - } - catch (IllegalAccessException e) { - LogHelper.error(e); + if (mob instanceof EntitySkeleton && ((EntitySkeleton) mob).getSkeletonType() == 1) + { + if (worldObj.rand.nextInt(200) < 5) mob.entityDropItem(new ItemStack(Items.skull, 1, 1), 0); } + mob.attackEntityFrom(DamageSource.causePlayerDamage(fakePlayer), 50000F); + //mob.attackEntityFrom(DamageSource.causePlayerDamage(FakePlayerFactory.getMinecraft((WorldServer)worldObj)), 50000F); - mob.attackEntityFrom(DamageSource.generic, 50000F); +// if (recentlyHit == null) { +// recentlyHit = ReflectionHelper.findField(EntityLivingBase.class, "recentlyHit", "field_70718_bc"); +// recentlyHit.setAccessible(true); +// } +// try { +// recentlyHit.setInt(mob, 0); +// } +// catch (IllegalAccessException e) +// { +// LogHelper.error(e); +// } + +// mob.attackEntityFrom(DamageSource.generic, 50000F); readyNext = true; return true; } @@ -170,21 +187,22 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne return false; } else { if (mob.isEntityAlive()) { - if (recentlyHit == null) { - recentlyHit = ReflectionHelper.findField(EntityLivingBase.class, "recentlyHit", "field_70718_bc"); - recentlyHit.setAccessible(true); - } - try { - recentlyHit.setInt(mob, 60); - LogHelper.info(recentlyHit.getInt(mob)); - } - catch (IllegalAccessException e) { - LogHelper.error(e); - } - - mob.attackEntityFrom(DamageSource.generic, 50000F); - readyNext = true; - return true; + mob.attackEntityFrom(DamageSource.causePlayerDamage(fakePlayer), 50000F); +// if (recentlyHit == null) { +// recentlyHit = ReflectionHelper.findField(EntityLivingBase.class, "recentlyHit", "field_70718_bc"); +// recentlyHit.setAccessible(true); +// } +// try { +// recentlyHit.setInt(mob, 60); +// LogHelper.info(recentlyHit.getInt(mob)); +// } +// catch (IllegalAccessException e) { +// LogHelper.error(e); +// } +// +// mob.attackEntityFrom(DamageSource.generic, 50000F); +// readyNext = true; +// return true; } readyNext = true; return false;