Everything posted by vin0m
-
[1.12.2] Issues with Modifying Max Health
Client and Server weren't synced up. Got it fixed.
-
[1.12.2] Issues with Modifying Max Health
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);
-
[1.12.2] Give Player an Item
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.
-
[1.12.2] Give Player an Item
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.
-
[1.12.2] Give Player an Item
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?
-
Weapon that ignores grass
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?
-
[1.10.2] Custom Repair Item
That was enough to help me figure it out. Thank you!
-
[1.10.2] Custom Repair Item
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); } }
-
[1.10.2] Entity Attributes
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);
-
[1.10.2] Entity Attributes
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); }
-
GUI and Scoreboard Info [1.10.2]
I got it working with Capabilities, thank you.
-
GUI and Scoreboard Info [1.10.2]
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())); } }
-
EntityPlayer Changes [1.10.2]
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); } }
-
EntityPlayer Changes [1.10.2]
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?
-
EntityPlayer Changes [1.10.2]
Gotcha. Could you point me towards a tutorial of some sort?
-
EntityPlayer Changes [1.10.2]
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.
-
Entity Team Info [1.10.2]
I had a gut feeling. I disabled sponge and now it works fine.
-
Entity Team Info [1.10.2]
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.
-
Entity Team Info [1.10.2]
When I type "/scoreboard teams list coalition" it shows the following: Does that not confirm that it is registered server-side?
-
Entity Team Info [1.10.2]
Yea I've been trying to figure out how to get it to work like that with no success yet.
-
Entity Team Info [1.10.2]
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.
-
Entity Team Info [1.10.2]
I tried setting it manually "/scoreboard teams join coalition 0c0ffb44-42c5-49d6-a47b-4e7ac77e5e8f" . The results are the same as above.
-
Entity Team Info [1.10.2]
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); }
-
Entity Team Info [1.10.2]
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.
-
Entity Team Info [1.10.2]
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; }
IPS spam blocked by CleanTalk.