Skip 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.

V0idWa1k3r

Members
  • Joined

  • Last visited

Everything posted by V0idWa1k3r

  1. I'll repeat myself: 1. Override Item::getArmorTexture in your armor class and make it do the following: Check for a boolean value stored in the NBT of the ItemStack passed to the method as an argument. If it is true: return a texture that is completely transparent If it is false: return your normal armor texture. 2. In your wraithBell's onItemRightClick class modify that boolean value of armor's NBT if your conditions are correct.
  2. Well, here is the cause of your NPE. The mc field is null as you've never assigned anything to it. Minecraft is a client-side only class. Using it like that will crash the server. Why on earth are you even using it to get the player when you have the player passed to you as an argument? Items are singletons. This means that changing this field will affect all items that are an instance of wraithBell. ItemStack is what you need to work with if you want to have some data that is unique to a specific... welll ItemStack. Please refrain from using logging to debug. The debugger and breakpoints exist for a reason. -> MobEffects.INVISIBILITY. Now all that out of the way: I assume you want the armor to become invisible with the player as they use your bell item, correct? Item::getArmorTexture has the ItemSteack of the armor as it's parameter - you can check for, say, a specific boolean being set to true in that stack's NBT and return a texture that is completely transparent.
  3. Have your own counter field in your entity class and increment it each tick, then reset when needed. Move this field to your entity class, then access it from your model when needed. This is a basic OOP concept. As I've said models are singletons. Any change made to the model will affect rendering of all your entities which use that model.
  4. Depends. The blockstates file fully controls the rendering of your model - you can apply your transformations there and they will be applied in the game just as any other item. I don't think that you can change the way a block renders in the world with blockstates. Maybe forge's animation system is capable of that - but I am no expert on it.
  5. A mtl file is more than a texture pointer. It contains a "library" of materials(defines different materials for different model parts) and controls all properties of that material. While it is possible to use obj without mtl it is still required by forge to do model setups and baking. So no, you still need an mtl file. I have mine here.
  6. Yes it is possible. You can define a texture for your material through a blockstates file just like you'd define a texture for a normal json model. I have an example of that here.
  7. Block13.rotateAngleX = Math.toRadians((float)entityIn.ticksExisted / 2); Additionally models are singletons. If you change a value of a fieldin your model it will apply to all your entities. I am talking about this:
  8. Please remove the formatting of the text in the post(when you paste the text in there is a "remove formatting" popup) or do not color it. Your post is impossible to read on the dark theme. 1. This is correct. If you really want you can register your particle with ParticleManager::registerParticle. You can add your own enum constant to EnumParticleTypes with EnumHelper but that is not necessary. 2. Your way is correct. To get an instance of a particle you either instantinate them, or get their IParticleFactory(if it is present) and invoke it's createParticle method. 3. That is the only particle registry. If a mod doesn't register their particle there - you can't. At that point the best you can do is reflection. A Particle is not a IForgeRegistryEntry - there are no registries for them. 4. Please clarify this point a bit more. A TextureMap is not your regular texture - if a sprite is not registered onto it it won't be there - TextureMap does not support dynamically adding textures to it. If you want to add your own texture to it you need to use TextureStitchEvent.Pre and TextureMap::registerSprite. The later returns you a TextureAtlasSprite object.
  9. You can calculate your rotation angles using any other variable. For example the amount of ticks your entity has existed for.
  10. Why are you using 1.8.9? Update, that version is nearly 3 years old. Please clarify You need to build your mod using gradle(gradlew build) to create a distributable jar file, you can't export(I assume you mean Eclipse's export feature) it. In the future please consider using online services such as gist or pastebin to host your code snippets, or at least use the Code(<>) BB tag.
  11. Afaik forge provides no built-in .obj support(apart from block/item models) so you have to write your own obj parser and renderer. Wikipedia will help you with parsing an obj file, it's not that complex, and rendering is also pretty straight-forward, depending on how exactly you are handling the model. I also have a very inefficient yet simple example of a custom obj parser here.
  12. EntityPlayer::isCreative EntityPlayer::isSpectator Or if you want to be more thorough: PlayerInteractionManager::getGameType
  13. Erm... You store it in a field and get it from that field? You do know what fields are, yes?
  14. No. registerSprite already returns you the TextureAtlasSprite object you need, there is no need to get it again.
  15. That TextureAtlasSprite object that you recieve as a result of this method. There is no regular stitch event. TextureStitchEvent has 2 sub-events - pre(as the map is being setup) and post(after everything was loaded in).
  16. TextureMap::registerSprite returns you a TextureAtlasSprite object. This method must be called during TextureStitchEvent.Pre
  17. partialTicks is the amount of a single tick that had passed. Using it depends on the way your animation is done. For example if you have a wheel a rotation of which equals to the amount of ticks the GUI is open you would get it's rotation angledeg like this: ticksExisted + partialTicks. You don't need to store a previousTick in this case as previousTick always equals currentTick - 1.
  18. TextureAtlasSprite has nothing to do with particles. It is simply a 'pointer' to a location of a specific image on a texture sheet(or if we disassemble the name - it is a sprite of a texture atlas(aka map)). Forge just allows custom loading of your sprites with those methods. By default there is only 1 texture map in the game - the blocks+items textures map. Particles have that field avaliable mostly for block/item crack/break particles, as they need to know what texture to be rendered with. This field is null for other particle types and theirt textureIndex determines their location on their texture map(default vanilla particles.png file). If you need a custom texture for your particles you can return 1 in your Particle::getFXLayer to use the blocks+items map as your texture and then call Particle::setParticleTexture with a TextureAtlasSprite object that would point to your custom texture on the blocks map. You will need to load that texture yourself using TextureStitchEvent and TextureMap::registerSprite.
  19. As @Earthcomputer said GuiScreen::updateScreen gets called each tick so operate on your timer there. You still have to render each frame obviously.
  20. See how BlockFurnace does this. Custom particles are a thing that is not easily done afaik. You either need to add an enum constant to the EnumParticleType using EnumHelper and register your particle factory for the particleID you specify in your enum constant or you need to build your own particle system from the ground.
  21. Could you please elaborate on that? You can't render anything as a tick happens as rending must happen each frame due to buffers being cleared. A tick is a semi-constant 1/20th of a second. A frame is any numerical value depending on a magnitude of factors.
  22. For one your renderer does absolutely nothing. As you are extending Render and not any of it's child classes you must manualy render the model of your choice in there. It most likely will be the ModelBrianade I see a commented out reference to. Rendering registration must be done in a client-only class like your proxy. Your current implementation will crash the server. No, your SideOnly here will not save you. It in fact will be the cause of your crash. Why is the override commented out? If your IDE/compiler throws an error you can't just comment out the Override and pretend that it never happened. This is the purpose of the override - to throw an error if the thing you are overriding can't be overriden for one reason or another. You are doing something weird with types. If your renderer renders an EntityBrianade just use the EntityBrianade as it's type, not <T extends EntityBrianade>
  23. As this is a TESR simply translate by x,y and z given to you in the method parameters, they are your position in view-space anyway, you don't need to translate by negative position of your TE in the world. I'll test it a bit more right now and tell you if everything is indeed correct. EDIT: Okay, this took a bit longer than I expected. The problem lies in the way BlockModelRenderer applies transformations relative to the position you give to it, so you have to offset by negative position of your TE to account for that but then you can't rotate properly because the translations are messed up relative to view-space. This took a bit of time to figure. I managed to make it work via a simple "hack" of separating my translations into 2 passes: First I translate by viewspace xyz(the arguments passed) Then I rotate Then I translate again by negative position of my TE to account for BlockModelRenderer's translations. And then it works. Mostly. Here is the code I came up with: BlockPos blockpos = te.getPos(); IBlockState iblockstate = Blocks.STONE.getDefaultState(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); GlStateManager.translate(x, y, z); GlStateManager.rotate(45, 1, 0 , 0); GlStateManager.translate(-blockpos.getX(), -blockpos.getY(), -blockpos.getZ()); blockrendererdispatcher.getBlockModelRenderer().renderModel(te.getWorld(), blockrendererdispatcher.getModelForState(iblockstate), iblockstate, blockpos, bufferbuilder, false, MathHelper.getPositionRandom(te.getPos())); tessellator.draw(); GlStateManager.enableLighting(); GlStateManager.popMatrix();
  24. Translate to your xyz first, then rotate.
  25. You only call proxy.registerRenderers, but not proxy.preInit as @Animefan8888 said. And don't use unlocalized names for model registering, use Block::getRegistryName.

Important Information

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

Account

Navigation

Search

Search

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.