Remove a bunch of deprecated methods
This commit is contained in:
@@ -75,39 +75,6 @@ public final class WizardryLoot {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method which gets a spell id according to the standard weighting. The tier is a weighted random value; the
|
||||
* actual spell within that tier is completely random. Will not return the id of a spell which has been disabled in
|
||||
* the config. This is for simple stuff like chests and drops; more complex generators like wizard trades don't use
|
||||
* this method.
|
||||
* <p></p>
|
||||
* For reference, the standard weighting is as follows: Novice: 60%, Apprentice: 25%, Advanced: 10%, Master: 5%
|
||||
*
|
||||
* @param random An instance of {@link Random} to use for RNG
|
||||
* @param filter A {@link Predicate} specifying any requirements the chosen spell must fulfil
|
||||
* @return A random spell id number, or -1 if no spell exists that satisfies the given filter
|
||||
* @deprecated Everything uses loot tables now, I may remove this as some point
|
||||
*/
|
||||
@Deprecated
|
||||
public static int getStandardWeightedRandomSpellId(Random random, Predicate<Spell> filter){
|
||||
|
||||
Tier tier = Tier.getWeightedRandomTier(random);
|
||||
|
||||
List<Spell> spells = Spell.getSpells(new Spell.TierElementFilter(tier, null));
|
||||
spells.removeIf(filter.negate());
|
||||
|
||||
// Ensures the tier chosen actually has spells in it, and if not uses NOVICE instead.
|
||||
if(spells.isEmpty()){
|
||||
spells = Spell.getSpells(new Spell.TierElementFilter(Tier.NOVICE, null));
|
||||
spells.removeIf(filter.negate());
|
||||
}
|
||||
|
||||
if(spells.isEmpty()) return -1;
|
||||
|
||||
// Finds a random spell in the list and returns its id.
|
||||
return spells.get(random.nextInt(spells.size())).metadata();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onLootTableLoadEvent(LootTableLoadEvent event){
|
||||
// General dungeon loot
|
||||
|
||||
@@ -211,7 +211,7 @@ public abstract class Spell extends IForgeRegistryEntry.Impl<Spell> implements C
|
||||
this.sounds = createSounds();
|
||||
this.id = nextSpellId++;
|
||||
this.items(WizardryItems.spell_book, WizardryItems.scroll);
|
||||
this.npcSelector((e, o) -> canBeCastByNPCs()); // Fallback to old behaviour until we remove it entirely
|
||||
this.npcSelector((e, o) -> false);
|
||||
}
|
||||
|
||||
// ========================================= Initialisation methods ===========================================
|
||||
@@ -488,17 +488,6 @@ public abstract class Spell extends IForgeRegistryEntry.Impl<Spell> implements C
|
||||
return npcSelector.test(npc, override);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether NPCs such as wizards can cast this spell. If you have overridden
|
||||
* {@link Spell#cast(World, EntityLiving, EnumHand, int, EntityLivingBase, SpellModifiers)}, you should override
|
||||
* this to return true.
|
||||
* @deprecated Use the entity-sensitive version {@link Spell#canBeCastBy(EntityLiving, boolean)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean canBeCastByNPCs(){
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the given dispenser can cast this spell. If you have overridden
|
||||
* {@link Spell#cast(World, double, double, double, EnumFacing, int, int, SpellModifiers)}, you should override this
|
||||
@@ -506,17 +495,6 @@ public abstract class Spell extends IForgeRegistryEntry.Impl<Spell> implements C
|
||||
* @param dispenser The dispenser to query.
|
||||
*/
|
||||
public boolean canBeCastBy(TileEntityDispenser dispenser){
|
||||
return canBeCastByDispensers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether dispensers can cast this spell. If you have overridden
|
||||
* {@link Spell#cast(World, double, double, double, EnumFacing, int, int, SpellModifiers)}, you should override this
|
||||
* to return true.
|
||||
* @deprecated Use the tileentity-sensitive version {@link Spell#canBeCastBy(TileEntityDispenser)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean canBeCastByDispensers(){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -250,27 +250,4 @@ public final class NBTExtras {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an NBTTagCompound which contains only the given UUID, stored using
|
||||
* {@link NBTTagCompound#setUniqueId(String, UUID)}. Allows for neater storage to NBTTagLists.
|
||||
* @deprecated Use {@link net.minecraft.nbt.NBTUtil#createUUIDTag(UUID)}. Note that this will break backwards
|
||||
* compatibility because it uses "M" and "L" instead of "uuidMost" and "uuidLeast".
|
||||
*/
|
||||
@Deprecated
|
||||
public static NBTTagCompound UUIDtoTagCompound(UUID id){
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setUniqueId("uuid", id);
|
||||
return tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for {@link NBTTagCompound#getUniqueId(String)} which converts an NBTTagCompound directly to a UUID.
|
||||
* Intended to be used as the inverse of {@link NBTExtras#UUIDtoTagCompound(UUID)}.
|
||||
* @deprecated Use {@link net.minecraft.nbt.NBTUtil#getUUIDFromTag(NBTTagCompound)}. Note that this will break
|
||||
* backwards compatibility because it uses "M" and "L" instead of "uuidMost" and "uuidLeast".
|
||||
*/
|
||||
@Deprecated
|
||||
public static UUID tagCompoundToUUID(NBTTagCompound tag){
|
||||
return tag.getUniqueId("uuid");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,62 +343,6 @@ public final class WizardryUtilities {
|
||||
return getNearestSurface(world, pos, EnumFacing.UP, range, true, SurfaceCriteria.COLLIDABLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the nearest floor level to the given y coord within the range specified at the given x and z coords.
|
||||
* As of Wizardry 4.2, this is now a wrapper for {@link WizardryUtilities#getNearestFloor(World, BlockPos, int)}
|
||||
* which retains the old functionality (i.e. returning an {@code int}, with -1 as 'not found') for compatibility.
|
||||
*
|
||||
* @param world The world to search in
|
||||
* @param pos The coordinates to search from
|
||||
* @param range The maximum distance from the given y coordinate to search.
|
||||
* @return The y coordinate of the closest floor level, or -1 if there is none. Returns the actual level of the
|
||||
* floor as would be seen in the debug screen when the player is standing on it.
|
||||
* @deprecated Use {@link WizardryUtilities#getNearestFloor(World, BlockPos, int)}; this method may be removed in
|
||||
* future.
|
||||
*/
|
||||
// Since this is always a y-coordinate, the 'not found' value can just be any negative number.
|
||||
@Deprecated
|
||||
public static int getNearestFloorLevel(World world, BlockPos pos, int range){
|
||||
Integer floor = getNearestFloor(world, pos, range);
|
||||
return floor == null ? -1 : floor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the nearest floor level to the given y coord within the range specified at the given x and z coords. Only
|
||||
* works if the block above the floor is actually air and the floor is solid or a liquid.
|
||||
*
|
||||
* @param world The world to search in
|
||||
* @param pos The coordinates to search from
|
||||
* @param range The maximum distance from the given y coordinate to search.
|
||||
* @return The y coordinate of the closest floor level, or -1 if there is none. Returns the actual level of the
|
||||
* floor as would be seen in the debug screen when the player is standing on it.
|
||||
* @deprecated Use {@link WizardryUtilities#getNearestSurface(World, BlockPos, EnumFacing, int, boolean, SurfaceCriteria)};
|
||||
* this method may be removed in future.
|
||||
*/
|
||||
@Deprecated
|
||||
public static int getNearestFloorLevelB(World world, BlockPos pos, int range){
|
||||
Integer floor = getNearestSurface(world, pos, EnumFacing.UP, range, true, SurfaceCriteria.SOLID_LIQUID_TO_AIR);
|
||||
return floor == null ? -1 : floor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the nearest floor level to the given y coord within the range specified at the given x and z coords.
|
||||
* Everything that is not air is treated as floor, even stuff that can't be walked on.
|
||||
*
|
||||
* @param world The world to search in
|
||||
* @param pos The coordinates to search from
|
||||
* @param range The maximum distance from the given y coordinate to search.
|
||||
* @return The y coordinate of the closest floor level, or -1 if there is none. Returns the actual level of the
|
||||
* floor as would be seen in the debug screen when the player is standing on it.
|
||||
* @deprecated Use {@link WizardryUtilities#getNearestSurface(World, BlockPos, EnumFacing, int, boolean, SurfaceCriteria)};
|
||||
* this method may be removed in future.
|
||||
*/
|
||||
@Deprecated
|
||||
public static int getNearestFloorLevelC(World world, BlockPos pos, int range){
|
||||
Integer floor = getNearestSurface(world, pos, EnumFacing.UP, range, true, SurfaceCriteria.NOT_AIR_TO_AIR);
|
||||
return floor == null ? -1 : floor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a random position on the ground near the given entity within the specified horizontal and vertical ranges.
|
||||
* Used to find a position to spawn entities in summoning spells.
|
||||
@@ -984,25 +928,6 @@ public final class WizardryUtilities {
|
||||
// Miscellaneous
|
||||
// ===============================================================================================================
|
||||
|
||||
/**
|
||||
* Verifies that the given string is a valid string representation of a UUID. More specifically, returns true if and
|
||||
* only if the given string is not null and matches the regular expression:
|
||||
* <p></p>
|
||||
* <center><code>/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/<p></code></center>
|
||||
* which is the regex equivalent of the standard string representation of a UUID as described in
|
||||
* {@link UUID#toString()}. This method is intended to be used as a check to prevent an
|
||||
* {@link IllegalArgumentException} from occurring when calling {@link UUID#fromString(String)}.
|
||||
*
|
||||
* @param string The string to be checked
|
||||
* @return Whether the given string is a valid string representation of a UUID
|
||||
* @deprecated UUIDs can now be stored in NBT directly; use that in preference to storing them as strings.
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean verifyUUIDString(String string){
|
||||
return string != null
|
||||
&& string.matches("/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/");
|
||||
}
|
||||
|
||||
/**
|
||||
* Flattens the given nested collection. The returned collection is an unmodifiable collection of all the elements
|
||||
* contained within all of the sub-collections of the given nested collection.
|
||||
|
||||
Reference in New Issue
Block a user