Skip to content

Commit

Permalink
Updated to 1.15.2
Browse files Browse the repository at this point in the history
  • Loading branch information
freneticfeline committed Feb 9, 2020
1 parent 8456049 commit c6529e9
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 49 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

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

Expand Down Expand Up @@ -71,7 +71,7 @@ dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.14.4-28.1.0'
minecraft 'net.minecraftforge:forge:1.15.2-31.1.0'

// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.dimension.DimensionType;
Expand Down Expand Up @@ -124,7 +125,7 @@ public void onBobberSplashDetected(float x, float y, float z) {
FishingBobberEntity hook = this.player.fishingBobber;
// double yDifference = Math.abs(hook.posY - y);
// Ignore Y component when calculating distance from hook
double xzDistanceFromHook = hook.getDistanceSq(x, hook.posY, z);
double xzDistanceFromHook = hook.getDistanceSq(x, hook.getPositionVec().y, z);
if (xzDistanceFromHook <= CLOSE_BOBBER_SPLASH_THRESHOLD) {
// AutoFishLogger.info("[%d] Close bobber splash at %f / %f", getGameTime(), xzDistanceFromHook, yDifference);
this.closeBobberSplashDetectedAt = getGameTime();
Expand Down Expand Up @@ -186,7 +187,8 @@ private boolean isUseOfNonRodInMainHand(Hand hand) {
public void onWaterWakeDetected(double x, double y, double z) {
if (this.minecraftClient != null && this.minecraftClient.player != null && playerHookInWater(this.minecraftClient.player)) {
FishingBobberEntity hook = this.minecraftClient.player.fishingBobber;
double distanceFromHook = new BlockPos(x, y, z).distanceSq(new Vec3i(hook.posX, hook.posY, hook.posZ));
Vec3d hookPosition = hook.getPositionVec();
double distanceFromHook = new BlockPos(x, y, z).distanceSq(new Vec3i(hookPosition.x, hookPosition.y, hookPosition.z));
if (distanceFromHook <= CLOSE_WATER_WAKE_THRESHOLD) {
if (this.closeWaterWakeDetectedAt <= 0) {
// AutoFishLogger.info("[%d] Close water wake at %f", getGameTime(), distanceFromHook);
Expand Down Expand Up @@ -426,7 +428,8 @@ private boolean playerHookInWater(PlayerEntity player) {
// water block, so also check a fraction of a block distance lower to see if that is water.
// (EntityFishHook.isInWater() seems to be completely broken in 1.13)
BlockState hookBlockState = player.fishingBobber.getEntityWorld().getBlockState(new BlockPos(player.fishingBobber));
BlockState justBelowHookBlockState = player.fishingBobber.getEntityWorld().getBlockState(new BlockPos(player.fishingBobber.posX, player.fishingBobber.posY - 0.25, player.fishingBobber.posZ));
Vec3d hookPosition = player.fishingBobber.getPositionVec();
BlockState justBelowHookBlockState = player.fishingBobber.getEntityWorld().getBlockState(new BlockPos(hookPosition.x, hookPosition.y - 0.25, hookPosition.z));
boolean hookIsInWater = hookBlockState.getMaterial() == Material.WATER || justBelowHookBlockState.getMaterial() == Material.WATER;
return hookIsInWater;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.unladenswallow.minecraft.autofish.config.AutoFishModConfig;
import net.unladenswallow.minecraft.autofish.events.EventListener;
Expand All @@ -32,10 +31,10 @@ public ModAutoFish() {
FMLJavaModLoadingContext.get().getModEventBus().register(AutoFishModConfig.class);
MinecraftForge.EVENT_BUS.register(this);
AutoFishModConfig.register(ModLoadingContext.get());
// ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY, () -> (mc, screen) -> {
// Logger.info("CONFIGGUIFACTORY thing is called");
// return new ConfigGui();
// });
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY, () -> (mc, screen) -> {
Logger.info("CONFIGGUIFACTORY thing is called");
return new ConfigGui();
});
}

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ExperienceOrbEntity;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.client.event.sound.PlaySoundEvent;
import net.minecraftforge.event.TickEvent.ClientTickEvent;
import net.minecraftforge.event.TickEvent.Phase;
Expand Down Expand Up @@ -102,7 +103,8 @@ public void onEntitySpawned(EntityJoinWorldEvent event) {
if (AutoFishModConfig.autofishEnabled() && event.getWorld().isRemote) {
Entity entity = event.getEntity();
if (entity instanceof ExperienceOrbEntity) {
_autoFish.onXpOrbAdded(entity.posX, entity.posY, entity.posZ);
Vec3d entityPosition = entity.getPositionVec();
_autoFish.onXpOrbAdded(entityPosition.x, entityPosition.y, entityPosition.z);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package net.unladenswallow.minecraft.autofish.events;

import java.util.function.Supplier;

import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.client.util.InputMappings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import net.minecraft.client.gui.widget.Widget;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.fml.ForgeI18n;
import net.minecraftforge.fml.client.config.GuiButtonExt;
import net.minecraftforge.fml.client.gui.widget.ExtendedButton;
import net.unladenswallow.minecraft.autofish.config.AutoFishModConfig;
import net.unladenswallow.minecraft.autofish.config.ConfigOption;
import net.unladenswallow.minecraft.autofish.util.Logger;
Expand Down Expand Up @@ -74,7 +74,7 @@ protected void init() {
addButton(new ConfigGuiButton(this.font, buttonX, rowY, BUTTON_WIDTH, BUTTON_HEIGHT, option));
buttonIndex++;
}
addButton(new GuiButtonExt((this.width - BUTTON_WIDTH) / 2, this.height - 20 - BUTTON_HEIGHT, BUTTON_WIDTH, BUTTON_HEIGHT, ForgeI18n.parseMessage("gui.autofish.config.done"),
addButton(new ExtendedButton((this.width - BUTTON_WIDTH) / 2, this.height - 20 - BUTTON_HEIGHT, BUTTON_WIDTH, BUTTON_HEIGHT, ForgeI18n.parseMessage("gui.autofish.config.done"),
b -> {this.closeGui();}));
}

Expand Down Expand Up @@ -126,7 +126,7 @@ public void renderButton(int p_renderButton_1_, int p_renderButton_2_, float p_r

@Override
public void renderToolTip(int mouseX, int mouseY) {
net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(
net.minecraftforge.fml.client.gui.GuiUtils.drawHoveringText(
Arrays.asList(this.tooltip),
mouseX,
mouseY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import net.minecraft.client.gui.FontRenderer;
import net.minecraftforge.fml.ForgeI18n;
import net.minecraftforge.fml.client.config.GuiButtonExt;
import net.minecraftforge.fml.client.gui.widget.ExtendedButton;
import net.unladenswallow.minecraft.autofish.config.AutoFishModConfig;
import net.unladenswallow.minecraft.autofish.config.ConfigOption;
import net.unladenswallow.minecraft.autofish.config.ConfigOption.ValueType;
import net.unladenswallow.minecraft.autofish.util.Logger;

class ConfigGuiButton extends GuiButtonExt {
class ConfigGuiButton extends ExtendedButton {

private ConfigOption configOption;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
package net.unladenswallow.minecraft.autofish.gui;

import java.util.Set;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen;
import net.minecraftforge.fml.client.IModGuiFactory;

public class GuiFactory implements IModGuiFactory {

@Override
public void initialize(Minecraft minecraftInstance) {
}

@Override
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
return null;
}

@Override
public boolean hasConfigGui() {
return true;
}

@Override
public Screen createConfigGui(Screen parentScreen) {
return new ConfigGui();
}

}
/*
* package net.unladenswallow.minecraft.autofish.gui;
*
* import java.util.Set;
*
* import net.minecraft.client.Minecraft; import
* net.minecraft.client.gui.screen.Screen; import
* net.minecraftforge.fml.client.IModGuiFactory;
*
* public class GuiFactory implements IModGuiFactory {
*
* @Override public void initialize(Minecraft minecraftInstance) { }
*
* @Override public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
* return null; }
*
* @Override public boolean hasConfigGui() { return true; }
*
* @Override public Screen createConfigGui(Screen parentScreen) { return new
* ConfigGui(); }
*
* }
*/

0 comments on commit c6529e9

Please sign in to comment.