Jump to content

vin0m

Members
  • Posts

    36
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Recent Profile Visitors

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

vin0m's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Client and Server weren't synced up. Got it fixed.
  2. I can modify the player's maxHealth via the code below but, I can't heal over 20 health. What am I doing wrong? AttributeModifier setHP = new AttributeModifier(playerUUID, "myHealthModifier", addHP, 0).setSaved(true); player.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).applyModifier(setHP);
  3. Apparently you can only set the item damage up to 4 digits. Anything over that and it fails to create the item. That was the issue.
  4. I am running it in my class "CommandGoldCoins implements ICommand {" in the section "public void execute(MinecraftServer server, ICommandSender sender, String[] input) throws CommandException". A part of this command modifies the current item damage. That works fine. It is also supposed to make a new item (code above) with a set damage amount. The new item does not appear in the inventory. It worked fine in 1.10.2 so I'm confused on what has changed.
  5. I am trying to give an item to a player and for some reason this code that was working in 1.10.2 will not work in 1.12.2. I can't figure out what I need to do differently. Code: ItemStack stack = new ItemStack(ModItems.goldSatchel); Item item = stack.getItem(); int newItemValue = maxItemDamage - value; item.setDamage(stack, newItemValue); player.inventory.addItemStackToInventory(stack); The new item is not placed in the players inventory. Did something change in 1.12?
  6. I've got a npc that is smaller than a grass block and if the npc is inside of it I can't hit with a sword. Is there anyway to make a sword that would ignore the grass block?
  7. That was enough to help me figure it out. Thank you!
  8. I am trying to repair my weapon with a custom item and I thought I had it figured out but it is not working. What I am I missing? I didn't copy over the whole class just the relevant bits, here is what I have so far: ModItems.class: public static final ToolMaterial metalLvl1 = EnumHelper.addToolMaterial(Reference.MODID + ":metalLvl1", 0, 120, 2.0F, 1.2F, 5); public static void init() { metalLvl1.setRepairItem(new ItemStack(ModItems.copperIngot, 1, 0)); swordCopper = new ItemWeapon(metalLvl1, "sword_copper"); } This works great for giving me the correct durability and damage for my weapon but the repairing does not work. Here is the ItemWeapon.class: public class ItemWeapon extends ItemSword{ public ItemWeapon(ToolMaterial materialIn, String name) { super(materialIn); setUnlocalizedName(name); setRegistryName(name); this.setMaxStackSize(1); } }
  9. In case anyone needs it, here is the code I used to change the movement speed: AttributeModifier boostSpeed = new AttributeModifier(playerUUID, "vmodspeed", 1.0D, 2).setSaved(true); ((EntityLivingBase) player).getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).removeAllModifiers(); ((EntityLivingBase) player).getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).applyModifier(boostSpeed);
  10. Is there any reason why in the code below the change to the health attribute will work but the movement speed does not? @SubscribeEvent public void onLogin(PlayerLoggedInEvent event){ Entity player = event.player; ((EntityLivingBase) player).getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(100.0D); ((EntityLivingBase) player).getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(50.0D); }
  11. I got it working with Capabilities, thank you.
  12. I am trying to render some information on screen for the players and I need to get some data from the scoreboard. The following code works fine in Single player but not on a server. What do I need to do to make this work when playing on a server? ManaBar public class ManaBar extends GuiIngame { public ManaBar(Minecraft mcIn) { super(mcIn); } private static final ResourceLocation texturepath = new ResourceLocation("vmod","textures/gui/mana_bar.png"); private int mana; private int maxMana; @SubscribeEvent public void onTick(PlayerTickEvent event) { EntityPlayer player = event.player; World world = player.getEntityWorld(); if(!world.isRemote){ MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); Scoreboard sb = world.getScoreboard(); mana = sb.getOrCreateScore(player.getName(),sb.getObjective("mana")).getScorePoints(); maxMana = sb.getOrCreateScore(player.getName(),sb.getObjective("maxMana")).getScorePoints(); } } ClientProxy public class ClientProxy extends CommonProxy { @Override public void init() { ModItems.registerRenders(); ModBlocks.registerRenders(); MinecraftForge.EVENT_BUS.register(new ManaBar(Minecraft.getMinecraft())); } }
  13. In the EntityPlayer class what are the p_71000_1_, p_71000_3_, and p_71000_5_? if (player.isInsideOfMaterial(Material.WATER)) { int i = Math.round(MathHelper.sqrt_double(p_71000_1_ * p_71000_1_ + p_71000_3_ * p_71000_3_ + p_71000_5_ * p_71000_5_) * 100.0F); if (i > 0) { player.addExhaustion(0.015F * (float)i * 0.01F); } }
  14. Awesome thank you. I've started messing around with the events now. Is there any particular event you'd recommend using to modify the exhaustion?
  15. Gotcha. Could you point me towards a tutorial of some sort?
×
×
  • Create New...

Important Information

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