Reinstate commented out changes for v1.11

This commit is contained in:
Kirsty McNaught
2017-06-04 10:56:20 +01:00
parent 96682b3231
commit 2df8bf3582
13 changed files with 54 additions and 94 deletions
@@ -1,20 +1,19 @@
package de.skate702.craftingkeys; package de.skate702.craftingkeys;
// NEW_1_8 cpw.mods.fml => net.minecraftforge.fml
import cpw.mods.fml.client.event.ConfigChangedEvent; import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance; import net.minecraftforge.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy; import net.minecraftforge.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent; import net.minecraftforge.fml.common.gameevent.InputEvent;
import cpw.mods.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.NetworkRegistry;
import de.skate702.craftingkeys.config.Config; import de.skate702.craftingkeys.config.Config;
import de.skate702.craftingkeys.config.GuiConfig; import de.skate702.craftingkeys.config.GuiConfig;
import de.skate702.craftingkeys.config.GuiConfigHandler; import de.skate702.craftingkeys.config.GuiConfigHandler;
@@ -116,7 +115,7 @@ public class CraftingKeys {
*/ */
@SubscribeEvent @SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) { public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) {
if (eventArgs.modID.equals(MODID)) { // NEW_1_9 modID => getModID() if (eventArgs.getModID().equals(MODID)) {
Config.syncConfig(); Config.syncConfig();
Logger.info("onConfigChanged(e)", "Changed config."); Logger.info("onConfigChanged(e)", "Changed config.");
} }
@@ -1,8 +1,7 @@
package de.skate702.craftingkeys.config; package de.skate702.craftingkeys.config;
// NEW_1_8 cpw.mods.fml => net.minecraftforge.fml
import cpw.mods.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import de.skate702.craftingkeys.CraftingKeys; import de.skate702.craftingkeys.CraftingKeys;
import de.skate702.craftingkeys.util.Logger; import de.skate702.craftingkeys.util.Logger;
import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Configuration;
@@ -229,18 +229,11 @@ public class GuiConfig extends GuiScreen {
mc.renderEngine.bindTexture(new ResourceLocation(CraftingKeys.MODID, "textures/gui/symbols.png")); mc.renderEngine.bindTexture(new ResourceLocation(CraftingKeys.MODID, "textures/gui/symbols.png"));
drawTexturedModalRect(guiShowBasePosX + 105, guiShowBasePosY + 17, 200, 0, 50, 50); drawTexturedModalRect(guiShowBasePosX + 105, guiShowBasePosY + 17, 200, 0, 50, 50);
//NEW_1.11
/*
drawInfoString(0, 24, 21); drawInfoString(0, 24, 21);
drawInfoString(4, 86, 63); drawInfoString(4, 86, 63);
drawInfoString(3, 64, 56); drawInfoString(3, 64, 56);
drawInfoString(5, 109, 56); drawInfoString(5, 109, 56);
*/
drawInfoString(1, 86, 21);
drawInfoString(4, 86, 58);
drawInfoString(3, 63, 50);
drawInfoString(5, 109, 50);
} }
private void genEnchantmentInfo() { private void genEnchantmentInfo() {
@@ -253,14 +246,8 @@ public class GuiConfig extends GuiScreen {
mc.renderEngine.bindTexture(new ResourceLocation(CraftingKeys.MODID, "textures/gui/symbols.png")); mc.renderEngine.bindTexture(new ResourceLocation(CraftingKeys.MODID, "textures/gui/symbols.png"));
drawTexturedModalRect(guiShowBasePosX + 105, guiShowBasePosY + 17, 150, 50, 50, 50); drawTexturedModalRect(guiShowBasePosX + 105, guiShowBasePosY + 17, 150, 50, 50, 50);
//NEW_1.11
/*
drawInfoString(1, 22, 51); drawInfoString(1, 22, 51);
drawInfoString(2, 42, 51); drawInfoString(2, 42, 51);
*/
drawInfoString(1, 32, 51);
// NEW_1_8 drawInfoString(2, 42, 51);
} }
@@ -306,19 +293,12 @@ public class GuiConfig extends GuiScreen {
mc.renderEngine.bindTexture(new ResourceLocation(CraftingKeys.MODID, "textures/gui/symbols.png")); mc.renderEngine.bindTexture(new ResourceLocation(CraftingKeys.MODID, "textures/gui/symbols.png"));
drawTexturedModalRect(guiShowBasePosX + 105, guiShowBasePosY + 17, 0, 0, 50, 50); drawTexturedModalRect(guiShowBasePosX + 105, guiShowBasePosY + 17, 0, 0, 50, 50);
/* NEW_1_11
drawInfoString(1, 105, 22); drawInfoString(1, 105, 22);
drawInfoString(2, 123, 22); drawInfoString(2, 123, 22);
drawInfoString(4, 105, 40); drawInfoString(4, 105, 40);
drawInfoString(5, 123, 40); drawInfoString(5, 123, 40);
drawInfoString(9, 164, 32); drawInfoString(9, 164, 32);
*/
drawInfoString(1, 95, 30);
drawInfoString(2, 113, 30);
drawInfoString(4, 95, 48);
drawInfoString(5, 113, 48);
drawInfoString(9, 151, 40);
} }
private void genDispenserInfo() { private void genDispenserInfo() {
@@ -1,8 +1,7 @@
package de.skate702.craftingkeys.config; package de.skate702.craftingkeys.config;
// NEW_1_8 cpw.mods.fml => net.minecraftforge.fml
import cpw.mods.fml.common.network.IGuiHandler; import net.minecraftforge.fml.common.network.IGuiHandler;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -1,8 +1,7 @@
package de.skate702.craftingkeys.config; package de.skate702.craftingkeys.config;
// NEW_1_8 cpw.mods.fml => net.minecraftforge.fml
import cpw.mods.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraft.client.settings.KeyBinding; import net.minecraft.client.settings.KeyBinding;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
@@ -36,8 +36,8 @@ public class BrewingManager extends ContainerManager {
@Override @Override
protected int specificKeyToSlotIndex() { protected int specificKeyToSlotIndex() {
//NEW_1.11 return mapKeyToSlot(4, 3, -1, 0, 1, 2, -1, -1, -1); //TODO: check for v1.11
return mapKeyToSlot(-1, 3, -1, 0, 1, 2, -1, -1, -1); return mapKeyToSlot(4, 3, -1, 0, 1, 2, -1, -1, -1);
} }
@Override @Override
@@ -6,9 +6,12 @@ import de.skate702.craftingkeys.util.InputUtil;
import de.skate702.craftingkeys.util.Logger; import de.skate702.craftingkeys.util.Logger;
import de.skate702.craftingkeys.util.Util; import de.skate702.craftingkeys.util.Util;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.settings.KeyBinding; import net.minecraft.client.settings.KeyBinding;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
@@ -17,8 +20,6 @@ import org.lwjgl.input.Keyboard;
*/ */
public abstract class ContainerManager { public abstract class ContainerManager {
// NEW_1_11 stackSize is private. Use: func_190916_E()
/** /**
* The Container to work with. * The Container to work with.
*/ */
@@ -100,7 +101,7 @@ public abstract class ContainerManager {
// Stack up on hand if equal or small enough, else throw held stack away // Stack up on hand if equal or small enough, else throw held stack away
if (Util.isHoldingStack() && getItemStack(getInteractionSlotIndex()) != null && ( if (Util.isHoldingStack() && getItemStack(getInteractionSlotIndex()) != null && (
!Util.getHeldStack().isItemEqual(getItemStack(getInteractionSlotIndex())) !Util.getHeldStack().isItemEqual(getItemStack(getInteractionSlotIndex()))
|| Util.getHeldStack().stackSize + getItemStack(getInteractionSlotIndex()).stackSize || Util.getHeldStack().getCount() + getItemStack(getInteractionSlotIndex()).getCount()
> getItemStack(getInteractionSlotIndex()).getMaxStackSize())) { > getItemStack(getInteractionSlotIndex()).getMaxStackSize())) {
moveStackToInventory(-1); moveStackToInventory(-1);
} }
@@ -112,9 +113,9 @@ public abstract class ContainerManager {
interact(); interact();
while (Util.isHoldingStack() && while (Util.isHoldingStack() &&
oldStackSize != Util.getHeldStack().stackSize) { oldStackSize != Util.getHeldStack().getCount()) {
oldStackSize = Util.getHeldStack().stackSize; oldStackSize = Util.getHeldStack().getCount();
interact(); interact();
} }
@@ -162,10 +163,9 @@ public abstract class ContainerManager {
// hotbar-slots are always the last 9 slots of the currently opened inventory // hotbar-slots are always the last 9 slots of the currently opened inventory
int hotbarStartIndex = Util.client.thePlayer.openContainer.getInventory().size() - 9 - 1; int hotbarStartIndex = Util.client.thePlayer.openContainer.getInventory().size() - 9 - 1;
// NEW_1_9 Player inventory Shield fix if (Util.client.currentScreen instanceof GuiInventory) {
//if (Util.client.currentScreen instanceof GuiInventory) { hotbarStartIndex -= 1;
// hotbarStartIndex -= 1; }
//}
int inputdelta; int inputdelta;
KeyBinding[] hotbar = Util.client.gameSettings.keyBindsHotbar; KeyBinding[] hotbar = Util.client.gameSettings.keyBindsHotbar;
@@ -286,7 +286,7 @@ public abstract class ContainerManager {
if (source == null) { if (source == null) {
Logger.debug("moveAll(i,i)", "Source ItemStack from Index == null"); Logger.debug("moveAll(i,i)", "Source ItemStack from Index == null");
} else { } else {
move(srcIndex, destIndex, source.stackSize); move(srcIndex, destIndex, source.getCount());
} }
} }
@@ -313,7 +313,7 @@ public abstract class ContainerManager {
} }
// Test for max. moving Amount // Test for max. moving Amount
int sourceSize = source.stackSize; int sourceSize = source.getCount();
int movedAmount = Math.min(amount, sourceSize); int movedAmount = Math.min(amount, sourceSize);
// Clear goal slot (May fail on full inventory!); only available if not holdling // Clear goal slot (May fail on full inventory!); only available if not holdling
@@ -358,15 +358,13 @@ public abstract class ContainerManager {
Slot slot = (Slot) (container.inventorySlots.get(index)); Slot slot = (Slot) (container.inventorySlots.get(index));
// NEW_1_11 No Null-Stacks anymore. Empty Stacks with air... // NEW_1_11 No Null-Stacks anymore. Empty Stacks with air...
/*ItemStack returnStack = (slot == null) ? null : slot.getStack(); ItemStack returnStack = (slot == null) ? null : slot.getStack();
if(returnStack.func_190916_E() == 0 && returnStack.getItem() == Item.getItemFromBlock(Blocks.AIR)) { if(returnStack.getCount() == 0 && returnStack.getItem() == Item.getItemFromBlock(Blocks.AIR)) {
returnStack = null; returnStack = null;
} }
return returnStack;*/ return returnStack;
return (slot == null) ? null : slot.getStack();
} else if (index == -1 && Util.isHoldingStack()) { } else if (index == -1 && Util.isHoldingStack()) {
return Util.getHeldStack(); return Util.getHeldStack();
@@ -444,7 +442,7 @@ public abstract class ContainerManager {
if (potentialGoalStack != null && stackToMove != null) { if (potentialGoalStack != null && stackToMove != null) {
if (potentialGoalStack.isItemEqual(stackToMove)) { if (potentialGoalStack.isItemEqual(stackToMove)) {
if (potentialGoalStack.stackSize + stackToMove.stackSize <= stackToMove.getMaxStackSize()) { if (potentialGoalStack.getCount() + stackToMove.getCount() <= stackToMove.getMaxStackSize()) {
return i; return i;
} }
} }
@@ -36,15 +36,15 @@ public class EnchantmentManager extends ContainerManager {
@Override @Override
protected int specificKeyToSlotIndex() { protected int specificKeyToSlotIndex() {
return mapKeyToSlot(-1, 0, -1, -1, 0, -1, -1, -1, -1); //TODO: check for v1.11
// NEW_1_8 return mapKeyToSlot(-1, 0, 1, -1, 0, 1, -1, -1, -1); return mapKeyToSlot(-1, 0, 1, -1, 0, 1, -1, -1, -1);
} }
@Override @Override
protected int getInventoryStartIndex() { protected int getInventoryStartIndex() {
return 1; // TODO: check for v1.11
// NEW_1_8 return 2; return 2;
} }
@Override @Override
@@ -54,8 +54,8 @@ public class EnchantmentManager extends ContainerManager {
@Override @Override
protected int[] getDropSlots() { protected int[] getDropSlots() {
return new int[]{0}; //TODO: check for v1.11
// NEW_1_8 return new int[] {0, 1}; return new int[] {0, 1};
} }
@Override @Override
@@ -36,9 +36,8 @@ public class InventoryManager extends ContainerManager {
@Override @Override
protected int specificKeyToSlotIndex() { protected int specificKeyToSlotIndex() {
//TODO: check for v1.11
return mapKeyToSlot(-1, 1, 2, -1, 3, 4, -1, -1, -1); return mapKeyToSlot(-1, 1, 2, 45, 3, 4, 45, -1, -1);
// NEW_1_9 return mapKeyToSlot(-1, 1, 2, 45, 3, 4, 45, -1, -1);
} }
@Override @Override
@@ -1,9 +1,8 @@
package de.skate702.craftingkeys.proxies; package de.skate702.craftingkeys.proxies;
// NEW_1_9 import net.minecraft.inventory.ClickType;
import net.minecraft.client.multiplayer.PlayerControllerMP; import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ClickType;
/** /**
* Client Proxy, extending Common Proxy. * Client Proxy, extending Common Proxy.
@@ -16,9 +15,7 @@ public class CraftingKeysClientProxy extends CraftingKeysProxy {
public void sendSlotClick(PlayerControllerMP controller, int windowId, int slot, int rightClick, int action, public void sendSlotClick(PlayerControllerMP controller, int windowId, int slot, int rightClick, int action,
EntityPlayer player) { EntityPlayer player) {
controller.windowClick(windowId, slot, rightClick, action, player); controller.windowClick(windowId, slot, rightClick, ClickType.PICKUP, player);
// NEW_1_9 controller.func_187098_a(windowId, slot, rightClick, ClickType.PICKUP, player);
// NEW_1_11 controller.windowClick(windowId, slot, rightClick, ClickType.PICKUP, player);
} }
} }
@@ -1,9 +1,7 @@
package de.skate702.craftingkeys.proxies; package de.skate702.craftingkeys.proxies;
// NEW_1_8 cpw.mods.fml => net.minecraftforge.fml import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.multiplayer.PlayerControllerMP; import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -1,8 +1,6 @@
package de.skate702.craftingkeys.util; package de.skate702.craftingkeys.util;
//NEW_1_9: net.minecraft.util.text.translation.I18n; import net.minecraft.client.resources.I18n;
//NEW_1_11: net.minecraft.client.resources.I18n;
import net.minecraft.util.StatCollector;
public class LanguageLocalizer { public class LanguageLocalizer {
/** /**
@@ -12,8 +10,6 @@ public class LanguageLocalizer {
* @return localized The localized String * @return localized The localized String
*/ */
public static String localize(String unloc) { public static String localize(String unloc) {
//NEW_1_9 return I18n.translateToLocal(unloc); return I18n.format(unloc);
//NEW_1_9.4: return I18n.format(unloc);
return StatCollector.translateToLocal(unloc);
} }
} }
@@ -1,12 +1,10 @@
package de.skate702.craftingkeys.util; package de.skate702.craftingkeys.util;
// NEW_1_8 cpw.mods.fml => net.minecraftforge.fml
// NEW_1_9 net.minecraft.util.text.TextComponentTranslation;
import cpw.mods.fml.client.FMLClientHandler; import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.text.TextComponentTranslation;
/** /**
* Provides basic utility methods. For input methods, look at InputUtil. * Provides basic utility methods. For input methods, look at InputUtil.
@@ -43,8 +41,7 @@ public class Util {
* @return True, if held stack != null * @return True, if held stack != null
*/ */
public static boolean isHoldingStack() { public static boolean isHoldingStack() {
// NEW_1_11 return (getHeldStack().func_190916_E() != 0); return (getHeldStack().getCount() > 0);
return (getHeldStack() != null);
} }
/** /**
@@ -68,8 +65,7 @@ public class Util {
* @param lang_key key from lang-file * @param lang_key key from lang-file
*/ */
public static void printMessage(String lang_key) { public static void printMessage(String lang_key) {
client.thePlayer.addChatMessage(new ChatComponentTranslation(lang_key)); client.thePlayer.addChatMessage(new TextComponentTranslation(lang_key));
// NEW_1_9 client.thePlayer.addChatMessage(new TextComponentTranslation(lang_key));
} }
} }