Minor code and documentation cleanup. (#4664)

This commit is contained in:
mezz authored and GitHub committed 2018-01-12 23:54:29 -08:00
1 parent 0c0cb2b11a
commit d0bdb23300
52 files changed
+227 -249

No files matched your search

@@ -19,14 +19,18 @@
package net.minecraftforge.client;
/**
* @deprecated TODO remove in 1.13. This has never been used
*/
@Deprecated
public interface IRenderContextHandler
{
/** Run before the specified rendering context.
*/
public void beforeRenderContext();
void beforeRenderContext();
/** Run after the specified rendering context.
*/
public void afterRenderContext();
void afterRenderContext();
}
@@ -28,10 +28,10 @@ public interface ICustomModelLoader extends IResourceManagerReloadListener
* Checks if given model should be loaded by this loader.
* Reading file contents is inadvisable, if possible decision should be made based on the location alone.
*/
public boolean accepts(ResourceLocation modelLocation);
boolean accepts(ResourceLocation modelLocation);
/*
* loads (or reloads) specified model
*/
public IModel loadModel(ResourceLocation modelLocation) throws Exception;
IModel loadModel(ResourceLocation modelLocation) throws Exception;
}
@@ -106,6 +106,9 @@ import com.google.common.base.Joiner;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import com.google.common.base.Predicate;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
@@ -208,8 +211,10 @@ public final class ModelLoader extends ModelBakery
@Override
protected void loadBlocks()
{
List<Block> blocks = Lists.newArrayList(Iterables.filter(Block.REGISTRY, block -> block.getRegistryName() != null));
blocks.sort(Comparator.comparing(b -> b.getRegistryName().toString()));
List<Block> blocks = StreamSupport.stream(Block.REGISTRY.spliterator(), false)
.filter(block -> block.getRegistryName() != null)
.sorted(Comparator.comparing(b -> b.getRegistryName().toString()))
.collect(Collectors.toList());
ProgressBar blockBar = ProgressManager.push("ModelLoader: blocks", blocks.size());
BlockStateMapper mapper = this.blockModelShapes.getBlockStateMapper();
@@ -280,8 +285,10 @@ public final class ModelLoader extends ModelBakery
registerVariantNames();
List<Item> items = Lists.newArrayList(Iterables.filter(Item.REGISTRY, item -> item.getRegistryName() != null));
Collections.sort(items, (i1, i2) -> i1.getRegistryName().toString().compareTo(i2.getRegistryName().toString()));
List<Item> items = StreamSupport.stream(Item.REGISTRY.spliterator(), false)
.filter(item -> item.getRegistryName() != null)
.sorted(Comparator.comparing(i -> i.getRegistryName().toString()))
.collect(Collectors.toList());
ProgressBar itemBar = ProgressManager.push("ModelLoader: items", items.size());
for(Item item : items)
@@ -34,36 +34,18 @@ import net.minecraftforge.common.ForgeModContainer;
public class ForgeBlockModelRenderer extends BlockModelRenderer
{
private final ThreadLocal<VertexLighterFlat> lighterFlat = new ThreadLocal<VertexLighterFlat>()
{
@Override
protected VertexLighterFlat initialValue()
{
return new VertexLighterFlat(colors);
}
};
private final ThreadLocal<VertexLighterSmoothAo> lighterSmooth = new ThreadLocal<VertexLighterSmoothAo>()
{
@Override
protected VertexLighterSmoothAo initialValue()
{
return new VertexLighterSmoothAo(colors);
}
};
private final ThreadLocal<VertexLighterFlat> lighterFlat;
private final ThreadLocal<VertexLighterSmoothAo> lighterSmooth;
private final ThreadLocal<VertexBufferConsumer> wrFlat = new ThreadLocal<>();
private final ThreadLocal<VertexBufferConsumer> wrSmooth = new ThreadLocal<>();
private final ThreadLocal<BufferBuilder> lastRendererFlat = new ThreadLocal<>();
private final ThreadLocal<BufferBuilder> lastRendererSmooth = new ThreadLocal<>();
private final BlockColors colors;
public ForgeBlockModelRenderer(BlockColors colors)
{
// TODO Auto-generated constructor stub
super(colors);
this.colors = colors;
lighterFlat = ThreadLocal.withInitial(() -> new VertexLighterFlat(colors));
lighterSmooth = ThreadLocal.withInitial(() -> new VertexLighterSmoothAo(colors));
}
@Override
@@ -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);
}
@@ -675,7 +675,7 @@ public class FMLClientHandler implements IFMLSidedHandler
}
catch (NoSuchMethodException e)
{
FMLLog.log.error("The container {} (type {}) returned an invalid class for it's resource pack.", container.getName(), container.getClass().getName());
FMLLog.log.error("The container {} (type {}) returned an invalid class for its resource pack.", container.getName(), container.getClass().getName());
}
catch (Exception e)
{
@@ -34,13 +34,13 @@ public interface IModGuiFactory {
*
* @param minecraftInstance the instance
*/
public void initialize(Minecraft minecraftInstance);
void initialize(Minecraft minecraftInstance);
/**
* If this method returns false, the config button in the mod list will be disabled
* @return true if this object provides a config gui screen, false otherwise
*/
public boolean hasConfigGui();
boolean hasConfigGui();
/**
* Return an initialized {@link GuiScreen}. This screen will be displayed
@@ -62,7 +62,7 @@ public interface IModGuiFactory {
* @return A class that will be instantiated on clicks on the config button
* or null if no GUI is desired.
*/
public GuiScreen createConfigGui(GuiScreen parentScreen);
GuiScreen createConfigGui(GuiScreen parentScreen);
/**
* Return a list of the "runtime" categories this mod wishes to populate with
@@ -84,7 +84,7 @@ public interface IModGuiFactory {
*
* @return the set of options this mod wishes to have available, or empty if none
*/
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories();
Set<RuntimeOptionCategoryElement> runtimeGuiCategories();
/**
* Represents an option category and entry in the runtime gui options list.
@@ -1692,45 +1692,45 @@ public class GuiConfigEntries extends GuiListExtended
* Gets the IConfigElement object owned by this entry.
* @return
*/
public IConfigElement getConfigElement();
IConfigElement getConfigElement();
/**
* Gets the name of the ConfigElement owned by this entry.
*/
public String getName();
String getName();
/**
* Gets the current value of this entry.
*/
public Object getCurrentValue();
Object getCurrentValue();
/**
* Gets the current values of this list entry.
*/
public Object[] getCurrentValues();
Object[] getCurrentValues();
/**
* Is this list entry enabled?
*
* @return true if this entry's controls should be enabled, false otherwise.
*/
public boolean enabled();
boolean enabled();
/**
* Handles user keystrokes for any GuiTextField objects in this entry. Call {@link GuiTextField#textboxKeyTyped(char, int)} for any GuiTextField
* objects that should receive the input provided.
*/
public void keyTyped(char eventChar, int eventKey);
void keyTyped(char eventChar, int eventKey);
/**
* Call {@link GuiTextField#updateCursorCounter()} for any GuiTextField objects in this entry.
*/
public void updateCursorCounter();
void updateCursorCounter();
/**
* Call {@link GuiTextField#mouseClicked(int, int, int)} for and GuiTextField objects in this entry.
*/
public void mouseClicked(int x, int y, int mouseEvent);
void mouseClicked(int x, int y, int mouseEvent);
/**
* Is this entry's value equal to the default value? Generally true should be returned if this entry is not a property or category
@@ -1738,50 +1738,50 @@ public class GuiConfigEntries extends GuiListExtended
*
* @return true if this entry's value is equal to this entry's default value.
*/
public boolean isDefault();
boolean isDefault();
/**
* Sets this entry's value to the default value.
*/
public void setToDefault();
void setToDefault();
/**
* Handles reverting any changes that have occurred to this entry.
*/
public void undoChanges();
void undoChanges();
/**
* Has the value of this entry changed?
*
* @return true if changes have been made to this entry's value, false otherwise.
*/
public boolean isChanged();
boolean isChanged();
/**
* Handles saving any changes that have been made to this entry back to the underlying object. It is a good practice to check
* isChanged() before performing the save action. This method should return true if the element has changed AND REQUIRES A RESTART.
*/
public boolean saveConfigElement();
boolean saveConfigElement();
/**
* Handles drawing any tooltips that apply to this entry. This method is called after all other GUI elements have been drawn to the
* screen, so it could also be used to draw any GUI element that needs to be drawn after all entries have had drawEntry() called.
*/
public void drawToolTip(int mouseX, int mouseY);
void drawToolTip(int mouseX, int mouseY);
/**
* Gets this entry's label width.
*/
public int getLabelWidth();
int getLabelWidth();
/**
* Gets this entry's right-hand x boundary. This value is used to control where the scroll bar is placed.
*/
public int getEntryRightBound();
int getEntryRightBound();
/**
* This method is called when the parent GUI is closed. Most handlers won't need this; it is provided for special cases.
*/
public void onGuiClosed();
void onGuiClosed();
}
}
@@ -691,16 +691,16 @@ public class GuiEditArrayEntries extends GuiListExtended
public static interface IArrayEntry extends GuiListExtended.IGuiListEntry
{
public void keyTyped(char eventChar, int eventKey);
void keyTyped(char eventChar, int eventKey);
public void updateCursorCounter();
void updateCursorCounter();
public void mouseClicked(int x, int y, int mouseEvent);
void mouseClicked(int x, int y, int mouseEvent);
public void drawToolTip(int mouseX, int mouseY);
void drawToolTip(int mouseX, int mouseY);
public boolean isValueSavable();
boolean isValueSavable();
public Object getValue();
Object getValue();
}
}
@@ -200,6 +200,6 @@ public class GuiSelectStringEntries extends GuiListExtended
public static interface IGuiSelectStringListEntry extends GuiListExtended.IGuiListEntry
{
public Object getValue();
Object getValue();
}
}
@@ -35,7 +35,7 @@ public interface IConfigElement
/**
* [Property, Category] Is this object a property object?
*/
public boolean isProperty();
boolean isProperty();
/**
* This method returns a class that implements {@link IConfigEntry} or null. This class MUST
@@ -47,7 +47,7 @@ public interface IConfigElement
* @see GuiConfigEntries.DoubleEntry
* @see GuiConfigEntries.IntegerEntry
*/
public Class<? extends IConfigEntry> getConfigEntryClass();
Class<? extends IConfigEntry> getConfigEntryClass();
/**
* This method returns a class that implements {@link IArrayEntry}. This class MUST provide a constructor with the
@@ -59,131 +59,131 @@ public interface IConfigElement
* @see GuiEditArrayEntries.DoubleEntry
* @see GuiEditArrayEntries.IntegerEntry
*/
public Class<? extends IArrayEntry> getArrayEntryClass();
Class<? extends IArrayEntry> getArrayEntryClass();
/**
* [Property, Category] Gets the name of this object.
*/
public String getName();
String getName();
/**
* [Category] Gets the qualified name of this object. This is typically only used for category objects.
*/
public String getQualifiedName();
String getQualifiedName();
/**
* [Property, Category] Gets a language key for localization of config GUI entry names. If the same key is specified with .tooltip
* appended to the end, that key will return a localized tooltip when the mouse hovers over the property label/category button.
*/
public String getLanguageKey();
String getLanguageKey();
/**
* [Property, Category] Gets the comment for this object. Used for the tooltip if getLanguageKey() + ".tooltip" is not defined in the
* .lang file.
*/
public String getComment();
String getComment();
/**
* [Category] Gets this category's child categories/properties.
*/
public List<IConfigElement> getChildElements();
List<IConfigElement> getChildElements();
/**
* [Property, Category] Gets the ConfigGuiType value corresponding to the type of this property object, or CONFIG_CATEGORY if this is a
* category object.
*/
public ConfigGuiType getType();
ConfigGuiType getType();
/**
* [Property] Is this property object a list?
*/
public boolean isList();
boolean isList();
/**
* [Property] Does this list property have to remain a fixed length?
*/
public boolean isListLengthFixed();
boolean isListLengthFixed();
/**
* [Property] Gets the max length of this list property, or -1 if the length is unlimited.
*/
public int getMaxListLength();
int getMaxListLength();
/**
* [Property] Is this property value equal to the default value?
*/
public boolean isDefault();
boolean isDefault();
/**
* [Property] Gets this property's default value. If this element is an array, this method should return a String
* representation of that array using Arrays.toString()
*/
public Object getDefault();
Object getDefault();
/**
* [Property] Gets this property's default values.
*/
public Object[] getDefaults();
Object[] getDefaults();
/**
* [Property] Sets this property's value to the default value.
*/
public void setToDefault();
void setToDefault();
/**
* [Property, Category] Whether or not this element is safe to modify while a world is running. For Categories return false if ANY properties
* in the category are modifiable while a world is running, true if all are not.
*/
public boolean requiresWorldRestart();
boolean requiresWorldRestart();
/**
* [Property, Category] Whether or not this element should be allowed to show on config GUIs.
*/
public boolean showInGui();
boolean showInGui();
/**
* [Property, Category] Whether or not this element requires Minecraft to be restarted when changed.
*/
public boolean requiresMcRestart();
boolean requiresMcRestart();
/**
* [Property] Gets this property value.
*/
public Object get();
Object get();
/**
* [Property] Gets this property value as a list. Generally you should be sure of whether the property is a list before calling this.
*/
public Object[] getList();
Object[] getList();
/**
* [Property] Sets this property's value.
*/
public void set(Object value);
void set(Object value);
/**
* [Property] Sets this property's value to the specified array.
*/
public void set(Object[] aVal);
void set(Object[] aVal);
/**
* [Property] Gets a String array of valid values for this property. This is generally used for String properties to allow the user to
* select a value from a list of valid values.
*/
public String[] getValidValues();
String[] getValidValues();
/**
* [Property] Gets this property's minimum value.
*/
public Object getMinValue();
Object getMinValue();
/**
* [Property] Gets this property's maximum value.
*/
public Object getMaxValue();
Object getMaxValue();
/**
* [Property] Gets a Pattern object used in String property input validation.
*/
public Pattern getValidationPattern();
Pattern getValidationPattern();
}
@@ -25,5 +25,5 @@ import net.minecraft.entity.Entity;
public interface IRenderFactory<T extends Entity>
{
public Render<? super T> createRenderFor(RenderManager manager);
Render<? super T> createRenderFor(RenderManager manager);
}
@@ -28,10 +28,10 @@ import net.minecraftforge.fml.relauncher.Side;
import org.apache.logging.log4j.Level;
public interface ILanguageAdapter {
public Object getNewInstance(FMLModContainer container, Class<?> objectClass, ClassLoader classLoader, Method factoryMarkedAnnotation) throws Exception;
public boolean supportsStatics();
public void setProxy(Field target, Class<?> proxyTarget, Object proxy) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException;
public void setInternalProxies(ModContainer mod, Side side, ClassLoader loader);
Object getNewInstance(FMLModContainer container, Class<?> objectClass, ClassLoader classLoader, Method factoryMarkedAnnotation) throws Exception;
boolean supportsStatics();
void setProxy(Field target, Class<?> proxyTarget, Object proxy) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException;
void setInternalProxies(ModContainer mod, Side side, ClassLoader loader);
public static class ScalaAdapter implements ILanguageAdapter {
@Override
@@ -45,5 +45,5 @@ public interface IWorldGenerator
* @param chunkProvider : additionalData[2] {@link IChunkProvider} that is requesting the world generation.
*
*/
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider);
void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider);
}
@@ -49,15 +49,15 @@ import net.minecraftforge.fml.relauncher.Side;
* at pre-defined times during the loading of the game, based on where you have applied the {@link EventHandler}
* annotation.
*
* <p>This is a simple example of a Mod. It has the modId of "MyModId", the name of "My example mod", it is
* <p>This is a simple example of a Mod. It has the modId of "mymodid", the name of "My example mod", it is
* version 1.0, and depends on FML being loaded.
* <pre>{@code
* package mymod;
* // Declare that this is a mod with modId "MyModId", name "My example mod", version "1.0" and dependency on FML.
* {@literal @}Mod(modId="MyModId",name="My example mod",version="1.0",dependencies="required-after:FML")
* // Declare that this is a mod with modId "mymodid", name "My example mod", version "1.0" and dependency on FML.
* {@literal @}Mod(modId="mymodid",name="My example mod",version="1.0",dependencies="required-after:FML")
* public class MyMod {
* // Populate this field with the instance of the mod created by FML
* {@literal @}Instance("MyModId")
* {@literal @}Instance("mymodid")
* public MyMod instance;
*
* // Mark this method for receiving an {@link FMLEvent} (in this case, it's the {@link FMLPreInitializationEvent})
@@ -95,6 +95,8 @@ public @interface Mod
*
* The version string here should be just numbers separated by dots,
* to make specifying {@link #dependencies()} simple for other mods.
*
* See also: <a href="https://cwiki.apache.org/confluence/display/MAVENOLD/Versioning">"Versioning" on Maven Wiki</a>
*/
String version() default "";
@@ -253,7 +255,7 @@ public @interface Mod
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({})
public @interface CustomProperty
@interface CustomProperty
{
/**
* A key. Should be unique.
@@ -307,7 +309,7 @@ public @interface Mod
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface EventHandler{}
@interface EventHandler{}
/**
* Populate the annotated field with the mod instance based on the specified ModId. This can be used
@@ -317,7 +319,7 @@ public @interface Mod
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Instance {
@interface Instance {
/**
* The mod object to inject into this field
*/
@@ -336,7 +338,7 @@ public @interface Mod
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Metadata {
@interface Metadata {
/**
* The mod id specifying the metadata to load here
*/
@@ -356,7 +358,7 @@ public @interface Mod
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface InstanceFactory {
@interface InstanceFactory {
}
/**
@@ -364,7 +366,7 @@ public @interface Mod
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface EventBusSubscriber {
@interface EventBusSubscriber {
Side[] value() default { Side.CLIENT, Side.SERVER };
/**
@@ -50,7 +50,7 @@ public final class Optional {
* Mark a list of interfaces for optional removal.
* @return
*/
public Interface[] value();
Interface[] value();
}
/**
* Used to remove optional interfaces
@@ -65,20 +65,20 @@ public final class Optional {
* The fully qualified name of the interface to be stripped
* @return the interface name
*/
public String iface();
String iface();
/**
* The modid that is required to be present for stripping NOT to occur
* @return the modid
*/
public String modid();
String modid();
/**
* Strip references to this interface in method declarations? (Useful to kill synthetic methods from scala f.e.)
*
* @return if references should be stripped
*/
public boolean striprefs() default false;
boolean striprefs() default false;
}
/**
* Used to remove optional methods
@@ -92,6 +92,6 @@ public final class Optional {
* The modid that is required to be present for stripping NOT to occur
* @return the modid
*/
public String modid();
String modid();
}
}
@@ -27,6 +27,6 @@ import net.minecraft.world.storage.*;
public interface WorldAccessContainer
{
public NBTTagCompound getDataForWriting(SaveHandler handler, WorldInfo info);
public void readData(SaveHandler handler, WorldInfo info, Map<String,NBTBase> propertyMap, NBTTagCompound tag);
NBTTagCompound getDataForWriting(SaveHandler handler, WorldInfo info);
void readData(SaveHandler handler, WorldInfo info, Map<String, NBTBase> propertyMap, NBTTagCompound tag);
}
@@ -29,5 +29,5 @@ public interface ITypeDiscoverer
// main class part, followed by an optional $ and an "inner class" part. $ cannot be last, otherwise scala breaks
public static Pattern classFile = Pattern.compile("[^\\s\\$]+(\\$[^\\s]+)?\\.class$");
public List<ModContainer> discover(ModCandidate candidate, ASMDataTable table);
List<ModContainer> discover(ModCandidate candidate, ASMDataTable table);
}
@@ -45,7 +45,6 @@ import javax.annotation.Nullable;
* Load any configuration data you might have {@link #getSuggestedConfigurationFile()}
* Search for a version.properties file and load it {@link #getVersionProperties()}
* Configure your {@link ModMetadata} programmatically {@link #getModMetadata()}
* Register your blocks and items with the {@link net.minecraftforge.fml.common.registry.GameRegistry}
* Discover parts of your mod by using annotation search {@link #getAsmData()}
*
* @see net.minecraftforge.fml.common.Mod.EventHandler for how to subscribe to this event
@@ -147,8 +146,6 @@ public class FMLPreInitializationEvent extends FMLStateEvent
/**
* Get a logger instance configured to write to the FML Log as a parent, identified by modid. Handy for mod logging!
* Configurations can be applied through the <code>config/logging.properties</code> file, specifying logging levels
* for your ModID. Use this!
*
* @return A logger
*/
@@ -23,5 +23,5 @@ package net.minecraftforge.fml.common.eventhandler;
public interface IEventListener
{
public void invoke(Event event);
void invoke(Event event);
}
@@ -29,6 +29,6 @@ import static java.lang.annotation.ElementType.*;
@Target(value = METHOD)
public @interface SubscribeEvent
{
public EventPriority priority() default EventPriority.NORMAL;
public boolean receiveCanceled() default false;
EventPriority priority() default EventPriority.NORMAL;
boolean receiveCanceled() default false;
}
@@ -33,11 +33,11 @@ public interface IMessage {
*
* @param buf
*/
public void fromBytes(ByteBuf buf);
void fromBytes(ByteBuf buf);
/**
* Deconstruct your message into the supplied byte buffer
* @param buf
*/
public void toBytes(ByteBuf buf);
void toBytes(ByteBuf buf);
}
@@ -39,5 +39,5 @@ public interface IMessageHandler<REQ extends IMessage, REPLY extends IMessage> {
* @param message The message
* @return an optional return message
*/
public REPLY onMessage(REQ message, MessageContext ctx);
REPLY onMessage(REQ message, MessageContext ctx);
}
@@ -298,21 +298,21 @@ public class GameRegistry
*
* @return The registry name
*/
public String value();
String value();
/**
* The metadata or damage value for the itemstack, defaults to 0.
*
* @return the metadata value
*/
public int meta() default 0;
int meta() default 0;
/**
* The string serialized nbt value for the itemstack. Defaults to empty for no nbt.
*
* @return a nbt string
*/
public String nbt() default "";
String nbt() default "";
}
/**
@@ -33,7 +33,7 @@ public interface IEntityAdditionalSpawnData
*
* @param buffer The packet data stream
*/
public void writeSpawnData(ByteBuf buffer);
void writeSpawnData(ByteBuf buffer);
/**
* Called by the client when it receives a Entity spawn packet.
@@ -41,5 +41,5 @@ public interface IEntityAdditionalSpawnData
*
* @param additionalData The packet data stream
*/
public void readSpawnData(ByteBuf additionalData);
void readSpawnData(ByteBuf additionalData);
}
@@ -31,11 +31,11 @@ public interface IThrowableEntity
* Gets the entity that threw/created this entity.
* @return The owner instance, Null if none.
*/
public Entity getThrower();
Entity getThrower();
/**
* Sets the entity that threw/created this entity.
* @param entity The new thrower/creator.
*/
public void setThrower(Entity entity);
void setThrower(Entity entity);
}
@@ -640,7 +640,7 @@ public class CoreModManager {
}
else if (deobfuscatedEnvironment && location == null) // This is probably a mod dev workspace
{
FMLLog.log.info("Ignoring missing certificate for coremod {} ({}), as this is a probably dev workspace", coreModName, coreModClass);
FMLLog.log.info("Ignoring missing certificate for coremod {} ({}), as this is probably a dev workspace", coreModName, coreModClass);
}
else // This is a probably a normal minecraft workspace - log at warn
{
@@ -93,9 +93,9 @@ public interface IFMLLoadingPlugin
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface TransformerExclusions
@interface TransformerExclusions
{
public String[] value() default "";
String[] value() default "";
}
/**
@@ -107,9 +107,9 @@ public interface IFMLLoadingPlugin
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface MCVersion
@interface MCVersion
{
public String value() default "";
String value() default "";
}
/**
@@ -119,16 +119,16 @@ public interface IFMLLoadingPlugin
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Name
@interface Name
{
public String value() default "";
String value() default "";
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface DependsOn
@interface DependsOn
{
public String[] value() default {};
String[] value() default {};
}
/**
@@ -138,9 +138,9 @@ public interface IFMLLoadingPlugin
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface SortingIndex
@interface SortingIndex
{
public int value() default 0;
int value() default 0;
}
}
@@ -44,5 +44,5 @@ import net.minecraftforge.fml.common.SidedProxy;
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
public @interface SideOnly
{
public Side value();
Side value();
}
@@ -35,7 +35,7 @@ import javax.annotation.Nullable;
*/
public interface IForgeRegistry<V extends IForgeRegistryEntry<V>> extends Iterable<V>
{
public Class<V> getRegistrySuperType();
Class<V> getRegistrySuperType();
void register(V value);