Jump to content

Codasylph

Members
  • Posts

    28
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Codasylph's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. OptiFine doesn't like two of my TESRs, as explained in this post: https://www.minecraftforge.net/forum/topic/71841-1122-optifine-causes-crash-when-rendering-obj-in-tesr/. Since I'm becoming increasingly dubious that there's a good answer for dealing with that issue I'd like to just change the way I render things if OptiFine is loaded. This presents an issue because apparently OptiFine isn't actually loaded by Forge so something like Loader.isModLoaded("OptiFine") doesn't tell me anything. So I ask, is there any reasonable way for my mod to tell whether OptiFine is loaded? And yes, It has already occurred to me that I can just have a config option asking the user if optifine is loaded (and I will be doing that if I can't do anything else), but seeing as if the user happens not to look at the configs and has optifine it will crash their world, i'd like a more aggressive solution.
  2. Well crap. There is one. It's called onInteractionForEntity. Welp, I need to go change some code..
  3. This is actually code in the Entity, not the Item. If you have a new custom animal that you want your custom item to be able to put into "breeding mode" you would override isBreedingItem in your entity's class. If you want a custom item to work on preexisting entities you would have to hook into the EntityInteract event.
  4. I have two TESRs in my mod where I use an IBakedModel to render a .obj. In both cases I do this because the model isn't static, in one case the .obj is several gears which rotate and in the other it is fluid which is only rendered when there is actually an item containing fluid in the TE. Apparently OptiFine does not like this, and when Minecraft attempts to render these with OptiFine installed it produces an IndexOutOfBoundsException and crashes. My question is, what can I do about this? My current plan is to put in some code that checks if OptiFine is loaded and do something else if it is (like rendering an item model instead of an .obj for the gears, and rendering a cube for the fluid, which won't be as pretty but also won't crash!) but I thought before using what I consider to be an imperfect solution I'd ask on here if there is just some other more OptiFine friendly way of rendering the a .obj in a TESR. For reference here is the crash report: https://paste.dimdev.org/isomagozof.cs and here is the code for one of the TESRs: https://paste.dimdev.org/fejagorose.java
  5. But.. but how? ? So, for anyone who stumbles across this thread in the future, I actually figured out how shortly after I made this post, proving that if i'd spent a few more minutes with google I would never have needed to post at all. If you use TextComponentTransation instead of TextComponentString it does the translating on the correct side. example: player.sendMessage(new TextComponentTranslation("text.altar_created.message")); No I18n or anything
  6. In my mod there are a number of times when a message is sent to the player's chat to say something like "Good job you did this thing, now you can do this other thing!" or "That didn't quite work, you should make sure all the blocks are in the right place." I want this messages to able to be changed via the mod's lang files so that someone playing the game in spanish gets a message in spanish, english gets english, etc. Currently I do this by calling something like this on the server side: player.sendMessage(new TextComponentString(DemConstants.ALTAR_CREATED)); and the variable ALTAR_CREATED is defined like this: public static final String ALTAR_CREATED = I18n.format("text.altar_created.message"); and the string "text.altar_created.message" is in my .lang file as whatever I actually want it to be. I currently only have a US English version, but I'm trying to plan ahead. This all works just dandy in single player mode, but when I attempt to run it on a dedicated server I get a NoClassDef error because I18n is client side only. To my knowledge EntityPlayer#SendMessage is *supposed* to be called on the server side. So, clearly what I'm doing is wrong. What should I be doing?
  7. Yeah. I can't think of one either, or I would have just looked at how they did it. The only thing I can think is that it used to be possible to render a TESR in inventory but that was back in 1.7.10 and I don't think its possible anymore. Also i didn't really want to make it a block or a tile entity for something that's actually an item.
  8. This question might be a bit easier to answer if we knew what kind of data you were trying to save, for what purpose. For example, are you trying to save data concerning a tile entity? item? or the player?
  9. I would recommend using nbt data rather than meta data. Meta data is just an integer value between 0 and 15 (inclusive), and obviously you could do all sorts of maths to that to get the burn times you want, but ultimately your item could only have 16 possible states (burn times). With an NBTTagCompound you just store what ever value like and name it say "burntime" when the itemstack is created by your machine. Now, for the function to determine the burn time of an individual container you will need to make an event handler and hook into FurnaceFuelBurnTimeEvent. This is fired when the furnace tries to determine the fuel value of an ItemStack and is where you want to look for the value you stored in nbt under the name "burntime." For the second half of your question, getting it not to remove the item its burning, I would look at how vanilla minecraft handles using buckets of lava as fuel.
  10. I have an item in my mod that can be associated with certain types of mobs and I'm wondering if there is a way to render the entity's model as part of the item. I know you can render an entity model as part of a TESR because that's what the vanilla enchanting table does, but I don't believe the book (which is the model part) is rendered for the ItemBlock, and anyway I would prefer an actual item and not some sort of weird hack, but i'm open to suggestions. I would prefer to use the entity's model in some way because I would like it to work with entities from other mods if they extend EntityAnimal.
  11. Thank you! I actually was returning SUCCESS every time the item "did something", but apparently only on the server side. -_-;
  12. I have a multi purpose tool in my mod (i.e. it does different things depending on whether you click in the air with it, or on a block, what kind of block, etc.) I'm wondering if there is any simple, reasonable way to prevent my code in Item#onItemRightClick from firing if Item#onItemUse already has. I know from testing that onItemUse fires first, and doesn't fire if the user is clicking on air as opposed to a block (which nixes my brilliant plan of putting all the functionality in onItemUse.) I'm mostly just trying to prevent chat spam for the user because onItemRightClick sends a chat message to the client with information about the surroundings, and I think this will become irritating if the user is trying to use the tool to do something like adjust settings on one of my blocks which may involve a lot of clicking.
  13. The Default baked format thing fixed it. As for the translating back thing, literally just because i've gotten this idea in my head that when you do openGL things you have to undo them. There's no actual good reason. Thanks again for the help!
  14. Ok, one more little thing. I don't crash anymore, and it renders the obj properly. But it renders very very dark, almost black. I can tell its actually rendering the texture, just super dark. I've tried using the RenderHelper#enableStandardItemLighting and a few other lighting things within GlStateManager but nothing seems to make the slightest difference. I saw one other post with a similar issue here, but it had no replies. For reference here is my updated code just for rendering the obj (since I wasn't actually binding a texture or anything in the previously posted code): private void renderReagent(CauldronTile te, float red, float green, float blue) { GlStateManager.pushMatrix(); bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); // GlStateManager.enableBlend(); // GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // GlStateManager.color(red, green, blue, .2f); GlStateManager.enableLight(1); GlStateManager.translate(-te.getPos().getX(), -te.getPos().getY()+1.0F, -te.getPos().getZ()+1.0F); Tessellator tessellator = Tessellator.getInstance(); tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModel( getWorld(), getBakedModel(), getWorld().getBlockState(te.getPos()), te.getPos(), Tessellator.getInstance().getBuffer(), true); tessellator.draw(); // GlStateManager.disableBlend(); GlStateManager.translate(te.getPos().getX(), te.getPos().getY(), te.getPos().getZ()); GlStateManager.popMatrix(); }
×
×
  • Create New...

Important Information

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