Jump to content

Tschipp

Forge Modder
  • Posts

    307
  • Joined

  • Last visited

Posts 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)

    2017-08-16_12_00_59.thumb.png.344f1bd3a20365e614960885ce96e630.png

     

    At day (with light)

    2017-08-16_12_01_21.thumb.png.3e7af4f397299d3480f79d087d76c6e8.png

     

    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. 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!
  5. 3 minutes ago, diesieben07 said:

    Uhm, yes, because a "normal player" can edit any block. What were you trying to achieve here?

    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.

  6. On 9.7.2017 at 11:01 AM, diesieben07 said:

    When right clicking a block with an, first RightClickBlock will fire, regardless of whether the block "accepts" the click or not. If it does accept it (or the event is canceled) the click goes to the item, which causes RightClickItem to fire. So it sounds like you want RightClickItem instead.

    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?

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

    Spoiler

    Normal Block:
    test_block
    This creates a blockstate file called 'test_block.json', a block model file called 'test_block.json' and an item model file called 'test_block.json'
    The block will try to use a texture called 'test_block', which is located in /textures/blocks

     

    Handheld Item:
    test_sword
    This creates an item model file called 'test_sword.json'. The item model will look like a sword when held
    The item will try to use a texture called 'test_sword', which is located in /textures/items

     

    Normal Item:
    test_apple
    This creates an item model file called 'test_apple.json'
    The item will try to use a texture called 'test_apple', which is located in /textures/items

     

    Orientable Block:
    test_furnace
    This creates a blockstate file called 'test_furnace.json', a block model file called 'test_furnace.json' and an item model file called 'test_furnace.json' The block will behave like an orientable block (like a furnace)
    The block will try to use textures called 'test_furnace_top', 'test_furnace_front' and 'test_furnace_side', all of them are located in /textures/blocks

     

    Slab Block:
    test
    This creates two blockstate files, one named 'test_slab.json', the other named 'test_slab_double'. Note how the _slab suffix is added automatically
    It also creates two block model files, one called 'test_slab.json' and one called 'test_slab_double.json'. It creates one item model file called 'test_slab.json'
    The block will try to use a texture called 'test', which is located in /textures/blocks

     

    Stair Block:
    test
    This creates a blockstate file called 'test_stair.json'. Note how the _stair suffix is added automatically
    It also creates three block model files, one called 'test_stair.json', one called 'test_stair_inner.json' and one called 'test_stair_outer.json'. It creates one item model file called 'test_stair.json'
    The block will try to use a texture called 'test', which is located in /textures/blocks

     

    Variant Block / Block with Properties:
    test_clay;blue,red,green:color
    This creates a blockstate file called 'test_clay.json'. It creates block model files for each variant, in this case 'blue.json', 'red.json' and 'green.json'. It also creates Item model files for all variants with the same names.
    The block will try to use textures called 'blue', 'red' and 'green', all of them are located in /textures/blocks

     

    Shaped Recipes:
    3*minecraft:stone;3,(###,#P#,###),#,minecraft:dirt;2,P,minecraft:dirt:3,?group
    This creates a recipe file called 'stone.json'
    The first argument is the recipe output. Using NUMBER*, you can specify how many items are created. The ;3 after the minecraft:stone refers to the damage value of the output
    The second argument in brackets is the recipe. The lines are separated with commas (first is top line in crafting, second is middle line and third is last line). You can also not write lines (for 4x4 crafting). (##,##). You can use any characters as identifiers apart from *,;:?
    The next arguments specify what the characters in the second argument stand for. The format for items is the same (modid:name;meta). You cannot specify a count.
    The last argument is indicated by the '?'. It is the group name, if you want to group your recipes. If you don't write a ?, it will not assign the recipe to a group.

     

    Shapeless Recipes:
    3*minecraft:stone;3,minecraft:dirt;2,minecraft:dirt:3,?group
    This creates a recipe file called 'stone.json'
    The first argument is the recipe output. Using NUMBER*, you can specify how many items are created. The ;3 after the minecraft:stone refers to the damage value of the output
    The next arguments specify the ingredients used in this recipe. The format for items is the same (modid:name;meta). You cannot specify a count.
    The last argument is indicated by the '?'. It is the group name, if you want to group your recipes. If you don't write a ?, it will not assign the recipe to a group.

    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!

  8. 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?

  9. 1 minute ago, diesieben07 said:

    The BlockRendererDispatcher expects the VertexBuffer to be in "draw" mode, check out the other places that renderModel is called.

    Although, why are you using a TESR for this? In the current configuration, it is not needed.

    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)

  10. 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?

  11. 2 minutes ago, Kitsune_Ultima said:

    I'm Confused

     

    12 minutes ago, V0idWa1k3r said:

    ...Or he could simply make the onModelRegistry method static and let forge automatically subscribe his InitEventHandler to the event bus without having to do this explicidly as he already has the EventBusSubscriber annotation...

     

  12. 2 minutes ago, Kitsune_Ultima said:

    error Cannot instantiate the type Mod.EventHandler
     

    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.