From aa77702954f6ddf45db1dc3c29c23e1de98618a1 Mon Sep 17 00:00:00 2001 From: squeek Date: Tue, 26 Jul 2016 22:25:21 -0700 Subject: [PATCH] Port to 1.9.4 --- .gitignore | 207 +++++++++++++++--- build.gradle | 83 +++---- .../quakemovement/ModQuakeMovement.java | 14 +- .../quakemovement/QuakeClientPlayer.java | 20 +- 4 files changed, 226 insertions(+), 98 deletions(-) diff --git a/.gitignore b/.gitignore index d7b6abd..545e638 100644 --- a/.gitignore +++ b/.gitignore @@ -1,40 +1,181 @@ -# Builds & binaries +eclipse +run +libs +media +classes +*.bat +builds +sources + +# Created by https://www.gitignore.io/api/gradle,intellij,eclipse,windows,osx,linux + +### Gradle ### +gradle/ +.gradle/ build/ +gradlew + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Cache of project +.gradletasknamecache + +### Intellij ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm + +*.iml + +## Directory-based project format: +.idea/ +# if you remove the above rule, at least ignore the following: + +# User-specific stuff: +# .idea/workspace.xml +# .idea/tasks.xml +# .idea/dictionaries +# .idea/shelf + +# Sensitive or high-churn files: +# .idea/dataSources.ids +# .idea/dataSources.xml +# .idea/sqlDataSources.xml +# .idea/dynamic.xml +# .idea/uiDesigner.xml + +# Gradle: +# .idea/gradle.xml +# .idea/libraries + +# Mongo Explorer plugin: +# .idea/mongoSettings.xml + +## File-based project format: +*.ipr +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + + +### Eclipse ### +*.pydevproject +.metadata bin/ -target/ -lib/ -launcher/ -.gradle/ -*.zip -*.jar +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath -# Misc mod files -media/ -libs/ +# Eclipse Core +.project -# Tmp files -*~ -*# +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch -# IDEs +# CDT-specific +.cproject + +# JDT-specific (Eclipse Java Development Tools) .classpath -.project -.settings -.pydevproject - -# MCP Files -docs/ -conf/ -eclipse/ -jars/ -logs/ -runtime/ -temp/ -reobf/ -CHANGELOG -LICENSE.txt -*.bat -*.sh -# Misc -*.rej \ No newline at end of file +# Java annotation processor (APT) +.factorypath + +# PDT-specific +.buildpath + +# sbteclipse plugin +.target + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + + +### Windows ### +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + + +### OSX ### +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* \ No newline at end of file diff --git a/build.gradle b/build.gradle index 7016486..4b72bff 100644 --- a/build.gradle +++ b/build.gradle @@ -1,64 +1,51 @@ buildscript { - repositories { - mavenCentral() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' - } + repositories { + jcenter() + maven { + name = "forge" + url = "http://files.minecraftforge.net/maven" + } + } + dependencies { + classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' + } } -apply plugin: 'forge' +apply plugin: 'net.minecraftforge.gradle.forge' minecraft { - version = "1.8-11.14.1.1334" - mappings = "snapshot_20141130" + version = "1.9.4-12.17.0.1962" + mappings = "snapshot_20160518" + runDir = "run" + + replace "\${version}", project.version + replaceIn "ModInfo.java" } group = project.projectDir.name.toLowerCase() archivesBaseName = project.projectDir.name + "-mc" + project.minecraft.version -sourceSets.main{ - java { - srcDirs 'java', 'apis' - } - resources { - srcDirs 'resources' - } -} +sourceSets.main.java.srcDirs += 'java' +sourceSets.main.resources.srcDirs += 'resources' -// variable substitution in java files -task processSourceMainJava(type:Copy) { - inputs.property "vars", project.version + project.minecraft.version - from('java') - { - include '**/ModInfo.java' - include '**/package-info.java' - expand 'version':project.version, 'mcversion':project.minecraft.version - } - into project.buildDir.getPath()+"/sources/java" +processResources { + inputs.property "vars", project.version + project.minecraft.version + from(sourceSets.main.resources.srcDirs) { + include '**/*.info' + expand 'version':project.version, 'mcversion':project.minecraft.version + } + from(sourceSets.main.resources.srcDirs) { + exclude '**/*.info' + } } -// correct task ordering -afterEvaluate { project -> - sourceMainJava.finalizedBy(processSourceMainJava) +repositories { + ivy { + name "PlayerAPI" + artifactPattern "http://addons-origin.cursecdn.com/files/2318/180/[module]-[revision].[ext]" + } } -processResources -{ - inputs.property "vars", project.version + project.minecraft.version - from(sourceSets.main.resources.srcDirs) { - include '**/*.info' - expand 'version':project.version, 'mcversion':project.minecraft.version - } - from(sourceSets.main.resources.srcDirs) { - exclude '**/*.info' - } +dependencies { + deobfCompile group: 'playerapi', name: 'PlayerAPI', version: '1.9.4-1.0', ext: 'jar' } \ No newline at end of file diff --git a/java/squeek/quakemovement/ModQuakeMovement.java b/java/squeek/quakemovement/ModQuakeMovement.java index f1b4fc2..5018a2f 100644 --- a/java/squeek/quakemovement/ModQuakeMovement.java +++ b/java/squeek/quakemovement/ModQuakeMovement.java @@ -2,19 +2,19 @@ import api.player.client.ClientPlayerAPI; import api.player.server.ServerPlayerAPI; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.living.LivingFallEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.event.FMLInterModComms; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.living.LivingFallEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.relauncher.Side; -@Mod(modid = ModInfo.MODID, version = ModInfo.VERSION, acceptedMinecraftVersions="[1.8,1.9)", dependencies = "required-after:PlayerAPI;after:Squeedometer") +@Mod(modid = ModInfo.MODID, version = ModInfo.VERSION, acceptedMinecraftVersions="[1.9,1.10)", dependencies = "required-after:PlayerAPI;after:Squeedometer") public class ModQuakeMovement { // The instance of your mod that Forge uses. @@ -42,12 +42,12 @@ public void postInit(FMLPostInitializationEvent event) @SubscribeEvent public void onLivingFall(LivingFallEvent event) { - if (!(event.entity instanceof EntityPlayer)) + if (!(event.getEntityLiving() instanceof EntityPlayer)) return; if (ModConfig.INCREASED_FALL_DISTANCE != 0.0D) { - event.distance = (float) (event.distance - ModConfig.INCREASED_FALL_DISTANCE); + event.setDistance((float) (event.getDistance() - ModConfig.INCREASED_FALL_DISTANCE)); } } } diff --git a/java/squeek/quakemovement/QuakeClientPlayer.java b/java/squeek/quakemovement/QuakeClientPlayer.java index 3d9fe49..7891b65 100644 --- a/java/squeek/quakemovement/QuakeClientPlayer.java +++ b/java/squeek/quakemovement/QuakeClientPlayer.java @@ -5,10 +5,11 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumBlockRenderType; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.MathHelper; import api.player.client.ClientPlayerAPI; import api.player.client.ClientPlayerBase; import net.minecraftforge.fml.common.Loader; @@ -51,7 +52,7 @@ public void moveEntityWithHeading(float sidemove, float forwardmove) double d1 = this.player.posY; double d2 = this.player.posZ; - if (this.player.capabilities.isFlying && this.player.ridingEntity == null) + if (this.player.capabilities.isFlying && this.player.getRidingEntity() == null) super.moveEntityWithHeading(sidemove, forwardmove); else this.quake_moveEntityWithHeading(sidemove, forwardmove); @@ -102,7 +103,7 @@ public void onLivingUpdate() @Override public void moveFlying(float sidemove, float forwardmove, float wishspeed) { - if ((this.player.capabilities.isFlying && this.player.ridingEntity == null) || this.player.isInWater()) + if ((this.player.capabilities.isFlying && this.player.getRidingEntity() == null) || this.player.isInWater()) { super.moveFlying(sidemove, forwardmove, wishspeed); return; @@ -236,9 +237,8 @@ private void spawnBunnyhopParticles(int numParticles) int i = MathHelper.floor_double(this.player.posY - 0.20000000298023224D - this.player.getYOffset()); int k = MathHelper.floor_double(this.player.posZ); IBlockState blockState = this.player.worldObj.getBlockState(new BlockPos(j, i, k)); - Block ground = blockState.getBlock(); - if (ground != null && ground.getRenderType() != -1) + if (blockState.getRenderType() != EnumBlockRenderType.INVISIBLE) { for (int iParticle = 0; iParticle < numParticles; iParticle++) { @@ -360,7 +360,7 @@ private void minecraft_SwingLimbsBasedOnMovement() private void minecraft_WaterMove(float sidemove, float forwardmove) { double d0 = this.player.posY; - this.player.moveFlying(sidemove, forwardmove, 0.04F); + this.player.moveRelative(sidemove, forwardmove, 0.04F); this.player.moveEntity(this.player.motionX, this.player.motionY, this.player.motionZ); this.player.motionX *= 0.800000011920929D; this.player.motionY *= 0.800000011920929D; @@ -387,7 +387,7 @@ public void minecraft_moveEntityWithHeading(float sidemove, float forwardmove) float momentumRetention = this.getSlipperiness(); // alter motionX/motionZ based on desired movement - this.player.moveFlying(sidemove, forwardmove, this.minecraft_getMoveSpeed()); + this.player.moveRelative(sidemove, forwardmove, this.minecraft_getMoveSpeed()); // make adjustments for ladder interaction minecraft_ApplyLadderPhysics(); @@ -483,7 +483,7 @@ else if (this.player.isInWater() && !this.player.capabilities.isFlying) if (ModConfig.SHARKING_ENABLED && ModConfig.SHARKING_SURFACE_TENSION > 0.0D && this.playerAPI.getIsJumpingField() && this.player.motionY < 0.0F) { AxisAlignedBB axisalignedbb = this.player.getEntityBoundingBox().offset(this.player.motionX, this.player.motionY, this.player.motionZ); - boolean isFallingIntoWater = this.player.worldObj.isAnyLiquid(axisalignedbb); + boolean isFallingIntoWater = this.player.worldObj.containsAnyLiquid(axisalignedbb); if (isFallingIntoWater) this.player.motionY *= ModConfig.SHARKING_SURFACE_TENSION;