Remove deprecations

This commit is contained in:
tterrag 2019-12-17 04:50:13 -05:00
parent 5b67354e24
commit 1558362583
17 changed files with 15 additions and 287 deletions

View File

@ -463,22 +463,6 @@ public class ForgeHooksClient
return model; return model;
} }
private static final FloatBuffer matrixBuf = BufferUtils.createFloatBuffer(16);
@Deprecated
public static void multiplyCurrentGlMatrix(Matrix4f matrix)
{
matrixBuf.clear();
float[] t = new float[4];
for(int i = 0; i < 4; i++)
{
matrix.getColumn(i, t);
matrixBuf.put(t);
}
matrixBuf.flip();
glMultMatrixf(matrixBuf);
}
// moved and expanded from WorldVertexBufferUploader.draw // moved and expanded from WorldVertexBufferUploader.draw
public static void preDraw(Usage attrType, VertexFormat format, int element, int stride, ByteBuffer buffer) public static void preDraw(Usage attrType, VertexFormat format, int element, int stride, ByteBuffer buffer)

View File

@ -72,9 +72,6 @@ public final class ModelDynBucket implements IModelGeometry<ModelDynBucket>
private static final float NORTH_Z_FLUID = 7.498f / 16f; private static final float NORTH_Z_FLUID = 7.498f / 16f;
private static final float SOUTH_Z_FLUID = 8.502f / 16f; private static final float SOUTH_Z_FLUID = 8.502f / 16f;
@Deprecated
public static final ModelDynBucket MODEL = new ModelDynBucket();
@Nonnull @Nonnull
private final Fluid fluid; private final Fluid fluid;
@ -82,12 +79,6 @@ public final class ModelDynBucket implements IModelGeometry<ModelDynBucket>
private final boolean tint; private final boolean tint;
private final boolean coverIsMask; private final boolean coverIsMask;
@Deprecated
public ModelDynBucket()
{
this(Fluids.EMPTY, false, true, false);
}
public ModelDynBucket(Fluid fluid, boolean flipGas, boolean tint, boolean coverIsMask) public ModelDynBucket(Fluid fluid, boolean flipGas, boolean tint, boolean coverIsMask)
{ {
this.fluid = fluid; this.fluid = fluid;
@ -97,24 +88,12 @@ public final class ModelDynBucket implements IModelGeometry<ModelDynBucket>
} }
/** /**
* Sets the fluid in the model. * Returns a new ModelDynBucket representing the given fluid, but with the same
* "fluid" - Name of the fluid in the fluid registry. * other properties (flipGas, tint, coverIsMask).
* "flipGas" - If "true" the model will be flipped upside down if the fluid is lighter than air. If "false" it won't.
* "applyTint" - If "true" the model will tint the fluid quads according to the fluid's base color.
* <p/>
* If the fluid can't be found, water is used.
*/ */
@Deprecated public ModelDynBucket withFluid(Fluid newFluid)
public ModelDynBucket withFluid(String newFluid)
{ {
ResourceLocation fluidName = new ResourceLocation(newFluid); return new ModelDynBucket(newFluid, flipGas, tint, coverIsMask);
Fluid fluid = ForgeRegistries.FLUIDS.getValue(fluidName);
if (fluid == null)
fluid = this.fluid;
// create new model with correct liquid
return new ModelDynBucket(fluid, flipGas, tint, coverIsMask);
} }
@Nullable @Nullable
@ -438,7 +417,7 @@ public final class ModelDynBucket implements IModelGeometry<ModelDynBucket>
if (!model.cache.containsKey(name)) if (!model.cache.containsKey(name))
{ {
ModelDynBucket parent = model.parent.withFluid(name); ModelDynBucket parent = model.parent.withFluid(fluid);
IBakedModel bakedModel = parent.bake(model.owner, bakery, ModelLoader.defaultTextureGetter(), new SimpleModelTransform(model.transforms), model.getOverrides(), new ResourceLocation("forge:bucket_override")); IBakedModel bakedModel = parent.bake(model.owner, bakery, ModelLoader.defaultTextureGetter(), new SimpleModelTransform(model.transforms), model.getOverrides(), new ResourceLocation("forge:bucket_override"));
model.cache.put(name, bakedModel); model.cache.put(name, bakedModel);
return bakedModel; return bakedModel;

View File

@ -69,11 +69,6 @@ public abstract class ModelFile {
public static class ExistingModelFile extends ModelFile { public static class ExistingModelFile extends ModelFile {
private final ExistingFileHelper existingHelper; private final ExistingFileHelper existingHelper;
@Deprecated
public ExistingModelFile(String location, ExistingFileHelper existingHelper) {
this(new ResourceLocation(location), existingHelper);
}
public ExistingModelFile(ResourceLocation location, ExistingFileHelper existingHelper) { public ExistingModelFile(ResourceLocation location, ExistingFileHelper existingHelper) {
super(location); super(location);
this.existingHelper = existingHelper; this.existingHelper = existingHelper;

View File

@ -254,30 +254,6 @@ public class LightUtil
} }
} }
private static IVertexConsumer tessellator = null;
@Deprecated // TODO: remove
public static IVertexConsumer getTessellator()
{
if(tessellator == null)
{
Tessellator tes = Tessellator.getInstance();
BufferBuilder wr = tes.getBuffer();
tessellator = new VertexBufferConsumer(wr);
}
return tessellator;
}
private static ItemConsumer itemConsumer = null;
@Deprecated // TODO: remove
public static ItemConsumer getItemConsumer()
{
if(itemConsumer == null)
{
itemConsumer = new ItemConsumer(getTessellator());
}
return itemConsumer;
}
private static final class ItemPipeline private static final class ItemPipeline
{ {
final VertexBufferConsumer bufferConsumer; final VertexBufferConsumer bufferConsumer;

View File

@ -77,24 +77,6 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
public static final String VERSION_CHECK_CAT = "version_checking"; public static final String VERSION_CHECK_CAT = "version_checking";
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOGGER = LogManager.getLogger();
private static final Marker FORGEMOD = MarkerManager.getMarker("FORGEMOD"); private static final Marker FORGEMOD = MarkerManager.getMarker("FORGEMOD");
//TODO: Remove all of these, use ForgeConfig instead
@Deprecated
public static int[] blendRanges = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34 };
@Deprecated
public static boolean disableVersionCheck = false;
@Deprecated
public static boolean forgeLightPipelineEnabled = true;
@Deprecated
public static boolean zoomInMissingModelTextInGui = false;
@Deprecated
public static boolean disableStairSlabCulling = false; // Also known as the "DontCullStairsBecauseIUseACrappyTexturePackThatBreaksBasicBlockShapesSoICantTrustBasicBlockCulling" flag
@Deprecated
public static boolean alwaysSetupTerrainOffThread = false; // In WorldRenderer.setupTerrain, always force the chunk render updates to be queued to the thread
@Deprecated
public static boolean logCascadingWorldGeneration = true; // see Chunk#logCascadingWorldGeneration()
@Deprecated
public static boolean fixVanillaCascading = false; // There are various places in vanilla that cause cascading worldgen. Enabling this WILL change where blocks are placed to prevent this.
// DO NOT contact Forge about worldgen not 'matching' vanilla if this flag is set.
private static ForgeMod INSTANCE; private static ForgeMod INSTANCE;
public static ForgeMod getInstance() public static ForgeMod getInstance()

View File

@ -136,26 +136,6 @@ public interface IForgeBlock
return false; return false;
} }
//TODO: remove in 1.15
/**
* Check if the face of a block should block rendering.
*
* Faces which are fully opaque should return true, faces with transparency
* or faces which do not span the full size of the block should return false.
*
* @param state The current block state
* @param world The current world
* @param pos Block position in world
* @param face The side to check
* @return True if the block is opaque on the specified side.
* @deprecated This is no longer used for rendering logic.
*/
@Deprecated
default boolean doesSideBlockRendering(BlockState state, ILightReader world, BlockPos pos, Direction face)
{
return state.isOpaqueCube(world, pos);
}
/** /**
* Determines if this block should set fire and deal fire damage * Determines if this block should set fire and deal fire damage
* to entities coming into contact with it. * to entities coming into contact with it.

View File

@ -102,25 +102,6 @@ public interface IForgeBlockState
return getBlockState().getBlock().isLadder(getBlockState(), world, pos, entity); return getBlockState().getBlock().isLadder(getBlockState(), world, pos, entity);
} }
//TODO: remove in 1.15
/**
* Check if the face of a block should block rendering.
*
* Faces which are fully opaque should return true, faces with transparency
* or faces which do not span the full size of the block should return false.
*
* @param world The current world
* @param pos Block position in world
* @param face The side to check
* @return True if the block is opaque on the specified side.
* @deprecated This is no longer used for rendering logic.
*/
@Deprecated
default boolean doesSideBlockRendering(ILightReader world, BlockPos pos, Direction face)
{
return getBlockState().getBlock().doesSideBlockRendering(getBlockState(), world, pos, face);
}
/** /**
* Called throughout the code as a replacement for block instanceof BlockContainer * Called throughout the code as a replacement for block instanceof BlockContainer
* Moving this to the Block base class allows for mods that wish to extend vanilla * Moving this to the Block base class allows for mods that wish to extend vanilla

View File

@ -79,8 +79,8 @@ public class ItemTooltipEvent extends PlayerEvent
*/ */
@Override @Override
@Nullable @Nullable
public PlayerEntity getEntityPlayer() public PlayerEntity getPlayer()
{ {
return super.getEntityPlayer(); return super.getPlayer();
} }
} }

