Everything posted by CrackedScreen
-
[1.16.5] Getting the armor value of an entity
Your suggestions worked, thanks again.
-
[1.16.5] Getting the armor value of an entity
I am creating a projectile that can bypass a certain amount of the target's armor by taking the effective "armor value", reducing it by a coefficient, and then applying the damage. I know getArmorInventoryList() returns armor the entity is wearing, but can't access the protection values of each individual piece as it only returns an ItemStack. Thanks in advance for any help.
-
[1.15.2] Issue with ranged weapon when reloading [SOLVED]
Thanks for helping, I'll be sure to take a look in the PlayerRenderer class. It might be better for me to use something else for the time being since I have other priorities. I'll mark this as solved.
-
[1.15.2] Issue with ranged weapon when reloading [SOLVED]
It doesn't extend CrossbowItem, but has this: public UseAction getUseAction(ItemStack stack) { return UseAction.CROSSBOW; } I wasn't personally aware that crossbow had special handling by the render class, but this method might be enough to cause this issue. Is there any way I can work around this?
-
[1.15.2] Issue with ranged weapon when reloading [SOLVED]
{ "parent": "item/generated", "textures": { "layer0": "rifles:item/rifle" }, "display": { "thirdperson_righthand": { "rotation": [ -80, 260, -40 ], "translation": [ -1, 0, 2.5 ], "scale": [ 0.9, 0.9, 0.9 ] }, "thirdperson_lefthand": { "rotation": [ -80, -280, 40 ], "translation": [ -1, -2, 2.5 ], "scale": [ 0.9, 0.9, 0.9 ] }, "firstperson_righthand": { "rotation": [ 0, -90, 25 ], "translation": [ 1.13, 3.2, 1.13], "scale": [ 0.68, 0.68, 0.68 ] }, "firstperson_lefthand": { "rotation": [ 0, 90, -25 ], "translation": [ 1.13, 3.2, 1.13], "scale": [ 0.68, 0.68, 0.68 ] } }, "overrides": [ { "predicate": { "reloading": 1, "reloaded": 1.0 }, "model": "item/crossbow_pulling_2" }, { "predicate": { "loaded": 1 }, "model": "item/crossbow_arrow" } ] } Here's the JSON, I'm aware that the reloaded/reload finish states point to the crossbow textures but this is just debug.
-
[1.15.2] Issue with ranged weapon when reloading [SOLVED]
For some reason, my custom weapon texture goes above the screen whenever I'm reloading. Is there any particular cause for this happening? I've even tried using the crossbow JSON values and texture like in the image above but it still does this. I don't think it's my code that is causing this kind of issue, but will post it if necessary. This issue only happens in first person view, the third person appearance is totally fine.
-
[1.14.4] Rendering entities as textures [SOLVED]
Yep, removing that override fixed my issue. Didn't think my screw-up would be that dumb. Also answered the other question myself, the method that is the jumble of numbers and letters does indeed control the appearance. Thanks for helping, will close this thread.
-
[1.14.4] Rendering entities as textures [SOLVED]
Stacktrace: [Server thread/ERROR]: An Entity type net.minecraft.entity.EntityType@8bde368 has thrown an exception trying to write state. It will not persist. Report this to the mod author net.minecraft.crash.ReportedException: Saving entity NBT at net.minecraft.entity.Entity.func_189511_e(Entity.java:1423) ~[?:?] at net.minecraft.entity.Entity.func_184198_c(Entity.java:1341) ~[?:?] at net.minecraft.entity.Entity.func_70039_c(Entity.java:1349) ~[?:?] at net.minecraft.world.chunk.storage.ChunkSerializer.func_222645_a(ChunkSerializer.java:319) [?:?] at net.minecraft.world.server.ChunkManager.func_219229_a(ChunkManager.java:674) [?:?] at net.minecraft.world.server.ChunkManager$$Lambda$3698/582496320.test(Unknown Source) [?:?] at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174) [?:1.8.0_51] at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) [?:1.8.0_51] at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) [?:1.8.0_51] at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) [?:1.8.0_51] at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512) [?:1.8.0_51] at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) [?:1.8.0_51] at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) [?:1.8.0_51] at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) [?:1.8.0_51] at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) [?:1.8.0_51] at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) [?:1.8.0_51] at net.minecraft.world.server.ChunkManager.func_219177_a(ChunkManager.java:333) [?:?] at net.minecraft.world.server.ServerChunkProvider.func_217210_a(SourceFile:319) [?:?] at net.minecraft.world.server.ServerWorld.func_217445_a(ServerWorld.java:746) [?:?] at net.minecraft.server.MinecraftServer.func_213211_a(MinecraftServer.java:513) [?:?] at net.minecraft.server.MinecraftServer.func_71260_j(MinecraftServer.java:553) [?:?] at net.minecraft.server.integrated.IntegratedServer.func_71260_j(IntegratedServer.java:210) [?:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:661) [?:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_51] Caused by: java.lang.NullPointerException at net.minecraft.network.datasync.EntityDataManager.func_187225_a(EntityDataManager.java:118) ~[?:?] at net.minecraft.entity.projectile.ProjectileItemEntity.func_213882_k(SourceFile:38) ~[?:?] at net.minecraft.entity.projectile.ProjectileItemEntity.func_213281_b(SourceFile:55) ~[?:?] at net.minecraft.entity.Entity.func_189511_e(Entity.java:1402) ~[?:?] ... 23 more [00:10:47] [Server thread/INFO]: ThreadedAnvilChunkStorage (Test): All chunks are saved [00:10:47] [Server thread/INFO]: ThreadedAnvilChunkStorage (Test): All chunks are saved [00:10:48] [Client thread/FATAL]: Reported exception thrown! net.minecraft.crash.ReportedException: Rendering entity in world at net.minecraft.client.renderer.entity.EntityRendererManager.func_188391_a(EntityRendererManager.java:401) ~[?:?] at net.minecraft.client.renderer.entity.EntityRendererManager.func_188388_a(EntityRendererManager.java:359) ~[?:?] at net.minecraft.client.renderer.WorldRenderer.func_215326_a(WorldRenderer.java:543) ~[?:?] at net.minecraft.client.renderer.GameRenderer.func_181560_a(GameRenderer.java:713) ~[?:?] at net.minecraft.client.renderer.GameRenderer.func_78471_a(GameRenderer.java:640) ~[?:?] at net.minecraft.client.renderer.GameRenderer.func_195458_a(GameRenderer.java:494) ~[?:?] at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:890) ~[?:?] at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:384) [?:?] at net.minecraft.client.main.Main.main(SourceFile:155) [?:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:56) [forge-1.14.4-28.1.111.jar:28.1] at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$392/26357357.call(Unknown Source) [forge-1.14.4-28.1.111.jar:28.1] at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-4.1.0.jar:?] at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-4.1.0.jar:?] at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-4.1.0.jar:?] at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-4.1.0.jar:?] at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-4.1.0.jar:?] Caused by: java.lang.NullPointerException at net.minecraft.network.datasync.EntityDataManager.func_187225_a(EntityDataManager.java:118) ~[?:?] at net.minecraft.entity.projectile.ProjectileItemEntity.func_213882_k(SourceFile:38) ~[?:?] at net.minecraft.entity.projectile.ProjectileItemEntity.func_184543_l(SourceFile:43) ~[?:?] at net.minecraft.client.renderer.entity.SpriteRenderer.func_76986_a(SourceFile:41) ~[?:?] at net.minecraft.client.renderer.entity.EntityRendererManager.func_188391_a(EntityRendererManager.java:370) ~[?:?] ... 19 more ClientProxy class: public class ClientProxy implements IProxy { @Override public void init() { RenderingRegistry.registerEntityRenderingHandler(BulletEntity.class, renderManager -> new SpriteRenderer<BulletEntity>(renderManager, Minecraft.getInstance().getItemRenderer())); } public World getClientWorld() { return Minecraft.getInstance().world; } } BulletEntity class: public class BulletEntity extends ProjectileItemEntity { public BulletEntity(EntityType<? extends BulletEntity> type, World worldIn) { super(type, worldIn); } public BulletEntity(World worldIn, LivingEntity shooter) { super(ModEntities.BULLET, shooter, worldIn); } public BulletEntity(double x, double y, double z, World worldIn) { super(ModEntities.BULLET, x, y, z, worldIn); } @Override protected void registerData() { // TODO Auto-generated method stub } @Override public Item func_213885_i() { return ModItems.bullet; } @Override public IPacket<?> createSpawnPacket() { return NetworkHooks.getEntitySpawningPacket(this); } } I'm not entirely sure about the func_213885 method, is this related to the getItem method you mentioned? I did some digging on another related thread that had to do with projectile entities and mirrored what they did.
-
[1.14.4] Rendering entities as textures [SOLVED]
How would I go about rendering my projectile entity with a 2D texture similar to a snowball? I've done some poking around the SpriteRenderer and EntityRendererManager classes but I have no idea on how to proceed, since most of my attempts at filling in the ItemRenderer field result in errors or crashes. The rendering code in my ClientProxy is as follows: RenderingRegistry.registerEntityRenderingHandler(BulletEntity.class, renderManager -> new SpriteRenderer<BulletEntity>(renderManager, Minecraft.getInstance().getItemRenderer())); and whenever the projectile entity is created in game it will end in a NullPointerException: [Server thread/ERROR]: An Entity type net.minecraft.entity.EntityType@8bde368 has thrown an exception trying to write state. It will not persist. Report this to the mod author Secondly, is there a way to control what texture the projectile uses with this method? I took a quick look through Mojang's code and didn't notice anything that might let me do this, so it would be great if someone could point me in the right direction. Thanks in advance.
IPS spam blocked by CleanTalk.