mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 12:42:26 +00:00
Minor code and documentation cleanup. (#4664)
This commit is contained in:
52 files changed
+227
-249
No files matched your search
@@ -166,7 +166,7 @@ public class ForgeChunkManager
|
||||
* @param tickets The tickets to re-register. The list is immutable and cannot be manipulated directly. Copy it first.
|
||||
* @param world the world
|
||||
*/
|
||||
public void ticketsLoaded(List<Ticket> tickets, World world);
|
||||
void ticketsLoaded(List<Ticket> tickets, World world);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -197,7 +197,7 @@ public class ForgeChunkManager
|
||||
* to "maxTicketCount" size after the call returns and then offered to the other callback
|
||||
* method
|
||||
*/
|
||||
public List<Ticket> ticketsLoaded(List<Ticket> tickets, World world, int maxTicketCount);
|
||||
List<Ticket> ticketsLoaded(List<Ticket> tickets, World world, int maxTicketCount);
|
||||
}
|
||||
|
||||
public interface PlayerOrderedLoadingCallback extends LoadingCallback
|
||||
@@ -216,7 +216,7 @@ public class ForgeChunkManager
|
||||
* @return A list of the tickets this mod wishes to use. This list will subsequently be offered
|
||||
* to the main callback for action
|
||||
*/
|
||||
public ListMultimap<String, Ticket> playerTicketsLoaded(ListMultimap<String, Ticket> tickets, World world);
|
||||
ListMultimap<String, Ticket> playerTicketsLoaded(ListMultimap<String, Ticket> tickets, World world);
|
||||
}
|
||||
public enum Type
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ public interface IMinecartCollisionHandler
|
||||
* @param cart The cart that called the collision.
|
||||
* @param other The object it collided with.
|
||||
*/
|
||||
public void onEntityCollision(EntityMinecart cart, Entity other);
|
||||
void onEntityCollision(EntityMinecart cart, Entity other);
|
||||
|
||||
/**
|
||||
* This function replaced the function of the same name in EntityMinecart.
|
||||
@@ -48,7 +48,7 @@ public interface IMinecartCollisionHandler
|
||||
* @param other The entity requesting the collision box.
|
||||
* @return The collision box or null.
|
||||
*/
|
||||
public AxisAlignedBB getCollisionBox(EntityMinecart cart, Entity other);
|
||||
AxisAlignedBB getCollisionBox(EntityMinecart cart, Entity other);
|
||||
|
||||
/**
|
||||
* This function is used to define the box used for detecting minecart collisions.
|
||||
@@ -56,7 +56,7 @@ public interface IMinecartCollisionHandler
|
||||
* @param cart The cart for which the collision box was requested.
|
||||
* @return The collision box, cannot be null.
|
||||
*/
|
||||
public AxisAlignedBB getMinecartCollisionBox(EntityMinecart cart);
|
||||
AxisAlignedBB getMinecartCollisionBox(EntityMinecart cart);
|
||||
|
||||
/**
|
||||
* This function replaces the function of the same name in EntityMinecart.
|
||||
@@ -64,6 +64,6 @@ public interface IMinecartCollisionHandler
|
||||
* @param cart The cart for which the bounding box was requested.
|
||||
* @return The bounding box or null.
|
||||
*/
|
||||
public AxisAlignedBB getBoundingBox(EntityMinecart cart);
|
||||
AxisAlignedBB getBoundingBox(EntityMinecart cart);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@ import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public interface IPlantable
|
||||
{
|
||||
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos);
|
||||
public IBlockState getPlant(IBlockAccess world, BlockPos pos);
|
||||
EnumPlantType getPlantType(IBlockAccess world, BlockPos pos);
|
||||
IBlockState getPlant(IBlockAccess world, BlockPos pos);
|
||||
}
|
||||
@@ -43,12 +43,12 @@ public interface IShearable
|
||||
* Checks if the object is currently shearable
|
||||
* Example: Sheep return false when they have no wool
|
||||
*
|
||||
* @param item The itemstack that is being used, Possible to be null
|
||||
* @param world The current world
|
||||
* @param item The ItemStack that is being used, may be empty.
|
||||
* @param world The current world.
|
||||
* @param pos Block's position in world.
|
||||
* @return If this is shearable, and onSheared should be called.
|
||||
*/
|
||||
public boolean isShearable(@Nonnull ItemStack item, IBlockAccess world, BlockPos pos);
|
||||
boolean isShearable(@Nonnull ItemStack item, IBlockAccess world, BlockPos pos);
|
||||
|
||||
/**
|
||||
* Performs the shear function on this object.
|
||||
@@ -62,11 +62,12 @@ public interface IShearable
|
||||
* For entities, they should trust there internal location information
|
||||
* over the values passed into this function.
|
||||
*
|
||||
* @param item The itemstack that is being used, Possible to be null
|
||||
* @param world The current world
|
||||
* @param item The ItemStack that is being used, may be empty.
|
||||
* @param world The current world.
|
||||
* @param pos If this is a block, the block's position in world.
|
||||
* @param fortune The fortune level of the shears being used
|
||||
* @return A ArrayList containing all items from this shearing. Possible to be null.
|
||||
* @param fortune The fortune level of the shears being used.
|
||||
* @return A List containing all items from this shearing. May be empty.
|
||||
*/
|
||||
public List<ItemStack> onSheared(@Nonnull ItemStack item, IBlockAccess world, BlockPos pos, int fortune);
|
||||
@Nonnull
|
||||
List<ItemStack> onSheared(@Nonnull ItemStack item, IBlockAccess world, BlockPos pos, int fortune);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public interface ISpecialArmor
|
||||
* @param slot The armor slot the item is in.
|
||||
* @return A ArmorProperties instance holding information about how the armor effects damage.
|
||||
*/
|
||||
public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, int slot);
|
||||
ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, int slot);
|
||||
|
||||
/**
|
||||
* Get the displayed effective armor.
|
||||
@@ -70,7 +70,7 @@ public interface ISpecialArmor
|
||||
* @param slot The armor slot the item is in.
|
||||
* @return The number of armor points for display, 2 per shield.
|
||||
*/
|
||||
public abstract int getArmorDisplay(EntityPlayer player, @Nonnull ItemStack armor, int slot);
|
||||
int getArmorDisplay(EntityPlayer player, @Nonnull ItemStack armor, int slot);
|
||||
|
||||
/**
|
||||
* Applies damage to the ItemStack. The mod is responsible for reducing the
|
||||
@@ -84,7 +84,7 @@ public interface ISpecialArmor
|
||||
* @param damage The amount of damage being applied to the armor
|
||||
* @param slot The armor slot the item is in.
|
||||
*/
|
||||
public abstract void damageArmor(EntityLivingBase entity, @Nonnull ItemStack stack, DamageSource source, int damage, int slot);
|
||||
void damageArmor(EntityLivingBase entity, @Nonnull ItemStack stack, DamageSource source, int damage, int slot);
|
||||
|
||||
public static class ArmorProperties implements Comparable<ArmorProperties>
|
||||
{
|
||||
|
||||
@@ -27,5 +27,5 @@ package net.minecraftforge.common.animation;
|
||||
*/
|
||||
public interface ITimeValue
|
||||
{
|
||||
public float apply(float input);
|
||||
float apply(float input);
|
||||
}
|
||||
@@ -37,16 +37,16 @@ public interface SelectorHandler
|
||||
*
|
||||
* @param sender The {@link ICommandSender} that initiated the query
|
||||
*/
|
||||
public <T extends Entity> List<T> matchEntities(ICommandSender sender, String token, Class<? extends T> targetClass) throws CommandException;
|
||||
<T extends Entity> List<T> matchEntities(ICommandSender sender, String token, Class<? extends T> targetClass) throws CommandException;
|
||||
|
||||
/**
|
||||
* Returns whether the selector string potentially matches multiple entities
|
||||
*/
|
||||
public boolean matchesMultiplePlayers(String selectorStr) throws CommandException;
|
||||
boolean matchesMultiplePlayers(String selectorStr) throws CommandException;
|
||||
|
||||
/**
|
||||
* Returns whether the string matches the overall syntax of the selector<br>
|
||||
* <b>Note:</b> If this returns {@code false}, {@link #matchEntities} should return an empty list
|
||||
*/
|
||||
public boolean isSelector(String selectorStr);
|
||||
boolean isSelector(String selectorStr);
|
||||
}
|
||||
@@ -67,21 +67,21 @@ public @interface Config
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD, ElementType.TYPE})
|
||||
public @interface LangKey
|
||||
@interface LangKey
|
||||
{
|
||||
String value();
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface Comment
|
||||
@interface Comment
|
||||
{
|
||||
String[] value();
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface RangeInt
|
||||
@interface RangeInt
|
||||
{
|
||||
int min() default Integer.MIN_VALUE;
|
||||
int max() default Integer.MAX_VALUE;
|
||||
@@ -89,7 +89,7 @@ public @interface Config
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface RangeDouble
|
||||
@interface RangeDouble
|
||||
{
|
||||
double min() default Double.MIN_VALUE;
|
||||
double max() default Double.MAX_VALUE;
|
||||
@@ -97,18 +97,18 @@ public @interface Config
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface Name
|
||||
@interface Name
|
||||
{
|
||||
String value();
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD, ElementType.TYPE})
|
||||
public @interface RequiresMcRestart
|
||||
@interface RequiresMcRestart
|
||||
{}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD, ElementType.TYPE})
|
||||
public @interface RequiresWorldRestart
|
||||
@interface RequiresWorldRestart
|
||||
{}
|
||||
}
|
||||
@@ -9,27 +9,27 @@ public interface IFieldWrapper
|
||||
/**
|
||||
* @return The type adapter to serialize the values returned by getValue. Null if non-primitive.
|
||||
*/
|
||||
public ITypeAdapter getTypeAdapter();
|
||||
ITypeAdapter getTypeAdapter();
|
||||
|
||||
/**
|
||||
* @param field the field about which to retrieve information
|
||||
* @param instance The instance whose field shall be queried.
|
||||
* @return a list of keys handled by this field
|
||||
*/
|
||||
public String[] getKeys();
|
||||
String[] getKeys();
|
||||
|
||||
public Object getValue(String key);
|
||||
Object getValue(String key);
|
||||
|
||||
public void setValue(String key, Object value);
|
||||
void setValue(String key, Object value);
|
||||
|
||||
public boolean hasKey(String name);
|
||||
boolean hasKey(String name);
|
||||
|
||||
public boolean handlesKey(String name);
|
||||
boolean handlesKey(String name);
|
||||
|
||||
public void setupConfiguration(Configuration cfg, String desc, String langKey, boolean reqMCRestart, boolean reqWorldRestart);
|
||||
void setupConfiguration(Configuration cfg, String desc, String langKey, boolean reqMCRestart, boolean reqWorldRestart);
|
||||
|
||||
/**
|
||||
* @return the category name in which the entries should be saved.
|
||||
*/
|
||||
public String getCategory();
|
||||
String getCategory();
|
||||
}
|
||||
@@ -23,5 +23,5 @@ import java.util.function.BooleanSupplier;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
public interface IConditionFactory {
|
||||
public BooleanSupplier parse(JsonContext context, JsonObject json);
|
||||
BooleanSupplier parse(JsonContext context, JsonObject json);
|
||||
}
|
||||
@@ -27,5 +27,5 @@ import net.minecraft.item.crafting.Ingredient;
|
||||
public interface IIngredientFactory
|
||||
{
|
||||
@Nonnull //If you would return null throw JsonSyntaxException to explain why
|
||||
public Ingredient parse(JsonContext context, JsonObject json);
|
||||
Ingredient parse(JsonContext context, JsonObject json);
|
||||
}
|
||||
@@ -23,5 +23,5 @@ import com.google.gson.JsonObject;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
|
||||
public interface IRecipeFactory {
|
||||
public IRecipe parse(JsonContext context, JsonObject json);
|
||||
IRecipe parse(JsonContext context, JsonObject json);
|
||||
}
|
||||
@@ -27,6 +27,6 @@ import net.minecraft.item.crafting.IRecipe;
|
||||
*/
|
||||
public interface IShapedRecipe extends IRecipe
|
||||
{
|
||||
public int getRecipeWidth();
|
||||
public int getRecipeHeight();
|
||||
int getRecipeWidth();
|
||||
int getRecipeHeight();
|
||||
}
|
||||
@@ -29,9 +29,9 @@ import net.minecraft.util.EnumFacing;
|
||||
*/
|
||||
public interface ITransformation
|
||||
{
|
||||
public Matrix4f getMatrix();
|
||||
Matrix4f getMatrix();
|
||||
|
||||
public EnumFacing rotate(EnumFacing facing);
|
||||
EnumFacing rotate(EnumFacing facing);
|
||||
|
||||
public int rotate(EnumFacing facing, int vertexIndex);
|
||||
int rotate(EnumFacing facing, int vertexIndex);
|
||||
}
|
||||
@@ -19,25 +19,22 @@
|
||||
|
||||
package net.minecraftforge.common.property;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
||||
import java.util.Optional;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableTable;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
||||
public class ExtendedBlockState extends BlockStateContainer
|
||||
{
|
||||
@@ -98,7 +95,7 @@ public class ExtendedBlockState extends BlockStateContainer
|
||||
return this;
|
||||
}
|
||||
|
||||
if (Iterables.all(unlistedProperties.values(), Predicates.<Optional<?>>equalTo(Optional.empty())))
|
||||
if (unlistedProperties.values().stream().noneMatch(Optional::isPresent))
|
||||
{ // no dynamic properties present, looking up in the normal table
|
||||
return clean;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraft.world.gen.structure.StructureStrongholdPieces.Stronghold.Door;
|
||||
import net.minecraftforge.classloading.FMLForgePlugin;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -376,10 +377,8 @@ public class EnumHelper
|
||||
try
|
||||
{
|
||||
T[] previousValues = (T[])valuesField.get(enumType);
|
||||
List<T> values = new ArrayList<T>(Arrays.asList(previousValues));
|
||||
T newValue = makeEnum(enumType, enumName, values.size(), paramTypes, paramValues);
|
||||
values.add(newValue);
|
||||
setFailsafeFieldValue(valuesField, null, values.toArray((T[]) Array.newInstance(enumType, 0)));
|
||||
T newValue = makeEnum(enumType, enumName, previousValues.length, paramTypes, paramValues);
|
||||
setFailsafeFieldValue(valuesField, null, ArrayUtils.add(previousValues, newValue));
|
||||
cleanEnumCache(enumType);
|
||||
|
||||
return newValue;
|
||||
|
||||
@@ -22,5 +22,5 @@ import net.minecraft.util.datafix.IDataFixer;
|
||||
|
||||
public interface IDataFixerData extends IDataFixer
|
||||
{
|
||||
public int getVersion(String mod);
|
||||
int getVersion(String mod);
|
||||
}
|
||||
Reference in new issue
Block a user