Skip to content

Commit

Permalink
Update for Forge 1.11 / 1.11.2
Browse files Browse the repository at this point in the history
  • Loading branch information
freneticfeline committed Jun 19, 2017
1 parent 4cc9ae1 commit fe64506
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.11-1.2
========
Update to work on Minecraft/Forge 1.11.2

1.10-1.2
========
Update to work on Minecraft/Forge 1.10 and 1.10.2
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ buildscript {

apply plugin: 'net.minecraftforge.gradle.forge'

version = "1.10-1.2"
version = "1.11-1.2"
group= "net.unladenswallow.minecraft.autofish" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "mod_autofish_forge"

minecraft {
version = "1.10.2-12.18.1.2011"
version = "1.11.2-13.20.0.2228"
runDir = "eclipse"

// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not allways work.
// simply re-run your setup task after changing the mappings to update your workspace.
mappings = "snapshot_20160518"
mappings = "snapshot_20161220"
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ public class AutoFishEventHandler {
private static final int CAST_QUEUE_TICK_DELAY = 30;
private static final int REEL_TICK_DELAY = 5;
private static final int AUTOFISH_BREAKPREVENT_THRESHOLD = 2;
private static final double MOTION_Y_THRESHOLD = -0.02d;
private static final double MOTION_Y_THRESHOLD = -0.05d;

@SubscribeEvent
public void onClientTickEvent(ClientTickEvent event) {
this.minecraft = Minecraft.getMinecraft();
if (ModAutoFish.config_autofish_enable && !this.minecraft.isGamePaused() && this.minecraft.thePlayer != null) {
this.player = this.minecraft.thePlayer;
if (ModAutoFish.config_autofish_enable && !this.minecraft.isGamePaused() && this.minecraft.player != null) {
this.player = this.minecraft.player;

if (playerHookInWater() && !isDuringReelDelay() && isFishBiting()) {
startReelDelay();
Expand Down Expand Up @@ -59,23 +59,23 @@ private boolean needToSwitchRods() {
}

private void scheduleNextCast() {
this.castScheduledAt = this.minecraft.theWorld.getTotalWorldTime();
this.castScheduledAt = this.minecraft.world.getTotalWorldTime();
}

/*
* Trigger a delay so we don't use the rod multiple times for the same bite,
* which can persist for 2-3 ticks.
*/
private void startReelDelay() {
this.startedReelDelayAt = this.minecraft.theWorld.getTotalWorldTime();
this.startedReelDelayAt = this.minecraft.world.getTotalWorldTime();
}

private void resetReelDelay() {
startedReelDelayAt = 0;
}

private boolean isDuringReelDelay() {
return (this.startedReelDelayAt != 0 && this.minecraft.theWorld.getTotalWorldTime() < this.startedReelDelayAt + REEL_TICK_DELAY);
return (this.startedReelDelayAt != 0 && this.minecraft.world.getTotalWorldTime() < this.startedReelDelayAt + REEL_TICK_DELAY);
}

private boolean playerHookInWater() {
Expand Down Expand Up @@ -160,26 +160,25 @@ private EntityPlayer getServerPlayerEntity() {
if (this.minecraft.getIntegratedServer() == null || this.minecraft.getIntegratedServer().getEntityWorld() == null) {
return null;
} else {
return this.minecraft.getIntegratedServer().getEntityWorld().getPlayerEntityByName(this.minecraft.thePlayer.getName());
return this.minecraft.getIntegratedServer().getEntityWorld().getPlayerEntityByName(this.minecraft.player.getName());
}
}

private EnumActionResult playerUseRod() {
return this.minecraft.playerController.processRightClick(
this.player,
this.minecraft.theWorld,
this.player.getHeldItemMainhand(),
this.minecraft.world,
EnumHand.MAIN_HAND);
}

private boolean isTimeToCast() {
return (this.castScheduledAt != 0 && this.minecraft.theWorld.getTotalWorldTime() > this.castScheduledAt + CAST_QUEUE_TICK_DELAY);
return (this.castScheduledAt != 0 && this.minecraft.world.getTotalWorldTime() > this.castScheduledAt + CAST_QUEUE_TICK_DELAY);
}

private void tryToSwitchRods() {
InventoryPlayer inventory = this.player.inventory;
for (int i = 0; i < 9; i++) {
ItemStack curItemStack = inventory.mainInventory[i];
ItemStack curItemStack = inventory.mainInventory.get(i);
if (curItemStack != null
&& curItemStack.getItem() == Items.FISHING_ROD
&& (!ModAutoFish.config_autofish_preventBreak || (curItemStack.getMaxDamage() - curItemStack.getItemDamage() > AUTOFISH_BREAKPREVENT_THRESHOLD))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void init() {
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
if (this.options.isPressed()) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
EntityPlayer player = Minecraft.getMinecraft().player;
if (playerIsHoldingFishingRod(player)) {
Minecraft.getMinecraft().displayGuiScreen(new AutoFishConfigGui(Minecraft.getMinecraft().currentScreen));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = ModAutoFish.MODID, useMetadata = true, acceptedMinecraftVersions="[1.10,1.11)", acceptableRemoteVersions="[1.10,1.11)",
@Mod(modid = ModAutoFish.MODID, useMetadata = true, acceptedMinecraftVersions="[1.11,1.12)", acceptableRemoteVersions="[1.11,1.12)",
guiFactory = "net.unladenswallow.minecraft.autofish.AutoFishGuiFactory")
public class ModAutoFish {
public static final String MODID = "mod_autofish";
Expand Down

0 comments on commit fe64506

Please sign in to comment.