Jump to content

vin0m

Members
  • Posts

    36
  • Joined

  • Last visited

Everything posted by vin0m

  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?
  16. I want to make some changes to the hunger/exhaustion system. I created a class that extends the EntityPlayer class and created overrides to the methods I needed to change. I'm guessing I need to initialize it somehow because it isn't overriding the default settings but, I'm not quite sure how to do it. Any help would be appreciated.
  17. I had a gut feeling. I disabled sponge and now it works fine.
  18. Yes that is the NPC. If you look at the images above you can see that matches what my mod sees for the UUID as well.
  19. When I type "/scoreboard teams list coalition" it shows the following: Does that not confirm that it is registered server-side?
  20. Yea I've been trying to figure out how to get it to work like that with no success yet.
  21. You misunderstood. The npc I'm wanting to get the team from is from the custom npc mod. The above code is how you set it within the mod in game. Regardless, if I set the team manually in game I still get the same result as above.
  22. I tried setting it manually "/scoreboard teams join coalition 0c0ffb44-42c5-49d6-a47b-4e7ac77e5e8f" . The results are the same as above.
  23. I set it through Custom NPC mod scripting tool: function init(event){ var npcUUID = event.npc.getUUID(); event.npc.world.getScoreboard().getTeam("coalition").addPlayer(npcUUID); }
  24. Here it is running with "if(world.isRemote)": The elTeam information is correct but the potion effect does not work. Here it is running with "if(!world.isRemote)": The elTeam information doesn't work at all but the potion effect is applied correctly.
  25. Here is the whole method: @Override public boolean onEntitySwing(EntityLivingBase entityIn, ItemStack stack) { EntityPlayer player = (EntityPlayer)entityIn; World world = player.getEntityWorld(); Item item = stack.getItem(); float cooldown = player.getCooldownTracker().getCooldown(item, 1.0F); if(cooldown == 0){ player.getCooldownTracker().setCooldown(this, 60); InventoryPlayer inv = player.inventory; int xpLevel = player.experienceLevel; radius = 5; if(xpLevel < requiredLevel){ inv.deleteStack(stack); } double x1 = player.posX-radius; double y1 = player.posY-radius; double z1 = player.posZ-radius; double x2 = player.posX+radius; double y2 = player.posY+radius; double z2 = player.posZ+radius; if(!world.isRemote){ AxisAlignedBB bb = new AxisAlignedBB(x1, y1, z1, x2, y2, z2); entL = world.getEntitiesWithinAABB(EntityLiving.class, bb); listSize = entL.size(); int i = 0; for(EntityLiving el : entL){ elName = el.getName(); elUUID = el.getUniqueID().toString(); elTeam = el.getTeam(); playerTeam = player.getTeam(); player.addChatMessage(new TextComponentString("Name: "+elName)); player.addChatMessage(new TextComponentString("elUUID: "+elUUID)); player.addChatMessage(new TextComponentString("elTeam: "+elTeam)); player.addChatMessage(new TextComponentString("playerTeam: "+playerTeam)); if(playerTeam != elTeam){ el.addPotionEffect(new PotionEffect(Potion.getPotionById(2), 100, 127)); } i++; } } EntityAOE cloud = new EntityAOE(world); cloud.setLocationAndAngles(player.posX, Math.floor(player.posY), player.posZ, player.rotationYaw, player.rotationPitch); cloud.setParticle(EnumParticleTypes.END_ROD); cloud.setColor(0xFFFFFF); cloud.setDuration(20); cloud.setRadius(radius); cloud.setWaitTime(0); world.spawnEntityInWorld(cloud); world.playSound(player, player.posX, player.posY, player.posZ, SoundHandler.wargroundshatter, SoundCategory.PLAYERS, 0.5F, world.rand.nextFloat() * 0.1F + 0.9F); } return true; }
×
×
  • Create New...

Important Information

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