Everything posted by 61352151511
-
[1.7.10] Passing NBT Data through a recipe?
I have copied it, as I said it adds the food points just fine, however for some reason it affects both the crafting result, and the lunchbox in the crafting grid. Here's the main part of the code. ItemStack lunchbox = null; for (int j = 0; j < craftingwindow.getSizeInventory(); j++) { if (craftingwindow.getStackInSlot(j) != null) { if (craftingwindow.getStackInSlot(j).getItem() == ModItems.Lunchbox) { lunchbox = craftingwindow.getStackInSlot(j); } } } if (lunchbox != null) { float FoodStored = 0F; if (lunchbox.getTagCompound() == null) { lunchbox.setTagCompound(new NBTTagCompound()); } try { FoodStored = lunchbox.getTagCompound().getFloat("Food_Stored"); } catch (NullPointerException e) { FoodStored = 0F; } float FoodPointsToAdd = 0F; boolean NonFood = false; for (int j = 0; j < craftingwindow.getSizeInventory(); j++) { if (craftingwindow.getStackInSlot(j) != null) { ItemStack StackInSlot = craftingwindow.getStackInSlot(j); if (StackInSlot.getItem() instanceof ItemFood) { ItemFood AFood = (ItemFood) StackInSlot.getItem(); FoodPointsToAdd = FoodPointsToAdd + AFood.func_150905_g(StackInSlot); } else { if (StackInSlot.getItem() != ModItems.Lunchbox) { NonFood = true; } } } } if (FoodStored + FoodPointsToAdd <= 100F && NonFood == false) { // 100F = Maximum Storage ItemStack res = new ItemStack(ModItems.Lunchbox, 1, lunchbox.getItemDamage()); res.setTagCompound(lunchbox.getTagCompound()); res.getTagCompound().setFloat("Food_Stored", FoodStored + FoodPointsToAdd); return res; } First it goes through all the slots of the crafting grid and sets the ItemStack "lunchbox" to the one in the slot Then if lunchbox isn't null it attempts to set the FoodStored variable to whatever the NBT Data of the lunchbox is (Succeeds) Then it goes through all slots, if the item in the current slot is a food it adds to a "FoodToAddVariable" Finally if the current food stored and the foodpoundstoadd variable are less than 100 it - Creates a new itemstack with the same item damage as the lunchbox used - sets the tag compound of that to the lunchbox's tag compound - sets the float of it to the correct number - returns the res ItemStack However the part I'm really confused about is why it affects the lunchbox in the crafting grid. If you don't understand what I'm saying I'll try to explain it better Nevermind, doing lunchbox.copy() then setting the NBT worked, which is weird because that's not how I did it for the heart canister's and they worked fine.
-
[1.7.10] Passing NBT Data through a recipe?
Ok that works, two things however. First the log says this when launching [08:29:54] [Client thread/INFO] [FML]: Unknown recipe class! com.sixonethree.snapshot.recipes.RecipesHeartStorageUpgrading Modder please refer to net.minecraftforge.oredict.RecipeSorter Again the recipes work fine I'm just not sure if this will cause issues in the future or not. Second I attempted to make a lunchbox like my heart canister, placing it in a crafting grid with any food is supposed to make the crafting result have the same food level of the lunchbox plus the food level of the food item you put in. This kinda works, as well as the crafting result having the correct NBT Data the lunchbox you put in the crafting grid gets changed. So if I put in a lunchbox with 0/100 food stored and a carrot, the crafting result will say 4/100 food stored, but the lunchbox you're crafting with will get changed as well causing it to have 4/100 food stored and not actually having to use up the carrot. Here's the crafting code. package com.sixonethree.snapshot.recipes; import com.sixonethree.snapshot.init.ModItems; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; public class RecipesLunchboxFeeding implements IRecipe { @Override public boolean matches(InventoryCrafting craftingwindow, World world) { int NumberOfLunchboxes = 0; for (int j = 0; j < craftingwindow.getSizeInventory(); j++) { if (craftingwindow.getStackInSlot(j) != null) { if (craftingwindow.getStackInSlot(j).getItem() == ModItems.Lunchbox) { NumberOfLunchboxes++; } } } if (NumberOfLunchboxes == 1) { ItemStack lunchbox = null; for (int j = 0; j < craftingwindow.getSizeInventory(); j++) { if (craftingwindow.getStackInSlot(j) != null) { if (craftingwindow.getStackInSlot(j).getItem() == ModItems.Lunchbox) { lunchbox = craftingwindow.getStackInSlot(j); } } } if (lunchbox != null) { float FoodStored = 0F; if (lunchbox.getTagCompound() == null) { lunchbox.setTagCompound(new NBTTagCompound()); } try { FoodStored = lunchbox.getTagCompound().getFloat("Food_Stored"); } catch (NullPointerException e) { FoodStored = 0F; } float FoodPointsToAdd = 0F; boolean NonFood = false; for (int j = 0; j < craftingwindow.getSizeInventory(); j++) { if (craftingwindow.getStackInSlot(j) != null) { ItemStack StackInSlot = craftingwindow.getStackInSlot(j); if (StackInSlot.getItem() instanceof ItemFood) { ItemFood AFood = (ItemFood) StackInSlot.getItem(); FoodPointsToAdd = FoodPointsToAdd + AFood.func_150905_g(StackInSlot); } else { if (StackInSlot.getItem() != ModItems.Lunchbox) { NonFood = true; } } } } if (FoodStored + FoodPointsToAdd <= 100F && NonFood == false) { // 100F = Maximum Storage return true; } } } return false; } @Override public ItemStack getCraftingResult(InventoryCrafting craftingwindow) { int NumberOfLunchboxes = 0; for (int j = 0; j < craftingwindow.getSizeInventory(); j++) { if (craftingwindow.getStackInSlot(j) != null) { if (craftingwindow.getStackInSlot(j).getItem() == ModItems.Lunchbox) { NumberOfLunchboxes++; } } } if (NumberOfLunchboxes == 1) { ItemStack lunchbox = null; for (int j = 0; j < craftingwindow.getSizeInventory(); j++) { if (craftingwindow.getStackInSlot(j) != null) { if (craftingwindow.getStackInSlot(j).getItem() == ModItems.Lunchbox) { lunchbox = craftingwindow.getStackInSlot(j); } } } if (lunchbox != null) { float FoodStored = 0F; if (lunchbox.getTagCompound() == null) { lunchbox.setTagCompound(new NBTTagCompound()); } try { FoodStored = lunchbox.getTagCompound().getFloat("Food_Stored"); } catch (NullPointerException e) { FoodStored = 0F; } float FoodPointsToAdd = 0F; boolean NonFood = false; for (int j = 0; j < craftingwindow.getSizeInventory(); j++) { if (craftingwindow.getStackInSlot(j) != null) { ItemStack StackInSlot = craftingwindow.getStackInSlot(j); if (StackInSlot.getItem() instanceof ItemFood) { ItemFood AFood = (ItemFood) StackInSlot.getItem(); FoodPointsToAdd = FoodPointsToAdd + AFood.func_150905_g(StackInSlot); } else { if (StackInSlot.getItem() != ModItems.Lunchbox) { NonFood = true; } } } } if (FoodStored + FoodPointsToAdd <= 100F && NonFood == false) { // 100F = Maximum Storage ItemStack res = new ItemStack(ModItems.Lunchbox, 1, lunchbox.getItemDamage()); res.setTagCompound(lunchbox.getTagCompound()); res.getTagCompound().setFloat("Food_Stored", FoodStored + FoodPointsToAdd); return res; } } } return null; } @Override public int getRecipeSize() { return 9; } @Override public ItemStack getRecipeOutput() { return null; } }
-
[1.7.10] Passing NBT Data through a recipe?
I tried searching and couldn't find the answer anywhere, sorry if this has been answered before. Basically I've created this heart canister that stores health for later, right clicking takes health away leaving you at one heart, shift right clicking gives you the health back, the amount of health the canister has is stored via NBT Data. I've created a second kind of canister, an upgraded one that automatically fills/drains the canister based on how much health you have, having less than 9 hearts will take health from the canister and fill you back to 9 hearts, having more than 9 hearts will take whatever you have over 9, put it in the canister, and leave you at 9 hearts. I want to make it so combining a normal heart canister with a nether star and a bucket will create an auto drain/fill canister, However the part I'm wondering is about saving the hearts in the canister, say the canister has 50 hearts stored in it, if I were to put it in a crafting table with the nether star and bucket I'd want the upgraded one to have 50 hearts as well. So anyone know how I can detect the NBT Data of the item in the crafting table?
-
[1.7.10] Can't launch after updating to java 8
I did uninstall it, reason being is because you don't need multiple versions of java installed at once. I updated because I like being as up to date with stuff on my computer as possible and launching from the minecraft launcher itself works just fine and I can play minecraft but when I try launching from eclipse with the GradleStart thing it doesn't work so I think it's a forge issue
-
[1.7.10] Can't launch after updating to java 8
I updated both my JRE and JDK to java 8 update 20 this morning, first time updating to java 8. I made sure eclipse switched from using JRE7 to JRE8 and I changed my system variables etc. When trying to launch any of the mods I'm making for testing I get this error. [11:55:50] [main/INFO] [GradleStart]: userProperties: {} [11:55:50] [main/INFO] [GradleStart]: assetsDir: C:\Users\Mitch\.gradle\caches\minecraft\assets [11:55:50] [main/INFO] [GradleStart]: assetIndex: 1.7.10 [11:55:50] [main/INFO] [GradleStart]: accessToken: test [11:55:50] [main/INFO] [GradleStart]: version: 1.6 [11:55:50] [main/INFO] [GradleStart]: tweakClass: cpw.mods.fml.common.launcher.FMLTweaker [11:55:50] [main/INFO] [GradleStart]: username: {HIDDEN} [11:55:50] [main/INFO] [GradleStart]: Extra: [] [11:55:50] [main/INFO] [GradleStart]: Password found, attempting login [11:55:50] [main/INFO]: Logging in with username & password [11:55:51] [main/INFO] [GradleStart]: Login Succesful! [11:55:51] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:\Users\Mitch\.gradle\caches\minecraft\assets, --assetIndex, 1.7.10, --accessToken, {REDACTED}, --version, 1.6, --uuid, 91659ea234d4484eaa84ef43b9e19bdb, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --username, 61352151511] [11:55:51] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker [11:55:51] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker [11:55:51] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker [11:55:51] [main/INFO] [FML]: Forge Mod Loader version 7.10.25.1199 for Minecraft 1.7.10 loading [11:55:51] [main/INFO] [FML]: Java is Java HotSpot 64-Bit Server VM, version 1.8.0_20-ea, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre1.8.0_20 [11:55:51] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [11:55:51] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [11:55:51] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker [11:55:51] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [11:55:51] [main/ERROR] [LaunchWrapper]: Unable to launch java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(Unknown Source) ~[?:1.8.0_20-ea] at java.util.ArrayList$Itr.remove(Unknown Source) ~[?:1.8.0_20-ea] at net.minecraft.launchwrapper.Launch.launch(Launch.java:117) [launchwrapper-1.9.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_20-ea] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_20-ea] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_20-ea] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_20-ea] at GradleStart.bounce(GradleStart.java:107) [start/:?] at GradleStart.startClient(GradleStart.java:100) [start/:?] at GradleStart.main(GradleStart.java:65) [start/:?] Any help would be appreciated
-
Modifying tooltips not working server sided
I'm trying to make it so tools you look at always show the durability when you mouse over them, (You don't need F3+H/Advanced tooltips to see them in this case) This is working fine client sided however when it comes to the server it doesn't work at all. Here are the 3 Proxies I have Common Proxy: package com.sixonethree.home.proxy; import com.sixonethree.home.utility.WarpPoint; public abstract class CommonProxy { public void init() { WarpPoint.loadAll(); } public void exit() { WarpPoint.saveAll(); } } ServerProxy: package com.sixonethree.home.proxy; public class ServerProxy extends CommonProxy { } ClientProxy: package com.sixonethree.home.proxy; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class ClientProxy extends CommonProxy { @Override public void init() { super.init(); MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void onItemTooltip(ItemTooltipEvent event) { if (!event.showAdvancedItemTooltips) { if (event.itemStack != null) { ItemStack is = event.itemStack; if (is.isItemDamaged()) { event.toolTip.add(EnumChatFormatting.GRAY + "Durability: " + (is.getMaxDamage() - is.getItemDamage() + " / " + is.getMaxDamage())); } } } } } I've got no idea why it doesn't work when it comes to the server side, any help is appreciated
-
[1.7.10] Nether Portals generating when teleporting players across dimensions?
I've been working on a home command for my server that will allow people to set homes anywhere and teleport to them whenever, there's one problem that occurs when you try teleporting cross dimensionally, I was testing in eclipse and it seems that nether portals generate where the player is when I use .travelToDimension Here's what I have in my home command if (WarpPoint.getHome(player.getUniqueID() + RequestedHome) != null) { Location loc = WarpPoint.getHome(player.getUniqueID() + RequestedHome).location; LastLocations.Set((EntityPlayerMP) player, new Location((EntityPlayerMP) player)); if (loc.dimension != player.dimension) { MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP) player, loc.dimension); } player.setPositionAndUpdate(loc.posX, loc.posY, loc.posZ); } else { player.addChatMessage(new ChatComponentText("You do not have a home called " + RequestedHome + ".")); return; } I'm wondering if anyone knows why nether portals generate when using transferPlayerToDimension, if it's just been a problem for me or if others have had it?
IPS spam blocked by CleanTalk.