Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

BourgeoisArab

Members
  • Posts

    40
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

BourgeoisArab's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. This is good to know, but what I was after was recolouring the model dynamically, based on the ItemStack. Anyway, implementing a custom IBakedModel works great, even with OBJ models.
  2. With simple 2D item models, the texture can be coloured very easily with the getColorFromItemStack method, but this doesn't appear to be called, when a 3D model (json or obj) is used. Can the textures of those be recoloured in a similar fashion? Do I need to implement my own ISmartItemModel and IBakedModel for it?
  3. I'm definitely registering the models in preInit. It throws errors anywhere else. Am I correct in thinking the forge models use the still and flowing icons in the Fluid constructor for rendering? Or do I need to recheck any misspelling of names?
  4. I've also tried various Forge versions and it seems to be the case with everything I do. Does anyone have any ideas as to what the cause is?
  5. I'm not entirely sure what you mean by this: I'm going to assume you're talking about "specific Tiles" that you're adding. You may be interested in implementing IFluidHandler rather than IFluidTank, because the handler is what pipes connect to, and the handler methods include ForgeDirection arguments, so you know which side of the block is being drained from, so you can check the TileEntity on that side. If I understand the bit with BC wooden pipes correctly, you're worried that one could use a plasma-compatible pipe as an intermediate, which you don't want. To solve this, just add the same logic you'd have in the machine to your plasma-compatible pipes. Hope this helps.
  6. Try increasing the player's y velocity, instead of position. I believe that's how the potion effects works.
  7. There is a lot simpler way of rendering OBJ models. If you register your mod with OBJLoader.instance.addDomain, you can simply use your .obj files instead of defining vanilla json model files. With the forge blockstate json syntax and submodels, I think you can get the versatility you need.
  8. If you want to be teleported only as you right-click the block, you don't need a TileEntity. If you want the block to remember the coordinates, so that it teleports anything at any time AFTER the right-click, you do need a TileEntity. Just make your block class extend BlockContainer and create a TileEntity class for it, with a field for the stored coordinates. In the Block class (now BlockContainer), you're interested in the onBlockActivated method. That supplies you with the player, so you can get the ItemStack you're holding and get the NBT data from that, and it gives you World and BlockPos, so you can access your TileEntity via world.getTileEntity(blockpos) or whatever. And there you just change the TileEntity's stored coordinates. TileEntities don't store data purely in NBT. Because they have individual classes, they just use normal fields in them, and only use NBT when saving the world/chunk/whatever. Look at basic TileEntity tutorials for this. If you want any entity to be teleported whenever the block is touched, you want a method along the lines of onLanded, isEntityInsideMaterial, or onEntityCollidedWithBlock, depending on the conditions to teleport you want.
  9. There wasn't anything conspicuous in the log, that I could see, but here it is:
  10. I apologize in advance, because I know this is going to be something completely stupid. I've researched this and there are various threads on similar issues of fluid blocks not rendering properly, but I've tried those solutions and none seem to work. The fluid behaviour is all fine, in terms of bucket use, etc. It's just that the blocks don't render - they're invisible. Here is my code: Blockstate json file: Fluid class: BlockFluid class: Client-side model registration: (done in pre-init stage)
  11. So it is a byte. Does this mean there is no solution and I just have to make do with 128 slots?
  12. It is the first thing I call in the preInit method. I don't think expanding the array is an issue, because I checked it and it is at the right size that I set it to.
  13. I've been working on adding custom potion effects in my mod and to do so, have expanded the vanilla potion array to accomodate my potions thus: public static void expandPotionArray(int arraySize) { Potion[] potionTypes = null; boolean successful = false; for (Field f : Potion.class.getDeclaredFields()) { f.setAccessible(true); try { if (f.getName().equals("potionTypes") || f.getName().equals("field_76425_a")) { Field modfield = Field.class.getDeclaredField("modifiers"); modfield.setAccessible(true); modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL); potionTypes = (Potion[]) f.get(null); final Potion[] newPotionTypes = new Potion[arraySize]; System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length); f.set(null, newPotionTypes); successful = true; } } catch (Exception e) { System.err.println("BourgeoisArab made a serious boo-boo. Please report this ASAP:"); System.err.println(e); } } if (successful) { Log.info("Potion array was expanded to " + arraySize); } } This is all fine and dandy, but once an effect is added to an entity, with an ID with 128 or greater causes the game to crash. This happens regardless of what the array size is, beyond 128. With a potion ID of 150, the following error is shown: ---- Minecraft Crash Report ---- // I blame Dinnerbone. Time: 23.6.15 11:17 Description: Ticking entity java.lang.ArrayIndexOutOfBoundsException: -106 at net.minecraft.potion.PotionEffect.onUpdate(PotionEffect.java:124) at net.minecraft.entity.EntityLivingBase.updatePotionEffects(EntityLivingBase.java:588) at net.minecraft.entity.EntityLivingBase.onEntityUpdate(EntityLivingBase.java:336) at net.minecraft.entity.Entity.onUpdate(Entity.java:386) at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1766) at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:327) at net.minecraft.client.entity.EntityClientPlayerMP.onUpdate(EntityClientPlayerMP.java:96) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298) at net.minecraft.world.World.updateEntity(World.java:2258) at net.minecraft.world.World.updateEntities(World.java:2108) at net.minecraft.client.Minecraft.runTick(Minecraft.java:2097) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1039) at net.minecraft.client.Minecraft.run(Minecraft.java:962) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) It appears that at 128 and beyond, the IDs are shifted by 256, into the negatives. However from debugging, this shift only seems to happen client-side, while on the server, the ID is the correct one at 150. One might say that I don't need an array larger than 128, and that is true if only my mod is installed. But in a modpack with other mods installed, like Blood Magic, Biomes O Plenty, Witchery and Ars Magica, those 128 slots for potions suddenly become very tight. Any ideas what is causing this, or how to fix it? Update: I've tested this with even higher IDs, like 700, and they are still shifted into negatives. It appears that it is shifted by a multiple of 128, until it becomes smaller than 128. Could it be that the potion ID being sent as a byte, instead of an int?
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.