View File

@ -53,17 +53,6 @@ public class PlayerEvent extends LivingEvent
entityPlayer = player; entityPlayer = player;
} }
/**
* Use {@link #getPlayer()}
*
* @return Player
*/
@Deprecated
public PlayerEntity getEntityPlayer()
{
return entityPlayer;
}
/** /**
* @return Player * @return Player
*/ */

View File

@ -38,7 +38,6 @@ import javax.annotation.Nullable;
import static net.minecraftforge.eventbus.api.Event.Result.DEFAULT; import static net.minecraftforge.eventbus.api.Event.Result.DEFAULT;
import static net.minecraftforge.eventbus.api.Event.Result.DENY; import static net.minecraftforge.eventbus.api.Event.Result.DENY;
import net.minecraftforge.eventbus.api.Event.Result;
import net.minecraftforge.fml.LogicalSide; import net.minecraftforge.fml.LogicalSide;
/** /**
@ -317,7 +316,7 @@ public class PlayerInteractEvent extends PlayerEvent
@Nonnull @Nonnull
public ItemStack getItemStack() public ItemStack getItemStack()
{ {
return getEntityPlayer().getHeldItem(hand); return getPlayer().getHeldItem(hand);
} }
/** /**
@ -347,7 +346,7 @@ public class PlayerInteractEvent extends PlayerEvent
*/ */
public World getWorld() public World getWorld()
{ {
return getEntityPlayer().getEntityWorld(); return getPlayer().getEntityWorld();
} }
/** /**

View File

@ -22,10 +22,10 @@ package net.minecraftforge.fml;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.IForgeRegistryEntry; import net.minecraftforge.registries.IForgeRegistryEntry;
import net.minecraftforge.registries.IRegistryDelegate;
import net.minecraftforge.registries.ObjectHolderRegistry; import net.minecraftforge.registries.ObjectHolderRegistry;
import net.minecraftforge.registries.RegistryManager; import net.minecraftforge.registries.RegistryManager;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Objects; import java.util.Objects;
@ -42,20 +42,10 @@ public final class RegistryObject<T extends IForgeRegistryEntry<? super T>> impl
@Nullable @Nullable
private T value; private T value;
@Deprecated
public static <T extends IForgeRegistryEntry<T>, U extends T> RegistryObject<U> of(final String name, Supplier<Class<? super T>> registryType) {
return of(new ResourceLocation(name), registryType);
}
public static <T extends IForgeRegistryEntry<T>, U extends T> RegistryObject<U> of(final ResourceLocation name, Supplier<Class<? super T>> registryType) { public static <T extends IForgeRegistryEntry<T>, U extends T> RegistryObject<U> of(final ResourceLocation name, Supplier<Class<? super T>> registryType) {
return new RegistryObject<>(name, registryType); return new RegistryObject<>(name, registryType);
} }
@Deprecated
public static <T extends IForgeRegistryEntry<T>, U extends T> RegistryObject<U> of(final String name, IForgeRegistry<T> registry) {
return of(new ResourceLocation(name), registry);
}
public static <T extends IForgeRegistryEntry<T>, U extends T> RegistryObject<U> of(final ResourceLocation name, IForgeRegistry<T> registry) { public static <T extends IForgeRegistryEntry<T>, U extends T> RegistryObject<U> of(final ResourceLocation name, IForgeRegistry<T> registry) {
return new RegistryObject<>(name, registry); return new RegistryObject<>(name, registry);
} }
@ -93,11 +83,13 @@ public final class RegistryObject<T extends IForgeRegistryEntry<? super T>> impl
/** /**
* Directly retrieves the wrapped Registry Object. This value will automatically be updated when the backing registry is updated. * Directly retrieves the wrapped Registry Object. This value will automatically be updated when the backing registry is updated.
*/ */
@Nullable
@Override @Override
@Nonnull
public T get() public T get()
{ {
return this.value; T ret = this.value;
Objects.requireNonNull(ret, "Registry Object not present");
return ret;
} }
public void updateReference(IForgeRegistry<? extends T> registry) public void updateReference(IForgeRegistry<? extends T> registry)
@ -110,14 +102,6 @@ public final class RegistryObject<T extends IForgeRegistryEntry<? super T>> impl
return this.name; return this.name;
} }
/**
* @deprecated Prefer {@link #getId()}
*/
@Deprecated
public String getName() {
return getId().toString();
}
public Stream<T> stream() { public Stream<T> stream() {
return isPresent() ? Stream.of(get()) : Stream.of(); return isPresent() ? Stream.of(get()) : Stream.of();
} }

