Jump to content

Losokos

Members
  • Posts

    14
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Losokos's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Been looking everywhere, just hope this helps someone. As of 1.19.2 the only way that doesn't cause problems would be to use push(). Unless someone is brighter than me lol. @SubscribeEvent public static void onLivingJump(LivingEvent.LivingJumpEvent event){ float jumpMultiplier = 0.07F; if (event.getEntity() instanceof Player){ event.getEntity().push(0,jumpMultiplier,0); }
  2. I mean, i uderstand i need to give it a Vec3 instead of BlockPos, but in order for me to use getBlockState i need a BlockPos. I am pretty new to java, so if i am getting something wrong here, please let me know..
  3. Does not work... error: incompatible types: Vec3 cannot be converted to BlockPos BlockPos posAbove = player.getPosition(1.0F);
  4. Oh yes, sorry haha here: error: method getPosition in class Entity cannot be applied to given types; BlockPos posAbove = player.getPosition().up(); ^ required: float found: no arguments reason: actual and formal argument lists differ in length
  5. BlockPos posAbove = player.getPosition().up(); BlockState blockStateAbove = world.getBlockState(posAbove); Block above = blockStateAbove.getBlock(); I've found a piece of code like this, but i am getting an error t the first line in .getPosition() I just have no idea what to place here in order for it to work properly... any suggestions???
  6. It was just a temporary solution, for me to check if lightning spawns at all... But i mean this works perfectly fine, and strikes lightning on player every second, but i guess i can use this method instead, cause this just feels wrong haha That is what i was thinking, but i was wondering if there are methods that would do this, thanks anyway
  7. package losokos.vce.custom; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LightningBolt; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraftforge.client.IBlockRenderProperties; import net.minecraftforge.common.extensions.IForgeBlockState; import java.util.concurrent.TimeUnit; public class CopperHelmetItem extends ArmorItem { public CopperHelmetItem(ArmorMaterial material, EquipmentSlot slot, Properties properties) { super(material, slot, properties); } @Override public void onArmorTick(ItemStack stack, Level world, Player player) { if (!world.isClientSide()){ BlockPos isOutside = player.getPosition().up(); IForgeBlockState blockStateAbove = world.getBlockState(isOutside); if(world.isThundering()){ //Adds "lightningEntity" that spawns lightning at players location Entity lightningEntity = new LightningBolt(EntityType.LIGHTNING_BOLT, world); lightningEntity.setPos(player.getX(),player.getY(),player.getZ()); try { Thread.sleep(1000); world.addFreshEntity(lightningEntity); } catch (InterruptedException e) { world.addFreshEntity(lightningEntity); } } } }} I am of course trying to check if all blocks above player are air blocks... How would i do that?
  8. Its my school project, haha... I didin't choose it, but i guess you are right.
  9. Thanks! Could you show me how to create a new instance of the entity? That would be really helpful!
  10. public class CopperHelmetItem extends ArmorItem { public CopperHelmetItem(ArmorMaterial material, EquipmentSlot slot, Properties properties) { super(material, slot, properties); } @Override public void onArmorTick(ItemStack stack, Level world, Player player) { if (!world.isClientSide()){ } } I would like to make an amor piece that summons lightning on the player when wearing it. I can't seem to find a method for spawning an entity in 1.18.1...
  11. Okay, thanks a lot! I will see if this works.
  12. Awesome! thanks, but i still need it for the tool breaking part, or do you have any other suggestions?
  13. I could not find any info on this ANYWHERE, and i've been searching for 2 days now... For context, i need to use some of optifine's functions into the mod, in order to do what i need to do. I've tried simply putting the optifine forge version into /run/mods folder, but that does not work. I've tried just putting optifine's source files into /src/ folder, does not work. I need optifine's methods in order to create a 3D custom armor model, so if there is any other way to do it, PLEASE let me know... I am also trying to create a tool set that changes its texture, depending on its durability level. I've downloaded and copy pasted code from "Broken Tools" mod ( changing its files accordingly of course ), and it does not work with my textures and my files, no matter what i try to change with it, i literally tried everything... And so i found out that optifine has the ability to do this for me. I am using IntelliJ IDEA.
  14. You could check for coordinates at which the lightning is struck instead...
×
×
  • Create New...

Important Information

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