diff options
Diffstat (limited to 'src/main/java/gtPlusPlus/plugin/fixes')
4 files changed, 45 insertions, 37 deletions
diff --git a/src/main/java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java b/src/main/java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java index 82757a2434..eed695108b 100644 --- a/src/main/java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java +++ b/src/main/java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java @@ -1,12 +1,13 @@ package gtPlusPlus.plugin.fixes.vanilla; -import gtPlusPlus.api.interfaces.IPlugin; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.plugin.manager.Core_Manager; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import gtPlusPlus.api.interfaces.IPlugin; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.plugin.manager.Core_Manager; + public class Core_VanillaFixes implements IPlugin { static final Core_VanillaFixes mInstance; @@ -87,8 +88,11 @@ public class Core_VanillaFixes implements IPlugin { mInstance.log( "Registering " + aStack.getDisplayName() + " to OreDictionary under the tag '" + aString + "'."); } else { - mInstance.log("Registering " + aStack.getDisplayName() + " to OreDictionary under the tag '" + aString - + "'. (Added to Forge in 1.8.9)"); + mInstance.log( + "Registering " + aStack.getDisplayName() + + " to OreDictionary under the tag '" + + aString + + "'. (Added to Forge in 1.8.9)"); } ItemUtils.addItemToOreDictionary(aStack, aString); } diff --git a/src/main/java/gtPlusPlus/plugin/fixes/vanilla/VanillaBackgroundMusicFix.java b/src/main/java/gtPlusPlus/plugin/fixes/vanilla/VanillaBackgroundMusicFix.java index ebf7729e92..5bf1420c35 100644 --- a/src/main/java/gtPlusPlus/plugin/fixes/vanilla/VanillaBackgroundMusicFix.java +++ b/src/main/java/gtPlusPlus/plugin/fixes/vanilla/VanillaBackgroundMusicFix.java @@ -1,12 +1,13 @@ package gtPlusPlus.plugin.fixes.vanilla; +import java.util.Timer; +import java.util.TimerTask; + import gtPlusPlus.api.interfaces.IPlugin; import gtPlusPlus.core.util.Utils; import gtPlusPlus.plugin.fixes.interfaces.IBugFix; import gtPlusPlus.plugin.fixes.vanilla.music.MusicTocker; import gtPlusPlus.preloader.CORE_Preloader; -import java.util.Timer; -import java.util.TimerTask; public class VanillaBackgroundMusicFix implements IBugFix { @@ -43,6 +44,7 @@ public class VanillaBackgroundMusicFix implements IBugFix { } private static class ManageTask extends TimerTask { + private final MusicTocker A; public ManageTask(MusicTocker a) { diff --git a/src/main/java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java b/src/main/java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java index cadb47e50d..5ae6e3e990 100644 --- a/src/main/java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java +++ b/src/main/java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java @@ -1,5 +1,11 @@ package gtPlusPlus.plugin.fixes.vanilla; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent; + import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gtPlusPlus.api.interfaces.IPlugin; @@ -8,10 +14,6 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.plugin.fixes.interfaces.IBugFix; import gtPlusPlus.preloader.DevHelper; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent; public class VanillaBedHeightFix implements IBugFix { @@ -52,8 +54,7 @@ public class VanillaBedHeightFix implements IBugFix { * Fix created by deNULL - * https://github.com/deNULL/BugPatch/blob/master/src/main/java/ru/denull/BugPatch/mod/ClientEvents.java#L45 * - * @param evt - * - The event where a player sleeps + * @param evt - The event where a player sleeps */ @SubscribeEvent(priority = EventPriority.HIGHEST) public void playerSleepInBed(PlayerSleepInBedEvent evt) { @@ -62,12 +63,16 @@ public class VanillaBedHeightFix implements IBugFix { int correctY = 256 + evt.y; if (correctY <= 0) { Logger.WARNING( - "You're trying to sleep at y=" + evt.y + ", which is impossibly low. However, fixed y value is " - + correctY + ", which is still below 0. Falling back to default behavior."); + "You're trying to sleep at y=" + evt.y + + ", which is impossibly low. However, fixed y value is " + + correctY + + ", which is still below 0. Falling back to default behavior."); } else { - Logger.WARNING("You're trying to sleep at y=" + evt.y - + ". This is probably caused by overflow, stopping original event; retrying with y=" + correctY - + "."); + Logger.WARNING( + "You're trying to sleep at y=" + evt.y + + ". This is probably caused by overflow, stopping original event; retrying with y=" + + correctY + + "."); evt.result = EntityPlayer.EnumStatus.OTHER_PROBLEM; try { mSleepInBedAt.invoke(evt.entityPlayer, evt.x, correctY, evt.z); diff --git a/src/main/java/gtPlusPlus/plugin/fixes/vanilla/music/MusicTocker.java b/src/main/java/gtPlusPlus/plugin/fixes/vanilla/music/MusicTocker.java index 17fbc9ae29..c2af6ea591 100644 --- a/src/main/java/gtPlusPlus/plugin/fixes/vanilla/music/MusicTocker.java +++ b/src/main/java/gtPlusPlus/plugin/fixes/vanilla/music/MusicTocker.java @@ -1,20 +1,22 @@ package gtPlusPlus.plugin.fixes.vanilla.music; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.api.interfaces.IPlugin; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.random.XSTR; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.preloader.CORE_Preloader; import java.lang.reflect.Field; import java.util.Random; + import net.minecraft.client.Minecraft; import net.minecraft.client.audio.ISound; import net.minecraft.client.audio.MusicTicker; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.util.MathHelper; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.interfaces.IPlugin; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.random.XSTR; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.preloader.CORE_Preloader; + @SideOnly(Side.CLIENT) public class MusicTocker extends MusicTicker implements Runnable { @@ -54,8 +56,7 @@ public class MusicTocker extends MusicTicker implements Runnable { return true; } } - } catch (IllegalArgumentException | IllegalAccessException e) { - } + } catch (IllegalArgumentException | IllegalAccessException e) {} mPlugin.log("[BGM] Failed."); return false; @@ -112,17 +113,13 @@ public class MusicTocker extends MusicTicker implements Runnable { } /* - * try { // Get Value stored in underlying object. Integer aRealDelay = + * try { // Get Value stored in underlying object. Integer aRealDelay = (Integer) + * ReflectionUtils.getField(getClass(), "field_147676_d").get(this); if (aRealDelay == null) { return; } else { + * if (aRealDelay > getDelay() || aRealDelay <= 0) { this.mTimeUntilNextTrack = getDelay(); + * updateInternalNumber(); } else { this.mTimeUntilNextTrack -= 5 * 20; updateInternalNumber(); } aRealDelay = * (Integer) ReflectionUtils.getField(getClass(), "field_147676_d").get(this); - * - * if (aRealDelay == null) { return; } else { if (aRealDelay > getDelay() || - * aRealDelay <= 0) { this.mTimeUntilNextTrack = getDelay(); - * updateInternalNumber(); } else { this.mTimeUntilNextTrack -= 5 * 20; - * updateInternalNumber(); } aRealDelay = (Integer) - * ReflectionUtils.getField(getClass(), "field_147676_d").get(this); - * Logger.INFO("[BGM] Adjusted BGM - "+aRealDelay); } - * - * } catch (IllegalArgumentException | IllegalAccessException e) { } + * Logger.INFO("[BGM] Adjusted BGM - "+aRealDelay); } } catch (IllegalArgumentException | IllegalAccessException + * e) { } */ } } |