Skip to content

Commit

Permalink
remove deprecated apis
Browse files Browse the repository at this point in the history
  • Loading branch information
deirn committed May 10, 2024
1 parent ada1923 commit fecf463
Show file tree
Hide file tree
Showing 15 changed files with 12 additions and 439 deletions.
26 changes: 0 additions & 26 deletions src/api/java/mcp/mobius/waila/api/IBlockAccessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
import mcp.mobius.waila.api.__internal__.ApiSide;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -57,28 +55,4 @@ public interface IBlockAccessor {

float getFrameTime();

// -----------------------------------------------------------------------------------------------------------------------------------------------
// TODO: Remove

/**
* @deprecated use {@link #getData()}, {@link IDataReader#raw()}
*/
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "1.21")
CompoundTag getServerData();

/**
* @deprecated use {@link #getBlockHitResult()}
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "1.21")
HitResult getHitResult();

/**
* @deprecated use {@link #getFrameTime()}
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "1.21")
double getPartialFrame();

}
18 changes: 0 additions & 18 deletions src/api/java/mcp/mobius/waila/api/ICommonAccessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import mcp.mobius.waila.api.__internal__.ApiSide;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
Expand Down Expand Up @@ -60,21 +59,4 @@ public interface ICommonAccessor {

float getFrameTime();

// -----------------------------------------------------------------------------------------------------------------------------------------------
// TODO: Remove

/**
* @deprecated use {@link #getData()}, {@link IDataReader#raw()}
*/
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "1.21")
CompoundTag getServerData();

/**
* @deprecated use {@link #getFrameTime()}
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "1.21")
double getPartialFrame();

}
26 changes: 0 additions & 26 deletions src/api/java/mcp/mobius/waila/api/IEntityAccessor.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package mcp.mobius.waila.api;

import mcp.mobius.waila.api.__internal__.ApiSide;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -43,28 +41,4 @@ public interface IEntityAccessor {

float getFrameTime();

// -----------------------------------------------------------------------------------------------------------------------------------------------
// TODO: Remove

/**
* @deprecated use {@link #getData()}, {@link IDataReader#raw()}
*/
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "1.21")
CompoundTag getServerData();

/**
* @deprecated use {@link #getEntityHitResult()}
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "1.21")
HitResult getHitResult();

/**
* @deprecated use {@link #getFrameTime()}
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "1.21")
double getPartialFrame();

}
18 changes: 0 additions & 18 deletions src/api/java/mcp/mobius/waila/api/IObjectPicker.java

This file was deleted.

28 changes: 0 additions & 28 deletions src/api/java/mcp/mobius/waila/api/IPickerAccessor.java

This file was deleted.

26 changes: 0 additions & 26 deletions src/api/java/mcp/mobius/waila/api/IPickerResults.java

This file was deleted.

38 changes: 0 additions & 38 deletions src/api/java/mcp/mobius/waila/api/IRegistrar.java
Original file line number Diff line number Diff line change
Expand Up @@ -661,26 +661,6 @@ default void addToolType(ResourceLocation id, IToolType toolType) {
// -----------------------------------------------------------------------------------------------------------------------------------------------
// TODO: Remove

/**
* @deprecated use {@link #addBlockData(IDataProvider, Class)}
*/
@SuppressWarnings("removal")
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "1.21")
default <T, BE extends BlockEntity> void addBlockData(IServerDataProvider<BE> provider, Class<T> clazz) {
addBlockData((IDataProvider<? extends BlockEntity>) provider, clazz);
}

/**
* @deprecated use {@link #addEntityData(IDataProvider, Class)}
*/
@SuppressWarnings("removal")
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "1.21")
default <T, E extends Entity> void addEntityData(IServerDataProvider<E> provider, Class<T> clazz) {
addEntityData((IDataProvider<? extends Entity>) provider, clazz);
}

/**
* @deprecated use {@link #addFeatureConfig(ResourceLocation, boolean)}
*/
Expand All @@ -699,22 +679,4 @@ default void addMergedSyncedConfig(ResourceLocation key, boolean defaultValue, b
addFeatureConfig(key, false);
}

