Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Draco18s

Members
  • Joined

  • Last visited

Everything posted by Draco18s

  1. This is real easy. I would create a new class with the following, but you can use your main class if you wish. 1) HashMap<ItemStack, ItemStack> 2) addRecipe method - takes two parameters: the input stack with size, the output stack 3) getResult method - takes one parameter: the current stack in the "crafting table" and returns the output if any 4) a way to check the input item stack against the ones registered including stack size, called from #3 If you look at FurnaceRecipes.java you'll see these types of methods.
  2. Why? Either way, this is what you're looking for: MainClass.class.getClassLoader().getResourceAsStream("some/location"); where "some/location" is a directory reference inside your jar file.
  3. This is how I did it: https://github.com/Draco18s/Artifacts/blob/master/main/java/com/draco18s/artifacts/components/ComponentLight.java Note that this class is analogous to the Item class. It has a different inheritance, due to how my mod works, but the functions are all called from an Item and do the same things (with a couple of convenience functions for certain other actions).
  4. That's true... So how do i do in this case??? (PS: Item of tool material is needed not for repairing, but for creation of new type of tool, if we can even call it a tool)... Not just tools, but armor as well. In any case, your best bet is to simply use the method vanilla provides, and then if a mod doesn't work properly with it, you file a bug report with that mod to properly use the function. Then if the material is not supposed to be repairable, if the user is using a texture pack that alters the colors or locations of pixels, or any other variety of strange things, you don't get weird results.
  5. You will need to write your own custom renderer. The armor layers are explicitly more pixels wide and float above the "skin" slightly.
  6. Show your code.
  7. Ha, love the url. Don't think I've noticed that before.
  8. If you have your own custom crop block, you do not need events. Events is how you affect other mod's blocks (and in some cases, vanilla blocks). If you have your own block all you have to do is override the function getDrops* and not call super() and then only add the items you want to add. *Double check which function creates the seed stacks in BlockCrops, that's the one you want.
  9. Where do you have this code? What's the context? What you're doing is entirely possible, but you can't just insert random code into random places and expect it to make sense.
  10. You could make a block that has Material.Water and renders like water for when the player is under water. For things like tall grass and reeds you can check the block just above the player (to see if it is air) and place there instead of directly where the player's head is. Also, it's a good idea to not update the light's position very often. In the mod I have that does this I only move the light source if the player is about 5 or more blocks away from the current light source (and store the coordinates of said lightsource in the item). That way the engine isn't getting hit with lighting updates every tick. As you're underwater you'll have to experiment with how much distance you'll allow between the player's current position and the lightsource's, but it'll likely be 2 blocks.
  11. If its already tessellating, then drop the "start" and "end" bits. Magic.
  12. Note: Some tool materials don't have a repair stack specified for a reason. I know that in my artifacts mod my armor items have a tool material that is used for the initiation of the item class, but it's not actually used in any meaningful way because 1) the durability data (etc) is all handled by nbt, including effective material 2) the repair item is based off that nbt data as well. Iron items are repaired using a special item crafted with an iron ingot to make the item actually used by the anvil. Other mods might do other things, such as materials that CANNOT be repaired.
  13. Just as a pre-emptive warning: These events do not fire in a consistent* way and these events are asynchronous, meaning that any data structures you use to track data will need to be thread-safe or you'll get concurrent modification errors. *By which I mean "use this for X and that for Y." There are two Save events fired when a chunk unloads, called from different points in the code. One of those points is after a chunk has been marked as unloaded and will see the chunk removed from memory. The other is simply a write-to-disk pass and the chunk may or may not be on its way to being unloaded. The best way I've found to handle clearing data from ram for when a chunk unloads is to use the Save event and check if(!chunk.isLoaded) Likewise, the Unload event doesn't give you access to the chunk NBT to save anything.
  14. You're in the wrong forum. This board is for people who make mods.
  15. Again, this is because that's not how the vanilla crafting table works. The vanilla crafting table assumes stack sizes of 1, so when the SIZE of the stack changes it doesn't bother updating matches(), because vanilla does not care about stack size.
  16. Noted. I wrote that code months ago and whatever reference I had did it that way and I never tried using the registerIcons method for it. Sigh. That check handles a portion of the code. In my case it makes it select an odd numbered item out of a list, rather than an even one. Learn 2 Java
  17. Ah, I have inadvertently mislead you. The object passed to that getIcon method, the IBlockAccess is not a World at all, but a ChunkCache. While a ChunkCache object has a World property, it is private. Instead, you will need to do something a little more clever. You will need to make a TextureAtlas class. There's a second reason too. The icon won't update just because it went from "night" to "day." You'd also have to tell the game to re-render the blocks. Fortunately a TextureAtlas can solve both of these problems. Here is a TextureAtlas I use. It does something very similar, but with a different time scale. It is up to you to rewrite this class for your needs. It's a simple class, really. package com.draco18s.wildlife.client; import com.draco18s.wildlife.WildlifeEventHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureUtil; @SideOnly(Side.CLIENT) public class TextureCalendar extends TextureAtlasSprite { public TextureCalendar(String par1Str) { super(par1Str); } public void updateAnimation() { if (!this.framesTextureData.isEmpty()) { Minecraft minecraft = Minecraft.getMinecraft(); int i = frameCounter; if (minecraft.theWorld != null && minecraft.thePlayer != null) { i = (int) ((minecraft.theWorld.getWorldTime() % WildlifeEventHandler.yearLength)/(WildlifeEventHandler.yearLength/4)); i*=2; if(minecraft.theWorld.provider.isHellWorld) { //Hell does not have day or night, you will want to do something else here. //Look at the TextureClock class in vanilla i++; } } if (i != this.frameCounter) { this.frameCounter = i; TextureUtil.uploadTextureMipmap((int[][])this.framesTextureData.get(this.frameCounter), this.width, this.height, this.originX, this.originY, false, false); } } } } You will also need to register an event handler: public class ClientEventHandler { @SubscribeEvent @SideOnly(Side.CLIENT) public void registerTextures(TextureStitchEvent.Pre event) { if(event.map.getTextureType() == 1 ) { //change these to point to your own variables and texture strings. The two strings should be identical. event.map.setTextureEntry("wildlife:season_calendar", ClientProxy.calendar = new TextureCalendar("wildlife:season_calendar")); } } } Finally, your getIcon and registerIcon methods: @SideOnly(Side.CLIENT) @Override public void registerIcons(IIconRegister iconReg) { itemIcon = ClientProxy.calendar; } @Override @SideOnly(Side.CLIENT) public IIcon getIconFromDamage(int par1) { return ClientProxy.calendar; }
  18. Save your lang file as UTF-8, not ascii.
  19. You put it where it needs to go. The question you need to ask yourself is: When do I want to do this?
  20. GL11.glDisable(GL11.GL_LIGHTING); inside your block class is going to do jack shit other than crash a dedicated server. To do what you want, you need to create a custom renderer class for your block.
  21. "Slowly and painfully" There might be a tool out there that will do it automatically, but you can do a find-replace-all in files and manually translate SRG names to MCP by looking them up in the mappings. Those are stored at: ~\.gradle\caches\minecraft\net\minecraftforge\forge\1.7.10-10.13.2.1291\unpacked\conf Where ~ is your user directory. In that folder will be two csv files: fields.csv and methods.csv
  22. Not really. Block and Item ID limits are still the same as ever. They are? Ok. One of those "it's 5am, I can't sleep, and digging around in the code requires moving and effort."
  23. getWorldTime() returns the total amount of time since the world's creation. There's a comment buried deep on the long that is returned which says that it is clamped 0-23999, but that's wrong. If you do a project-wide search for where that value is set and modified, you will find no such modulation.

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.