Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

magic_man

Members
  • Joined

  • Last visited

Everything posted by magic_man

  1. @Override public InteractionResult onItemUseFirst(ItemStack stack, UseOnContext context) { //get all online players //check if one of those players is in spectator mode and has a max health of 0 //set player gamemode to survival and set their max health to 6 stack.setCount(stack.getCount() - 1); return super.onItemUseFirst(stack, context); }
  2. MinecraftServer.getPlayerList()
  3. but like i said before, getPlayerList() isn't an option after MinecraftServer
  4. how do i get all online players in a server
  5. an infinite loop is a loop that keeps looping until that condition is met, right?
  6. i tried this: @SubscribeEvent public static void playerRespawn(PlayerRespawnEvent event) { Player player = event.getPlayer(); player.getAttribute(Attributes.MAX_HEALTH).setBaseValue(playerhealth - 2); if (playerhealth == 2) { ((ServerPlayer) player).setGameMode(GameType.SPECTATOR); Vec3 playerPos = player.position(); teleportPlayer (player, playerPos); } } static void teleportPlayer(Player player, Vec3 position) { while (playerhealth == 0) { player.setpos(position); } } but it just crashed me...without crashing me. basically nothing worked anymore from what i know, because i was stuck in spectator and commands didn't work anymore
  7. how do i make a player not able to move, even in spectator?
  8. spectator mode makes it so you can teleport to other players and see their location. you can also use it as a sort of xray i wasn't done with it but as a temporary solution i was trying to make a dead player get tped to 0 -100 0 and make them keep dying of the void until they get revived
  9. in lifesteal, there is an item that when a player is banned, it can revive/unban that player and you get banned if you lose all your hearts if you don't trust me i can just send you all my code so it shows that i'm actually working on a lifesteal mod and not with some server wipe mod or something
  10. still doesnt seem to exist
  11. Server.getplayerlist() does not exist
  12. someone asked me to make a lifesteal mod and i'm trying to make a way to revive someone after he gets banned. but i also dont know how to even ban someone sooo thats why i'm here
  13. how to i detect who are banned, how to ban players, and how to unban them
  14. the way the entity is facing @Override public void performRangedAttack(LivingEntity p_33317_, float p_33318_) { if (this.distanceToSqr(p_33317_) >=10) { LightningBolt lightningbolt = new LightningBolt(EntityType.LIGHTNING_BOLT, this.level); //get the front of the entity //set the pos to (for example) 2 blocks in front of it this.level.addFreshEntity(lightningbolt); (the 'if distancetosqr' was an attempt to try alternate between attacks)
  15. i'm trying to make lightning spawn in front of my entity in a row as a sort of attack but don't know how to make it actually detect what the front is and how you move it from there. i also have a second question, i want my entity to have multiple attacks, but currently it only prioritizes one and never does the other one.
  16. my custom entity has a 3 block reach and it's impossible to hit it without it hitting you atleast twice how do i change this?
  17. i already did, but then i got that other error. my assumption is that it is caused by one of my events so here is that code: @Mod.EventBusSubscriber(modid = Electrified.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class ModEventBusEvents { @SubscribeEvent public static void entityAttributeEvent(EntityAttributeCreationEvent event) { event.put(ModEntityTypes.ANCIENT.get(), AncientBoss.setAttributes()); } } @Mod.EventBusSubscriber(modid = Electrified.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public class ModEventClientBusEvents { @SubscribeEvent private static void clientSetup(final FMLClientSetupEvent event) { EntityRenderers.register(ModEntityTypes.ANCIENT.get(), AncientRenderer::new); } }
  18. but it's my own mod.... edit: electrified:The_Ancient was supposed to be just ancient, but now i get a different error: illegal private member with @SubscribeEvent annotation
  19. still can't get getAttackStrengthScale to work code: @Override public void doPostAttack(LivingEntity pAttacker, Entity pTarget, int pLevel) { if(!pAttacker.level.isClientSide()) { ServerPlayer player = (ServerPlayer) pAttacker; if(pLevel == 1) { if (player.getAttackStrengthScale(0) >= 1.0F) { pTarget.setPos(pTarget.getX(), pTarget.getY() -0.8, pTarget.getZ());
  20. i also have a second question. how do i only make the enchantment work if the attack cooldown is fully charged? is there some sort of 'if' statement for it that i just couldn't find?
  21. i looked in the vanilla code and couldn't find anything about enchantments for only a specific tool.
  22. that worked, thx i was using a texture from someone else as a template but apparently he had it wrong which meaned mine broke as well

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.