View File

@ -37,7 +37,6 @@ import java.util.function.Supplier;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -145,12 +144,6 @@ public class ClientModLoader
return VersionChecker.Status.UP_TO_DATE; return VersionChecker.Status.UP_TO_DATE;
} }
@Deprecated // TODO: remove in 1.15
public static void complete()
{
completeModLoading();
}
public static boolean completeModLoading() public static boolean completeModLoading()
{ {
RenderSystem.disableTexture(); RenderSystem.disableTexture();

View File

@ -64,37 +64,6 @@ public class ObfuscationReflectionHelper
return FMLLoader.getNameFunction("srg").map(f->f.apply(domain, name)).orElse(name); return FMLLoader.getNameFunction("srg").map(f->f.apply(domain, name)).orElse(name);
} }
/**
* Gets the value a field with the specified index in the given class.
* Note: For performance, use {@link #findField(Class, int)} if you are getting the value more than once.
* <p>
* Throws an exception if the field is not found or the value of the field cannot be gotten.
*
* @param classToAccess The class to find the field on.
* @param instance The instance of the {@code classToAccess}.
* @param fieldIndex The index of the field in the {@code classToAccess}.
* @param <T> The type of the value.
* @param <E> The type of the {@code classToAccess}.
* @return The value of the field with the specified index in the {@code classToAccess}.
* @throws UnableToAccessFieldException If there was a problem getting the field or the value.
* @deprecated Use {@link #getPrivateValue(Class, Object, String)} because field indices change a lot more often than field names do.
* TODO: Remove in 1.15
*/
@Deprecated
@Nullable
public static <T, E> T getPrivateValue(Class<? super E> classToAccess, E instance, int fieldIndex)
{
try
{
return (T) findField(classToAccess, fieldIndex).get(instance);
}
catch (Exception e)
{
LOGGER.error(REFLECTION, "There was a problem getting field index {} from {}", fieldIndex, classToAccess.getName(), e);
throw new UnableToAccessFieldException(e);
}
}
/** /**
* Gets the value a field with the specified name in the given class. * Gets the value a field with the specified name in the given class.
* Note: For performance, use {@link #findField(Class, String)} if you are getting the value more than once. * Note: For performance, use {@link #findField(Class, String)} if you are getting the value more than once.
@ -129,36 +98,6 @@ public class ObfuscationReflectionHelper
} }
} }
/**
* Sets the value a field with the specified index in the given class.
* Note: For performance, use {@link #findField(Class, int)} if you are setting the value more than once.
* <p>
* Throws an exception if the field is not found or the value of the field cannot be set.
*
* @param classToAccess The class to find the field on.
* @param instance The instance of the {@code classToAccess}.
* @param value The new value for the field
* @param fieldIndex The index of the field in the {@code classToAccess}.
* @param <T> The type of the value.
* @param <E> The type of the {@code classToAccess}.
* @throws UnableToAccessFieldException If there was a problem setting the value of the field.
* @deprecated Use {@link #setPrivateValue(Class, Object, Object, String)} because field indices change a lot more often than field names do.
* TODO: Remove in 1.15
*/
@Deprecated
public static <T, E> void setPrivateValue(@Nonnull final Class<? super T> classToAccess, @Nonnull final T instance, @Nullable final E value, int fieldIndex)
{
try
{
findField(classToAccess, fieldIndex).set(instance, value);
}
catch (IllegalAccessException e)
{
LOGGER.error("There was a problem setting field index {} on type {}", fieldIndex, classToAccess.getName(), e);
throw new UnableToAccessFieldException(e);
}
}
/** /**
* Sets the value a field with the specified name in the given class. * Sets the value a field with the specified name in the given class.
* Note: For performance, use {@link #findField(Class, String)} if you are setting the value more than once. * Note: For performance, use {@link #findField(Class, String)} if you are setting the value more than once.
@ -304,35 +243,6 @@ public class ObfuscationReflectionHelper
} }
} }
/**
* Finds a field with the specified index in the given class and makes it accessible.
* Note: For performance, store the returned value and avoid calling this repeatedly.
* <p>
* Throws an exception if the field is not found.
*
* @param clazz The class to find the field on.
* @param fieldIndex The index of the field on the class
* @param <T> The type.
* @return The constructor with the specified parameters in the given class.
* @throws NullPointerException If {@code clazz} is null.
* @throws UnableToFindFieldException If the field could not be found.
* @deprecated Use {@link #findField(Class, String)} because field indices change a lot more often than field names do.
* TODO: Remove in 1.15
*/
@Deprecated
@Nonnull
public static <T> Field findField(final Class<? super T> clazz, final int fieldIndex) {
Preconditions.checkNotNull(clazz, "Class to find field on cannot be null.");
try {
final Field f = clazz.getDeclaredFields()[fieldIndex];
f.setAccessible(true);
return f;
} catch (Exception e) {
throw new UnableToFindFieldException(e);
}
}
public static class UnableToAccessFieldException extends RuntimeException public static class UnableToAccessFieldException extends RuntimeException
{ {
private UnableToAccessFieldException(Exception e) private UnableToAccessFieldException(Exception e)

View File

@ -395,12 +395,6 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
return ret; return ret;
} }
@Deprecated //Public for ByteByfUtils only!
public V getRaw(int id)
{
return this.ids.get(id);
}
void addAlias(ResourceLocation from, ResourceLocation to) void addAlias(ResourceLocation from, ResourceLocation to)
{ {
if (this.isLocked()) if (this.isLocked())

View File

@ -969,15 +969,6 @@ public class GameData
} }
} }
/**
* @deprecated Use {@link #checkPrefix(String, boolean)}.
*/
@Deprecated
public static ResourceLocation checkPrefix(String name)
{
return checkPrefix(name, true);
}
/** /**
* Check a name for a domain prefix, and if not present infer it from the * Check a name for a domain prefix, and if not present infer it from the
* current active mod container. * current active mod container.

View File

@ -68,13 +68,4 @@ public class ForgeTimings<T>
return sum / rawTimingData.length; return sum / rawTimingData.length;
} }
/**
* Returns a copy of the raw timings data collected by the tracker
* @return The raw timing data
* @deprecated Added for compatibility, remove in 1.13
*/
public int[] getRawTimingData(){
return Arrays.copyOfRange(rawTimingData, 0, rawTimingData.length);
}
} }

View File

@ -115,7 +115,7 @@ public class ContainerTypeTest
if (event.getWorld().getBlockState(event.getPos()).getBlock() == Blocks.SPONGE) if (event.getWorld().getBlockState(event.getPos()).getBlock() == Blocks.SPONGE)
{ {
String text = "Hello World!"; String text = "Hello World!";
NetworkHooks.openGui((ServerPlayerEntity) event.getEntityPlayer(), new INamedContainerProvider() NetworkHooks.openGui((ServerPlayerEntity) event.getPlayer(), new INamedContainerProvider()
{ {
@Override @Override
public Container createMenu(int p_createMenu_1_, PlayerInventory p_createMenu_2_, PlayerEntity p_createMenu_3_) public Container createMenu(int p_createMenu_1_, PlayerInventory p_createMenu_2_, PlayerEntity p_createMenu_3_)