Skip to content

Commit

Permalink
Update to 1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Nov 16, 2016
1 parent a862273 commit a2b5aea
Show file tree
Hide file tree
Showing 41 changed files with 132 additions and 140 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -90,7 +90,7 @@ curseforge {
id = curse_project_id
changelog = file('changelog.html')
changelogType = 'html'
releaseType = 'beta'
releaseType = 'alpha'
}
}

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
@@ -1,6 +1,6 @@
mcversion=1.10.2
forgeversion=12.18.2.2125
mcp_mappings=snapshot_20161111
mcversion=1.11
forgeversion=13.19.0.2127-1.11.x
mcp_mappings=snapshot_20161115
curse_project_id=238222

version_major=4
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/mezz/jei/ItemBlacklist.java
Expand Up @@ -27,8 +27,8 @@ public void addItemToBlacklist(@Nullable ItemStack itemStack) {
Log.error("Null itemStack", new NullPointerException());
return;
}
if (itemStack.getItem() == null) {
Log.error("Null item in itemStack", new NullPointerException());
if (itemStack.func_190926_b()) {
Log.error("Invalid itemStack", new IllegalArgumentException());
return;
}

Expand All @@ -42,8 +42,8 @@ public void removeItemFromBlacklist(@Nullable ItemStack itemStack) {
Log.error("Null itemStack", new NullPointerException());
return;
}
if (itemStack.getItem() == null) {
Log.error("Null item in itemStack", new NullPointerException());
if (itemStack.func_190926_b()) {
Log.error("Invalid itemStack", new IllegalArgumentException());
return;
}

Expand All @@ -57,8 +57,8 @@ public boolean isItemBlacklisted(@Nullable ItemStack itemStack) {
Log.error("Null itemStack", new NullPointerException());
return false;
}
if (itemStack.getItem() == null) {
Log.error("Null item in itemStack", new NullPointerException());
if (itemStack.func_190926_b()) {
Log.error("Invalid itemStack", new IllegalArgumentException());
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/mezz/jei/JustEnoughItems.java
Expand Up @@ -16,8 +16,8 @@
name = Constants.NAME,
version = Constants.VERSION,
guiFactory = "mezz.jei.config.JEIModGuiFactory",
acceptedMinecraftVersions = "[1.10]",
dependencies = "required-after:Forge@[12.18.1.2053,);")
acceptedMinecraftVersions = "[1.11]",
dependencies = "required-after:forge@13.19.0.2127,);")
public class JustEnoughItems {

@SuppressWarnings("NullableProblems")
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mezz/jei/ProxyCommonClient.java
Expand Up @@ -116,7 +116,7 @@ public void onResourceManagerReload(IResourceManager resourceManager) {

@SubscribeEvent
public void onEntityJoinedWorld(EntityJoinWorldEvent event) {
if (event.getWorld().isRemote && !SessionData.hasJoinedWorld() && Minecraft.getMinecraft().thePlayer != null) {
if (event.getWorld().isRemote && !SessionData.hasJoinedWorld() && Minecraft.getMinecraft().player != null) {
SessionData.setJoinedWorld();
Config.syncWorldConfig();
}
Expand Down
19 changes: 2 additions & 17 deletions src/main/java/mezz/jei/RecipeRegistry.java
Expand Up @@ -38,7 +38,6 @@
import mezz.jei.util.Log;
import mezz.jei.util.RecipeCategoryComparator;
import mezz.jei.util.RecipeMap;
import mezz.jei.util.StackHelper;
import net.minecraft.block.Block;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container;
Expand Down Expand Up @@ -212,24 +211,10 @@ private <T> void addRecipe(T recipe, Class<? extends T> recipeClass) {
addRecipeUnchecked(recipe, recipeCategory, recipeHandler);
} catch (RuntimeException e) {
String recipeInfo = ErrorUtil.getInfoFromBrokenRecipe(recipe, recipeHandler);

// suppress the null item in stack exception, that information is redundant here.
String errorMessage = e.getMessage();
if (StackHelper.nullItemInStack.equals(errorMessage)) {
Log.error("Found a broken recipe: {}\n", recipeInfo);
} else {
Log.error("Found a broken recipe: {}\n", recipeInfo, e);
}
Log.error("Found a broken recipe: {}\n", recipeInfo, e);
} catch (LinkageError e) {
String recipeInfo = ErrorUtil.getInfoFromBrokenRecipe(recipe, recipeHandler);

// suppress the null item in stack exception, that information is redundant here.
String errorMessage = e.getMessage();
if (StackHelper.nullItemInStack.equals(errorMessage)) {
Log.error("Found a broken recipe: {}\n", recipeInfo);
} else {
Log.error("Found a broken recipe: {}\n", recipeInfo, e);
}
Log.error("Found a broken recipe: {}\n", recipeInfo, e);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/mezz/jei/SubtypeRegistry.java
Expand Up @@ -52,12 +52,12 @@ public String getSubtypeInfo(@Nullable ItemStack itemStack) {
return null;
}

Item item = itemStack.getItem();
if (item == null) {
Log.error("Null item", new NullPointerException());
if (itemStack.func_190926_b()) {
Log.error("Invalid ItemStack", new IllegalArgumentException());
return null;
}

Item item = itemStack.getItem();
ISubtypeInterpreter nbtInterpreter = interpreters.get(item);
if (nbtInterpreter != null) {
return nbtInterpreter.getSubtypeInfo(itemStack);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/mezz/jei/config/JEIModConfigGui.java
Expand Up @@ -33,7 +33,7 @@ private static GuiScreen getParent(GuiScreen parent) {
if (parentScreen != null) {
return parentScreen;
} else {
return new GuiInventory(parent.mc.thePlayer);
return new GuiInventory(parent.mc.player);
}
}
return parent;
Expand All @@ -42,7 +42,7 @@ private static GuiScreen getParent(GuiScreen parent) {
private static List<IConfigElement> getConfigElements() {
List<IConfigElement> configElements = new ArrayList<IConfigElement>();

if (Minecraft.getMinecraft().theWorld != null) {
if (Minecraft.getMinecraft().world != null) {
Configuration worldConfig = Config.getWorldConfig();
if (worldConfig != null) {
ConfigCategory categoryWorldConfig = worldConfig.getCategory(SessionData.getWorldUid());
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/mezz/jei/gui/ItemListOverlayInternal.java
Expand Up @@ -326,8 +326,8 @@ public void drawScreen(Minecraft minecraft, int mouseX, int mouseY) {

private boolean shouldShowDeleteItemTooltip(Minecraft minecraft) {
if (Config.isDeleteItemsInCheatModeActive()) {
EntityPlayer player = minecraft.thePlayer;
if (player.inventory.getItemStack() != null) {
EntityPlayer player = minecraft.player;
if (!player.inventory.getItemStack().func_190926_b()) {
return true;
}
}
Expand Down Expand Up @@ -408,10 +408,10 @@ public boolean handleMouseClicked(int mouseX, int mouseY, int mouseButton) {

if (Config.isDeleteItemsInCheatModeActive()) {
Minecraft minecraft = Minecraft.getMinecraft();
EntityPlayerSP player = minecraft.thePlayer;
EntityPlayerSP player = minecraft.player;
ItemStack itemStack = player.inventory.getItemStack();
if (itemStack != null) {
player.inventory.setItemStack(null);
if (!itemStack.func_190926_b()) {
player.inventory.setItemStack(ItemStack.field_190927_a);
PacketJei packet = new PacketDeletePlayerItem(itemStack);
JustEnoughItems.getProxy().sendPacketToServer(packet);
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mezz/jei/gui/recipes/RecipeGuiLogic.java
Expand Up @@ -105,7 +105,7 @@ private void setState(State state) {
}

private int getRecipeCategoryIndex(List<IRecipeCategory> recipeCategories) {
final Container container = Minecraft.getMinecraft().thePlayer.openContainer;
final Container container = Minecraft.getMinecraft().player.openContainer;
if (container == null) {
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/mezz/jei/gui/recipes/RecipesGui.java
Expand Up @@ -319,7 +319,7 @@ public void close() {
mc.displayGuiScreen(parentScreen);
parentScreen = null;
} else {
mc.thePlayer.closeScreen();
mc.player.closeScreen();
}
logic.clearHistory();
}
Expand Down Expand Up @@ -371,7 +371,7 @@ protected void actionPerformed(GuiButton guibutton) {
RecipeLayout recipeLayout = recipeLayouts.get(recipeIndex);
boolean maxTransfer = GuiScreen.isShiftKeyDown();
Container container = getParentContainer();
if (container != null && RecipeTransferUtil.transferRecipe(container, recipeLayout, mc.thePlayer, maxTransfer)) {
if (container != null && RecipeTransferUtil.transferRecipe(container, recipeLayout, mc.player, maxTransfer)) {
close();
}
}
Expand Down Expand Up @@ -417,7 +417,7 @@ private void addRecipeTransferButtons(List<RecipeLayout> recipeLayouts) {
buttonList.clear();
addButtons();

EntityPlayer player = mc.thePlayer;
EntityPlayer player = mc.player;
Container container = getParentContainer();

for (RecipeLayout recipeLayout : recipeLayouts) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mezz/jei/input/GuiContainerWrapper.java
Expand Up @@ -24,7 +24,7 @@ public IClickedIngredient<?> getIngredientUnderMouse(int mouseX, int mouseY) {
Slot slotUnderMouse = guiContainer.getSlotUnderMouse();
if (slotUnderMouse != null) {
ItemStack stack = slotUnderMouse.getStack();
if (stack != null) {
if (!stack.func_190926_b()) {
return new ClickedIngredient<ItemStack>(stack);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mezz/jei/network/PacketHandler.java
Expand Up @@ -68,7 +68,7 @@ public void onPacket(FMLNetworkEvent.ServerCustomPacketEvent event) {
public void onPacket(FMLNetworkEvent.ClientCustomPacketEvent event) {
PacketBuffer packetBuffer = new PacketBuffer(event.getPacket().payload());
Minecraft minecraft = Minecraft.getMinecraft();
EntityPlayer player = minecraft.thePlayer;
EntityPlayer player = minecraft.player;
IPacketJeiHandler packetHandler;

try {
Expand Down
Expand Up @@ -31,7 +31,7 @@ public void readPacketData(PacketBuffer buf, EntityPlayer player) throws IOExcep
ItemStack itemStack = buf.readItemStackFromBuffer();
ItemStack playerItem = player.inventory.getItemStack();
if (ItemStack.areItemStacksEqual(itemStack, playerItem)) {
player.inventory.setItemStack(null);
player.inventory.setItemStack(ItemStack.field_190927_a);
}
}
}
Expand Down
Expand Up @@ -38,8 +38,8 @@ public void readPacketData(PacketBuffer buf, EntityPlayer player) throws IOExcep

NBTTagCompound itemStackSerialized = buf.readNBTTagCompoundFromBuffer();
if (itemStackSerialized != null) {
ItemStack itemStack = ItemStack.loadItemStackFromNBT(itemStackSerialized);
if (itemStack != null) {
ItemStack itemStack = new ItemStack(itemStackSerialized);
if (!itemStack.func_190926_b()) {
if (CommandUtil.hasPermission(sender, itemStack)) {
CommandUtil.executeGive(sender, itemStack);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mezz/jei/plugins/jei/debug/DebugRecipe.java
Expand Up @@ -80,7 +80,7 @@ public List<String> getTooltipStrings(int mouseX, int mouseY) {
@Override
public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton) {
if (mouseButton == 0 && button.mousePressed(minecraft, mouseX, mouseY)) {
GuiScreen screen = new GuiInventory(minecraft.thePlayer);
GuiScreen screen = new GuiInventory(minecraft.player);
minecraft.displayGuiScreen(screen);

IJeiRuntime runtime = JEIInternalPlugin.jeiRuntime;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/mezz/jei/plugins/vanilla/VanillaPlugin.java
Expand Up @@ -53,6 +53,7 @@
import net.minecraft.item.ItemMonsterPlacer;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;

@JEIPlugin
Expand All @@ -79,7 +80,8 @@ public String getSubtypeInfo(ItemStack itemStack) {
@Nullable
@Override
public String getSubtypeInfo(ItemStack itemStack) {
return ItemMonsterPlacer.getEntityIdFromItem(itemStack);
ResourceLocation resourceLocation = ItemMonsterPlacer.func_190908_h(itemStack);
return resourceLocation == null ? null : resourceLocation.toString();
}
});
}
Expand Down
Expand Up @@ -23,10 +23,12 @@
import net.minecraft.potion.PotionHelper;
import net.minecraft.potion.PotionType;
import net.minecraft.potion.PotionUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.brewing.AbstractBrewingRecipe;
import net.minecraftforge.common.brewing.BrewingRecipeRegistry;
import net.minecraftforge.common.brewing.IBrewingRecipe;
import net.minecraftforge.common.brewing.VanillaBrewingRecipe;
import net.minecraftforge.fml.common.registry.ForgeRegistries;

public class BrewingRecipeMaker {
private final Set<Class> unhandledRecipeClasses = new HashSet<Class>();
Expand Down Expand Up @@ -90,7 +92,7 @@ private List<ItemStack> getNewPotions(final int brewingStep, List<ItemStack> kno
for (ItemStack potionInput : knownPotions) {
for (ItemStack potionIngredient : potionIngredients) {
ItemStack potionOutput = PotionHelper.doReaction(potionIngredient, potionInput.copy());
if (potionOutput == null) {
if (potionOutput.equals(potionInput)) {
continue;
}

Expand All @@ -101,9 +103,9 @@ private List<ItemStack> getNewPotions(final int brewingStep, List<ItemStack> kno
}

PotionType potionInputType = PotionUtils.getPotionFromItem(potionInput);
int inputId = PotionType.getID(potionInputType);
int outputId = PotionType.getID(potionOutputType);
if (inputId == outputId) {
ResourceLocation inputId = ForgeRegistries.POTION_TYPES.getKey(potionInputType);
ResourceLocation outputId = ForgeRegistries.POTION_TYPES.getKey(potionOutputType);
if (inputId.equals(outputId)) {
continue;
}
}
Expand Down
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionType;
import net.minecraft.potion.PotionUtils;
import net.minecraftforge.fml.common.registry.ForgeRegistries;

public class BrewingRecipeWrapper extends BlankRecipeWrapper {
private final List<ItemStack> ingredients;
Expand Down Expand Up @@ -42,8 +43,8 @@ public BrewingRecipeWrapper(List<ItemStack> ingredients, ItemStack potionInput,

PotionType typeIn = PotionUtils.getPotionFromItem(potionInput);
PotionType typeOut = PotionUtils.getPotionFromItem(potionOutput);
this.hashCode = Objects.hashCode(potionInput.getItem(), PotionType.getID(typeIn),
potionOutput.getItem(), PotionType.getID(typeOut),
this.hashCode = Objects.hashCode(potionInput.getItem(), ForgeRegistries.POTION_TYPES.getKey(typeIn),
potionOutput.getItem(), ForgeRegistries.POTION_TYPES.getKey(typeOut),
firstIngredient.getItem(), firstIngredient.getMetadata());
}

Expand Down Expand Up @@ -99,7 +100,7 @@ private static boolean arePotionsEqual(ItemStack potion1, ItemStack potion2) {
}
PotionType type1 = PotionUtils.getPotionFromItem(potion1);
PotionType type2 = PotionUtils.getPotionFromItem(potion2);
return PotionType.getID(type1) == PotionType.getID(type2);
return ForgeRegistries.POTION_TYPES.getKey(type1).equals(ForgeRegistries.POTION_TYPES.getKey(type2));
}

public int getBrewingSteps() {
Expand Down
Expand Up @@ -24,8 +24,8 @@ public ShapedOreRecipeWrapper(IJeiHelpers jeiHelpers, ShapedOreRecipe recipe) {
for (Object input : this.recipe.getInput()) {
if (input instanceof ItemStack) {
ItemStack itemStack = (ItemStack) input;
if (itemStack.stackSize != 1) {
itemStack.stackSize = 1;
if (itemStack.func_190916_E() != 1) {
itemStack.func_190920_e(1);
}
}
}
Expand Down
Expand Up @@ -16,8 +16,8 @@ public class ShapedRecipesWrapper extends BlankRecipeWrapper implements IShapedC
public ShapedRecipesWrapper(ShapedRecipes recipe) {
this.recipe = recipe;
for (ItemStack itemStack : this.recipe.recipeItems) {
if (itemStack != null && itemStack.stackSize != 1) {
itemStack.stackSize = 1;
if (itemStack != null && itemStack.func_190916_E() != 1) {
itemStack.func_190920_e(1);
}
}
}
Expand Down
Expand Up @@ -19,8 +19,8 @@ public ShapelessOreRecipeWrapper(IJeiHelpers jeiHelpers, ShapelessOreRecipe reci
for (Object input : this.recipe.getInput()) {
if (input instanceof ItemStack) {
ItemStack itemStack = (ItemStack) input;
if (itemStack.stackSize != 1) {
itemStack.stackSize = 1;
if (itemStack.func_190916_E() != 1) {
itemStack.func_190920_e(1);
}
}
}
Expand Down
Expand Up @@ -15,8 +15,8 @@ public ShapelessRecipesWrapper(IGuiHelper guiHelper, ShapelessRecipes recipe) {
for (Object input : this.recipe.recipeItems) {
if (input instanceof ItemStack) {
ItemStack itemStack = (ItemStack) input;
if (itemStack.stackSize != 1) {
itemStack.stackSize = 1;
if (itemStack.func_190916_E() != 1) {
itemStack.func_190920_e(1);
}
}
}
Expand Down
Expand Up @@ -18,9 +18,9 @@ public static List<SmeltingRecipe> getFurnaceRecipes(IJeiHelpers helpers) {

List<SmeltingRecipe> recipes = new ArrayList<SmeltingRecipe>();

for (Map.Entry<ItemStack, ItemStack> itemStackItemStackEntry : smeltingMap.entrySet()) {
ItemStack input = itemStackItemStackEntry.getKey();
ItemStack output = itemStackItemStackEntry.getValue();
for (Map.Entry<ItemStack, ItemStack> entry : smeltingMap.entrySet()) {
ItemStack input = entry.getKey();
ItemStack output = entry.getValue();

List<ItemStack> inputs = stackHelper.getSubtypes(input);
SmeltingRecipe recipe = new SmeltingRecipe(inputs, output);
Expand Down

0 comments on commit a2b5aea

Please sign in to comment.