Some entity patches.

This commit is contained in:
LexManos committed 2016-03-01 20:42:36 -08:00
1 parent 728319cbb5
commit ad788880e5
57 files changed
+697 -751

No files matched your search

@@ -21,7 +21,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
@@ -42,6 +45,7 @@ import net.minecraftforge.event.entity.EntityMountEvent;
import net.minecraftforge.event.entity.EntityStruckByLightningEvent;
import net.minecraftforge.event.entity.PlaySoundAtEntityEvent;
import net.minecraftforge.event.entity.item.ItemExpireEvent;
import net.minecraftforge.event.entity.living.LivingEntityUseItemEvent;
import net.minecraftforge.event.entity.living.LivingExperienceDropEvent;
import net.minecraftforge.event.entity.living.LivingHealEvent;
import net.minecraftforge.event.entity.living.LivingPackSizeEvent;
@@ -61,7 +65,6 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
import net.minecraftforge.event.entity.player.PlayerSetSpawnEvent;
import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
import net.minecraftforge.event.entity.player.PlayerUseItemEvent;
import net.minecraftforge.event.entity.player.PlayerWakeUpEvent;
import net.minecraftforge.event.entity.player.SleepingLocationCheckEvent;
import net.minecraftforge.event.entity.player.UseHoeEvent;
@@ -102,11 +105,11 @@ public class ForgeEventFactory
return event;
}
public static boolean doPlayerHarvestCheck(EntityPlayer player, Block block, boolean success)
public static boolean doPlayerHarvestCheck(EntityPlayer player, IBlockState state, boolean success)
{
PlayerEvent.HarvestCheck event = new PlayerEvent.HarvestCheck(player, block, success);
PlayerEvent.HarvestCheck event = new PlayerEvent.HarvestCheck(player, state, success);
MinecraftForge.EVENT_BUS.post(event);
return event.success;
return event.canHarvest();
}
public static float getBreakSpeed(EntityPlayer player, IBlockState state, float original, BlockPos pos)
@@ -128,9 +131,9 @@ public class ForgeEventFactory
return event;
}
public static void onPlayerDestroyItem(EntityPlayer player, ItemStack stack)
public static void onPlayerDestroyItem(EntityPlayer player, ItemStack stack, EnumHand hand)
{
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, stack));
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, stack, hand));
}
public static Result canEntitySpawn(EntityLiving entity, World world, float x, float y, float z)
@@ -212,26 +215,26 @@ public class ForgeEventFactory
return MinecraftForge.EVENT_BUS.post(new EntityStruckByLightningEvent(entity, bolt));
}
public static int onItemUseStart(EntityPlayer player, ItemStack item, int duration)
public static int onItemUseStart(EntityLivingBase entity, ItemStack item, int duration)
{
PlayerUseItemEvent event = new PlayerUseItemEvent.Start(player, item, duration);
LivingEntityUseItemEvent event = new LivingEntityUseItemEvent.Start(entity, item, duration);
return MinecraftForge.EVENT_BUS.post(event) ? -1 : event.duration;
}
public static int onItemUseTick(EntityPlayer player, ItemStack item, int duration)
public static int onItemUseTick(EntityLivingBase entity, ItemStack item, int duration)
{
PlayerUseItemEvent event = new PlayerUseItemEvent.Tick(player, item, duration);
LivingEntityUseItemEvent event = new LivingEntityUseItemEvent.Tick(entity, item, duration);
return MinecraftForge.EVENT_BUS.post(event) ? -1 : event.duration;
}
public static boolean onUseItemStop(EntityPlayer player, ItemStack item, int duration)
public static boolean onUseItemStop(EntityLivingBase entity, ItemStack item, int duration)
{
return MinecraftForge.EVENT_BUS.post(new PlayerUseItemEvent.Stop(player, item, duration));
return MinecraftForge.EVENT_BUS.post(new LivingEntityUseItemEvent.Stop(entity, item, duration));
}
public static ItemStack onItemUseFinish(EntityPlayer player, ItemStack item, int duration, ItemStack result)
public static ItemStack onItemUseFinish(EntityLivingBase entity, ItemStack item, int duration, ItemStack result)
{
PlayerUseItemEvent.Finish event = new PlayerUseItemEvent.Finish(player, item, duration, result);
LivingEntityUseItemEvent.Finish event = new LivingEntityUseItemEvent.Finish(entity, item, duration, result);
MinecraftForge.EVENT_BUS.post(event);
return event.result;
}
@@ -294,7 +297,7 @@ public class ForgeEventFactory
return 0;
}
public static ItemStack onBucketUse(EntityPlayer player, World world, ItemStack stack, MovingObjectPosition target)
public static ItemStack onBucketUse(EntityPlayer player, World world, ItemStack stack, RayTraceResult target)
{
FillBucketEvent event = new FillBucketEvent(player, stack, world, target);
if (MinecraftForge.EVENT_BUS.post(event)) return stack;
@@ -305,10 +308,10 @@ public class ForgeEventFactory
return stack;
if (--stack.stackSize <= 0)
return event.result;
return event.getFilledBucket();
if (!player.inventory.addItemStackToInventory(event.result))
player.dropPlayerItemWithRandomChoice(event.result, false);
if (!player.inventory.addItemStackToInventory(event.getFilledBucket()))
player.dropPlayerItemWithRandomChoice(event.getFilledBucket(), false);
return stack;
}
@@ -367,9 +370,9 @@ public class ForgeEventFactory
}
}
public static boolean canInteractWith(EntityPlayer player, Entity entity)
public static boolean canInteractWith(EntityPlayer player, Entity entity, ItemStack item, EnumHand hand)
{
return !MinecraftForge.EVENT_BUS.post(new EntityInteractEvent(player, entity));
return !MinecraftForge.EVENT_BUS.post(new EntityInteractEvent(player, entity, item, hand));
}
public static boolean canMountEntity(Entity entityMounting, Entity entityBeingMounted, boolean isMounting)
@@ -3,7 +3,6 @@ package net.minecraftforge.event;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.text.ITextComponent;
/**
@@ -26,11 +25,10 @@ import net.minecraft.util.text.ITextComponent;
@Cancelable
public class ServerChatEvent extends Event
{
public final String message, username;
public final EntityPlayerMP player;
@Deprecated //Use methods below
public ChatComponentTranslation component;
public ServerChatEvent(EntityPlayerMP player, String message, ChatComponentTranslation component)
private final String message, username;
private final EntityPlayerMP player;
private ITextComponent component;
public ServerChatEvent(EntityPlayerMP player, String message, ITextComponent component)
{
super();
this.message = message;
@@ -41,14 +39,15 @@ public class ServerChatEvent extends Event
public void setComponent(ITextComponent e)
{
if (e instanceof ChatComponentTranslation)
this.component = (ChatComponentTranslation)e;
else
this.component = new ChatComponentTranslation("%s", e);
this.component = e;
}
public ITextComponent getComponent()
{
return this.component;
}
public String getMessage() { return this.message; }
public String getUsername() { return this.username; }
public EntityPlayerMP getPlayer() { return this.player; }
}
@@ -1,17 +1,18 @@
package net.minecraftforge.event.entity.player;
package net.minecraftforge.event.entity.living;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public abstract class PlayerUseItemEvent extends PlayerEvent
public abstract class LivingEntityUseItemEvent extends LivingEvent
{
public final ItemStack item;
public int duration;
private PlayerUseItemEvent(EntityPlayer player, ItemStack item, int duration)
private LivingEntityUseItemEvent(EntityLivingBase entity, ItemStack item, int duration)
{
super(player);
super(entity);
this.item = item;
this.duration = duration;
}
@@ -28,11 +29,11 @@ public abstract class PlayerUseItemEvent extends PlayerEvent
*
*/
@Cancelable
public static class Start extends PlayerUseItemEvent
public static class Start extends LivingEntityUseItemEvent
{
public Start(EntityPlayer player, ItemStack item, int duration)
public Start(EntityLivingBase entity, ItemStack item, int duration)
{
super(player, item, duration);
super(entity, item, duration);
}
}
@@ -43,32 +44,32 @@ public abstract class PlayerUseItemEvent extends PlayerEvent
*
*/
@Cancelable
public static class Tick extends PlayerUseItemEvent
public static class Tick extends LivingEntityUseItemEvent
{
public Tick(EntityPlayer player, ItemStack item, int duration)
public Tick(EntityLivingBase entity, ItemStack item, int duration)
{
super(player, item, duration);
super(entity, item, duration);
}
}
/**
* Fired when a player stops using an item without the use duration timing out.
* Fired when a player stops using an item without the use duration timing out.
* Example:
* Stop eating 1/2 way through
* Stop defending with sword
* Stop drawing bow. This case would fire the arrow
*
*
* Duration on this event is how long the item had left in it's count down before 'finishing'
*
* Canceling this event will prevent the Item from being notified that it has stopped being used,
* Canceling this event will prevent the Item from being notified that it has stopped being used,
* The only vanilla item this would effect are bows, and it would cause them NOT to fire there arrow.
*/
@Cancelable
public static class Stop extends PlayerUseItemEvent
public static class Stop extends LivingEntityUseItemEvent
{
public Stop(EntityPlayer player, ItemStack item, int duration)
public Stop(EntityLivingBase entity, ItemStack item, int duration)
{
super(player, item, duration);
super(entity, item, duration);
}
}
@@ -76,18 +77,18 @@ public abstract class PlayerUseItemEvent extends PlayerEvent
* Fired after an item has fully finished being used.
* The item has been notified that it was used, and the item/result stacks reflect after that state.
* This means that when this is fired for a Potion, the potion effect has already been applied.
*
*
* If you wish to cancel those effects, you should cancel one of the above events.
*
*
* The result item stack is the stack that is placed in the player's inventory in replacement of the stack that is currently being used.
*
*/
public static class Finish extends PlayerUseItemEvent
public static class Finish extends LivingEntityUseItemEvent
{
public ItemStack result;
public Finish(EntityPlayer player, ItemStack item, int duration, ItemStack result)
public Finish(EntityLivingBase entity, ItemStack item, int duration, ItemStack result)
{
super(player, item, duration);
super(entity, item, duration);
this.result = result;
}
}
@@ -3,11 +3,13 @@ package net.minecraftforge.event.entity.minecart;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
/**
* MinecartInteractEvent is fired when a player interacts with a minecart. <br>
* This event is fired whenever a player interacts with a minecart in
* EntityMinecartContainer#interactFirst(EntityPlayer),
* EntityMinecartContainer#interactFirst(EntityPlayer),
* EntityMinecartEmpty#interactFirst(EntityPlayer)
* EntityMinecartFurnace#interactFirst(EntityPlayer)
* EntityMinecartHopper#interactFirst(EntityPlayer).<br>
@@ -24,11 +26,19 @@ import net.minecraft.entity.player.EntityPlayer;
@Cancelable
public class MinecartInteractEvent extends MinecartEvent
{
public final EntityPlayer player;
private final EntityPlayer player;
private final ItemStack item;
private final EnumHand hand;
public MinecartInteractEvent(EntityMinecart minecart, EntityPlayer player)
public MinecartInteractEvent(EntityMinecart minecart, EntityPlayer player, ItemStack item, EnumHand hand)
{
super(minecart);
this.player = player;
this.item = item;
this.hand = hand;
}
public EntityPlayer getPlayer() { return player; }
public ItemStack getItem() { return item; }
public EnumHand getHand() { return hand; }
}
@@ -4,6 +4,8 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
/**
* EntityInteractEvent is fired when a player interacts with an Entity.<br>
@@ -22,10 +24,18 @@ import net.minecraft.entity.player.EntityPlayer;
@Cancelable
public class EntityInteractEvent extends PlayerEvent
{
public final Entity target;
public EntityInteractEvent(EntityPlayer player, Entity target)
private final Entity target;
private final ItemStack item;
private final EnumHand hand;
public EntityInteractEvent(EntityPlayer player, Entity target, ItemStack item, EnumHand hand)
{
super(player);
this.target = target;
this.item = item;
this.hand = hand;
}
public Entity getTarget() { return this.target; }
public ItemStack getItem() { return this.item; }
public EnumHand getHand() { return this.hand; }
}
@@ -4,7 +4,7 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
@Cancelable
@@ -12,26 +12,32 @@ import net.minecraft.world.World;
public class FillBucketEvent extends PlayerEvent
{
/**
* This event is fired when a player attempts to use a Empty bucket, it
* This event is fired when a player attempts to use a Empty bucket, it
* can be canceled to completely prevent any further processing.
*
* If you set the result to 'ALLOW', it means that you have processed
* the event and wants the basic functionality of adding the new
*
* If you set the result to 'ALLOW', it means that you have processed
* the event and wants the basic functionality of adding the new
* ItemStack to your inventory and reducing the stack size to process.
* setResult(ALLOW) is the same as the old setHandeled();
*/
public final ItemStack current;
public final World world;
public final MovingObjectPosition target;
private final ItemStack current;
private final World world;
private final RayTraceResult target;
public ItemStack result;
private ItemStack result;
public FillBucketEvent(EntityPlayer player, ItemStack current, World world, MovingObjectPosition target)
public FillBucketEvent(EntityPlayer player, ItemStack current, World world, RayTraceResult target)
{
super(player);
this.current = current;
this.world = world;
this.target = target;
}
public ItemStack getEmptyBucket() { return this.current; }
public World getWorld(){ return this.world; }
public RayTraceResult getTarget() { return this.target; }
public ItemStack getFilledBucket() { return this.result; }
public void setFilledBucket(ItemStack bucket) { this.result = bucket; }
}
@@ -3,6 +3,7 @@ package net.minecraftforge.event.entity.player;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
/**
* PlayerDestroyItemEvent is fired when a player destroys an item.<br>
@@ -15,6 +16,7 @@ import net.minecraft.item.ItemStack;
* and ItemInWorldManager#activateBlockOrUseItem(EntityPlayer, World, ItemStack, int, int, int, int, float, float, float).<br>
* <br>
* {@link #original} contains the original ItemStack before the item was destroyed. <br>
* (@link #hand) contains the hand that the current item was held in.<br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
@@ -24,11 +26,16 @@ import net.minecraft.item.ItemStack;
**/
public class PlayerDestroyItemEvent extends PlayerEvent
{
public final ItemStack original;
public PlayerDestroyItemEvent(EntityPlayer player, ItemStack original)
private final ItemStack original;
private final EnumHand hand;
public PlayerDestroyItemEvent(EntityPlayer player, ItemStack original, EnumHand hand)
{
super(player);
this.original = original;
this.hand = hand;
}
public ItemStack getOriginal() { return this.original; }
public EnumHand getHand() { return this.hand; }
}
@@ -43,15 +43,19 @@ public class PlayerEvent extends LivingEvent
**/
public static class HarvestCheck extends PlayerEvent
{
public final Block block;
public boolean success;
private final IBlockState state;
private boolean success;
public HarvestCheck(EntityPlayer player, Block block, boolean success)
public HarvestCheck(EntityPlayer player, IBlockState state, boolean success)
{
super(player);
this.block = block;
this.state = state;
this.success = success;
}
public IBlockState getTargetBlock() { return this.state; }
public boolean canHarvest() { return this.success; }
public void setCanHarvest(boolean success){ this.success = success; }
}
/**
@@ -321,12 +321,6 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
return true;
}
@Override
public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos pos, IBlockState state)
{
return null;
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
@@ -14,7 +14,7 @@ import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.MathHelper;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.common.network.ByteBufUtils;
@@ -110,12 +110,12 @@ public abstract class FMLMessage {
}
public static class EntityAdjustMessage extends EntityMessage {
int serverX;
int serverY;
int serverZ;
long serverX;
long serverY;
long serverZ;
public EntityAdjustMessage() {}
public EntityAdjustMessage(Entity entity, int serverX, int serverY, int serverZ)
public EntityAdjustMessage(Entity entity, long serverX, long serverY, long serverZ)
{
super(entity);
this.serverX = serverX;
@@ -127,9 +127,9 @@ public abstract class FMLMessage {
void toBytes(ByteBuf buf)
{
super.toBytes(buf);
buf.writeInt(serverX);
buf.writeInt(serverY);
buf.writeInt(serverZ);
buf.writeLong(serverX);
buf.writeLong(serverY);
buf.writeLong(serverZ);
}
@Override
@@ -109,7 +109,7 @@ public class FMLNetworkHandler
}
public static void makeEntitySpawnAdjustment(Entity entity, EntityPlayerMP player, int serverX, int serverY, int serverZ)
public static void makeEntitySpawnAdjustment(Entity entity, EntityPlayerMP player, long serverX, long serverY, long serverZ)
{
EmbeddedChannel embeddedChannel = channelPair.get(Side.SERVER);
embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.PLAYER);
@@ -118,8 +118,6 @@ public class EntityRegistry
private ListMultimap<ModContainer, EntityRegistration> entityRegistrations = ArrayListMultimap.create();
private Map<String,ModContainer> entityNames = Maps.newHashMap();
private BiMap<Class<? extends Entity>, EntityRegistration> entityClassRegistrations = HashBiMap.create();
private Map<String, EntityList.EntityEggInfo> entityEggs = Maps.newHashMap();
private Map<String, EntityList.EntityEggInfo> entityEggsUn = Collections.unmodifiableMap(entityEggs);
public static EntityRegistry instance()
{
@@ -200,40 +198,6 @@ public class EntityRegistry
entityRegistrations.put(mc, er);
}
/**
* Registers a spawn egg for the specified entity class.
* The class must already be registered in the EntityList.classToStringMapping.
* This can be done either by using the global ID system, or preferably the registerModEntity functions above.
* Once registered mob eggs can be created by using minecraft:spawn_egg with NBT entry 'entity_name' with
* value of the name this class is registered in the classToStringMapping with.
*
* @param entityClass The entity class
* @param primary Primary egg color
* @param secondary Secondary egg color
*
* @throws IllegalArgumentException if entityClass is not registered in classToStringMapping.
*
*/
public static void registerEgg(Class<? extends Entity> entityClass, int primary, int secondary)
{
if (!EntityList.classToStringMapping.containsKey(entityClass))
throw new IllegalArgumentException("Entity not registered in classToString map: " + entityClass);
String name = (String)EntityList.classToStringMapping.get(entityClass);
EntityRegistry.instance().entityEggs.put(name, new EntityList.EntityEggInfo(name, primary, secondary));
FMLLog.fine("Registering entity egg '%s' for %s", name, entityClass);
}
/**
* Returns a Unmodifiable view of the registered entity eggs list.
*
* @return An Unmodifiable view of the registered entity eggs list.
*/
public static Map<String, EntityList.EntityEggInfo> getEggs()
{
return instance().entityEggsUn;
}
/**
* Registers in the minecraft Entity ID list. This is generally not a good idea and shouldn't be used.
* Simply use {@link #registerModEntity(Class, String, int, Object, int, int, boolean, int, int)} instead.
@@ -21,8 +21,8 @@ import org.apache.commons.lang3.Validate;
import org.apache.logging.log4j.Level;
import net.minecraft.util.ObjectIntIdentityMap;
import net.minecraft.util.RegistryNamespacedDefaultedByKey;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.RegistryNamespacedDefaultedByKey;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.functions.GenericIterableFactory;
import net.minecraftforge.fml.common.registry.RegistryDelegate.Delegate;
@@ -431,11 +431,10 @@ public class VillagerRegistry
},
{
new ListItemForEmeralds(Items.redstone, new PriceInfo(-4, -1)),
new ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()),
new PriceInfo(-2, -1))
new ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new PriceInfo(-2, -1))
},
{
new ListItemForEmeralds(Items.ender_eye, new PriceInfo(7, 11)),
new ListItemForEmeralds(Items.ender_pearl, new PriceInfo(4, 7)),
new ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new PriceInfo(-3, -1))
},
{
@@ -10,7 +10,7 @@ import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.server.ForgeTimeTracker;
@@ -113,7 +113,7 @@ public class ForgeCommand extends CommandBase {
{
ForgeTimeTracker.tileEntityTrackingDuration = duration;
ForgeTimeTracker.tileEntityTracking = true;
sender.addChatMessage(new ChatComponentTranslation("commands.forge.tracking.te.enabled", duration));
sender.addChatMessage(new TextComponentTranslation("commands.forge.tracking.te.enabled", duration));
}
private void doTPSLog(ICommandSender sender, String[] args)
@@ -136,17 +136,17 @@ public class ForgeCommand extends CommandBase {
{
double worldTickTime = ForgeCommand.mean(this.getServer().worldTickTimes.get(dimId)) * 1.0E-6D;
double worldTPS = Math.min(1000.0/worldTickTime, 20);
sender.addChatMessage(new ChatComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dimId), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
sender.addChatMessage(new TextComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dimId), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
}
double meanTickTime = ForgeCommand.mean(this.getServer().tickTimeArray) * 1.0E-6D;
double meanTPS = Math.min(1000.0/meanTickTime, 20);
sender.addChatMessage(new ChatComponentTranslation("commands.forge.tps.summary","Overall", timeFormatter.format(meanTickTime), timeFormatter.format(meanTPS)));
sender.addChatMessage(new TextComponentTranslation("commands.forge.tps.summary","Overall", timeFormatter.format(meanTickTime), timeFormatter.format(meanTPS)));
}
else
{
double worldTickTime = ForgeCommand.mean(this.getServer().worldTickTimes.get(dim)) * 1.0E-6D;
double worldTPS = Math.min(1000.0/worldTickTime, 20);
sender.addChatMessage(new ChatComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dim), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
sender.addChatMessage(new TextComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dim), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
}
}