Jump to content

BourgeoisArab

Members
  • Posts

    40
  • Joined

  • Last visited

Everything posted by BourgeoisArab

  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?
  14. Can you elaborate on this? How does one blend with a white image?
  15. I did think of that at first, but I'd like to use vanilla textures, wherever possible, mainly due to texturepack support. These rendering and shader tricks you speak of is what I'm after here.
  16. I have a method drawing a square with an animated water texture and I've been trying to change the colour of it with the method: Tessellator.instance.setColorOpaque(r, g, b); This works, however it simply takes away the colors from the original texture, so it comes out very dark. Is there a way to increase the brightness/lightness of the texture so it doesn't look awful? Or a different way of recolouring the texture? EDIT: I tried making use of the Tessellator.instance.setBrightness() method, but it doesn't appear to do anything. Am I just using it wrong?
  17. Thank you. With the PlayerRespawnEvent it works. But why doesn't the PlayerEvent.Clone work, just out of interest?
  18. I've been trying to make a player respawn with a certain potion effect active, using the Forge PlayerEvent.Clone event. However this is only called on the server-side, so when my potion effect is added, the effect takes place, but it doesn't show in the inventory on client-side. I've tried to resolve this by sending a message (implementing IMessage) to the client, on which this method is called: Minecraft.getMinecraft().thePlayer.addPotionEffect(new PotionEffect(3, 9000, 0)); However, for whatever reason this does not work. It doesn't make any difference to the outcome. What I'm really asking is more of a general question, not necessarily limited to the player respawn event. How does one let the client know that a potion effect has been applied, when it was applied only on the server side, for whatever reason? Must one use some sort of vanilla packet, or am I missing something stupidly obvious? Any help is much appreciated.
  19. Is there any way to render a 3D model (ideally Techne or .obj files) for a block without a tile entity, because as far as I know the TESR is for tile entities? I looked at the ISimpleBlockRenderingHandler, but it doesn't appear to do models.
  20. I've been trying to look up something on packet handling, but all of it seems outdated and has big messages saying "DO NOT USE THIS IN NEW CODE!!!" I was wondering if any of you could give me some up-to-date info on this, as what I've found is very confusing. How does one use this packet system? What can't be done without packets? Must one use this? How does one create a basic/advanced packet hanlder? Any help is greatly appreciated.
  21. I was thinking of creating a TileEntity based on a block's metadata, but was too stupid to notice the metadata value is supplied. Don't mind me! Idiot here...
  22. It was more of a general question. I've just been thinking about stuff and I wondered if it was possible. So the bottom line is, it's impossible.
×
×
  • Create New...

Important Information

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