Optimize Imports

This commit is contained in:
Kam committed 2024-02-15 17:54:28 -05:00
1 parent ec78673fa2
commit e46b78ff71
149 files changed
+931 -1029

No files matched your search

@@ -21,7 +21,6 @@ import net.minecraft.item.*;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.math.BlockPos;
@@ -14,9 +14,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import noppes.npcs.api.*;
import noppes.npcs.util.LRUHashMap;
import java.util.Map;
public class ScriptBlock implements IBlock {
protected IWorld world;
@@ -2,7 +2,6 @@ package noppes.npcs.scripted;
import net.minecraft.block.Block;
import net.minecraft.block.BlockAir;
import net.minecraft.block.BlockLiquid;
import net.minecraft.entity.Entity;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
@@ -11,7 +10,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTBase.NBTPrimitive;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
@@ -14,9 +14,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagIntArray;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import noppes.npcs.NoppesUtilPlayer;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.api.INbt;
import noppes.npcs.api.IParticle;
@@ -580,7 +578,7 @@ public class ScriptEntity<T extends Entity> implements IEntity {
compound.setString(key, (String)value);
saveStoredCompound(compound);
}
public void setStoredData(String key, int[] array){
NBTTagCompound compound = getStoredCompound();
compound.setIntArray(key, array);
@@ -694,7 +692,7 @@ public class ScriptEntity<T extends Entity> implements IEntity {
public String getTypeName(){
return EntityList.getEntityString(entity);
}
public void playSound(String name, float volume, float pitch) {
entity.playSound(name, volume, pitch);
}
@@ -920,4 +918,4 @@ public class ScriptEntity<T extends Entity> implements IEntity {
IWorld world = NpcAPI.Instance().getIWorld(entity.worldObj);
entity.dimension = world.getDimensionID();
}
}
}
@@ -17,13 +17,11 @@ import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.constants.EntityType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T> implements IEntityLivingBase {
protected T entity;
public ScriptLivingBase(T entity){
super(entity);
this.entity = entity;
@@ -35,7 +33,7 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
public float getHealth(){
return entity.getHealth();
}
/**
* @param health The new health of this entity
*/
@@ -112,7 +110,7 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
public boolean isAttacking(){
return entity.getAITarget() != null;
}
/**
* @param living Entity which this entity will attack
*/
@@ -122,7 +120,7 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
else
entity.setRevengeTarget(living.getMCEntity());
}
/**
* @return The entity which this entity is attacking
*/
@@ -216,7 +214,7 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
public IEntity[] getLookingAtEntities(int maxDistance, double offset, double range) {
return getLookingAtEntities(maxDistance,offset,range,true,false,true);
}
/**
* Expert use only
* @return Returns the minecraft entity object
@@ -235,7 +233,7 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
public void swingHand(){
entity.swingItem();
}
/**
* Works the same as the <a href="http://minecraft.wiki/w/Commands#effect">/effect command</a>
* @param effect
@@ -246,16 +244,16 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
public void addPotionEffect(int effect, int duration, int strength, boolean hideParticles){
if (effect < 0 || effect >= Potion.potionTypes.length || Potion.potionTypes[effect] == null)
return;
if(strength < 0)
strength = 0;
if(duration < 0)
duration = 0;
if(!Potion.potionTypes[effect].isInstant())
duration *= 20;
if(duration == 0)
entity.removePotionEffect(effect);
else
@@ -269,7 +267,7 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
public void clearPotionEffects(){
entity.clearActivePotions();
}
/**
* @since 1.7.10c
* @param effect Potion effect to check
@@ -281,7 +279,7 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
return -1;
return pf.getAmplifier();
}
/**
* Note not all Living Entities support this
* @since 1.7.10c
@@ -290,7 +288,7 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
public IItemStack getHeldItem(){
return NpcAPI.Instance().getIItemStack(entity.getHeldItem());
}
/**
* Note not all Living Entities support this
* @since 1.7.10c
@@ -299,7 +297,7 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
public void setHeldItem(IItemStack item){
entity.setCurrentItemOrArmor(0, item == null?null:item.getMCItemStack());
}
/**
* Note not all Living Entities support this
* @param slot Slot of what armor piece to get, 0:boots, 1:pants, 2:body, 3:head
@@ -308,7 +306,7 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
public IItemStack getArmor(int slot){
return NpcAPI.Instance().getIItemStack(entity.getEquipmentInSlot(slot + 1));
}
/**
* Note not all Living Entities support this
* @since 1.7.10c
@@ -31,7 +31,10 @@ import noppes.npcs.constants.EnumPacketClient;
import noppes.npcs.constants.EnumQuestRepeat;
import noppes.npcs.constants.EnumQuestType;
import noppes.npcs.containers.ContainerCustomGui;
import noppes.npcs.controllers.*;
import noppes.npcs.controllers.CustomGuiController;
import noppes.npcs.controllers.DialogController;
import noppes.npcs.controllers.PlayerDataController;
import noppes.npcs.controllers.QuestController;
import noppes.npcs.controllers.data.*;
import noppes.npcs.entity.EntityDialogNpc;
import noppes.npcs.scripted.NpcAPI;
@@ -55,14 +58,14 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
super(player);
this.player = player;
}
/**
* @return Returns the displayed name of the player
*/
public String getDisplayName(){
return player.getDisplayName();
}
}
/**
* @return Returns the players name
*/
@@ -235,12 +238,12 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
return;
removeQuest(quest.getId());
}
public boolean hasFinishedQuest(int id){
PlayerQuestData data = PlayerDataController.Instance.getPlayerData(player).questData;
return data.finishedQuests.containsKey(id);
}
public boolean hasActiveQuest(int id){
PlayerQuestData data = PlayerDataController.Instance.getPlayerData(player).questData;
return data.activeQuests.containsKey(id);
@@ -330,7 +333,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
data.factionData.increasePoints(faction, points-getFactionPoints(faction), player);
}
/**
/**
* @param faction The faction id
* @return points
*/
@@ -342,11 +345,11 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
public void sendMessage(String message){
player.addChatMessage(new ChatComponentTranslation(NoppesStringUtils.formatText(message,player)));
}
public void sendMessage(String message, String color, boolean bold, boolean italic, boolean underlined) {
sendMessage(message, color, bold, italic, underlined, false, false);
}
public void sendMessage(String message, String color, boolean bold, boolean italic, boolean obfuscated, boolean strikethrough, boolean underlined) {
EnumChatFormatting c = getColor(color);
@@ -365,7 +368,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
player.addChatMessage(chat);
}
private EnumChatFormatting getColor(String color) {
switch (color) {
case "black": return EnumChatFormatting.BLACK;
@@ -394,14 +397,14 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
public int getMode(){
return player.theItemInWorldManager.getGameType().getID();
}
/**
* @param type The gamemode type. 0:SURVIVAL, 1:CREATIVE, 2:ADVENTURE
*/
public void setMode(int type){
player.setGameType(WorldSettings.getGameTypeById(type));
}
/**
* @since 1.7.10d
* @return Returns a IItemStack array size 36
@@ -519,7 +522,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
return false;
}
}
/**
* @since 1.7.10c
* @param id The items name
@@ -530,10 +533,10 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
public boolean giveItem(String id, int damage, int amount){
Item item = (Item)Item.itemRegistry.getObject(id);
if(item == null)
return false;
return false;
return player.inventory.addItemStackToInventory(new ItemStack(item, amount, damage));
}
/**
* Same as the /spawnpoint command
* @param x The x position
@@ -550,7 +553,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
public void setSpawnpoint(IPos pos){
this.setSpawnpoint(pos.getX(),pos.getY(),pos.getZ());
}
public void resetSpawnpoint(){
player.setSpawnChunk(null, false);
}
@@ -639,7 +642,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
}
return player.func_147099_x().hasAchievementUnlocked((Achievement) statbase);
}
/**
* @param permission Bukkit/Cauldron permission
* @return Returns whether or not the player has the permission
@@ -655,7 +658,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
public int getExpLevel(){
return player.experienceLevel;
}
/**
* @since 1.7.10c
* @param level The new exp level you want to set
@@ -664,7 +667,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
player.experienceLevel = level;
player.addExperienceLevel(0);
}
/**
* Requires pixelmon to be installed
* @since 1.7.10d
@@ -1,14 +1,12 @@
package noppes.npcs.scripted.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import noppes.npcs.api.entity.IPlayer;
import noppes.npcs.api.event.ICustomGuiEvent;
import noppes.npcs.api.gui.ICustomGui;
import noppes.npcs.api.gui.IItemSlot;
import noppes.npcs.api.item.IItemStack;
import noppes.npcs.client.gui.custom.components.CustomGuiSlot;
import noppes.npcs.constants.EnumScriptType;
import noppes.npcs.scripted.NpcAPI;
@@ -10,7 +10,6 @@ import noppes.npcs.constants.EnumScriptType;
import noppes.npcs.controllers.ScriptContainer;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.controllers.data.INpcScriptHandler;
import noppes.npcs.controllers.data.IScriptHandler;
import noppes.npcs.scripted.CustomNPCsException;
import java.util.*;