-
Posts
105 -
Joined
-
Last visited
Everything posted by Socratic_Phoenix
-
Is there an event for when a player clicks a slot in an inventory? If not, how would I create a listener which does listen to this action, through game state or whatever?
-
Thanks so much for your help! It works perfectly! Now, should I create a separate thread with similar questions about furnaces (and tile entities and capabilities)? Or should I continue the discussion here? (Probably a new thread...)
-
K got it, it's coming along! Thanks for all the help so far
-
Slot takes an inventory... do I have to implement an IInventory for the crafting grid?
-
I don't (at least, not until I make the furnace), so should the crafting table just extend Block and override the onclick/interact/whatever method?
-
Okay, this should be fairly simple, but the research I've done so far hasn't been hugely helpful, and I see some things that say "always use this class" and then some tutorials implement other classes, so I'm not exactly sure what convention is here. I'm new-ish to forge modding as well, and this is my first project were I do anything more than generate a few ores (in this mod, I'll generate about 16 million of them). In short, I need to create a crafting table. Nothing fancy, in fact, it shouldn't be different than vanilla, other than gui name and block texture (and, of course, my custom recipes). I know that once I get the block actually in the world, with a gui and inventory, I can implement the recipe mechanic, so I'm going to focus on the first thing first. So, my question is, how do I crafting table? Does it need to be a TileEntity? If so, what kind? Just TileEntity? TileEntityLockable? How do I provide the container (or gui screen or whatever it is)? I have an empty gui hander, but that's about it. (Also, what is the difference between Container and GuiScreen, how do they relate?) How do I make the inventory work? How do I position the slots properly on the inventory when it's drawn (How does one even draw an inventory)? How do I change set the title of the inventory ("Crafting Table" is vanilla, I want "Craftinium Table"). How do I open this inventory when the block is clicked? How do I listen to the events from the inventory to check if the player has done recipe stuff? Exactly what classes do I actually have to extend? What. in. the. world. is. a. capability. (and how do I use it?) (Forge docs provided some context, but not much). I understand that a lot of these questions could be answered with tutorials, but so far, I haven't found a single tut using capabilities, despite those being explicitly suggested in many of the forum topics I found, so I'm not sure what a "proper" implementation would look like. There's also the fact that I have no idea where I should start... Thanks for any replies! (I am using 1.11.2, Forge build #2228) (For anyone who wants it, this is the github link to the package I'm putting all this code in, but at the moment there isn't anything for the table there yet...) (Also, thanks for all the help I've received from the community so far! Very helpful! (also, also, I'm a forge noob, not a java noob, use whatever java lingo you deem necessary, but don't mention the evil that is bytecode instrumentation (which, side note, is surprisingly not difficult)))
-
What happens if I don't register an item?
Socratic_Phoenix replied to Socratic_Phoenix's topic in Modder Support
No, I am registering the item, I just want to use minecraft's default items (itemhoe, itemaxe, etc.) to define it's behavior, but use different itemhoes depending on world seed... so cool, thanks -
Issue when loading Resource Pack textures
Socratic_Phoenix replied to TNT3530's topic in Modder Support
Take a look at this thread: My code is functional, but I register my blocks at the beginning of the game, so not sure if it'll help or not, but it is a possible solution (though, I only have textures working, not models or translations)... -
Basically, the title... but some context: I want to create an item which, depending on various stuffs (in this case, the world seed), delegates methods calls to different "backing" items. These backing items, would, of course, exist only to provide proper functionality to a registered item. So, my question is, does not registering an item detract from its functionality? Would calling any of its methods fail? (I don't care if it can't be obtained in the world, or exist in "the game," I just want it as an object to give me methods).
-
Just make sure it works no matter what IBlockAccess is passed in... the block generates custom drops depending on what world it's in (specifically, dependent on the seed), so if I can't get the seed it doesn't generate any drops... It should be fine though... mostly? I guess...
-
Okay, this is going to sound strange, but... my textures are too powerful... I decided to add some consistent blocks, alongside the dynamic ones... and... well... they're taking up the textures registered for the dynamic blocks. I have no idea why. I've tried setting the consistent ones to use one of the dynamic textures, set to they're texture, and I print out during loading what textures are loaded for what blocks, and it says it's loading the correct texture, but... it doesn't. I am 100% stumped. I don't understand how this is even possible! IT. MAKES. NO. SENSE. I JUST MUST BE GOING CRAZY. Texture code: https://github.com/SocraticPhoenix/Randores/tree/master/src/main/java/com/gmail/socraticphoenix/forge/randore/texture Item/Block registration: https://github.com/SocraticPhoenix/Randores/blob/master/src/main/java/com/gmail/socraticphoenix/forge/randore/RandoresRegister.java Texture Registration: https://github.com/SocraticPhoenix/Randores/blob/master/src/main/java/com/gmail/socraticphoenix/forge/randore/RandoresTextureListener.java Item Render Registration: https://github.com/SocraticPhoenix/Randores/blob/master/src/main/java/com/gmail/socraticphoenix/forge/randore/RandoresClientProxy.java#L110 Place where it logs that it's working, even though it's not: https://github.com/SocraticPhoenix/Randores/blob/master/src/main/java/com/gmail/socraticphoenix/forge/randore/texture/FlexibleAtlasSprite.java#L87 So... PLEASE HELP. (Also, more weird behavior: The custom block I'm registering always takes up the first dynamic block texture, but the custom item seems to randomly take up dynamic textures...)
-
Yeah, but if that IBlockAccess isn't a world (and it's like, ChunkCache) how would I get the seed?
-
BlockHelper still exists, it's just called BlockMatcher now... I generate ores like so: https://github.com/SocraticPhoenix/Randores/blob/master/src/main/java/com/gmail/socraticphoenix/forge/randore/RandoresWorldGenerator.java#L70, but you just have to pass in a BlockMatcher.forBlock() argument as the last one in WorldGenMinable...
- 1 reply
-
- 1
-
So this is a fairly simple question... is Block#getDrops ever called with the parameter IBlockAccess not an instanceof World, and if so when, and how can I obtain the world the block is in (or, more specifically, the world seed)?
-
Of course, silly me!
-
Thanks everyone! It's working now!
-
That makes sense (grumbles about it being possible to map fields to the constructor)... It does persist the fields though?
-
Yes I do... Ok thanks! Ok thanks! But.... why?
-
I'm working on a mod that needs to send a seed (don't worry!! not the world seed!) from the server (or server thread) to the client (or client thread). I followed the tutorial in the forge docs on networking, but my packet isn't being sent properly, or received properly or something. I register the channel like this: package com.gmail.socraticphoenix.forge.randore.packet; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; public class RandoreNetworking { public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel("randores"); } This is my packet: package com.gmail.socraticphoenix.forge.randore.packet; import io.netty.buffer.ByteBuf; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; public class RandorePacket implements IMessage { private long seed; public RandorePacket(long seed) { this.seed = seed; } public long getSeed() { return this.seed; } public void setSeed(long seed) { this.seed = seed; } @Override public void fromBytes(ByteBuf buf) { this.setSeed(buf.readLong()); } @Override public void toBytes(ByteBuf buf) { buf.writeLong(this.getSeed()); } } This is my handler: package com.gmail.socraticphoenix.forge.randore.packet; import com.gmail.socraticphoenix.forge.randore.Randores; import net.minecraft.client.Minecraft; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; public class RandorePacketHandler implements IMessageHandler<RandorePacket, IMessage> { @Override public IMessage onMessage(final RandorePacket message, MessageContext ctx) { Minecraft.getMinecraft().addScheduledTask(new Runnable() { @Override public void run() { Randores.getInstance().getLogger().info("Received seed information: " + message.getSeed()); } }); return null; } } I attempt to send the message like this: RandoreNetworking.INSTANCE.sendToAll(new RandorePacket(world.getSeed())); I have verified that this code is reached AND that it is called from the server thread. I am using the world seed for testing purposes. I register the message like this: RandoreNetworking.INSTANCE.registerMessage(RandorePacketHandler.class, RandorePacket.class, 0, Side.CLIENT); I register this in the constructor. Perhaps that's the problem? (I'll try in init and pre init as well). Thanks for any help!
-
I'd like to be able to do it programatically (for specific reasons, and yes it must be programatically)
-
I suppose this is a simple question, but it probably does not have a simple answer.... Is there a way to "animate" armor on while it is being worn by the player? Not make it move any differently, or rotate or anything, but just change the texture, like, make it flash colors by switching textures every second or so? I can iron out the details if I know how to change the texture, so is that possible?
-
Pretty simple question... Is there some way to force a player to "execute" F3+T (full texture reload) from code? Client side or server side would work...
-
Okay, I've come up with a system I want to use... Basically, I'm going to generate ~600 "flexible" blocks, register them all, and then change their properties and texture depending on the world. I'll do the same with items too, but first, blocks. So far, I've been unable to "link" the block to the texture. I generate all the sprites, and then register them with the TextureMap from Minecraft.getMinecraft().getTextureMapBlocks(). This is the code I'm using to register: @Override public void init() { super.init(); TextureMap map = Minecraft.getMinecraft().getTextureMapBlocks(); Logger logger = Randores.getInstance().getLogger(); logger.info("Generating FlexibleAtlasSprites..."); for (int i = 0; i < 600; i++) { FlexibleAtlasSprite sprite = new FlexibleAtlasSprite(Randores.textureName(i), "test"); TextureRegistry.register(sprite); map.setTextureEntry(sprite); } logger.info("Finished generating FlexibleAtlasSprites."); } Randores.textureName returns "randores.block." + i. TextureRegistry just holds a list of the textures for my future use.... I feel like I must be missing something, as the console displays the below error: [16:32:19] [Client thread/ERROR] [TEXTURE ERRORS]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= [16:32:19] [Client thread/ERROR] [TEXTURE ERRORS]: The following texture errors were found. [16:32:19] [Client thread/ERROR] [TEXTURE ERRORS]: ================================================== [16:32:19] [Client thread/ERROR] [TEXTURE ERRORS]: DOMAIN randores [16:32:19] [Client thread/ERROR] [TEXTURE ERRORS]: -------------------------------------------------- [16:32:19] [Client thread/ERROR] [TEXTURE ERRORS]: domain randores is missing 600 textures [16:32:19] [Client thread/ERROR] [TEXTURE ERRORS]: domain randores has 1 location: [16:32:19] [Client thread/ERROR] [TEXTURE ERRORS]: unknown resourcepack type net.minecraft.client.resources.LegacyV2Adapter : FMLFileResourcePack:Socratic_Phoenix's Randores [16:32:19] [Client thread/ERROR] [TEXTURE ERRORS]: ------------------------- [16:32:19] [Client thread/ERROR] [TEXTURE ERRORS]: The missing resources for domain randores are: [16:32:19] [Client thread/ERROR] [TEXTURE ERRORS]: textures/blocks/randores.block.91.png [16:32:19] [Client thread/ERROR] [TEXTURE ERRORS]: textures/blocks/randores.block.75.png [16:32:20] [Client thread/ERROR] [TEXTURE ERRORS]: textures/blocks/randores.block.56.png [16:32:20] [Client thread/ERROR] [TEXTURE ERRORS]: ------------------------- [16:32:20] [Client thread/ERROR] [TEXTURE ERRORS]: No other errors exist for domain randores [16:32:20] [Client thread/ERROR] [TEXTURE ERRORS]: ================================================== [16:32:20] [Client thread/ERROR] [TEXTURE ERRORS]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= (I cut out the other 567 texture error notes, but "The missing resources for domain randores are:" includes all 600 blocks. How do I make the blocks actually display the proper texture? Edit: I. FEEL. SUCCESSFUL. Okay, I got the texture atlas to link to the block and the item and I've got the models working and it's all pretty and stuff! I'm gonna do some testing with changing the textures on world load, but I do have one more question: How do I trigger a texture reload?
-
That's exactly what I'm doing Like this? https://github.com/SocraticPhoenix/Randores/blob/master/src/main/java/com/gmail/socraticphoenix/forge/randore/RandoreClientProxy.java#L35 Also, how feasible is having large numbers of textures? Like, how much memory/ram does each sprite take up? Could I predefine 100? 500? 1,000? Like, how? (I'll do some research myself too, but I've looked around A LOT and can't find anything. It's easy enough to change the texture of an item, like with compasses or clocks or whatever, but I also want to change the ToolMaterial, speed, and damage of axes/hoes/shovels/etc).