Jump to content

Tschipp

Forge Modder
  • Posts

    307
  • Joined

  • Last visited

Posts posted by Tschipp

  1. I'm trying to add my own "data type" to datapacks. The data is a simple json file that I use for various things.

    Since datapacks were introduced and they can sync from the server to the client, I would like to leverage that system for my purposes.

    Is such a thing possible?

    I used to just have a folder in the minecraft root directory and read my files from there, but obviously that caused issues when playing on a server without/with different files.

  2. I feel like an idiot asking such a mundane question, especially since I've done it countless times before, but maybe I'm just blind and someone here can help me out.

    I made and registred models (and textures) for my items, but only one texture shows up on one item, and it's even the wrong texture:

     

    The items are all new instances of the same Class, but I don't see how that would cause a problem.

    The Item registration:

    	public static Item tier1;
    	public static Item tier2;
    	public static Item tier3;
    	public static Item tier4;
    	public static Item tier5;
    
    	private static List<Item> items = new ArrayList<Item>();
    	
    	public static void registerItems()
    	{
    		items.add(tier1 = new BuildersBagItem(1, "one"));
    		items.add(tier2 = new BuildersBagItem(2, "two"));
    		items.add(tier3 = new BuildersBagItem(3, "three"));
    		items.add(tier4 = new BuildersBagItem(4, "four"));
    		items.add(tier5 = new BuildersBagItem(5, "five"));
    	}

     

    I call registerItems during preInit, as you'd expect.

     

    Then I call this from my client side, also during preInit, after Item registration:

    	public static void regItemRenders()
    	{
    		register(RegistryHandler.tier1);
    		register(RegistryHandler.tier2);
    		register(RegistryHandler.tier3);
    		register(RegistryHandler.tier4);
    		register(RegistryHandler.tier5);
    	}
    	
    	
    	public static void register(Item item)
    	{
    		System.out.println("Registering model for " + item.getRegistryName());
    		ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
    	}

    The debug output gets printed, I've checked. Also there are no model errors being printed.

    My model folder looks like this:

    50425b5515a2f8924e09343b48e94b99.png

     

    Now, what's interesting is: Only the first item gets a texture ingame. Interestingly enough, it is the texture of the tier 5 item, not the tier 1 (as it should be).

    If I uncomment the registration of the tier 5 item, it gets the texture of the tier 4 item instead.

    Only the first uncommented item gets a texture. The others don't even get the "missing model" model (the one with the registred name as text).

    It's almost as if the texture gets overwritten and only applied on the first item.

    I am utterly confused, I have never encountered this.

    Can someone help me with this situation?

     

     

  3. I have a contraption that renders static entities, meaning the entities don't exist in the world.

    The entity NBT must be read before the render to conserve information such as sheep color or entity age.

    This used to work fine for all cases in 1.12, but I'm having trouble with Villagers and Foxes.

     

    I'll illustrate my issue for foxes:

     

    First, I call IForgeEntity#deserializeNBT.

    That then calls Entity#read, which eventually calls Entity#readAdditional.

     

    For foxes, that method then calls a method of FoxEntity called "func_213501_ej".

    That function adds attack goals to the fox. Problem is, that those attack goals haven't been initialized yet and are null, causing a NPE further down the line in the TargetSelector class.

     

    One potential solution that I see for this is that I call MobEntity#registerGoals before the NBT read. However, I would need to use reflection for that.

    MobEntity#registerGoals is usually called from the MobEntity constructor but registerGoals only gets executed when the world is not remote. 

     

    But I wonder, how does vanilla do it? I mean the game reads the NBT on the client at some point, but doesn't get any crashes from uninitialized AI Goals...

    Am I calling the wrong serialize/deserialize functions?

     

  4. I'm trying to render a regular block model inside a TESR.

    This is my code:

    	@Override
    	public void render(TileEntityRegeneratingOre te, double x, double y, double z, float partialTicks, int destroyStage, float alpha)
    	{
    
    		IBlockState ore = te.getOre();
    
    		Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    		BlockRendererDispatcher renderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
    
    		GlStateManager.pushMatrix();
    		GlStateManager.translate(x, y, z);
    		GlStateManager.rotate(-90, 0, 1, 0);
    
    		renderer.renderBlockBrightness(te.getOre(), te.getWorld().getCombinedLight(new BlockPos(x, y, z), 0));
    		
    		GlStateManager.popMatrix();
    	}

    However, this produces a very dark block:

    image.thumb.png.8eba501813ae7852e7ca2575e4124fa9.png

     

    What can I do to fix this issue?

    Also, how do I add the breaking animation and correct break particles? I tried looking at any of the vanilla TESR but didn't really get smarter from that...

     

  5. When I was updating to 1.14.4, I noticed that when I render something relative to the player using GL, it seems that the renderer is no longer positioned on the player by default, but on the camera.

    This is especially obvious when switching to f5, as I can then see the things that are normally being rendered relative to the player being rendered relative to the camera.

     

    Has anyone else experienced this?

    Is there a way to get the camera position?

  6. So I wanted to integrate LLibrary into my mod, so I added this to my build.gradle:

     

    dependencies {
      	 
    		deobfCompile "net.ilexiconn:llibrary:1.7.19-1.12.2"
    		deobfCompile "net.ilexiconn:llibrary-core:1.0.11-1.12.2"
    
    }

    This worked fine. I'm using Forge 1.12.2-14.23.5.2816, which LLibrary asks for (well not exactly 2816, but 2771 or higher)

    However, when I launch the game, the game crashes with this error:

    java.lang.NoSuchMethodError: net.minecraft.util.ResourceLocation.getNamespace()Ljava/lang/String;
    	at net.ilexiconn.llibrary.client.model.tabula.TabulaModelHandler.accepts(TabulaModelHandler.java:173)
    	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:123)
    	at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:235)
    	at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:153)
    	at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:223)
    	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:150)
    	at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28)
    	at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121)
    	at net.minecraft.client.Minecraft.init(Minecraft.java:560)
    	at net.minecraft.client.Minecraft.run(Minecraft.java:422)
    	at net.minecraft.client.main.Main.main(Main.java:118)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	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(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    	at GradleStart.main(GradleStart.java:25)

     

    I checked ResourceLocation to see if the Method exists, and sure enough, it doesn't. I tried up- and downgrading forge to various versions, but nothing seems to work. 

    What am I missing here?

  7. I'm not sure what's wrong. I give the method the same parameters as vanilla does when moving entities, the entity height and width...

     

    The method always returns false at one of the isSafeToStandAt in isDirectPathBetweenPoints. I should probably also mention that the position where the entity should walk is a block of water, that might be why it's failing.

     

    Is there any other way than isDirectPathBetweenPoints?

  8. 2 minutes ago, Cadiboo said:

    You might want to use a method handle to reduce the overhead of reflection. Example

    Good idea, but the way I have it right now it still always returns false. I'm suspecting it has something to do with the sizeX, sizeY and sizeZ parameters. What exactly to they do, and what should their values be in my example?

×
×
  • Create New...

Important Information

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