tweak energy values in robots
This commit is contained in:
parent
d4a66f73eb
commit
457f69e5e0
14 changed files with 51 additions and 13 deletions
|
@ -24,7 +24,7 @@ import buildcraft.api.core.IZone;
|
||||||
public abstract class EntityRobotBase extends EntityLiving implements IInventory, IFluidHandler {
|
public abstract class EntityRobotBase extends EntityLiving implements IInventory, IFluidHandler {
|
||||||
|
|
||||||
public static final int MAX_ENERGY = 100000;
|
public static final int MAX_ENERGY = 100000;
|
||||||
public static final int SAFETY_ENERGY = MAX_ENERGY / 4;
|
public static final int SAFETY_ENERGY = MAX_ENERGY / 5;
|
||||||
public static final long NULL_ROBOT_ID = Long.MAX_VALUE;
|
public static final long NULL_ROBOT_ID = Long.MAX_VALUE;
|
||||||
|
|
||||||
public EntityRobotBase(World par1World) {
|
public EntityRobotBase(World par1World) {
|
||||||
|
|
36
common/buildcraft/core/lib/AchievementManager.java
Normal file
36
common/buildcraft/core/lib/AchievementManager.java
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
package buildcraft.core.lib;
|
||||||
|
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.stats.Achievement;
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||||
|
import net.minecraftforge.common.AchievementPage;
|
||||||
|
|
||||||
|
public class AchievementManager {
|
||||||
|
public AchievementPage page;
|
||||||
|
|
||||||
|
public AchievementManager(String name) {
|
||||||
|
page = new AchievementPage(name);
|
||||||
|
AchievementPage.registerAchievementPage(page);
|
||||||
|
|
||||||
|
FMLCommonHandler.instance().bus().register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Achievement registerAchievement(Achievement a) {
|
||||||
|
page.getAchievements().add(a.registerStat());
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onCrafting(PlayerEvent.ItemCraftedEvent event) {
|
||||||
|
Item item = event.crafting.getItem();
|
||||||
|
int damage = event.crafting.getItemDamage();
|
||||||
|
|
||||||
|
for (Achievement a : page.getAchievements()) {
|
||||||
|
if (item.equals(a.theItemStack.getItem()) && damage == a.theItemStack.getItemDamage()) {
|
||||||
|
event.player.addStat(a, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,6 +10,7 @@ package buildcraft.robots.ai;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
|
||||||
|
import buildcraft.api.blueprints.BuilderAPI;
|
||||||
import buildcraft.api.robots.AIRobot;
|
import buildcraft.api.robots.AIRobot;
|
||||||
import buildcraft.api.robots.EntityRobotBase;
|
import buildcraft.api.robots.EntityRobotBase;
|
||||||
import buildcraft.robots.EntityRobot;
|
import buildcraft.robots.EntityRobot;
|
||||||
|
@ -87,6 +88,6 @@ public class AIRobotAttack extends AIRobot {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyCost() {
|
public int getEnergyCost() {
|
||||||
return 50;
|
return (BuilderAPI.BREAK_ENERGY * 2 / 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.world.WorldServer;
|
||||||
|
|
||||||
import net.minecraftforge.common.ForgeHooks;
|
import net.minecraftforge.common.ForgeHooks;
|
||||||
|
|
||||||
|
import buildcraft.api.blueprints.BuilderAPI;
|
||||||
import buildcraft.api.core.BlockIndex;
|
import buildcraft.api.core.BlockIndex;
|
||||||
import buildcraft.api.robots.AIRobot;
|
import buildcraft.api.robots.AIRobot;
|
||||||
import buildcraft.api.robots.EntityRobotBase;
|
import buildcraft.api.robots.EntityRobotBase;
|
||||||
|
@ -129,7 +130,7 @@ public class AIRobotBreak extends AIRobot {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyCost() {
|
public int getEnergyCost() {
|
||||||
return 30;
|
return (int) Math.ceil((float) BuilderAPI.BREAK_ENERGY * 2 / 30.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -35,7 +35,7 @@ public abstract class AIRobotCraftGeneric extends AIRobot {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyCost() {
|
public int getEnergyCost() {
|
||||||
return 10;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,6 +159,6 @@ public class AIRobotFetchItem extends AIRobot {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyCost() {
|
public int getEnergyCost() {
|
||||||
return 20;
|
return 15;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,6 @@ public abstract class AIRobotGoto extends AIRobot {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyCost() {
|
public int getEnergyCost() {
|
||||||
return 10;
|
return 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,6 +116,6 @@ public class AIRobotLoad extends AIRobot {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyCost() {
|
public int getEnergyCost() {
|
||||||
return 20;
|
return 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ public class AIRobotLoadFluids extends AIRobot {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyCost() {
|
public int getEnergyCost() {
|
||||||
return 20;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class AIRobotPumpBlock extends AIRobot {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyCost() {
|
public int getEnergyCost() {
|
||||||
return 30;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class AIRobotStripesHandler extends AIRobot implements IStripesActivator
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyCost() {
|
public int getEnergyCost() {
|
||||||
return 70;
|
return 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class AIRobotUnload extends AIRobot {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyCost() {
|
public int getEnergyCost() {
|
||||||
return 20;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class AIRobotUnloadFluids extends AIRobot {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyCost() {
|
public int getEnergyCost() {
|
||||||
return 20;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -70,6 +70,6 @@ public class AIRobotUseToolOnBlock extends AIRobot {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyCost() {
|
public int getEnergyCost() {
|
||||||
return 30;
|
return 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue