Re-Enabled Trinkets
This commit is contained in:
parent
1db88f8d06
commit
5bdc02c474
7 changed files with 120 additions and 120 deletions
|
@ -8,6 +8,7 @@ import org.betterx.betterend.commands.CommandRegistry;
|
|||
import org.betterx.betterend.config.Configs;
|
||||
import org.betterx.betterend.effects.EndPotions;
|
||||
import org.betterx.betterend.integration.Integrations;
|
||||
import org.betterx.betterend.integration.trinkets.Elytra;
|
||||
import org.betterx.betterend.recipe.builders.InfusionRecipe;
|
||||
import org.betterx.betterend.registry.*;
|
||||
import org.betterx.betterend.tab.CreativeTabs;
|
||||
|
@ -80,10 +81,9 @@ public class BetterEnd implements ModInitializer {
|
|||
}
|
||||
});
|
||||
|
||||
//TODO: 1.20 Re-enable when Trinkets is back
|
||||
// if (RUNS_TRINKETS) {
|
||||
// org.betterx.betterend.integration.trinkets.Elytra.register();
|
||||
// }
|
||||
if (RUNS_TRINKETS) {
|
||||
Elytra.register();
|
||||
}
|
||||
}
|
||||
|
||||
public static ResourceLocation makeID(String path) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.betterx.betterend.client;
|
||||
|
||||
import org.betterx.betterend.BetterEnd;
|
||||
import org.betterx.betterend.client.render.BetterEndSkyRenderer;
|
||||
import org.betterx.betterend.events.ItemTooltipCallback;
|
||||
import org.betterx.betterend.interfaces.MultiModelItem;
|
||||
|
@ -48,10 +49,9 @@ public class BetterEndClient implements ClientModInitializer {
|
|||
if (ClientOptions.isCustomSky()) {
|
||||
DimensionRenderingRegistry.registerSkyRenderer(Level.END, new BetterEndSkyRenderer());
|
||||
}
|
||||
//TODO: 1.20 Re-Enable with Trinkets
|
||||
// if (BetterEnd.RUNS_TRINKETS) {
|
||||
// org.betterx.betterend.integration.trinkets.ElytraClient.register();
|
||||
// }
|
||||
if (BetterEnd.RUNS_TRINKETS) {
|
||||
org.betterx.betterend.integration.trinkets.ElytraClient.register();
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerTooltips() {
|
||||
|
|
|
@ -1,88 +1,88 @@
|
|||
package org.betterx.betterend.integration.trinkets;
|
||||
|
||||
//import org.betterx.bclib.items.elytra.BCLElytraItem;
|
||||
//import org.betterx.bclib.items.elytra.BCLElytraUtils;
|
||||
//
|
||||
//import net.minecraft.util.Tuple;
|
||||
//import net.minecraft.world.entity.EquipmentSlot;
|
||||
//import net.minecraft.world.entity.LivingEntity;
|
||||
//import net.minecraft.world.item.ElytraItem;
|
||||
//import net.minecraft.world.item.Item;
|
||||
//import net.minecraft.world.item.ItemStack;
|
||||
//
|
||||
//import net.fabricmc.fabric.api.entity.event.v1.EntityElytraEvents;
|
||||
//import net.fabricmc.fabric.api.entity.event.v1.FabricElytraItem;
|
||||
//
|
||||
//import dev.emi.trinkets.api.SlotReference;
|
||||
//import dev.emi.trinkets.api.TrinketComponent;
|
||||
//import dev.emi.trinkets.api.TrinketsApi;
|
||||
//
|
||||
//import java.util.List;
|
||||
//import java.util.Optional;
|
||||
//
|
||||
//public class Elytra {
|
||||
// private static boolean isElytra(ItemStack stack) {
|
||||
// return stack.getItem() instanceof ElytraItem
|
||||
// || stack.getItem() instanceof FabricElytraItem;
|
||||
// }
|
||||
//
|
||||
// public static void register() {
|
||||
// BCLElytraUtils.slotProvider = (entity, slotGetter) -> {
|
||||
// ItemStack itemStack = slotGetter.apply(EquipmentSlot.CHEST);
|
||||
// if (isElytra(itemStack)) return itemStack;
|
||||
//
|
||||
// Optional<TrinketComponent> oTrinketComponent = TrinketsApi.getTrinketComponent(entity);
|
||||
// if (oTrinketComponent.isPresent()) {
|
||||
// List<Tuple<SlotReference, ItemStack>> equipped =
|
||||
// oTrinketComponent.get().getEquipped(Elytra::isElytra);
|
||||
//
|
||||
// if (!equipped.isEmpty()) return equipped.get(0).getB();
|
||||
// }
|
||||
// return null;
|
||||
// };
|
||||
//
|
||||
// BCLElytraUtils.onBreak = (entity, chestStack) -> {
|
||||
// Optional<TrinketComponent> oTrinketComponent = TrinketsApi.getTrinketComponent(entity);
|
||||
// if (oTrinketComponent.isPresent()) {
|
||||
// List<Tuple<SlotReference, ItemStack>> equipped =
|
||||
// oTrinketComponent.get().getEquipped(Elytra::isElytra);
|
||||
//
|
||||
// for (Tuple<SlotReference, ItemStack> slot : equipped) {
|
||||
// ItemStack slotStack = slot.getB();
|
||||
// if (slotStack == chestStack) {
|
||||
// TrinketsApi.onTrinketBroken(slotStack, slot.getA(), entity);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// EntityElytraEvents.CUSTOM.register(Elytra::useElytraTrinket);
|
||||
// }
|
||||
//
|
||||
// private static boolean useElytraTrinket(LivingEntity entity, boolean tickElytra) {
|
||||
// Optional<TrinketComponent> oTrinketComponent = TrinketsApi.getTrinketComponent(entity);
|
||||
// if (oTrinketComponent.isPresent()) {
|
||||
// List<Tuple<SlotReference, ItemStack>> equipped =
|
||||
// oTrinketComponent.get().getEquipped(Elytra::isElytra);
|
||||
//
|
||||
// for (Tuple<SlotReference, ItemStack> slot : equipped) {
|
||||
// ItemStack stack = slot.getB();
|
||||
// Item item = stack.getItem();
|
||||
//
|
||||
// if (item instanceof ElytraItem) {
|
||||
// if (ElytraItem.isFlyEnabled(stack)) {
|
||||
// BCLElytraItem.vanillaElytraTick(entity, stack);
|
||||
// return true;
|
||||
// }
|
||||
// } else if (item instanceof FabricElytraItem fabricElytraItem) {
|
||||
// if (fabricElytraItem.useCustomElytra(entity, stack, tickElytra)) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
//}
|
||||
//
|
||||
import org.betterx.bclib.items.elytra.BCLElytraItem;
|
||||
import org.betterx.bclib.items.elytra.BCLElytraUtils;
|
||||
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.ElytraItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
import net.fabricmc.fabric.api.entity.event.v1.EntityElytraEvents;
|
||||
import net.fabricmc.fabric.api.entity.event.v1.FabricElytraItem;
|
||||
|
||||
import dev.emi.trinkets.api.SlotReference;
|
||||
import dev.emi.trinkets.api.TrinketComponent;
|
||||
import dev.emi.trinkets.api.TrinketsApi;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class Elytra {
|
||||
private static boolean isElytra(ItemStack stack) {
|
||||
return stack.getItem() instanceof ElytraItem
|
||||
|| stack.getItem() instanceof FabricElytraItem;
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
BCLElytraUtils.slotProvider = (entity, slotGetter) -> {
|
||||
ItemStack itemStack = slotGetter.apply(EquipmentSlot.CHEST);
|
||||
if (isElytra(itemStack)) return itemStack;
|
||||
|
||||
Optional<TrinketComponent> oTrinketComponent = TrinketsApi.getTrinketComponent(entity);
|
||||
if (oTrinketComponent.isPresent()) {
|
||||
List<Tuple<SlotReference, ItemStack>> equipped =
|
||||
oTrinketComponent.get().getEquipped(Elytra::isElytra);
|
||||
|
||||
if (!equipped.isEmpty()) return equipped.get(0).getB();
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
BCLElytraUtils.onBreak = (entity, chestStack) -> {
|
||||
Optional<TrinketComponent> oTrinketComponent = TrinketsApi.getTrinketComponent(entity);
|
||||
if (oTrinketComponent.isPresent()) {
|
||||
List<Tuple<SlotReference, ItemStack>> equipped =
|
||||
oTrinketComponent.get().getEquipped(Elytra::isElytra);
|
||||
|
||||
for (Tuple<SlotReference, ItemStack> slot : equipped) {
|
||||
ItemStack slotStack = slot.getB();
|
||||
if (slotStack == chestStack) {
|
||||
TrinketsApi.onTrinketBroken(slotStack, slot.getA(), entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
EntityElytraEvents.CUSTOM.register(Elytra::useElytraTrinket);
|
||||
}
|
||||
|
||||
private static boolean useElytraTrinket(LivingEntity entity, boolean tickElytra) {
|
||||
Optional<TrinketComponent> oTrinketComponent = TrinketsApi.getTrinketComponent(entity);
|
||||
if (oTrinketComponent.isPresent()) {
|
||||
List<Tuple<SlotReference, ItemStack>> equipped =
|
||||
oTrinketComponent.get().getEquipped(Elytra::isElytra);
|
||||
|
||||
for (Tuple<SlotReference, ItemStack> slot : equipped) {
|
||||
ItemStack stack = slot.getB();
|
||||
Item item = stack.getItem();
|
||||
|
||||
if (item instanceof ElytraItem) {
|
||||
if (ElytraItem.isFlyEnabled(stack)) {
|
||||
BCLElytraItem.vanillaElytraTick(entity, stack);
|
||||
return true;
|
||||
}
|
||||
} else if (item instanceof FabricElytraItem fabricElytraItem) {
|
||||
if (fabricElytraItem.useCustomElytra(entity, stack, tickElytra)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
package org.betterx.betterend.integration.trinkets;
|
||||
|
||||
//import net.minecraft.world.item.ElytraItem;
|
||||
//
|
||||
//import net.fabricmc.api.EnvType;
|
||||
//import net.fabricmc.api.Environment;
|
||||
//import net.fabricmc.fabric.api.client.rendering.v1.LivingEntityFeatureRenderEvents;
|
||||
//import net.fabricmc.fabric.api.entity.event.v1.FabricElytraItem;
|
||||
//
|
||||
//import dev.emi.trinkets.api.TrinketsApi;
|
||||
//
|
||||
//@Environment(EnvType.CLIENT)
|
||||
//public class ElytraClient {
|
||||
// public static void register() {
|
||||
// LivingEntityFeatureRenderEvents.ALLOW_CAPE_RENDER.register((player) -> TrinketsApi
|
||||
// .getTrinketComponent(player)
|
||||
// .map(trinketComponent -> trinketComponent.getEquipped(
|
||||
// stack -> stack.getItem() instanceof ElytraItem ||
|
||||
// stack.getItem() instanceof FabricElytraItem
|
||||
// ).size() == 0).orElse(true));
|
||||
// }
|
||||
//}
|
||||
import net.minecraft.world.item.ElytraItem;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.LivingEntityFeatureRenderEvents;
|
||||
import net.fabricmc.fabric.api.entity.event.v1.FabricElytraItem;
|
||||
|
||||
import dev.emi.trinkets.api.TrinketsApi;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class ElytraClient {
|
||||
public static void register() {
|
||||
LivingEntityFeatureRenderEvents.ALLOW_CAPE_RENDER.register((player) -> TrinketsApi
|
||||
.getTrinketComponent(player)
|
||||
.map(trinketComponent -> trinketComponent.getEquipped(
|
||||
stack -> stack.getItem() instanceof ElytraItem ||
|
||||
stack.getItem() instanceof FabricElytraItem
|
||||
).size() == 0).orElse(true));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
"blockus": ">=2.0.2",
|
||||
"nourish": ">=1.2.0",
|
||||
"colored_lights": ">=1.0.3",
|
||||
"trinkets": ">=3.4.0"
|
||||
"trinkets": ">=3.7.0"
|
||||
},
|
||||
"custom": {
|
||||
"bclib": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue