[1.13] A sweep through deprecations (#5345)

This commit is contained in:
Vincent Lee 2019-01-25 15:29:52 -06:00 committed by LexManos
parent 06a6fac23a
commit 69f8e57cea
13 changed files with 0 additions and 457 deletions

View file

@ -43,12 +43,6 @@ public class RenderBlockOverlayEvent extends net.minecraftforge.eventbus.api.Eve
private final IBlockState blockForOverlay;
private final BlockPos blockPos;
@Deprecated
public RenderBlockOverlayEvent(EntityPlayer player, float renderPartialTicks, OverlayType type, Block block, int x, int y, int z)
{
this(player, renderPartialTicks, type, block.getDefaultState(), new BlockPos(x, y, z));
}
public RenderBlockOverlayEvent(EntityPlayer player, float renderPartialTicks, OverlayType type, IBlockState block, BlockPos blockPos)
{
this.player = player;

View file

@ -33,12 +33,6 @@ public abstract class RenderLivingEvent<T extends EntityLivingBase> extends net.
private final double y;
private final double z;
@Deprecated
public RenderLivingEvent(EntityLivingBase entity, RenderLivingBase<T> renderer, double x, double y, double z)
{
this(entity, renderer, 1, x, y, z);
}
public RenderLivingEvent(EntityLivingBase entity, RenderLivingBase<T> renderer, float partialRenderTick, double x, double y, double z)
{
this.entity = entity;
@ -59,14 +53,10 @@ public abstract class RenderLivingEvent<T extends EntityLivingBase> extends net.
@net.minecraftforge.eventbus.api.Cancelable
public static class Pre<T extends EntityLivingBase> extends RenderLivingEvent<T>
{
@Deprecated
public Pre(EntityLivingBase entity, RenderLivingBase<T> renderer, double x, double y, double z){ super(entity, renderer, x, y, z); }
public Pre(EntityLivingBase entity, RenderLivingBase<T> renderer, float partialRenderTick, double x, double y, double z){ super(entity, renderer, partialRenderTick, x, y, z); }
}
public static class Post<T extends EntityLivingBase> extends RenderLivingEvent<T>
{
@Deprecated
public Post(EntityLivingBase entity, RenderLivingBase<T> renderer, double x, double y, double z){ super(entity, renderer, x, y, z); }
public Post(EntityLivingBase entity, RenderLivingBase<T> renderer, float partialRenderTick, double x, double y, double z){ super(entity, renderer, partialRenderTick, x, y, z); }
}

View file

@ -55,84 +55,11 @@ public abstract class RenderPlayerEvent extends PlayerEvent
public static class Pre extends RenderPlayerEvent
{
public Pre(EntityPlayer player, RenderPlayer renderer, float tick, double x, double y, double z){ super(player, renderer, tick, x, y, z); }
@Deprecated
public Pre(EntityPlayer player, RenderPlayer renderer, float tick){ this(player, renderer, tick, 0D, 0D, 0D); }
}
public static class Post extends RenderPlayerEvent
{
public Post(EntityPlayer player, RenderPlayer renderer, float tick, double x, double y, double z){ super(player, renderer, tick, x, y, z); }
@Deprecated
public Post(EntityPlayer player, RenderPlayer renderer, float tick){ this(player, renderer, tick, 0D, 0D, 0D); }
}
@Deprecated
public abstract static class Specials extends RenderPlayerEvent
{
public Specials(EntityPlayer player, RenderPlayer renderer, float partialTicks)
{
super(player, renderer, partialTicks, 0D, 0D, 0D);
}
@net.minecraftforge.eventbus.api.Cancelable
public static class Pre extends Specials
{
private boolean renderHelmet = true;
private boolean renderCape = true;
private boolean renderItem = true;
public Pre(EntityPlayer player, RenderPlayer renderer, float partialTicks){ super(player, renderer, partialTicks); }
public boolean shouldRenderHelmet() { return renderHelmet; }
public void setRenderHelmet(boolean renderHelmet) { this.renderHelmet = renderHelmet; }
public boolean shouldRenderCape() { return renderCape; }
public void setRenderCape(boolean renderCape) { this.renderCape = renderCape; }
public boolean shouldRenderItem() { return renderItem; }
public void setRenderItem(boolean renderItem) { this.renderItem = renderItem; }
}
public static class Post extends Specials
{
public Post(EntityPlayer player, RenderPlayer renderer, float partialTicks){ super(player, renderer, partialTicks); }
}
}
@Deprecated
public static class SetArmorModel extends RenderPlayerEvent
{
private int result = -1;
private final int slot;
@Nonnull
private final ItemStack stack;
public SetArmorModel(EntityPlayer player, RenderPlayer renderer, int slot, float partialTick, @Nonnull ItemStack stack)
{
super(player, renderer, partialTick, 0D, 0D, 0D);
this.slot = slot;
this.stack = stack;
}
/**
* Setting this to any value besides -1 will result in the function being
* Immediately exited with the return value specified.
*/
public int getResultValue()
{
return result;
}
public void setResult(int result)
{
this.result = result;
}
public int getSlot()
{
return slot;
}
@Nonnull
public ItemStack getStack()
{
return stack;
}
}
}

View file

@ -222,13 +222,6 @@ public final class MultiModel implements IUnbakedModel
private final IUnbakedModel base;
private final Map<String, Pair<IUnbakedModel, IModelState>> parts;
// TODO 1.13 remove, kept for binary compatibility
@Deprecated
public MultiModel(ResourceLocation location, @Nullable IUnbakedModel base, IModelState baseState, ImmutableMap<String, Pair<IUnbakedModel, IModelState>> parts)
{
this(location, base, parts);
}
public MultiModel(ResourceLocation location, @Nullable IUnbakedModel base, ImmutableMap<String, Pair<IUnbakedModel, IModelState>> parts)
{
this.location = location;
@ -236,13 +229,6 @@ public final class MultiModel implements IUnbakedModel
this.parts = parts;
}
// TODO 1.13 remove, kept for binary compatibility
@Deprecated
public MultiModel(ResourceLocation location, IUnbakedModel base, IModelState baseState, Map<String, Pair<IUnbakedModel, IModelState>> parts)
{
this(location, base, parts);
}
public MultiModel(ResourceLocation location, IUnbakedModel base, Map<String, Pair<IUnbakedModel, IModelState>> parts)
{
this(location, base, ImmutableMap.copyOf(parts));

View file

@ -44,12 +44,6 @@ public enum KeyModifier {
}
}
@Override
public boolean isActive()
{
return GuiScreen.isCtrlKeyDown();
}
@Override
public boolean isActive(@Nullable IKeyConflictContext conflictContext)
{
@ -71,12 +65,6 @@ public enum KeyModifier {
return key.getKeyCode() == GLFW.GLFW_KEY_LEFT_SHIFT || key.getKeyCode() == GLFW.GLFW_KEY_RIGHT_SHIFT;
}
@Override
public boolean isActive()
{
return GuiScreen.isShiftKeyDown();
}
@Override
public boolean isActive(@Nullable IKeyConflictContext conflictContext)
{
@ -96,12 +84,6 @@ public enum KeyModifier {
return key.getKeyCode() == GLFW.GLFW_KEY_LEFT_ALT || key.getKeyCode() == GLFW.GLFW_KEY_RIGHT_ALT;
}
@Override
public boolean isActive()
{
return GuiScreen.isAltKeyDown();
}
@Override
public boolean isActive(@Nullable IKeyConflictContext conflictContext)
{
@ -121,12 +103,6 @@ public enum KeyModifier {
return false;
}
@Override
public boolean isActive()
{
return true;
}
@Override
public boolean isActive(@Nullable IKeyConflictContext conflictContext)
{
@ -190,12 +166,6 @@ public enum KeyModifier {
public abstract boolean matches(InputMappings.Input key);
/**
* @deprecated use {@link #isActive(IKeyConflictContext)}
*/
@Deprecated
public abstract boolean isActive();
public abstract boolean isActive(@Nullable IKeyConflictContext conflictContext);
public abstract String getLocalizedComboName(InputMappings.Input key);

View file

@ -81,13 +81,6 @@ public class BlockSnapshot
this.setFlag(flag);
}
/** @deprecated use {@link #BlockSnapshot(int, BlockPos, ResourceLocation, int, int, NBTTagCompound)} */
@Deprecated
public BlockSnapshot(int dimension, BlockPos pos, String modId, String blockName, int meta, int flag, @Nullable NBTTagCompound nbt)
{
this(dimension, pos, new ResourceLocation(modId, blockName), meta, flag, nbt);
}
/**
* Raw constructor designed for serialization usages.
*/

View file

@ -1,59 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2018.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.event.entity;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.util.math.RayTraceResult;
import net.minecraftforge.eventbus.api.Cancelable;
/**
* This event is fired before an {@link EntityThrowable} calls its {@link EntityThrowable#onImpact} method.
* This event is fired via {@link net.minecraftforge.common.ForgeHooks#onThrowableImpact}.
* This event is cancelable. When canceled, {@link EntityThrowable#onImpact} will not be called.
* Killing or other handling of the entity after event cancellation is up to the modder.
* This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.
*
* @deprecated use {@link ProjectileImpactEvent.Throwable}
*/
@Deprecated // TODO: remove (1.13)
@net.minecraftforge.eventbus.api.Cancelable
public class ThrowableImpactEvent extends EntityEvent
{
private final EntityThrowable throwable;
private final RayTraceResult ray;
public ThrowableImpactEvent(EntityThrowable throwable, RayTraceResult ray)
{
super(throwable);
this.throwable = throwable;
this.ray = ray;
}
public EntityThrowable getEntityThrowable()
{
return throwable;
}
public RayTraceResult getRayTraceResult()
{
return ray;
}
}

View file

@ -50,28 +50,6 @@ public class AnvilRepairEvent extends PlayerEvent
this.setBreakChance(0.12f);
}
/**
* Deprecated in favour of {@link #getItemInput()} - this is actually the output slot of the anvil
* @return the output slot
*/
@Deprecated
@Nonnull
public ItemStack getLeft() { return output; }
/**
* Deprecated in favour of {@link #getIngredientInput()}} - this is actually the first input slot of the anvil
* @return the first input slot
*/
@Deprecated
@Nonnull
public ItemStack getRight() { return left; }
/**
* Deprecated in favour of {@link #getItemResult()} - this is actually the second input slot of the anvil
* @return the second input slot
*/
@Deprecated
@Nonnull
public ItemStack getOutput() { return right; }
/**
* Get the output result from the anvil
* @return the output

View file

@ -210,30 +210,6 @@ public class FluidUtil
.orElse(FluidActionResult.FAILURE);
}
/**
* Takes an Fluid Container Item and tries to fill it from the given tank.
* If the player is in creative mode, the container will not be modified on success, and no additional items created.
* If the input itemstack has a stacksize > 1 it will stow the filled container in the given inventory.
* If the inventory does not accept it, it will be given to the player or dropped at the players feet.
* If player is null in this case, the action will be aborted.
*
* @param container The Fluid Container ItemStack to fill.
* Will not be modified directly, if modifications are necessary a modified copy is returned in the result.
* @param fluidSource The fluid source to fill from
* @param inventory An inventory where any additionally created item (filled container if multiple empty are present) are put
* @param maxAmount Maximum amount of fluid to take from the tank.
* @param player The player that gets the items the inventory can't take.
* Can be null, only used if the inventory cannot take the filled stack.
* @return a {@link FluidActionResult} holding the result and the resulting container. The resulting container is empty on failure.
* @deprecated use {@link #tryFillContainerAndStow(ItemStack, IFluidHandler, IItemHandler, int, EntityPlayer, boolean)}
*/
@Deprecated // TODO remove in 1.13
@Nonnull
public static FluidActionResult tryFillContainerAndStow(@Nonnull ItemStack container, IFluidHandler fluidSource, IItemHandler inventory, int maxAmount, @Nullable EntityPlayer player)
{
return tryFillContainerAndStow(container, fluidSource, inventory, maxAmount, player, true);
}
/**
* Takes an Fluid Container Item and tries to fill it from the given tank.
* If the player is in creative mode, the container will not be modified on success, and no additional items created.
@ -303,29 +279,6 @@ public class FluidUtil
return FluidActionResult.FAILURE;
}
/**
* Takes an Fluid Container Item, tries to empty it into the fluid handler, and stows it in the given inventory.
* If the player is in creative mode, the container will not be modified on success, and no additional items created.
* If the input itemstack has a stacksize > 1 it will stow the emptied container in the given inventory.
* If the inventory does not accept the emptied container, it will be given to the player or dropped at the players feet.
* If player is null in this case, the action will be aborted.
*
* @param container The filled Fluid Container Itemstack to empty.
* Will not be modified directly, if modifications are necessary a modified copy is returned in the result.
* @param fluidDestination The fluid destination to fill from the fluid container.
* @param inventory An inventory where any additionally created item (filled container if multiple empty are present) are put
* @param maxAmount Maximum amount of fluid to take from the tank.
* @param player The player that gets the items the inventory can't take. Can be null, only used if the inventory cannot take the filled stack.
* @return a {@link FluidActionResult} holding the result and the resulting container. The resulting container is empty on failure.
* @deprecated use {@link #tryEmptyContainerAndStow(ItemStack, IFluidHandler, IItemHandler, int, EntityPlayer, boolean)}
*/
@Deprecated // TODO: remove in 1.13
@Nonnull
public static FluidActionResult tryEmptyContainerAndStow(@Nonnull ItemStack container, IFluidHandler fluidDestination, IItemHandler inventory, int maxAmount, @Nullable EntityPlayer player)
{
return tryEmptyContainerAndStow(container, fluidDestination, inventory, maxAmount, player, true);
}
/**
* Takes an Fluid Container Item, tries to empty it into the fluid handler, and stows it in the given inventory.
* If the player is in creative mode, the container will not be modified on success, and no additional items created.

View file

@ -261,16 +261,6 @@ public class UniversalBucket extends Item
}
}
/**
* @deprecated use the NBT-sensitive version {@link FluidUtil#getFilledBucket(FluidStack)}
*/
@Deprecated
@Nonnull
public static ItemStack getFilledBucket(@Nonnull UniversalBucket item, Fluid fluid)
{
return FluidUtil.getFilledBucket(new FluidStack(fluid, Fluid.BUCKET_VOLUME));
}
@Nullable
public FluidStack getFluid(@Nonnull ItemStack container)
{

View file

@ -99,14 +99,6 @@ public class FluidBucketWrapper implements IFluidHandlerItem, ICapabilityProvide
}
}
/**
* @deprecated use the NBT-sensitive version {@link #setFluid(FluidStack)}
*/
@Deprecated
protected void setFluid(@Nullable Fluid fluid) {
setFluid(new FluidStack(fluid, Fluid.BUCKET_VOLUME));
}
protected void setFluid(@Nullable FluidStack fluidStack)
{
if (fluidStack == null)

View file

@ -35,8 +35,6 @@ public class PlayerEvent extends Event {
}
public static class ItemPickupEvent extends PlayerEvent {
@Deprecated
public final EntityItem pickedUp;
/**
* Original EntityItem with current remaining stack size
*/
@ -49,7 +47,6 @@ public class PlayerEvent extends Event {
{
super(player);
this.originalEntity = entPickedUp;
this.pickedUp = entPickedUp;
this.stack = stack;
}

View file

@ -1,168 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2018.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.server;
import java.lang.ref.WeakReference;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.MapMaker;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.server.timings.TimeTracker;
/**
* @deprecated To be removed in 1.13 - Implementation has been moved
* @see net.minecraftforge.server.timings.TimeTracker
*/
@Deprecated
public class ForgeTimeTracker {
/**
* @deprecated To be removed in 1.13 - Implementation has been moved
* @see net.minecraftforge.server.timings.TimeTracker
*/
@Deprecated
public static boolean tileEntityTracking;
/**
* @deprecated To be removed in 1.13 - Implementation has been moved
* @see net.minecraftforge.server.timings.TimeTracker
*/
@Deprecated
public static int tileEntityTrackingDuration;
/**
* @deprecated To be removed in 1.13 - Implementation has been moved
* @see net.minecraftforge.server.timings.TimeTracker
*/
@Deprecated
public static long tileEntityTrackingTime;
private Map<TileEntity,int[]> tileEntityTimings;
private WeakReference<TileEntity> tile;
private static final ForgeTimeTracker INSTANCE = new ForgeTimeTracker();
/* not implemented
private WeakReference<Entity> entity;
private Map<Entity,int[]> entityTimings;
*/
private long timing;
private ForgeTimeTracker()
{
MapMaker mm = new MapMaker();
mm.weakKeys();
tileEntityTimings = mm.makeMap();
//entityTimings = mm.makeMap();
}
private void trackTileStart(TileEntity tileEntity, long nanoTime)
{
if (tileEntityTrackingTime == 0)
{
tileEntityTrackingTime = nanoTime;
}
else if (tileEntityTrackingTime + tileEntityTrackingDuration < nanoTime)
{
tileEntityTracking = false;
tileEntityTrackingTime = 0;
return;
}
tile = new WeakReference<TileEntity>(tileEntity);
timing = nanoTime;
}
private void trackTileEnd(TileEntity tileEntity, long nanoTime)
{
if (tile == null || tile.get() != tileEntity)
{
tile = null;
// race, exit
return;
}
int[] timings = tileEntityTimings.computeIfAbsent(tileEntity, k -> new int[101]);
int idx = timings[100] = (timings[100] + 1) % 100;
timings[idx] = (int) (nanoTime - timing);
}
/**
* @deprecated To be removed in 1.13 - Implementation has been moved
* @see TimeTracker#getTimingData()
*/
@Deprecated
public static ImmutableMap<TileEntity,int[]> getTileTimings()
{
return INSTANCE.buildImmutableTileEntityTimingMap();
}
private ImmutableMap<TileEntity, int[]> buildImmutableTileEntityTimingMap()
{
ImmutableMap.Builder<TileEntity, int[]> builder = new ImmutableMap.Builder<>();
TimeTracker.TILE_ENTITY_UPDATE.getTimingData().stream()
.filter(t -> t.getObject().get() != null).forEach(e -> builder.put(e.getObject().get(), e.getRawTimingData()));
return builder.build();
}
/**
* @deprecated To be removed in 1.13 - Implementation has been moved
* @see TimeTracker#trackStart(Object)
*/
@Deprecated
public static void trackStart(TileEntity tileEntity)
{
TimeTracker.TILE_ENTITY_UPDATE.trackStart(tileEntity);
}
/**
* @deprecated To be removed in 1.13 - Implementation has been moved
* @see TimeTracker#trackEnd(Object)
*/
@Deprecated
public static void trackEnd(TileEntity tileEntity)
{
TimeTracker.TILE_ENTITY_UPDATE.trackEnd(tileEntity);
}
/**
* @deprecated To be removed in 1.13 - Implementation has been moved
* @see TimeTracker#trackStart(Object)
*/
@Deprecated
public static void trackStart(Entity par1Entity)
{
}
/**
* @deprecated To be removed in 1.13 - Implementation has been moved
* @see TimeTracker#trackEnd(Object)
*/
@Deprecated
public static void trackEnd(Entity par1Entity)
{
}
}