LittleOne
Members-
Posts
25 -
Joined
-
Last visited
Everything posted by LittleOne
-
(SOLVED)Set rotation angles (animations) for Player
LittleOne replied to LittleOne's topic in Modder Support
I followed your instructions and everything worked out! Thank you soooo much!. I ended up creating a RenderLivingBaseEx that inherits from renderlivingbase and changed the dorender method as instructed. Then I inherited from the class in my RenderLivBaseExEx and did some more things, then finally in my renderrealplayer class I used RenderLivBaseExEx, plugged in my model and texture and the animations are now playing. I love this site. -
(SOLVED)Set rotation angles (animations) for Player
LittleOne replied to LittleOne's topic in Modder Support
I'm trying to get the animations set in the rotation angles in the model class to work. They're supposed to be consistent back and forth animations of the designated box. The method does fire but it auto rotates to only one side instead of going back and forth. The animations work for a mob entity extending, for example, entity horse, just not the player. That's why I was using entityliving because the animations definitely work for it. However, since it doesn't work, it leads me to believe it's something with how I render the player. And you said that I'm creating a new instance of the player every time it's rendering and using the variables from that instance. If set rotation angles is already being called then I finally see that it doesn't need to be called again. Just the way I'm rendering it is wrong. Is it impossible to render what I'm attempting to render through entityliving/renderliving? If it is, I did try your way. I got a stack overflow error null at the dorender method in the renderplayerevent, pre. I've never learned about this type of error. What I tried was: EntityPlayer player = event.getEntityPlayer(); EntityPlayerSP playerSP = (EntityPlayerSP)player; RenderRealPlayer renderRealPlayer = new RenderRealPlayer(insert proper perameters here); renderRealPlayer.doRender(playerSP, 0, 0, 0, 0.5f, event.getPartialRenderTicks); So I looked up this type of error and found that the usual cause is deep recursion or an infinite loop of some sort. After reading this, I attempted to realize how it was calling itself. My IQ is very low so I, of course, was not able to accomplish this goal. Therefore, I'm unsure how to fix this and what I did wrong. Moving into uncharted territory, I was scared. So I went back to extending renderliving<EntityRealPlayer>. This does not mean that I'm not willing to return to this method. Next, I contacted someone more experienced in programming minecraft mods. Specifically animations. They too have not yet figured out what's going on. It seems you know exactly what's going on though. I'm just really hard headed and unlikely to learn quickly. You're giving me the answers. It's just that I have so many presumptions that it's making it difficult to process new information. Truly sorry if I'm giving you a headache. It's not my intention even if it's occurring. I really do appreciate your time in helping me solve this. -
(SOLVED)Set rotation angles (animations) for Player
LittleOne replied to LittleOne's topic in Modder Support
I attempted to render the entityplayer in the new renderer. Is there a way to change the main model though? I'm not seeing getmainmodel or setrotationangles. Perhaps I didn't follow your suggestion right? What I did: public class RenderRealPlayer extends Render<EntityPlayer> -
(SOLVED)Set rotation angles (animations) for Player
LittleOne replied to LittleOne's topic in Modder Support
Honestly, I thought that was the only way to render a new model onto the player. While learning, I gathered that an entity has three things. Entity, render, and model classes. Going to test a few things now to try and fix it. Thank you. -
(SOLVED)Set rotation angles (animations) for Player
LittleOne replied to LittleOne's topic in Modder Support
I might understand. Thanks for the help! Tried a few things but still can't get it to work. Would I have to pull everything from event. ? From where I would have to change what my entity and render class inherits from? Right now they're not from renderplayer or entityplayer. Or do I just need to pull the variables from event and apply them to set rotation angles? I tried this, but perhaps I did it wrong? -
Hello everyone, I'm attempting to set the rotation angles of my model, however, it's not working. So what I've done so far: Made a Living entity, cancelled render player event at pre. Then I called a dorender method for the custom living entity. The new model loads fine. Just the animations do not. I'm thinking that it's because I'm typing this line in the render player event pre, which i suppose only fires when the player is being rendered the first time? I'm really not sure though. Any help is appreciated! Here's what I've tried. @SubscribeEvent public static void onPlayerRender(RenderPlayerEvent.Pre event) { if (event.getEntity() instanceof EntityPlayer) { event.setCanceled(true); } RenderRealPlayer renderRealPlayer = new RenderRealPlayer(Minecraft.getMinecraft().getRenderManager(), new ModelRealPlayer()); EntityRealPlayer player = new EntityRealPlayer(Minecraft.getMinecraft().world); renderRealPlayer.doRender(player, 0, 0, 0, 0.5f, event.getPartialRenderTick()); renderRealPlayer.getMainModel().setRotationAngles(player.limbSwing, player.limbSwingAmount, player.ticksExisted, player.rotationYawHead, player.rotationPitch, 0.0f, player); Also tried setting the rotation angles in living update event and didn't get very far because it felt wrong.
-
Does it still give you the same logs when you run the client?
-
Yep those are the ones! So these lines here: Could not load vanilla model parent 'block/em:bottom_ruby_refined_slab' for 'net.minecraft.client.renderer.block.model.ModelBlock@209fa1fc net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model block/em:bottom_ruby_refined_slab with loader VanillaLoader.INSTANCE, skipping Caused by: java.io.FileNotFoundException: block/em:models/bottom_ruby_refined_slab.json at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:69) ~ [08:58:53] [main/ERROR] [FML]: Exception loading model for variant em:ruby_refined_slab_half#inventory for item "em:ruby_refined_slab_half", normal location exception: java.lang.IllegalStateException: vanilla model 'net.minecraft.client.renderer.block.model.ModelBlock@209fa1fc' can't have non-vanilla parent Perhaps something to do with this. "parent": "block/em:bottom_ruby_refined_slab" ? I'm taking a guess.
-
When you run the game, in the minecraft client console, does it say anything there about this block? ctrl f to find the statements about the block then paste them here? I'm sort of new but I've had a similar problem that I solved.
-
Do the methods init and register in mod items and mod blocks and mod recipes point to anything? Or are the methods supposed to be empty? Sorry, I'm a little new. I'm just looking at the differences between working mods pre init and yours. Also are you supposed to call those in the pre init?
-
I'm new but I think I know how to help you. In your reference libraries in the project, go to forgesrc, net, minecraft, entity, passive, entityvillager. And it has some things there. From there you can navigate through the rest of the code that is attached to it like INPC or IMerchant. Anyone please correct me if I'm wrong. Don't want to be giving out false information.
-
Hello, I'm trying to animate my model that has taken the place of the main model for renderplayer. And as usual, where I am learning to mod, trouble follows. In this test, I've created a simple animation using LLibrary ModelAnimator. Specifically, using keyframes. I attempted the walk() method, however, it does the same thing. Nothing happens, and I know I'm at fault. I used the eclipse debugger and it showed that the method animate() in render has no return value. I'm not sure this is the right place for this inquiry. If it isn't then I will be more than willing to change over to another support forum. Here's what I have. @Override public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { EntityTwoPlayer twoplayer = (EntityTwoPlayer) entity; animate(twoplayer, f, f1, f2, f3, f4, f5); GlStateManager.pushMatrix(); GlStateManager.translate(this.Head.offsetX, this.Head.offsetY, this.Head.offsetZ); GlStateManager.translate(this.Head.rotationPointX * f5, this.Head.rotationPointY * f5, this.Head.rotationPointZ * f5); GlStateManager.scale(0.68D, 0.81D, 0.81D); GlStateManager.translate(-this.Head.offsetX, -this.Head.offsetY, -this.Head.offsetZ); GlStateManager.translate(-this.Head.rotationPointX * f5, -this.Head.rotationPointY * f5, -this.Head.rotationPointZ * f5); this.Head.render(f5); GlStateManager.popMatrix(); } /** * This is a helper function from Tabula to set the rotation of model parts */ @Override public void setRotationAngles(TabulaModel model, EntityTwoPlayer entity, float f, float f1, float f2, float f3, float f4, float f5) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); resetToDefaultPose(); } public void animate(IAnimatedEntity entity, float f, float f1, float f2, float f3, float f4, float f5) { EntityTwoPlayer twoplayer = (EntityTwoPlayer) entity; animator.update(twoplayer); setRotationAngles(f5, f, f1, f2, f3, f4, twoplayer); float frame = twoplayer.ticksExisted + LLibrary.PROXY.getPartialTicks(); if (twoplayer.getAnimation() == EntityTwoPlayer.WALK_ANIMATION) { animator.setAnimation(EntityTwoPlayer.WALK_ANIMATION); if(twoplayer.isSprinting()) { animator.startKeyframe(8); animator.rotate(Thigh1, 15.5f, 0, 0); animator.endKeyframe(); animator.setStaticKeyframe(2); animator.startKeyframe(8); animator.rotate(Thigh1, -10f, 0, 0); animator.endKeyframe(); animator.setStaticKeyframe(2); animator.resetKeyframe(10); } } } Any help is greatly appreciated.
-
(Solved!)Render different model onto player
LittleOne replied to LittleOne's topic in Modder Support
Lol... The model did render, the texture didn't. So... I guess it was fully transparent and I didn't see it... -
(Solved!)Render different model onto player
LittleOne replied to LittleOne's topic in Modder Support
I don't think I'm experienced enough yet to do what I'm attempting to do. I looked over metamorph and made a few changes and additions. However, the model renders yet doesn't appear on the screen. By that I mean the code executes and variables change but nothing happens. Here's what I have. @SideOnly(Side.CLIENT) public class RenderPlayerHandler{ public RenderPlayerHandler() { } @SideOnly(Side.CLIENT) @SubscribeEvent(priority = EventPriority.HIGHEST) public void onPlayerRender(RenderPlayerEvent.Pre event) { if(event.getEntity() instanceof EntityPlayer) { event.setCanceled(true); RenderManager manager = Minecraft.getMinecraft().getRenderManager(); final RenderEntityTwoPlayer modelRenderer = new RenderEntityTwoPlayer(manager, new ModelPlayerTwo(), 1.5F); modelRenderer.doRender(new EntityTwoPlayer(Minecraft.getMinecraft().world), 0D, 0D, 0D, 0.65F, 0.65F); } } } If anything else is needed, let me know. -
(Solved!)Render different model onto player
LittleOne replied to LittleOne's topic in Modder Support
Yes -
Hello, I'm attempting to cancel the RenderPlayerEvent.pre if it's of EntityPlayer in order to apply my own render to the event. So far, I have a model class and render for that model. However, I don't understand how to connect all of the pieces or if the pieces are even compatible. Therefore, I'm looking for a source of information that I can study to assist me with this. This is what I have in my Events @SideOnly(Side.CLIENT) public class RenderPlayerHandler{ @SubscribeEvent public void pre(RenderPlayerEvent.Pre event) { if(event.getEntity() instanceof EntityPlayer) { event.setCanceled(true); } } } At this point, I'm at a loss. Any help is greatly appreciated.
-
Keep Blocks Grass except for Block under player
LittleOne replied to LittleOne's topic in Modder Support
Alright thank you! I changed a few things including the variable names and == to .equals(). I think there's something else though because the code still isn't doing what I want it to do. I'm wondering if the whole for loop is somehow being negated. public void onPlayerTickEvent(PlayerTickEvent event) { if(event.player instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.player; BlockPos playerUPos = player.getPosition().down(); IBlockState playerUState = player.world.getBlockState(playerUPos); BlockPos playerOBPos = player.getPosition().add(5, 2, 5); BlockPos playerTBPos = player.getPosition().add(-5, -2, -5); Iterable<BlockPos> playerABPos = player.getPosition().getAllInBox(playerOBPos, playerTBPos); if(player.onGround && player.world.getBlockState(playerUPos).getBlock() == Blocks.GRASS) { player.world.setBlockState(playerUPos, Blocks.STONE.getDefaultState()); for (BlockPos pos : playerABPos) { IBlockState newPosState = player.world.getBlockState(pos); Block newPosBlock = newPosState.getBlock(); if(pos.equals(playerUPos)) { player.world.setBlockState(playerUPos, Blocks.STONE.getDefaultState()); }else { if(newPosBlock == Blocks.STONE.getDefaultState()) { player.world.setBlockState(pos, Blocks.GRASS.getDefaultState()); } } } } } } Or the part under else is not going through for some reason. -
Keep Blocks Grass except for Block under player
LittleOne replied to LittleOne's topic in Modder Support
Thanks for pointing that out. I changed it to BlockPos playerTBPos = player.getPosition().add(-5, -2, -5); However, the blocks are still not changing. Or did I mess up the initialization again? -
Hello, I'm attempting to change the block under the player, which works, from playerUPos. However, I'm trying to get the surrounding positions in relation to the player and set those blocks to grass. This code isn't working. I think I'm not getting the logic yet. Any help is greatly appreciated! @SubscribeEvent public void onPlayerTickEvent(PlayerTickEvent event) { if(event.player instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.player; BlockPos playerUPos = player.getPosition().down(); IBlockState playerUState = player.world.getBlockState(playerUPos); BlockPos playerOBPos = player.getPosition().add(5, 2, 5); BlockPos playerTBPos = player.getPosition().subtract(playerOBPos); Iterable<BlockPos> playerABPos = player.getPosition().getAllInBox(playerOBPos, playerTBPos); if(player.onGround && player.world.getBlockState(playerUPos).getBlock() == Blocks.GRASS) { player.world.setBlockState(playerUPos, Blocks.STONE.getDefaultState()); for (BlockPos item : playerABPos) { IBlockState newItem = player.world.getBlockState(item); Block newItemBlock = newItem.getBlock(); if(item == playerUPos) { player.world.setBlockState(playerUPos, Blocks.STONE.getDefaultState()); }else { if(newItemBlock == Blocks.STONE.getDefaultState()) { player.world.setBlockState(item, Blocks.GRASS.getDefaultState()); } } } } } } Also I did try the method by taking each position individually and that worked. However, I feel it was too tedious and it actually didn't work when a player jumped off a bock.
-
(Thanks: Solved)Continuously Change Block Under Player
LittleOne replied to LittleOne's topic in Modder Support
Solved! Thanks for your clarification and help. I will also look at the IBlockState Interface. Also, it's working! @SubscribeEvent public void onPlayerTickEvent(PlayerTickEvent event) { if(event.player instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.player; BlockPos playerUPos = player.getPosition().down(); IBlockState playerUState = player.world.getBlockState(playerUPos); if (player.onGround && player.world.getBlockState(playerUPos).getBlock() == Blocks.GRASS) { player.world.setBlockState(playerUPos, Blocks.STONE.getDefaultState()); } } } -
(Thanks: Solved)Continuously Change Block Under Player
LittleOne replied to LittleOne's topic in Modder Support
public void onLivingUpdateEvent(LivingUpdateEvent event) { event.getEntity(); if(event.getEntity() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.getEntity(); BlockPos playerUPos = player.getPosition().down(); IBlockState playerUState = (IBlockState)playerUPos; Block playerUBlock = (Block)playerUState; IBlockState grassState = Blocks.GRASS.getDefaultState(); if(player.onGround && playerUBlock == Blocks.GRASS) { } } } } Something like this? Or am I missing something? If I need more java experience before doing this, I will accept that. Thank you in advance. How to set blockstate next? -
(Thanks: Solved)Continuously Change Block Under Player
LittleOne replied to LittleOne's topic in Modder Support
1.12.2, By the way, thank you for responding quickly. I'm looking for a hint or two in the right direction, even if it is outdated. -
(Thanks: Solved)Continuously Change Block Under Player
LittleOne replied to LittleOne's topic in Modder Support
Whenever the entity is on ground. Both, I suppose. -
(Thanks: Solved)Continuously Change Block Under Player
LittleOne replied to LittleOne's topic in Modder Support
To Stone. Apologies, I should have mentioned that. Is this possible? -
I feel really bad that I can't figure this out. I've tried for days now and I'm sure there's a really simple solution. What I want is this: When EntityPlayer moves on ground, specifically the block, grass, I want the grass to change to a different block. This change has to be constant as they travel around the world. Any help is greatly appreciated!