Skip to content

Commit

Permalink
Remove All Deprecated code from Curios
Browse files Browse the repository at this point in the history
  • Loading branch information
Leclowndu93150 committed Jun 18, 2024
1 parent 2df219a commit de34d7f
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ configurations {

dependencies {
implementation "net.neoforged:neoforge:${neo_version}"
implementation "curse.maven:curios-1037991:5434184"
implementation "curse.maven:curios-1037991:5441959"
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static void tickRing(ItemStack stack, Player player) {
}

public static void tickPlayer(Player player) {
Optional<SlotResult> slotResult = CuriosApi.getCuriosHelper().getCuriosHandler(player).flatMap(curiosHandler -> curiosHandler.findFirstCurio(ItemRegistry.ANGEL_RING.get()));
Optional<SlotResult> slotResult = CuriosApi.getCuriosInventory(player).flatMap(handler -> handler.findFirstCurio(ItemRegistry.ANGEL_RING.get()));
if (slotResult.isPresent()) {
ItemStack angelRingStack = slotResult.get().stack();
tickRing(angelRingStack, player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public static Boolean getInertiaModifier(ItemStack stack) {
}

public static void setSpeedModifier(ItemStack stack) {
stack.set(DataComponentRegistry.SPEED_MODIFIER, true);
stack.set(DataComponentRegistry.SPEED_MODIFIER, null);
}

public static Boolean getSpeedModifier(ItemStack stack) {
return stack.getOrDefault(DataComponentRegistry.SPEED_MODIFIER, false);
public static Float getSpeedModifier(ItemStack stack) {
return stack.getOrDefault(DataComponentRegistry.SPEED_MODIFIER, 0.02F );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class AngelRingEvents {
@SubscribeEvent(priority = EventPriority.LOW)
public static void setRingBreakSpeed(PlayerEvent.BreakSpeed event) {
Player player = event.getEntity();
Optional<SlotResult> slotResult = CuriosApi.getCuriosHelper().getCuriosHandler(player).flatMap(curiosHandler -> curiosHandler.findFirstCurio(ItemRegistry.ANGEL_RING.get()));
Optional<SlotResult> slotResult = CuriosApi.getCuriosInventory(player).flatMap(handler -> handler.findFirstCurio(ItemRegistry.ANGEL_RING.get()));
if (slotResult.isPresent()) {
ItemStack angelRingStack = slotResult.get().stack();
float newDigSpeed = event.getOriginalSpeed();
Expand All @@ -45,7 +45,7 @@ public static void setRingBreakSpeed(PlayerEvent.BreakSpeed event) {
@SubscribeEvent(priority = EventPriority.LOW)
public static void stopDrift(PlayerTickEvent.Pre event) {
Player player = event.getEntity();
Optional<SlotResult> slotResult = CuriosApi.getCuriosHelper().getCuriosHandler(player).flatMap(curiosHandler -> curiosHandler.findFirstCurio(ItemRegistry.ANGEL_RING.get()));
Optional<SlotResult> slotResult = CuriosApi.getCuriosInventory(player).flatMap(handler -> handler.findFirstCurio(ItemRegistry.ANGEL_RING.get()));
if (slotResult.isPresent()) {
ItemStack angelRingStack = slotResult.get().stack();
Vec3 motion = player.getDeltaMovement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static void registerBindings(RegisterKeyMappingsEvent event) {
public static void onKey(InputEvent.Key event) {
Player player = Minecraft.getInstance().player;
if (player == null) return;
Optional<SlotResult> slotResult = CuriosApi.getCuriosHelper().getCuriosHandler(player).flatMap(curiosHandler -> curiosHandler.findFirstCurio(ItemRegistry.ANGEL_RING.get()));
Optional<SlotResult> slotResult = CuriosApi.getCuriosInventory(player).flatMap(handler -> handler.findFirstCurio(ItemRegistry.ANGEL_RING.get()));
if (slotResult.isPresent()) {
ItemStack angelRingStack = slotResult.get().stack();
if (INERTIA_MODULE.get().consumeClick() && AngelRingModules.getInertiaModifier(angelRingStack)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@
import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.client.renderer.entity.layers.CapeLayer;
import net.minecraft.client.renderer.entity.layers.ElytraLayer;
import net.minecraft.client.renderer.entity.layers.RenderLayer;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.world.entity.player.PlayerModelPart;
import net.minecraft.world.item.ElytraItem;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.NotNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class AngelRingCheck {
public static boolean isBaseEquipped(AbstractClientPlayer playerEntity) {
return CuriosApi.getCuriosHelper().findEquippedCurio(ItemRegistry.ANGEL_RING.get(), playerEntity).isPresent();
return CuriosApi.getCuriosInventory(playerEntity).flatMap(handler -> handler.findFirstCurio(ItemRegistry.ANGEL_RING.get())).isPresent();
}

public static boolean isEquipped(AbstractClientPlayer playerEntity) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ description='''${mod_description}'''
modId="curios"
type="required"
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="[9.0.0,]"
versionRange="[9.0.2,]"
ordering="NONE"
side="BOTH"

Expand Down

0 comments on commit de34d7f

Please sign in to comment.