/**
* @deprecated use {@link #addRayCastVector(IRayCastVectorProvider, int)}
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "1.21")
@ApiSide.ClientOnly
void replacePicker(IObjectPicker picker, int priority);

/**
* @deprecated use {@link #addRayCastVector(IRayCastVectorProvider, int)}
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "1.21")
@ApiSide.ClientOnly
default void replacePicker(IObjectPicker picker) {
replacePicker(picker, DEFAULT_PRIORITY);
}

}
24 changes: 0 additions & 24 deletions src/api/java/mcp/mobius/waila/api/IServerDataProvider.java

This file was deleted.

21 changes: 0 additions & 21 deletions src/api/java/mcp/mobius/waila/api/data/FluidData.java
Original file line number Diff line number Diff line change
Expand Up @@ -332,25 +332,4 @@ public interface PlatformTranslator<T> {

protected abstract void implAdd(Fluid fluid, DataComponentPatch data, double stored, double capacity);

// -----------------------------------------------------------------------------------------------------------------------------------------------
// TODO: Remove

/**
* @deprecated use {@link #of(Unit)}
*/
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "1.21")
public static FluidData of() {
return of(Unit.MILLIBUCKETS);
}

/**
* @deprecated use {@link #of(Unit, int)}
*/
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "1.21")
public static FluidData of(int slotCountHint) {
return of(Unit.MILLIBUCKETS, slotCountHint);
}

}
18 changes: 0 additions & 18 deletions src/main/java/mcp/mobius/waila/access/ClientAccessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
Expand Down Expand Up @@ -86,12 +85,6 @@ public BlockPos getPosition() {
return this.pos;
}

@Override
@Deprecated
public HitResult getHitResult() {
return getRawHitResult();
}

public HitResult getRawHitResult() {
return this.hitResult;
}
Expand All @@ -111,12 +104,6 @@ public Vec3 getRenderingPosition() {
return this.renderingVec;
}

@Override
@SuppressWarnings("removal")
public CompoundTag getServerData() {
return getData().raw();
}

@Override
public IDataReader getData() {
if (!dataAccess) return DataReader.NOOP;
Expand All @@ -132,11 +119,6 @@ public long getServerDataTime() {
return data.contains("WailaTime") ? data.getLong("WailaTime") : System.currentTimeMillis();
}

@Override
public double getPartialFrame() {
return this.frameTime;
}

@Override
public Direction getSide() {
return hitResult == null ? null : hitResult.getType() == HitResult.Type.ENTITY ? null : ((BlockHitResult) hitResult).getDirection();
Expand Down
25 changes: 8 additions & 17 deletions src/main/java/mcp/mobius/waila/gui/hud/TooltipHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import mcp.mobius.waila.config.PluginConfig;
import mcp.mobius.waila.config.WailaConfig;
import mcp.mobius.waila.mixin.PlayerTabOverlayAccess;
import mcp.mobius.waila.pick.PickerAccessor;
import mcp.mobius.waila.pick.PickerResults;
import mcp.mobius.waila.registry.Registrar;
import net.minecraft.ChatFormatting;
Expand Down Expand Up @@ -72,22 +71,14 @@ public static void tick() {
Vec3 castOrigin = null;
Vec3 castDirection = null;

var picker = Registrar.get().picker;
if (picker != null) {
// TODO: remove
castOrigin = camera.getEyePosition(frameTime);
castDirection = camera.getViewVector(frameTime);
picker.pick(PickerAccessor.of(client, camera, pickRange, frameTime), results, PluginConfig.CLIENT);
} else {
for (var entry : Registrar.get().raycastVectorProviders.get(Object.class)) {
var provider = entry.instance();
if (!provider.isEnabled(PluginConfig.CLIENT)) continue;

castOrigin = provider.getOrigin(frameTime);
castDirection = provider.getDirection(frameTime);
RayCaster.cast(client.level, camera, castOrigin, castDirection, pickRange, results);
break;
}
for (var entry : Registrar.get().raycastVectorProviders.get(Object.class)) {
var provider = entry.instance();
if (!provider.isEnabled(PluginConfig.CLIENT)) continue;

castOrigin = provider.getOrigin(frameTime);
castDirection = provider.getDirection(frameTime);
RayCaster.cast(client.level, camera, castOrigin, castDirection, pickRange, results);
break;
}

if (castOrigin == null) return;
Expand Down
Loading

0 comments on commit fecf463

Please sign in to comment.