From 8761c634cfc101c6add1a7f451ed4d675ed44ed2 Mon Sep 17 00:00:00 2001 From: OneEyeMaker Date: Mon, 25 Sep 2017 10:33:38 +0300 Subject: [PATCH] Added configuration for Teleport Staff --- .../mod/config/values/ConfigIntValues.java | 5 ++++- .../actuallyadditions/mod/items/ItemTeleStaff.java | 11 ++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java index 4dde77311..bdee844ad 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java @@ -45,7 +45,10 @@ public enum ConfigIntValues{ MAGNETISM_RING_ENERGY_USE("Ring Of Magnetism: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 50, 1, 1000000000, "Amount of energy Ring Of Magnetism uses to pick up item."), LIQUID_BANNING_RING_ENERGY_CAPACITY("Ring Of Liquid Banning: Energy Capacity", ConfigCategories.TOOL_ENERGY_VALUES, 800000, 1000, 1000000000, "Amount of energy Ring Of Liquid Banning can store."), LIQUID_BANNING_RING_ENERGY_TRANSFER("Ring Of Liquid Banning: Energy Transfer Rate", ConfigCategories.TOOL_ENERGY_VALUES, 1000, 1, 1000000000, "Amount of energy Ring Of Liquid Banning can receive per tick."), - LIQUID_BANNING_RING_ENERGY_USE("Ring Of Liquid Banning: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 150, 1, 1000000000, "Amount of energy Ring Of Liquid Banning uses to remove liquid block."); + LIQUID_BANNING_RING_ENERGY_USE("Ring Of Liquid Banning: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 150, 1, 1000000000, "Amount of energy Ring Of Liquid Banning uses to remove liquid block."), + TELEPORT_STAFF_ENERGY_CAPACITY("Teleport Staff: Energy Capacity", ConfigCategories.TOOL_ENERGY_VALUES, 250000, 1000, 1000000000, "Amount of energy Teleport Staff can store."), + TELEPORT_STAFF_ENERGY_TRANSFER("Teleport Staff: Energy Transfer Rate", ConfigCategories.TOOL_ENERGY_VALUES, 1000, 1, 1000000000, "Amount of energy Teleport Staff can receive per tick."), + TELEPORT_STAFF_ENERGY_USE("Teleport Staff: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 200, 1, 1000000000, "Amount of energy Teleport Staff uses to teleport per block."); public final String name; public final String category; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java index 460d6663a..f5602c7cd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java @@ -10,6 +10,7 @@ package de.ellpeck.actuallyadditions.mod.items; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.entity.player.EntityPlayer; @@ -28,7 +29,7 @@ import net.minecraft.world.World; public class ItemTeleStaff extends ItemEnergy{ public ItemTeleStaff(String name){ - super(250000, 1000, name); + super(ConfigIntValues.TELEPORT_STAFF_ENERGY_CAPACITY.getValue(), ConfigIntValues.TELEPORT_STAFF_ENERGY_TRANSFER.getValue(), name); } @Override @@ -42,14 +43,14 @@ public class ItemTeleStaff extends ItemEnergy{ double x = pos.hitVec.x-(side == 4 ? 0.5 : 0)+(side == 5 ? 0.5 : 0); double y = pos.hitVec.y-(side == 0 ? 2.0 : 0)+(side == 1 ? 0.5 : 0); double z = pos.hitVec.z-(side == 2 ? 0.5 : 0)+(side == 3 ? 0.5 : 0); - int baseUse = 200; - int use = baseUse+(int)(baseUse*pos.hitVec.distanceTo(new Vec3d(player.posX, player.posY+(player.getEyeHeight()-player.getDefaultEyeHeight()), player.posZ))); - if(this.getEnergyStored(stack) >= use){ + int baseEnergyUse = ConfigIntValues.TELEPORT_STAFF_ENERGY_USE.getValue(); + int energyUse = baseEnergyUse+(int)(baseEnergyUse*pos.hitVec.distanceTo(new Vec3d(player.posX, player.posY+(player.getEyeHeight()-player.getDefaultEyeHeight()), player.posZ))); + if(this.getEnergyStored(stack) >= energyUse){ ((EntityPlayerMP)player).connection.setPlayerLocation(x, y, z, player.rotationYaw, player.rotationPitch); player.dismountRidingEntity(); world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.PLAYERS, 1.0F, 1.0F); if(!player.capabilities.isCreativeMode){ - this.extractEnergyInternal(stack, use, false); + this.extractEnergyInternal(stack, energyUse, false); player.getCooldownTracker().setCooldown(this, 50); } return ActionResult.newResult(EnumActionResult.SUCCESS, stack);