-
Posts
37 -
Joined
-
Last visited
Everything posted by magic_man
-
@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); }
-
MinecraftServer.getPlayerList()
-
but like i said before, getPlayerList() isn't an option after MinecraftServer
-
how do i get all online players in a server
-
an infinite loop is a loop that keeps looping until that condition is met, right?
-
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
-
how do i make a player not able to move, even in spectator?
-
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
-
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
-
still doesnt seem to exist
-
Server.getplayerlist() does not exist
-
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
-
how to i detect who are banned, how to ban players, and how to unban them
-
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)
-
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.
-
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?
-
getting errors after trying to add an entity with geckolib
magic_man replied to magic_man's topic in Support & Bug Reports
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); } } -
getting errors after trying to add an entity with geckolib
magic_man replied to magic_man's topic in Support & Bug Reports
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 -
make an enchantment specifically for a shovel
magic_man replied to magic_man's topic in Modder Support
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()); -
make an enchantment specifically for a shovel
magic_man replied to magic_man's topic in Modder Support
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? -
i looked in the vanilla code and couldn't find anything about enchantments for only a specific tool.
-
when equiping my custom boots they use the texture layer of leggings
magic_man replied to magic_man's topic in Modder Support
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