Jump to content

Tschipp

Forge Modder
  • Posts

    307
  • Joined

  • Last visited

Everything posted by Tschipp

  1. I'm trying to render a static entity on the screen when the player is in first person. The RenderManager#renderEntityStatic method that I'm using seems to apply some sort of lighting to the model, but it actually applies it to the rest of screen, but not to the model. Some images will help: Note how it colores the hotbar and text darker (and the rest of the screen) At day (with light) As you can see, it doesn't seem to change the brightness of the chicken at all in both pictures. I'm using this code during RenderHandEvent: GlStateManager.pushMatrix(); GlStateManager.scale(1, 1, 1); GlStateManager.rotate(180, 0, 1, 0); GlStateManager.translate(0.0, -height, width + 0.1); GlStateManager.enableAlpha(); if (perspective == 0) { Minecraft.getMinecraft().getRenderManager().setRenderShadow(false); Minecraft.getMinecraft().getRenderManager().renderEntityStatic(entity, 0.0f, false); Minecraft.getMinecraft().getRenderManager().setRenderShadow(true); } GlStateManager.disableAlpha(); GlStateManager.scale(1, 1, 1); GlStateManager.popMatrix();
  2. Update: So what we tried to do was getting the RenderPlayer, then the model and then setting the visibilty of the left and right arm to false. Then we rendered our own arm with the set rotation. This does work, the problem is just that it hides the arm for all players, even those that don't carry the item. It seems like there's only at once two instances of RenderPlayer? One for default and one for slim? Is it not possible to get an instance of the model specific to that player?
  3. I'm trying to change the player's arm rotation during RenderPlayerEvent.Pre. It's doing absolutely nothing, as far as I can tell. What am I missing? @SideOnly(Side.CLIENT) @SubscribeEvent public void onPlayerRenderPre(RenderPlayerEvent.Pre event) { ModelPlayer playerModel = renderer.getMainModel(); playerModel.bipedLeftArm.rotateAngleX = 90f; } And yes, the event is getting called. I've checked with the debugger.
  4. Yeah, but that only works for vanilla particles
  5. I have a few questions about Particles: 1. How do I make my own? I made a class that extended Particle, and I changed some values. I was able to spawn them, but it doesn't seem right? Do I have to register them anywhere? 2. How do I properly spawn them? I made a method that calls Minecraft#getMinecraft().effectRenderer.addEffect(). I pass along my particle, because it has a public constructor. It seems very hacky, is there a more official way to do this? How do I get an Instance of a vanilla particle? How do i get Instances of other mod's particles? 3. How do I get a list of all registered Particles? I know of EnumParticleTypes, but that obviously only includes vanilla particles, not modded ones. Is there a registry I can access? 4. How do I spawn Particles with custom textures? I made a Particle that has its FXLayer set to 1, meaning I can use Particle#setParticleTexture. I tried getting a TextureAtlasSprite using Minecraft.getMinecraft().getTextureMapBlocks.getAtlasSprite() with my resource location (I've double, triple and quadruple checked the location, the texture is there), but it always returns the missingno texture. When I changed the resource location to the item texture of one of my items it worked, so my guess Is that the texture is not registered (somehow, never knew you needed to do this, I've made things like guis in the past and never registered a texture). Thank you for your responses!
  6. Is this one of your blocks, meaning can you edit the class? If that is the case, you can override Block#onEntityCollidedWithBlock
  7. But I thought player.rayTrace was client only? And the ItemStacks' method is protected. Is the world's rayTrace also for servers? Edit: Nevermind, it worked out, thanks
  8. Sorry, I should have been more specific. I'm using vanilla's seed item
  9. I figured those methods didn't sound right... I'm trying to check if the block has a right-click action, like opening a door or a chest. I'm trying to check this from a RightClickBlock Event, I know that that event fires before the block reacts to the click. But I can't use RightClickItem, because then I don't have the BlockPos where the player clicked.
  10. I tried this: boolean canEdit = player.canPlayerEdit(pos, event.getFace(), stack); boolean modifiable = world.isBlockModifiable(player, pos); Both always seem to return true, when I click normal blocks and blocks like doors & chests
  11. world.getBlockState to get the state. The TileEntity can be null. It should only drop with silk touch when the pickaxe has silk touch, no?
  12. You could call block.harvestBlock and drop the returned ItemStack
  13. That sounds good, but now I don't have the BlockPos of where the player clicked... and raycasting won't work because it's client only, or am I wrong?
  14. With 1.12 here, I thought this was the perfect time to finally make a json generator. I did not make the generator have a gui - because I didn't want to. The main Idea was that you would be able to generate tons of files in seconds. The generator can currently generate: Normal Items Handheld Items (Swords, Tools) Normal Blocks Orientable Blocks (Furnaces, Machines) Blocks with Properties Slabs Stairs Shaped Crafting Recipes Shapeless Crafting Recipes I'm planning to add: Oredict Crafting Recipes Fences Pillars Usage: First, when you download the file, place it somewhere in a folder and run it once. DO NOT RENAME THE JAR. A bunch of files and folders will be generated. Open the "modid.txt" file and write your mod's modid on the first line, save and close. Next, in the params folder, you find all the txts that you need to edit in order to generate files. In the base folder you will find an Example.txt, which will look like this: The main purpose of this is, that you can have as many blocks generated at once as you want. Just make a new line in the respective file. Download: v1.0 There will probably be bugs, so please, report any funny business here! I hope it helps you, especially for updating your mods to 1.12!
  15. I have an event (PlayerInteractEvent.RightClickBlock) that checks if the player is holding a certain Item and then places a block. The Problem that I'm currently having is that is places the block whether or not the block has an interaction - let me give you some examples: When I click doors with the item, the block gets placed and the door is opened. It should only open the door. When I click a chest it opens the chest, but again, also places the block. I tried manually testing for the interaction, using block.onBlockActivated. I stored the return value in a boolean, and then tested. If it was true, that meant the block could interact, if it was false that meant the block should be placed. The problem I was having then was that it was only happening server side. So chests wouldn't show an animation and doors wouldn't open. Does anyone know if there's another way to determine how the block will interact if clicked?
  16. How do I put it in "draw" mode? What should I use instead of a TESR? A custom Model implementation? I could do a custom Model Implementation, but I found the TESR to be more straight forward (and better documented)
  17. I'm trying to render an IBakedModel from within a TESR. This is my code: public static class RendererInfected extends TileEntitySpecialRenderer<TileEntityInfectedBlock> { @Override public void renderTileEntityAt(TileEntityInfectedBlock te, double x, double y, double z, float partialTicks, int destroyStage) { BlockRendererDispatcher renderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); IBlockState state = te.getParent(); if(state != null) { IBakedModel model = renderer.getModelForState(state); renderer.getBlockModelRenderer().renderModel(getWorld(), model, state, te.getPos(), Tessellator.getInstance().getBuffer(), true); } } } The problem that I'm having is that the VertexBuffer crashes somewhere, throwing an ArrayIndexOutOfBoundsException: Description: Tesselating block model java.lang.ArrayIndexOutOfBoundsException: 3 at net.minecraftforge.client.model.pipeline.VertexLighterFlat.processQuad(VertexLighterFlat.java:108) at net.minecraftforge.client.model.pipeline.QuadGatheringTransformer.put(QuadGatheringTransformer.java:63) at net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(LightUtil.java:126) at net.minecraft.client.renderer.block.model.BakedQuad.pipe(BakedQuad.java:70) at net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer.render(ForgeBlockModelRenderer.java:138) at net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer.renderModelSmooth(ForgeBlockModelRenderer.java:103) at net.minecraft.client.renderer.BlockModelRenderer.renderModel(BlockModelRenderer.java:47) at net.minecraft.client.renderer.BlockModelRenderer.renderModel(BlockModelRenderer.java:38) at tschipp.pathology.render.InfectedBlockRendering$RendererInfected.renderTileEntityAt(InfectedBlockRendering.java:60) at tschipp.pathology.render.InfectedBlockRendering$RendererInfected.renderTileEntityAt(InfectedBlockRendering.java:1) at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:156) at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:131) at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:723) at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1385) at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1299) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1106) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1140) at net.minecraft.client.Minecraft.run(Minecraft.java:407) at net.minecraft.client.main.Main.main(Main.java:118) 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 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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) My best guess is that this is not the correct way to use the VertexBuffer. Is there another way to get an instance of it?
  18. Yeah you're right, I forgot
  19. You imported the wrong EventHandler. You need to import the one that you created, or just rename yours to something that isn't already used. To rename a class, right click it in the Package explorer, hit Refactor and then rename.
×
×
  • Create New...

Important Information

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