Skip to content

Commit

Permalink
backport 1.7 to 1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
freneticfeline committed Jan 6, 2018
1 parent 9ae9611 commit 5283ac6
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 78 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.

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

minecraft {
version = "1.11.2-13.20.1.2386"
version = "1.10.2-12.18.3.2185"
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_20161220"
mappings = "snapshot_20160518"
}

dependencies {
Expand Down
138 changes: 81 additions & 57 deletions src/main/java/net/unladenswallow/minecraft/autofish/AutoFish.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import net.unladenswallow.minecraft.autofish.proxy.CommonProxy;
import net.unladenswallow.minecraft.autofish.util.Logger;

@Mod(modid = ModAutoFish.MODID, useMetadata = true, acceptedMinecraftVersions="[1.11,1.12)", acceptableRemoteVersions="[1.11,1.12)",
@Mod(modid = ModAutoFish.MODID, useMetadata = true, acceptedMinecraftVersions="[1.10,1.11)", acceptableRemoteVersions="[1.10,1.11)",
guiFactory = "net.unladenswallow.minecraft.autofish.gui.GuiFactory")
public class ModAutoFish {
public static final String MODID = "mod_autofish";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,6 @@ public void spawnParticle(int particleID, boolean ignoreRange, double xCoord, do

}

@Override
public void spawnParticle(int id, boolean ignoreRange, boolean p_190570_3_, double x, double y, double z,
double xSpeed, double ySpeed, double zSpeed, int... parameters) {
spawnParticle(id, ignoreRange, x, y, z, xSpeed, ySpeed, zSpeed, parameters);
}

@Override
public void onEntityAdded(Entity entityIn) {
if (ModAutoFish.config_autofish_enable && entityIn instanceof EntityXPOrb) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void init() {
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
if (this.options.isPressed()) {
EntityPlayer player = Minecraft.getMinecraft().player;
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (playerIsHoldingFishingRod(player)) {
Minecraft.getMinecraft().displayGuiScreen(new ConfigGui(Minecraft.getMinecraft().currentScreen));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ public void initialize(Minecraft minecraftInstance) {

}

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

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

@Override
public Class<? extends GuiScreen> mainConfigGuiClass() {
return ConfigGui.class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,30 @@ public static int getPrivateIntFieldFromObject(Object object, String forgeFieldN

}

/**
* Using Java reflection APIs, access a private member data of type double
*
* @param object The target object
* @param fieldName The name of the private data field in object
*
* @return The double value of the private member data from object with fieldName
*/
public static double getPrivateDoubleFieldFromObject(Object object, String forgeFieldName, String vanillaFieldName) throws NoSuchFieldException, SecurityException, NumberFormatException, IllegalArgumentException, IllegalAccessException {
Field targetField = null;
try {
targetField = object.getClass().getDeclaredField(forgeFieldName);
} catch (NoSuchFieldException e) {
targetField = object.getClass().getDeclaredField(vanillaFieldName);
}
if (targetField != null) {
targetField.setAccessible(true);
return Double.valueOf(targetField.get(object).toString()).doubleValue();
} else {
return 0;
}

}

/**
* Using Java reflection APIs, set a private member data of type int
*
Expand Down

0 comments on commit 5283ac6

Please sign in to comment.