-
Posts
57 -
Joined
-
Last visited
Everything posted by EmeraldJelly
-
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
Ok. I managed to get it working using the debugger.. Sort of. But the one issue that I have is that it does not go through the entire recipe, and it does not let me use the recipe twice, I assume because it still thinks it has more stuff in it but idk. Say the recipe calls for WAX and a SNOWBALL. Once I throw in the Wax, it instantly thinks its a complete recipe and outputs the correct item. That is not what I am aiming for. Here is my code, really would appreciate one last consultation to tell me what is going wrong because I cannot figure that out. Cauldron Recpies TE Cauldron Recipe Block Class -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
ok but the problem isnt exactly that, its not adding the items it recognizes to my list. The crash only happened when I threw on the items, otherwise, it didnt crash or do anything. -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
I added a simple != null check, but again I think the problem is, it's not Capturing the items correctly, can you help me fix that, I believe its the only thing stopping this from working properly. -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
It Crashes my game...... -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
Oml.. I think that is it LOL Here ill send you my final code and you can tell me if there is anything I missed but I dont think so THANK YOU, YOU ARE A GOD XD!!! (Oh also I think my getCaptureEntities Method is flawed, what do I do there XD) TileEntity CauldronRecipes CauldronRecipe ICauldronRecipe -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
But I STILL do not know how to CALL THAT MATCHES METHOD IN THE CAULDRON RECPE CLASS. -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
and which one of your tile entities uses that? All im asking is what LINE of code do I use to get my TileEntity to send that information over to the recipe classes and in return get a true or false for match and the output item. Where do I put that. -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
uhh. can you like write an example of that please. Im sorry I keep bothering you. Last thing I promise. -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
This ALL makes sense to me now just 1 missing piece of the puzzle. How do I make the TE communicate with the Recipe class? Because it flat out wont let me call matches from the TE class. And I cannot extend more then 1 thing. -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
Uh there is no Furnace involved... And My current code is the one I posted above... MY PROBLEM IS AS FOLLOWS: I want to know how the HELL I can get check to see if the items picked up by the cauldron matches using the matches code FROM the TileEntity class. Inputting the list of items put in FROM the getCapturedItems method, and outputting and spawning in the world the correct output correlating to the recipe that it matches... I will describe the steps I want to take, please tell me how to take them. (ALL WITHIN THE TILEENTITY CLASS) Step 1: put dropped items into a list. Step 2: check to see if those items match any recipes. Step 3: grab that recipes output. Step 4: spawn the output into the world. Step 5: clear the list of dropped items. -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
I: that doesn't solve anything...... -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
ok then I wont, but that still doesn't answer my question. Considered it cloned and non final. But still. Here is everything I have. Rather then giving me bits and pieces in many different replies of small tiny things I got wrong, I kindly ask for you to tell me what and where I need to put specific things to get this all to work together nicely. Recipe List Class Recipe Class TileEntity Class -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
That does not answer my question.. The list is a public static final. Final's cannot be modified. -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
private ItemStack resultItem = ItemStack.EMPTY; List<ItemStack> items = new ArrayList<ItemStack>(); public CauldronRecipe(List<ItemStack> items, ItemStack output) { this.resultItem = output; this.items = items; } for (int i = 0; i < itemStacks.size(); i++) { ItemStack itemstack = itemStacks.get(i); if (itemstack != ItemStack.EMPTY) { boolean flag = false; for (ItemStack itemstack1 : this.items) { Like that? Where do I check for matching now, like when I throw the items in and get the list what class of mine (and how) do I check if it matches.. -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
Sigh... Im asking you I: Clearly I am too stupid to understand what you are telling me sooo.... Either that or my brain just isn't working recently. -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
Like That? Now how do I call these methods when something is being created... Like how do I test the dropped items from my TileEntitySorcerersCauldron class? -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
CauldronRecipe.java package emeraldjelly.mystica.util.recipe.recipetypes; ; import emeraldjelly.mystica.api.ICauldronRecipe; import emeraldjelly.mystica.init.ModItems; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class CauldronRecipe implements ICauldronRecipe { //What am Missing in this class? Where do i make all of this code happen? public CauldronRecipe(List<Item> items, ItemStack output) { } private ItemStack resultItem = ItemStack.EMPTY; public static final List<Item> EMPTYLACRAMA = new ArrayList<>(Arrays.asList(ModItems.VERTO_PULVERIS, ModItems.VERTO_PULVERIS, ModItems.VERTO_PULVERIS, ModItems.VERTO_PULVERIS, ModItems.VERTO_PULVERIS, ModItems.EMPTYLACRAMA)); // Output (Always the 5th Item) <-- = resultItem. @Override public boolean matches(List<ItemStack> itemStacks) { for (int i = 0; i < itemStacks.size(); i++) { ItemStack itemstack = itemStacks.get(i); if (itemstack != ItemStack.EMPTY) { boolean flag = false; for (ItemStack itemstack1 : itemStacks) { if (!itemstack.hasTagCompound() && itemstack.getItem() == itemstack1.getItem() && ( itemstack1.getMetadata() == OreDictionary.WILDCARD_VALUE || itemstack.getMetadata() == itemstack1.getMetadata())) { flag = true; if (i == 4) { resultItem = itemStacks.get(5); break; } itemStacks.remove(itemstack1); break; } } if (!flag) { return false; } } } return itemStacks.isEmpty(); } @Override public ItemStack getCraftingResult() { return resultItem; } } TileEntitySorcerersCauldron.java package emeraldjelly.mystica.blocks.tileentity; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EntitySelectors; import net.minecraft.util.ITickable; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; import net.minecraftforge.items.ItemStackHandler; import java.util.ArrayList; import java.util.List; public class TileEntitySorcerersCauldron extends TileEntity implements ITickable { //Do i need to Implement anything else? public static AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 1.2D, 1); static List<ItemStack> items = new ArrayList<>(); private int cooldown; private ItemStackHandler handler; public TileEntitySorcerersCauldron() { this.cooldown = 0; this.handler = new ItemStackHandler(5); } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { compound.setInteger("Cooldown", this.cooldown); compound.setTag("ItemStackHandler", this.handler.serializeNBT()); return super.writeToNBT(compound); } @Override public void readFromNBT(NBTTagCompound compound) { this.cooldown = compound.getInteger("Cooldown"); this.handler.deserializeNBT(compound.getCompoundTag("ItemStackHandler")); super.readFromNBT(compound); } @Override public void update() { this.cooldown++; this.cooldown %= 100; populateCauldronList(getCaptureItems(world)); } public List<EntityItem> getCaptureItems(World worldIn) { return worldIn.<EntityItem>getEntitiesWithinAABB(EntityItem.class, AABB, EntitySelectors.IS_ALIVE); } public void populateCauldronList(List<EntityItem> entityItems) { for (int i = 0; i < entityItems.size(); i++) { items.add(new ItemStack(entityItems.get(i).getItem().getItem())); } checkAndCraft(items); } public void checkAndCraft(List<ItemStack> itemsList) { //Anything here....?? } @Override public SPacketUpdateTileEntity getUpdatePacket() { NBTTagCompound nbt = new NBTTagCompound(); this.writeToNBT(nbt); int metadata = getBlockMetadata(); return new SPacketUpdateTileEntity(this.pos, metadata, nbt); } @Override public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) { this.readFromNBT(pkt.getNbtCompound()); } @Override public NBTTagCompound getUpdateTag() { NBTTagCompound nbt = new NBTTagCompound(); this.writeToNBT(nbt); return nbt; } @Override public void handleUpdateTag(NBTTagCompound tag) { this.readFromNBT(tag); } @Override public NBTTagCompound getTileData() { NBTTagCompound nbt = new NBTTagCompound(); this.writeToNBT(nbt); return nbt; } } ICauldronRecipe.java package emeraldjelly.mystica.api; import net.minecraft.item.ItemStack; import java.util.List; public interface ICauldronRecipe { /** * Used to check if a recipe matches current crafting inventory */ boolean matches(List<ItemStack> itemStacks); /** * Returns an Item that is the result of this recipe */ ItemStack getCraftingResult(); } // IS THERE ANYTHING ELSE REQUIRED IN HERE? Check out the comments I made around the classes, tell me if anything is missing and what I should fill in please. I THINK im close but im not really sure because everything I have tried has failed. -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
@Override public ItemStack getCraftingResult(InventoryCrafting inv) { return null; } What do I put there instead of InventoryCrafting inv? -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
ugh. how. do fix this... Please just help me fix this I've been stuck on this one stupid thing for too long. But if I understand how to do something like this, it will help understand a lot more. flat out do not know how the hell I can do that properly. What implements what, what extends what, how do I get the dropped items to be recognized because they flat out aren't being recognized... do I just have 1 class containing public static final List<ItemStack> recipes.. I know im being really annoying and you probably want to strangle me right now (I dont blame you) but can you just talk to me like im a baby for a second... (sorry for the damn attitude im just pissed off irl about something. can't help it.) -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
It Thinks that EVEN if there are NO ITEMS dropped anywhere near the block, it thinks that items match and constantly tries to do something. I tested this by putting down a print statement in the checkAndCraft() method. [21:13:40] [main/INFO] [STDOUT]: [emeraldjelly.mystica.blocks.tileentity.TileEntitySorcerersCauldron:checkAndCraft:71]: Did something? [21:13:40] [Server thread/INFO] [STDOUT]: [emeraldjelly.mystica.blocks.tileentity.TileEntitySorcerersCauldron:checkAndCraft:71]: Did something? -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
^^ Matches Method ^^ Recipe for snowball ^^ CauldronRecipe ^^ TileEntity Class How do I get the thing to know which one to output... Do I just throw that into the matches method or what..... -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
I looked at matches and I just dont see it. Now I may be a complete idiot but could you explain it to me -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
ShapelessRecipes.Java does that in a completely different way. A. basically half the class is talking about JSON (I Know I have the data, but still the comparison it draws in their methods do not match my goals at all.. it checks if its simple, looks at inventories and such. The matches method only does comparison based on inventories.) That is not what Im trying to achieve. lll break it down. I guess... 1. Drop item into cauldron. 2. Remove that item from world (despawn it). 2. Add item to a list. 3. Keep checking if that list matches some sort of static final recipe list. 4. Clear the list. 5. Spawn the output item in the world at player's position. Ultimately: I want to create a method that checks the items thrown with a LIST of all recipes, if the items thrown in matches any recipe, output the item that the recipe matches. I have tried to achieve that in my code but it crashes the game. Looking at Vanilla files doesn't help me that much because there is Nothing in vanilla Minecraft that does what I am doing. Sure, hoppers check for items, I copied that code, and it does not work. Shapeless recipes compare inventories and such to a json... I am not trying to do that. So what possibly can I do to make this work? -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
Don't they use JSON files?? Tell me where I can find an example in the code. But I would prefer if you can tell me what I did wrong in my code please. -
Create a Cauldron Thingy That Takes items and outputs results.
EmeraldJelly replied to EmeraldJelly's topic in Modder Support
I did that is where I got the getCapturedItems thing, but it stores it into an inventory. I do not want to do that, I just wanna compare it to a recipe ArrayList of itemstacks. What I did just crashes my game with THIS Console Error: A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace: at emeraldjelly.mystica.blocks.tileentity.TileEntitySorcerersCauldron.craft(TileEntitySorcerersCauldron.java:89) at emeraldjelly.mystica.blocks.tileentity.TileEntitySorcerersCauldron.checkWithCauldronRecipe(TileEntitySorcerersCauldron.java:80) at emeraldjelly.mystica.blocks.tileentity.TileEntitySorcerersCauldron.update(TileEntitySorcerersCauldron.java:53) -- Block entity being ticked -- Details: Name: myt:sorcerers_cauldron // emeraldjelly.mystica.blocks.tileentity.TileEntitySorcerersCauldron Block type: ID #259 (tile.sorcerers_cauldron // emeraldjelly.mystica.blocks.SorcerersCauldron) Block data value: 0 / 0x0 / 0b0000 Block location: World: (1352,237,207), Chunk: (at 8,14,15 in 84,12; contains blocks 1344,0,192 to 1359,255,207), Region: (2,0; contains chunks 64,0 to 95,31, blocks 1024,0,0 to 1535,255,511) Actual block type: ID #259 (tile.sorcerers_cauldron // emeraldjelly.mystica.blocks.SorcerersCauldron) Actual block data value: 0 / 0x0 / 0b0000 Stacktrace: at net.minecraft.world.World.updateEntities(World.java:2004) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:643) -- Affected level -- Details: Level name: TestFire World All players: 0 total; [] Chunk stats: ServerChunkCache: 625 Drop: 0 Level seed: -6876014066799134505 Level generator: ID 01 - flat, ver 0. Features enabled: false Level generator options: 3;minecraft:bedrock,230*minecraft:stone,5*minecraft:dirt,minecraft:grass;3;biome_1,decoration,stronghold,mineshaft,dungeon Level spawn location: World: (1276,4,173), Chunk: (at 12,0,13 in 79,10; contains blocks 1264,0,160 to 1279,255,175), Region: (2,0; contains chunks 64,0 to 95,31, blocks 1024,0,0 to 1535,255,511) Level time: 132657 game time, 51330 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 1 (now: false), thunder time: 1 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:840) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:741) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:590) at java.lang.Thread.run(Thread.java:748) -- System Details -- Details: Minecraft Version: 1.12.2 Operating System: Mac OS X (x86_64) version 10.13.3 Java Version: 1.8.0_151, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 717653568 bytes (684 MB) / 1008730112 bytes (962 MB) up to 1908932608 bytes (1820 MB) JVM Flags: 0 total; IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP 9.42 Powered by Forge 14.23.2.2640 5 mods loaded, 5 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored | State | ID | Version | Source | Signature | |:--------- |:--------- |:------------ |:-------------------------------- |:--------- | | UCHIJAAAA | minecraft | 1.12.2 | minecraft.jar | None | | UCHIJAAAA | mcp | 9.42 | minecraft.jar | None | | UCHIJAAAA | FML | 8.0.99.99 | forgeSrc-1.12.2-14.23.2.2640.jar | None | | UCHIJAAAA | forge | 14.23.2.2640 | forgeSrc-1.12.2-14.23.2.2640.jar | None | | UCHIJAAAA | myt | a0.1 | Mystica_main | None | Loaded coremods (and transformers): GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread. Profiler Position: N/A (disabled) Player Count: 0 / 8; [] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' [15:44:23] [main/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:629]: #@!@# Game crashed! Crash report saved to: #@!@# ./crash-reports/crash-2018-04-03_15.44.21-server.txt [15:44:23] [Client Shutdown Thread/INFO] [net.minecraft.server.MinecraftServer]: Stopping server [15:44:23] [Client Shutdown Thread/INFO] [net.minecraft.server.MinecraftServer]: Saving players [15:44:23] [Client Shutdown Thread/INFO] [net.minecraft.server.MinecraftServer]: Saving worlds AL lib: (EE) alc_cleanup: 1 device not closed