Jump to content

NoNameGuy

Members
  • Posts

    2
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Location
    Heaven

NoNameGuy's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. thanks for your reply. That helps a lot.The only thing I don't understand is that i don't own dersichkeinennamenausdenkenkann.com? What do you mean at that point?
  2. So I made this mod a while ago where I had an item, that adds a lightningboltentity to whatever block you look. Turns out that it doesn't function properly on a dedicated server. Can anyone tell me what the issue is? Here is the code: package com.dersichkeinennamenausdenkenkann.somethings.items; import java.util.List; import com.dersichkeinennamenausdenkenkann.somethings.SomeMod; import com.dersichkeinennamenausdenkenkann.somethings.util.helpers.KeyHelpStuff; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.effect.LightningBoltEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; public class Cross extends Item { public Cross() { super(new Item.Properties() .group(SomeMod.SomethingItemGroup.instance) .maxStackSize(1) ); } public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) { if(KeyHelpStuff.isHoldingShift()) { tooltip.add(new StringTextComponent("With this Item, you will be able to summon some dawm sick lightningbolts. But they hurt... Just so you know")); } else { tooltip.add(new StringTextComponent("Hold" + "\u00A7b" + " SHIFT " + "\u00A7f" + "for more Information!")); } super.addInformation(stack, worldIn, tooltip, flagIn); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn){ if(!(worldIn instanceof ServerWorld)) return new ActionResult<>(ActionResultType.PASS, playerIn.getHeldItem(handIn)); RayTraceResult lookingAt = Minecraft.getInstance().objectMouseOver; if (lookingAt != null && lookingAt.getType() == RayTraceResult.Type.BLOCK) { double x = lookingAt.getHitVec().getX(); double y = lookingAt.getHitVec().getY(); double z = lookingAt.getHitVec().getZ(); ((ServerWorld) worldIn).addLightningBolt(new LightningBoltEntity(worldIn, x, y, z, false)); } // not looking at block return super.onItemRightClick(worldIn, playerIn, handIn); } @Override public boolean canPlayerBreakBlockWhileHolding(BlockState state, World worldIn, BlockPos pos, PlayerEntity player) { return false; } } or is it something other than the lightning that is added?
×
×
  • Create New...

Important Information

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