Jump to content

kaydogz

Members
  • Posts

    106
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by kaydogz

  1. I changed everything to this: @SubscribeEvent public static void keyboardKey(final GuiScreenEvent.KeyboardKeyEvent event) { if (event.getGui() instanceof InventoryScreen || event.getGui() instanceof CreativeScreen) { ClientPlayerEntity player = Minecraft.getInstance().player; if (Minecraft.getInstance().gameSettings.keyBindForward.isPressed()) player.movementInput.forwardKeyDown = true; if (Minecraft.getInstance().gameSettings.keyBindBack.isPressed()) player.movementInput.backKeyDown = true; if (Minecraft.getInstance().gameSettings.keyBindLeft.isPressed()) player.movementInput.leftKeyDown = true; if (Minecraft.getInstance().gameSettings.keyBindRight.isPressed()) player.movementInput.rightKeyDown = true; if (Minecraft.getInstance().gameSettings.keyBindJump.isPressed()) player.movementInput.jump = true; if (Minecraft.getInstance().gameSettings.keyBindSprint.isPressed()) player.setSprinting(true); } } but nothing is happening when I try it.
  2. I want to make it so that the player can move around while they are in their inventory screen. I currently have this: @SubscribeEvent public static void keyboardKey(final GuiScreenEvent.KeyboardKeyEvent event) { if (event.getGui() instanceof InventoryScreen || event.getGui() instanceof CreativeScreen) { ClientPlayerEntity player = Minecraft.getInstance().player; if (Minecraft.getInstance().gameSettings.keyBindForward.isPressed()) LOGGER.log("Forward!"); if (Minecraft.getInstance().gameSettings.keyBindBack.isPressed()) LOGGER.log("Back!"); if (Minecraft.getInstance().gameSettings.keyBindLeft.isPressed()) LOGGER.log("Left!"); if (Minecraft.getInstance().gameSettings.keyBindRight.isPressed()) LOGGER.log("Right!"); if (Minecraft.getInstance().gameSettings.keyBindJump.isPressed() && player.onGround) player.jump(); } } but I have no idea how to simulate moving the character to the left, right, forward, or back (jumping works when holding, but it stops when I leave the inventory). I have tried searching for the vanilla class that controls player movement but to no avail. Any help would be appreciated.
  3. In between the line where you create the entity and the line where you render it, you need to put in: entity.rotationYaw = player.rotationYaw along with all of the other rotation variables, such as prevyaw, pitch, prevpitch, etc. basically every variable that has to do with the rotation of the entity
  4. Do: entity.XXXXX = player.XXXXX; with all of the rotation and visual variables and you're all set.
  5. Great all of those worked, but I have one last issue that has been bugging me for the last few days. I don't know how to change the player's hitbox to respect the entity's. I can change their EntitySize, but that is not the same as the actual hitbox.
  6. Add a capability to keep track of the damage amount
  7. I fixed the height issue but I still can't seem to figure out the rest
  8. This worked incredibly well, thanks so much. But there are a few issues that I am having. I need it to: - Change the height of the client's POV to correspond with that of the entity I am rendering - Make it so you cannot swim while the entity is being rendered - Make it so other mobs won't attack you - Render the player's hand to that of the different entity's If you could help me with one or two of these that would be great
  9. Its aight but I don't know how to do the rendering properly. The best I have is this: https://imgur.com/a/pw4FaM4 Rendering code: event.setCanceled(true); Entity entity = EntityType.byKey(GodsCrownItem.getSelectedMorphMobOf(stack).toString()).get().create(event.getEntity().world); Minecraft.getInstance().getRenderManager().getRenderer(entity.getClass()).doRender(entity, event.getX(), event.getY(), event.getZ(), event.getPlayer().rotationYaw, event.getPartialRenderTick()); Im probably doing this terribly wrong
  10. Just tried that and it seems that because I am canceling PlayerRenderEvent.Pre it is not firing PlayerRenderEvent.Post as a result. Is there any way to fix this?
  11. Basically, I want to make it so that whenever I hit a certain key, it changes the player's model from a player to the selected mob. Everything works except I have no clue as to how to change the renderer/model of the player to that of the selected mob. Here is the RenderLivingEvent.Pre: @SubscribeEvent public static void renderLivingPre(final RenderLivingEvent.Pre<?, ?> event) { if (event.getEntity() instanceof PlayerEntity) { PlayerEntity player = (PlayerEntity) event.getEntity(); if (GodsCrownItem.isWearingGodsCrown(player)) { ItemStack stack = player.inventory.armorInventory.get(3); if (GodsCrownItem.isGodsCrownMorphed(stack) && !GodsCrownItem.isSelectedMorphMobEmpty(stack)) { // Don't know how to change renderer. } } } } So, how would I go about changing the renderer of the player?
  12. Try adding bus=Mod.EventBusSubscriber.Bus.FORGE to your class annotation.
  13. Use player.addItemStackToInventory(...) instead of stack = new ItemStack. Also, why are you checking if target is an instance of LivingEntity? It is already defined as a LivingEntity. Did you mean to check if it is an instance of PlayerEntity?
  14. Nice! As soon as I get home I’ll test it out! Edit: It worked! Good fucking job man!
  15. ? The .ogg needs to be in assets/yourmodid/sounds/records, and the sounds.json needs to be in assets/yourmodid i don’t understand how you placed your music file in the vanilla directory
  16. Well, the record has to be a vanilla one for that to work, because your record is not located in assets/minecraft/sounds/records/, it is located in assets/yourmodid/sounds/records/
  17. I think the issue is that in the sounds.json, it categorizes the sound with the folder that it is in (the record part of “censoredid:records/song”. I’m guessing that it checks if it has the prefix of Minecraft:records, and if it does, it gives the record it’s attenuation properties. This is why vanilla discs work. However, since I am using my mod id, it doesn’t not recognize the category, hence not giving it attenuation. Idk, im probably wrong, but it’s my best guess. But the issue is definitely with the name parameter in the sounds.json, because changing the file location to a vanilla song (minecraft:records/stal) works perfectly
  18. Doesn't change anything, the sound still plays thousands of blocks away from the jukebox. And yes, I made sure the value for attenuation_distance was an integer. I even checked vanilla references of attenuation_distance to make sure I used it correctly, and I did. It just doesn't solve my issue.
  19. What do you mean by 'the sounds are already called in preinit" The problem is that forge registers items before soundevents. Your records don't play sound because when they were registered, the soundevents were null. Basically, you need to make it so that the soundevents are instantiated before the registration of items. You can do this in FMLPreInitializationEvent, because it fires before registration. You need to move this line soundEvent = (SoundEvent)new SoundEvent(rs).setRegistryName(rs); so that it gets called in FMLPreInitializationEvent. And in RegistryEvent.Register<SoundEvent>, you just need to pass each of the soundevents in event.getRegistry.registerAll(). If that doesn't work, remove the static from onRegisterSoundEvent. Also, the reason your sword works is because it uses the onItemRightClick (or something like that) method to play the sound, while records have the sound as a parameter.
  20. Try changing onRegisterSoundEvent to static Edit: Also, the issue may be that items are being initialized before the sounds are. In that case, in FMLPreInitializationEvent, you need to instantiate the sounds, and in RegistryEvent.Register<SoundEvent>, you need to register them.
  21. Your item initialization looks good. But I think I found the issue: SoundIndex.init is never being called
×
×
  • Create New...

Important Information

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