more curio stuff

This commit is contained in:
Vincent Lee authored and Vincent Lee committed 2019-06-02 12:44:22 -07:00
1 parent 5fbf520c1d
commit 58ce052176
28 files changed
+370 -330

No files matched your search

@@ -138,7 +138,7 @@ public class DummyMethodHandler implements IInternalMethodHandler {
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) {}
@Override
public IItemHandlerModifiable getBaublesInventoryWrapped(EntityPlayer player) {
public IItemHandlerModifiable getAccessoriesInventory(EntityPlayer player) {
return null;
}
@@ -81,7 +81,7 @@ public interface IInternalMethodHandler {
public int getPassiveFlowerDecay();
public IItemHandlerModifiable getBaublesInventoryWrapped(EntityPlayer player);
public IItemHandlerModifiable getAccessoriesInventory(EntityPlayer player);
public void breakOnAllCursors(EntityPlayer player, Item item, ItemStack stack, BlockPos pos, EnumFacing side);
@@ -54,23 +54,23 @@ public final class ManaItemHandler {
}
/**
* Gets a list containing all mana-holding items in a player's baubles inventory.
* Gets a list containing all mana-holding items in a player's accessories inventory.
* @return The list of items
*/
public static Map<Integer, ItemStack> getManaBaubles(EntityPlayer player) {
public static Map<Integer, ItemStack> getManaAccesories(EntityPlayer player) {
if (player == null)
return new HashMap<Integer, ItemStack>();
IItemHandler baublesInv = BotaniaAPI.internalHandler.getBaublesInventoryWrapped(player);
if (baublesInv == null)
IItemHandler acc = BotaniaAPI.internalHandler.getAccessoriesInventory(player);
if (acc == null)
return new HashMap<Integer, ItemStack>();
Map<Integer, ItemStack> toReturn = new HashMap<Integer, ItemStack>();
int size = baublesInv.getSlots();
int size = acc.getSlots();
for(int slot = 0; slot < size; slot++) {
ItemStack stackInSlot = baublesInv.getStackInSlot(slot);
ItemStack stackInSlot = acc.getStackInSlot(slot);
if(!stackInSlot.isEmpty() && stackInSlot.getItem() instanceof IManaItem) {
toReturn.put(slot, stackInSlot);
@@ -109,8 +109,8 @@ public final class ManaItemHandler {
}
}
Map<Integer, ItemStack> baubles = getManaBaubles(player);
for (Entry<Integer, ItemStack> entry : baubles.entrySet()) {
Map<Integer, ItemStack> acc = getManaAccesories(player);
for (Entry<Integer, ItemStack> entry : acc.entrySet()) {
ItemStack stackInSlot = entry.getValue();
if(stackInSlot == stack)
continue;
@@ -160,8 +160,8 @@ public final class ManaItemHandler {
}
}
Map<Integer, ItemStack> baubles = getManaBaubles(player);
for (Entry<Integer, ItemStack> entry : baubles.entrySet()) {
Map<Integer, ItemStack> acc = getManaAccesories(player);
for (Entry<Integer, ItemStack> entry : acc.entrySet()) {
ItemStack stackInSlot = entry.getValue();
if(stackInSlot == stack)
continue;
@@ -214,8 +214,8 @@ public final class ManaItemHandler {
}
}
Map<Integer, ItemStack> baubles = getManaBaubles(player);
for (Entry<Integer, ItemStack> entry : baubles.entrySet()) {
Map<Integer, ItemStack> acc = getManaAccesories(player);
for (Entry<Integer, ItemStack> entry : acc.entrySet()) {
ItemStack stackInSlot = entry.getValue();
if(stackInSlot == stack)
continue;
@@ -268,8 +268,8 @@ public final class ManaItemHandler {
}
}
Map<Integer, ItemStack> baubles = getManaBaubles(player);
for (Entry<Integer, ItemStack> entry : baubles.entrySet()) {
Map<Integer, ItemStack> acc = getManaAccesories(player);
for (Entry<Integer, ItemStack> entry : acc.entrySet()) {
ItemStack stackInSlot = entry.getValue();
if(stackInSlot == stack)
continue;
@@ -67,8 +67,8 @@ public final class BoundTileRenderer {
LazyOptional<IItemHandler> mainInvCap = player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.UP);
mainInvCap.ifPresent(mainInv -> {
IItemHandlerModifiable baublesInv = BotaniaAPI.internalHandler.getBaublesInventoryWrapped(player);
IItemHandler joined = baublesInv != null ? new CombinedInvWrapper((IItemHandlerModifiable) mainInv, baublesInv) : mainInv;
IItemHandlerModifiable acc = BotaniaAPI.internalHandler.getAccessoriesInventory(player);
IItemHandler joined = acc != null ? new CombinedInvWrapper((IItemHandlerModifiable) mainInv, acc) : mainInv;
for (int i = 0; i < joined.getSlots(); i++) {
ItemStack stackInSlot = joined.getStackInSlot(i);
@@ -34,9 +34,9 @@ import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import org.lwjgl.opengl.GL11;
import top.theillusivec4.curios.api.CuriosAPI;
import vazkii.botania.api.lexicon.ILexicon;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
@@ -60,6 +60,7 @@ import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex.InputHandler;
import vazkii.botania.common.block.tile.mana.TilePool;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.helper.PlayerHelper;
import vazkii.botania.common.integration.curios.CurioIntegration;
import vazkii.botania.common.item.ItemCraftingHalo;
import vazkii.botania.common.item.ItemSextant;
import vazkii.botania.common.item.ItemTwigWand;
@@ -81,39 +82,31 @@ public final class HUDHandler {
public static final ResourceLocation manaBar = new ResourceLocation(LibResources.GUI_MANA_HUD);
/* todo 1.13
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void onDrawScreenPre(RenderGameOverlayEvent.Pre event) {
Minecraft mc = Minecraft.getInstance();
Profiler profiler = mc.profiler;
if(event.getType() == ElementType.HEALTH) {
if(event.getType() == ElementType.HEALTH && Botania.curiosLoaded) {
profiler.startSection("botania-hud");
IItemHandler baublesInv = BaublesApi.getBaublesHandler(mc.player);
ItemStack headpiece = baublesInv.getStackInSlot(4);
if(!headpiece.isEmpty() && headpiece.getItem() == ModItems.flightTiara) {
CuriosAPI.FinderData result = CuriosAPI.getCurioEquipped(ModItems.flightTiara, mc.player);
if(result != null) {
profiler.startSection("flugelTiara");
ItemFlightTiara.renderHUD(mc.player, headpiece);
ItemFlightTiara.renderHUD(mc.player, result.getStack());
profiler.endSection();
}
dodgeRing: {
ItemStack ring = baublesInv.getStackInSlot(1);
if(ring.isEmpty() || !(ring.getItem() instanceof ItemDodgeRing)) {
ring = baublesInv.getStackInSlot(2);
if(ring.isEmpty() || !(ring.getItem() instanceof ItemDodgeRing))
break dodgeRing;
}
result = CuriosAPI.getCurioEquipped(ModItems.dodgeRing, mc.player);
if(result != null) {
profiler.startSection("dodgeRing");
ItemDodgeRing.renderHUD(mc.player, ring, event.getPartialTicks());
ItemDodgeRing.renderHUD(mc.player, result.getStack(), event.getPartialTicks());
profiler.endSection();
}
profiler.endSection();
}
}
*/
@SubscribeEvent
public static void onDrawScreenPost(RenderGameOverlayEvent.Post event) {
@@ -207,17 +200,17 @@ public final class HUDHandler {
boolean creative = false;
IItemHandler mainInv = new net.minecraftforge.items.ItemStackHandler(1); // player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).orElseThrow(NullPointerException::new);
IItemHandler baublesInv = null; // todo 1.13
IItemHandler accInv = Botania.curiosLoaded ? CurioIntegration.getAllCurios(player).orElse(null) : null;
int invSize = mainInv.getSlots();
int size = invSize;
if(baublesInv != null)
size += baublesInv.getSlots();
if(accInv != null)
size += accInv.getSlots();
for(int i = 0; i < size; i++) {
boolean useBaubles = i >= invSize;
IItemHandler inv = useBaubles ? baublesInv : mainInv;
ItemStack stack = inv.getStackInSlot(i - (useBaubles ? invSize : 0));
boolean useAccessories = i >= invSize;
IItemHandler inv = useAccessories ? accInv : mainInv;
ItemStack stack = inv.getStackInSlot(i - (useAccessories ? invSize : 0));
if(!stack.isEmpty()) {
Item item = stack.getItem();
@@ -237,8 +230,8 @@ public final class HUDHandler {
creative = true;
}
Map<Integer, ItemStack> baubles = ManaItemHandler.getManaBaubles(player);
for (Entry<Integer, ItemStack> entry : baubles.entrySet()) {
Map<Integer, ItemStack> acc = ManaItemHandler.getManaAccesories(player);
for (Entry<Integer, ItemStack> entry : acc.entrySet()) {
ItemStack stack = entry.getValue();
Item item = stack.getItem();
if(!((IManaItem) item).isNoExport(stack)) {
@@ -54,17 +54,17 @@ public class ContainerBaubleBox extends Container {
int k = j + i * 6;
addSlotToContainer(new SlotItemHandler(baubleBoxInv, k, 62 + j * 18, 8 + i * 18));
}
*/
for(i = 0; i < 3; ++i)
for(j = 0; j < 9; ++j)
addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
addSlot(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
for(i = 0; i < 9; ++i) {
if(playerInv.getStackInSlot(i) == baubleBoxInv.box)
addSlotToContainer(new SlotLocked(playerInv, i, 8 + i * 18, 142));
else addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 142));
addSlot(new SlotLocked(playerInv, i, 8 + i * 18, 142));
else addSlot(new Slot(playerInv, i, 8 + i * 18, 142));
}
*/
}
@@ -113,6 +113,7 @@ public class Botania {
public static boolean bcApiLoaded = false;
public static boolean bloodMagicLoaded = false;
public static boolean coloredLightsLoaded = false;
public static boolean curiosLoaded = false;
public static Botania instance;
public static IProxy proxy;
@@ -140,6 +141,7 @@ public class Botania {
bcApiLoaded = ModList.get().isLoaded("buildcraftlib");
bloodMagicLoaded = ModList.get().isLoaded("bloodmagic"); // Psh, noob
coloredLightsLoaded = ModList.get().isLoaded("easycoloredlights");
curiosLoaded = ModList.get().isLoaded("curios");
BotaniaAPI.internalHandler = new InternalMethodHandler();
@@ -166,7 +168,7 @@ public class Botania {
MinecraftForge.EVENT_BUS.register(TileCorporeaIndex.getInputHandler());
MinecraftForge.EVENT_BUS.register(new LootHandler());
if(ModList.get().isLoaded("curios")) {
if(curiosLoaded) {
CurioIntegration.init();
FMLJavaModLoadingContext.get().getModEventBus().register(CurioIntegration.class);
MinecraftForge.EVENT_BUS.register(CurioIntegration.class);
@@ -21,7 +21,9 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.wrapper.EmptyHandler;
import vazkii.botania.api.BotaniaAPIClient;
import vazkii.botania.api.corporea.CorporeaHelper;
import vazkii.botania.api.corporea.ICorporeaSpark;
@@ -48,6 +50,7 @@ import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.decor.BlockFloatingFlower;
import vazkii.botania.common.block.subtile.functional.SubTileSolegnolia;
import vazkii.botania.common.integration.corporea.WrappedIInventory;
import vazkii.botania.common.integration.curios.CurioIntegration;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import vazkii.botania.common.item.relic.ItemLokiRing;
@@ -149,8 +152,12 @@ public class InternalMethodHandler extends DummyMethodHandler {
}
@Override
public IItemHandlerModifiable getBaublesInventoryWrapped(EntityPlayer player) {
return null; // todo 1.13 BaublesApi.getBaublesHandler(player);
public IItemHandlerModifiable getAccessoriesInventory(EntityPlayer player) {
if(Botania.curiosLoaded) {
LazyOptional<IItemHandlerModifiable> cap = CurioIntegration.getAllCurios(player);
return cap.orElseGet(EmptyHandler::new);
}
return new EmptyHandler();
}
@Override
@@ -7,13 +7,17 @@ import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import vazkii.botania.api.item.IPixieSpawner;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.PlayerHelper;
import vazkii.botania.common.entity.EntityPixie;
import vazkii.botania.common.integration.curios.CurioIntegration;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.armor.elementium.ItemElementiumHelm;
import vazkii.botania.common.lib.LibMisc;
@@ -40,11 +44,14 @@ public final class PixieHandler {
for (ItemStack element : player.inventory.armorInventory)
chance += getChance(element);
// todo 1.13
/*
IItemHandler baubles = BaublesApi.getBaublesHandler(player);
for(int i = 0; i < baubles.getSlots(); i++)
chance += getChance(baubles.getStackInSlot(i));
if(Botania.curiosLoaded) {
LazyOptional<IItemHandlerModifiable> cap = CurioIntegration.getAllCurios(player);
if(cap.isPresent()) {
IItemHandlerModifiable handler = cap.orElseThrow(NullPointerException::new);
for(int i = 0; i < handler.getSlots(); i++)
chance += getChance(handler.getStackInSlot(i));
}
}
if(Math.random() < chance) {
EntityPixie pixie = new EntityPixie(player.world);
@@ -62,7 +69,6 @@ public final class PixieHandler {
pixie.onInitialSpawn(player.world.getDifficultyForLocation(new BlockPos(pixie)), null, null);
player.world.spawnEntity(pixie);
}
*/
}
}
@@ -33,6 +33,8 @@ import vazkii.botania.api.mana.spark.ISparkAttachable;
import vazkii.botania.api.mana.spark.ISparkEntity;
import vazkii.botania.api.mana.spark.SparkHelper;
import vazkii.botania.api.mana.spark.SparkUpgradeType;
import vazkii.botania.common.Botania;
import vazkii.botania.common.integration.curios.CurioIntegration;
import vazkii.botania.common.item.ItemSparkUpgrade;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibMisc;
@@ -110,12 +112,13 @@ public class EntitySpark extends Entity implements ISparkEntity {
List<ItemStack> stacks = new ArrayList<>();
stacks.addAll(player.inventory.mainInventory);
stacks.addAll(player.inventory.armorInventory);
/* todo 1.13
IItemHandler baubles = BaublesApi.getBaublesHandler(player);
for (int i = 0; i < baubles.getSlots(); i++)
stacks.add(baubles.getStackInSlot(i));
*/
if(Botania.curiosLoaded) {
CurioIntegration.getAllCurios(player).ifPresent(inv -> {
for (int i = 0; i < inv.getSlots(); i++)
stacks.add(inv.getStackInSlot(i));
});
}
for(ItemStack stack : stacks) {
if(stack.isEmpty() || !(stack.getItem() instanceof IManaItem))
@@ -1,5 +1,6 @@
package vazkii.botania.common.integration.curios;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
@@ -11,6 +12,8 @@ import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
import net.minecraftforge.registries.IRegistryDelegate;
import top.theillusivec4.curios.api.CuriosAPI;
import top.theillusivec4.curios.api.capability.CuriosCapability;
@@ -20,6 +23,7 @@ import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.bauble.*;
import vazkii.botania.common.item.relic.ItemLokiRing;
import vazkii.botania.common.item.relic.ItemOdinRing;
import vazkii.botania.common.item.relic.ItemThorRing;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
@@ -27,6 +31,7 @@ import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
import java.util.function.Predicate;
// Classloading-safe way to attach curio behaviour to our items
public class CurioIntegration {
@@ -55,6 +60,25 @@ public class CurioIntegration {
InterModComms.sendTo("curios", CuriosAPI.IMC.REGISTER_TYPE, () -> new CurioIMCMessage("belt"));
InterModComms.sendTo("curios", CuriosAPI.IMC.REGISTER_TYPE, () -> new CurioIMCMessage("body"));
InterModComms.sendTo("curios", CuriosAPI.IMC.REGISTER_TYPE, () -> new CurioIMCMessage("head"));
InterModComms.sendTo("curios", CuriosAPI.IMC.REGISTER_TYPE, () -> new CurioIMCMessage("trinket"));
}
public static LazyOptional<IItemHandlerModifiable> getAllCurios(EntityLivingBase living) {
return CuriosAPI.getCuriosHandler(living).map(h -> {
IItemHandlerModifiable[] invs = h.getCurioMap().values().toArray(new IItemHandlerModifiable[0]);
return new CombinedInvWrapper(invs);
});
}
// Convenience methods, also avoids referencing FinderData class in common code
public static ItemStack findOrEmpty(Item item, EntityLivingBase living) {
CuriosAPI.FinderData result = CuriosAPI.getCurioEquipped(item, living);
return result == null ? ItemStack.EMPTY : result.getStack();
}
public static ItemStack findOrEmpty(Predicate<ItemStack> pred, EntityLivingBase living) {
CuriosAPI.FinderData result = CuriosAPI.getCurioEquipped(pred, living);
return result == null ? ItemStack.EMPTY : result.getStack();
}
public static void init() {
@@ -64,6 +88,7 @@ public class CurioIntegration {
FACTORIES.put(ModItems.bloodPendant.delegate, ItemBloodPendant.Curio::new);
FACTORIES.put(ModItems.divaCharm.delegate, ItemDivaCharm.Curio::new);
FACTORIES.put(ModItems.dodgeRing.delegate, ItemDodgeRing.Curio::new);
FACTORIES.put(ModItems.flightTiara.delegate, ItemFlightTiara.Curio::new);
FACTORIES.put(ModItems.goddessCharm.delegate, ItemGoddessCharm.Curio::new);
FACTORIES.put(ModItems.holyCloak.delegate, ItemHolyCloak.Curio::new);
FACTORIES.put(ModItems.icePendant.delegate, ItemIcePendant.Curio::new);
@@ -81,11 +106,17 @@ public class CurioIntegration {
FACTORIES.put(ModItems.pixieRing.delegate, BaseCurio::new);
FACTORIES.put(ModItems.reachRing.delegate, ItemReachRing.Curio::new);
FACTORIES.put(ModItems.superLavaPendant.delegate, ItemSuperLavaPendant.Curio::new);
FACTORIES.put(ModItems.superTravelBelt.delegate, ItemTravelBelt.Curio::new);
FACTORIES.put(ModItems.swapRing.delegate, ItemSwapRing.Curio::new);
FACTORIES.put(ModItems.thirdEye.delegate, ItemThirdEye.Curio::new);
FACTORIES.put(ModItems.tinyPlanet.delegate, ItemTinyPlanet.Curio::new);
FACTORIES.put(ModItems.thorRing.delegate, s -> new RelicCurio(s, ((ItemThorRing) ModItems.thorRing).getDummy()));
FACTORIES.put(ModItems.travelBelt.delegate, ItemTravelBelt.Curio::new);
FACTORIES.put(ModItems.unholyCloak.delegate, ItemHolyCloak.Curio::new);
FACTORIES.put(ModItems.waterRing.delegate, ItemWaterRing.Curio::new);
for (Item i : ModItems.cosmetics.values()) {
FACTORIES.put(i.delegate, ItemBaubleCosmetic.Curio::new);
}
}
private static final Map<IRegistryDelegate<Item>, Function<ItemStack, ICurio>> FACTORIES = new HashMap<>();
@@ -1,37 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [22/10/2016, 17:31:04 (GMT)]
*/
package vazkii.botania.common.item.equipment.bauble;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
public abstract class CloudPendantShim extends ItemBauble {
public CloudPendantShim(Properties props) {
super(props);
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase player) {
super.onWornTick(stack, player);
clientWornTick(stack, player);
}
public void clientWornTick(ItemStack stack, EntityLivingBase player) {
// NO-OP
}
public int getMaxAllowedJumps() {
return 2;
}
}
@@ -22,6 +22,7 @@ import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
@@ -32,8 +33,10 @@ import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.item.IBaubleRender;
import vazkii.botania.api.item.ICosmeticBauble;
import vazkii.botania.client.core.handler.ModelHandler;
import vazkii.botania.common.integration.curios.BaseCurio;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibItemNames;
@@ -66,7 +69,7 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
@OnlyIn(Dist.CLIENT)
@Override
public void addHiddenTooltip(ItemStack stack, World world, List<ITextComponent> stacks, ITooltipFlag flags) {
if(this == ModItems.cosmetics.get(Variant.THINKING_HAND)) {
if(variant == Variant.THINKING_HAND) {
stacks.add(new TextComponentTranslation("botaniamisc.cosmeticThinking"));
} else {
stacks.add(new TextComponentTranslation("botaniamisc.cosmeticBauble"));
@@ -74,21 +77,24 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
super.addHiddenTooltip(stack, world, stacks, flags);
}
/* todo 1.13
@Override
public BaubleType getBaubleType(ItemStack arg0) {
return BaubleType.TRINKET;
}
*/
public static class Curio extends BaseCurio {
public Curio(ItemStack stack) {
super(stack);
}
@Override
public void onPlayerBaubleRender(ItemStack stack, EntityPlayer player, RenderType type, float partialTicks) {
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
@Override
public boolean hasRender(String identifier, EntityLivingBase living) {
return true;
}
if (type == RenderType.HEAD) {
Helper.translateToHeadLevel(player);
Helper.translateToFace();
Helper.defaultTransforms();
@Override
public void doRender(String identifier, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Variant variant = ((ItemBaubleCosmetic) stack.getItem()).variant;
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.pushMatrix();
IBaubleRender.Helper.translateToHeadLevel(player);
IBaubleRender.Helper.translateToFace();
IBaubleRender.Helper.defaultTransforms();
switch (variant) {
case RED_GLASSES:
scale(1.25F);
@@ -228,77 +234,79 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
GlStateManager.rotatef(15F, 0F, 0F, 1F);
renderItem(stack);
break;
default: break;
default: {
// body cosmetics
GlStateManager.popMatrix();
IBaubleRender.Helper.rotateIfSneaking(player);
IBaubleRender.Helper.translateToChest();
IBaubleRender.Helper.defaultTransforms();
switch (variant) {
case BLACK_BOWTIE:
GlStateManager.translatef(0F, 0.15F, 0F);
renderItem(stack);
break;
case BLACK_TIE:
GlStateManager.translatef(0F, -0.15F, 0F);
renderItem(stack);
break;
case PUFFY_SCARF:
GlStateManager.translatef(0F, -0.15F, 0F);
renderItem(stack);
break;
case WITCH_PIN:
scale(0.35F);
GlStateManager.translatef(-0.35F, 0.35F, 0.15F);
renderItem(stack);
break;
case DEVIL_TAIL:
GlStateManager.rotatef(90F, 0F, 1F, 0F);
GlStateManager.translatef(0.5F, -0.75F, 0F);
renderItem(stack);
break;
case KAMUI_EYE: // DON'T LOSE YOUR WAAAAAAAAY
scale(0.9F);
GlStateManager.translatef(0.9F, 0.35F, 0F);
renderItem(stack);
GlStateManager.translatef(-1.3F, -0.5F, 0.5F);
GlStateManager.rotatef(180F, 0F, 0F, 1F);
GlStateManager.rotatef(180F, 1F, 0F, 0F);
renderKamuiBlack(stack);
break;
case FOUR_LEAF_CLOVER:
scale(0.5F);
GlStateManager.translatef(0.35F, 0.3F, -0.075F);
renderItem(stack);
break;
case BOTANIST_EMBLEM:
scale(0.5F);
GlStateManager.translatef(0F, -0.75F, 0F);
renderItem(stack);
break;
case LUSITANIC_SHIELD:
GlStateManager.rotatef(180F, 0F, 1F, 0F);
GlStateManager.translatef(0.035F, -0.2F, 0.55F);
GlStateManager.rotatef(8F, 0F, 0F, 1F);
renderItem(stack);
break;
default: break;
}
}
} else {
Helper.rotateIfSneaking(player);
Helper.translateToChest();
Helper.defaultTransforms();
switch (variant) {
case BLACK_BOWTIE:
GlStateManager.translatef(0F, 0.15F, 0F);
renderItem(stack);
break;
case BLACK_TIE:
GlStateManager.translatef(0F, -0.15F, 0F);
renderItem(stack);
break;
case PUFFY_SCARF:
GlStateManager.translatef(0F, -0.15F, 0F);
renderItem(stack);
break;
case WITCH_PIN:
scale(0.35F);
GlStateManager.translatef(-0.35F, 0.35F, 0.15F);
renderItem(stack);
break;
case DEVIL_TAIL:
GlStateManager.rotatef(90F, 0F, 1F, 0F);
GlStateManager.translatef(0.5F, -0.75F, 0F);
renderItem(stack);
break;
case KAMUI_EYE: // DON'T LOSE YOUR WAAAAAAAAY
scale(0.9F);
GlStateManager.translatef(0.9F, 0.35F, 0F);
renderItem(stack);
GlStateManager.translatef(-1.3F, -0.5F, 0.5F);
GlStateManager.rotatef(180F, 0F, 0F, 1F);
GlStateManager.rotatef(180F, 1F, 0F, 0F);
renderKamuiBlack(stack);
break;
case FOUR_LEAF_CLOVER:
scale(0.5F);
GlStateManager.translatef(0.35F, 0.3F, -0.075F);
renderItem(stack);
break;
case BOTANIST_EMBLEM:
scale(0.5F);
GlStateManager.translatef(0F, -0.75F, 0F);
renderItem(stack);
break;
case LUSITANIC_SHIELD:
GlStateManager.rotatef(180F, 0F, 1F, 0F);
GlStateManager.translatef(0.035F, -0.2F, 0.55F);
GlStateManager.rotatef(8F, 0F, 0F, 1F);
renderItem(stack);
break;
default: break;
}
}
}
public void scale(float f) {
public static void scale(float f) {
GlStateManager.scalef(f, f, f);
}
public void renderItem(ItemStack stack) {
public static void renderItem(ItemStack stack) {
GlStateManager.pushMatrix();
Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.NONE);
GlStateManager.popMatrix();
}
// todo 1.13 recheck vanilla copying
private void renderKamuiBlack(ItemStack stack) {
private static void renderKamuiBlack(ItemStack stack) {
// Modified copy of RenderItem.renderItem(stack, transformtype)
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
@@ -324,7 +332,7 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
}
// Adapted from RenderItem.renderModel(model, stack), added extra color param
private void renderModel(IBakedModel model, ItemStack stack, int color) {
private static void renderModel(IBakedModel model, ItemStack stack, int color) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldrenderer = tessellator.getBuffer();
worldrenderer.begin(7, DefaultVertexFormats.ITEM);
@@ -339,7 +347,7 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
}
// Copy of RenderItem.renderQuads
private void renderQuads(BufferBuilder renderer, List<BakedQuad> quads, int color, ItemStack stack)
private static void renderQuads(BufferBuilder renderer, List<BakedQuad> quads, int color, ItemStack stack)
{
boolean flag = color == -1 && !stack.isEmpty();
int i = 0;
@@ -22,16 +22,19 @@ import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor;
import vazkii.botania.api.item.IBaubleRender;
import vazkii.botania.client.core.handler.MiscellaneousIcons;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.integration.curios.BaseCurio;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibItemNames;
import vazkii.botania.common.network.PacketHandler;
import vazkii.botania.common.network.PacketJump;
import java.util.UUID;
public class ItemCloudPendant extends CloudPendantShim implements IBaubleRender {
public class ItemCloudPendant extends ItemBauble {
private static int timesJumped;
private static boolean jumpDown;
@@ -40,47 +43,51 @@ public class ItemCloudPendant extends CloudPendantShim implements IBaubleRender
super(props);
}
/* todo 1.13
@Override
public BaubleType getBaubleType(ItemStack arg0) {
return BaubleType.AMULET;
}
*/
@Override
@OnlyIn(Dist.CLIENT)
public void clientWornTick(ItemStack stack, EntityLivingBase player) {
if(player instanceof EntityPlayerSP && player == Minecraft.getInstance().player) {
EntityPlayerSP playerSp = (EntityPlayerSP) player;
UUID uuid = playerSp.getUniqueID();
if(playerSp.onGround)
timesJumped = 0;
else {
if(playerSp.movementInput.jump) {
if(!jumpDown && timesJumped < getMaxAllowedJumps()) {
playerSp.jump();
PacketHandler.sendToServer(new PacketJump());
timesJumped++;
}
jumpDown = true;
} else jumpDown = false;
}
public static class Curio extends BaseCurio {
public Curio(ItemStack stack) {
super(stack);
}
}
@Override
@OnlyIn(Dist.CLIENT)
public void onPlayerBaubleRender(ItemStack stack, EntityPlayer player, RenderType type, float partialTicks) {
if(type == RenderType.BODY) {
@Override
public void onCurioTick(String identifier, EntityLivingBase player) {
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
if(player instanceof EntityPlayerSP && player == Minecraft.getInstance().player) {
EntityPlayerSP playerSp = (EntityPlayerSP) player;
if(playerSp.onGround)
timesJumped = 0;
else {
if(playerSp.movementInput.jump) {
if(!jumpDown && timesJumped < ((ItemCloudPendant) stack.getItem()).getMaxAllowedJumps()) {
playerSp.jump();
PacketHandler.sendToServer(new PacketJump());
timesJumped++;
}
jumpDown = true;
} else jumpDown = false;
}
}
});
}
@Override
public boolean hasRender(String identifier, EntityLivingBase living) {
return true;
}
@Override
@OnlyIn(Dist.CLIENT)
public void doRender(String identifier, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
Helper.rotateIfSneaking(player);
IBaubleRender.Helper.rotateIfSneaking(player);
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
GlStateManager.rotatef(180F, 1F, 0F, 0F);
GlStateManager.translatef(-0.2F, -0.3F, armor ? 0.2F : 0.15F);
GlStateManager.scalef(0.5F, 0.5F, 0.5F);
TextureAtlasSprite gemIcon = MiscellaneousIcons.INSTANCE.cirrusGem;
TextureAtlasSprite gemIcon = stack.getItem() == ModItems.superCloudPendant
? MiscellaneousIcons.INSTANCE.nimbusGem
: MiscellaneousIcons.INSTANCE.cirrusGem;
float f = gemIcon.getMinU();
float f1 = gemIcon.getMaxU();
float f2 = gemIcon.getMinV();
@@ -88,5 +95,9 @@ public class ItemCloudPendant extends CloudPendantShim implements IBaubleRender
IconHelper.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, gemIcon.getWidth(), gemIcon.getHeight(), 1F / 32F);
}
}
public int getMaxAllowedJumps() {
return 2;
}
}
@@ -40,6 +40,7 @@ import net.minecraftforge.fml.common.gameevent.PlayerEvent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.lwjgl.opengl.GL11;
import top.theillusivec4.curios.api.CuriosAPI;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.item.IBaubleRender;
import vazkii.botania.api.mana.IManaUsingItem;
@@ -56,6 +57,7 @@ import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.core.helper.StringObfuscator;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.integration.curios.BaseCurio;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibItemNames;
@@ -63,7 +65,7 @@ import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaubleRender {
public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
private static final ResourceLocation textureHud = new ResourceLocation(LibResources.GUI_HUD_ICONS);
private static final ResourceLocation textureHalo = new ResourceLocation(LibResources.MISC_HALO);
@@ -90,13 +92,6 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
MinecraftForge.EVENT_BUS.register(this);
}
/* todo 1.13
@Override
public BaubleType getBaubleType(ItemStack arg0) {
return BaubleType.HEAD;
}
*/
@Override
public void fillItemGroup(@Nonnull ItemGroup tab, @Nonnull NonNullList<ItemStack> list) {
if(isInGroup(tab)) {
@@ -185,7 +180,8 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
public void updatePlayerFlyStatus(LivingUpdateEvent event) {
if(event.getEntityLiving() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
ItemStack tiara = ItemStack.EMPTY; // todo 1.13 BaublesApi.getBaublesHandler(player).getStackInSlot(4);
CuriosAPI.FinderData result = CuriosAPI.getCurioEquipped(ModItems.flightTiara, player);
ItemStack tiara = result == null ? ItemStack.EMPTY : result.getStack();
int left = ItemNBTHelper.getInt(tiara, TAG_TIME_LEFT, MAX_FLY_TIME);
if(playersWithFlight.contains(playerStr(player))) {
@@ -284,8 +280,9 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
}
private boolean shouldPlayerHaveFlight(EntityPlayer player) {
ItemStack armor = ItemStack.EMPTY; // todo 1.13 BaublesApi.getBaublesHandler(player).getStackInSlot(4);
if(!armor.isEmpty() && armor.getItem() == this) {
CuriosAPI.FinderData result = CuriosAPI.getCurioEquipped(ModItems.flightTiara, player);
if(result != null) {
ItemStack armor = result.getStack();
int left = ItemNBTHelper.getInt(armor, TAG_TIME_LEFT, MAX_FLY_TIME);
boolean flying = ItemNBTHelper.getBoolean(armor, TAG_FLYING, false);
return (left > (flying ? 0 : MAX_FLY_TIME / 10) || player.inventory.hasItemStack(new ItemStack(ModItems.flugelEye))) && ManaItemHandler.requestManaExact(armor, player, getCost(armor, left), false);
@@ -303,16 +300,29 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
return true;
}
@Override
@OnlyIn(Dist.CLIENT)
public void onPlayerBaubleRender(ItemStack stack, EntityPlayer player, RenderType type, float partialTicks) {
int meta = ItemNBTHelper.getInt(stack, TAG_VARIANT, 0);
if(type == RenderType.BODY) {
public static class Curio extends BaseCurio {
public Curio(ItemStack stack) {
super(stack);
}
@Override
public boolean shouldSyncToTracking(String identifier, EntityLivingBase living) {
return true;
}
@Override
public boolean hasRender(String identifier, EntityLivingBase living) {
return living instanceof EntityPlayer;
}
@Override
public void doRender(String identifier, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
int meta = ItemNBTHelper.getInt(stack, TAG_VARIANT, 0);
if(meta > 0 && meta <= MiscellaneousIcons.INSTANCE.tiaraWingIcons.length) {
TextureAtlasSprite icon = MiscellaneousIcons.INSTANCE.tiaraWingIcons[meta - 1];
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
boolean flying = player.abilities.isFlying;
boolean flying = ((EntityPlayer) player).abilities.isFlying;
float rz = 120F;
float rx = 20F + (float) ((Math.sin((double) (player.ticksExisted + partialTicks) * (flying ? 0.4F : 0.2F)) + 0.5F) * (flying ? 30F : 5F));
@@ -402,7 +412,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
float f3 = icon.getMaxV();
float sr = 1F / s;
Helper.rotateIfSneaking(player);
IBaubleRender.Helper.rotateIfSneaking(player);
GlStateManager.translatef(0F, h, i);
@@ -433,13 +443,15 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
GlStateManager.popMatrix();
OpenGlHelper.glMultiTexCoord2f(OpenGlHelper.GL_TEXTURE1, lbx, lby);
if(meta == 1)
renderHalo(player, partialTicks);
}
} else if(meta == 1) // Jibril's Halo
renderHalo(player, partialTicks);
}
}
@OnlyIn(Dist.CLIENT)
public static void renderHalo(EntityPlayer player, float partialTicks) {
public static void renderHalo(EntityLivingBase player, float partialTicks) {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.shadeModel(GL11.GL_SMOOTH);
@@ -451,7 +463,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
Minecraft.getInstance().textureManager.bindTexture(textureHalo);
if(player != null)
Helper.translateToHeadLevel(player);
IBaubleRender.Helper.translateToHeadLevel(player);
GlStateManager.translatef(0, 1.5F, 0);
GlStateManager.rotatef(30, 1, 0, -1);
GlStateManager.translatef(-0.1F, -0.5F, -0.1F);
@@ -34,25 +34,4 @@ public class ItemSuperCloudPendant extends ItemCloudPendant {
public int getMaxAllowedJumps() {
return 3;
}
@Override
@OnlyIn(Dist.CLIENT)
public void onPlayerBaubleRender(ItemStack stack, EntityPlayer player, RenderType type, float partialTicks) {
if(type == RenderType.BODY) {
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
Helper.rotateIfSneaking(player);
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
GlStateManager.rotatef(180F, 1F, 0F, 0F);
GlStateManager.translatef(-0.2F, -0.45F, armor ? 0.2F : 0.15F);
GlStateManager.scalef(0.5F, 0.5F, 0.5F);
TextureAtlasSprite gemIcon = MiscellaneousIcons.INSTANCE.nimbusGem;
float f = gemIcon.getMinU();
float f1 = gemIcon.getMaxU();
float f2 = gemIcon.getMinV();
float f3 = gemIcon.getMaxV();
IconHelper.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, gemIcon.getWidth(), gemIcon.getHeight(), 1F / 32F);
}
}
}
@@ -14,6 +14,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.model.ModelBiped;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
@@ -24,16 +25,18 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import top.theillusivec4.curios.api.CuriosAPI;
import vazkii.botania.api.item.IBaubleRender;
import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.integration.curios.BaseCurio;
import vazkii.botania.common.lib.LibItemNames;
import java.util.ArrayList;
import java.util.List;
public class ItemTravelBelt extends ItemBauble implements IBaubleRender, IManaUsingItem {
public class ItemTravelBelt extends ItemBauble implements IManaUsingItem {
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_TRAVEL_BELT);
@OnlyIn(Dist.CLIENT)
@@ -60,20 +63,14 @@ public class ItemTravelBelt extends ItemBauble implements IBaubleRender, IManaUs
this.fallBuffer = fallBuffer;
}
/* todo 1.13
@Override
public BaubleType getBaubleType(ItemStack itemstack) {
return BaubleType.BELT;
}
*/
@SubscribeEvent
public void updatePlayerStepStatus(LivingUpdateEvent event) {
if(event.getEntityLiving() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
CuriosAPI.FinderData result = CuriosAPI.getCurioEquipped(s -> s.getItem() instanceof ItemTravelBelt, player);
String s = playerStr(player);
ItemStack belt = ItemStack.EMPTY; // todo 1.13 BaublesApi.getBaublesHandler(player).getStackInSlot(3);
ItemStack belt = result == null ? ItemStack.EMPTY : result.getStack();
if(playersWithStepup.contains(s)) {
if(shouldPlayerHaveStepup(player)) {
ItemTravelBelt beltItem = (ItemTravelBelt) belt.getItem();
@@ -116,18 +113,18 @@ public class ItemTravelBelt extends ItemBauble implements IBaubleRender, IManaUs
public void onPlayerJump(LivingJumpEvent event) {
if(event.getEntityLiving() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
ItemStack belt = ItemStack.EMPTY; // todo 1.13 BaublesApi.getBaublesHandler(player).getStackInSlot(3);
CuriosAPI.FinderData result = CuriosAPI.getCurioEquipped(s -> s.getItem() instanceof ItemTravelBelt, player);
if(!belt.isEmpty() && belt.getItem() instanceof ItemTravelBelt && ManaItemHandler.requestManaExact(belt, player, COST, false)) {
player.motionY += ((ItemTravelBelt) belt.getItem()).jump;
player.fallDistance = -((ItemTravelBelt) belt.getItem()).fallBuffer;
if(result != null && ManaItemHandler.requestManaExact(result.getStack(), player, COST, false)) {
player.motionY += ((ItemTravelBelt) result.getStack().getItem()).jump;
player.fallDistance = -((ItemTravelBelt) result.getStack().getItem()).fallBuffer;
}
}
}
private boolean shouldPlayerHaveStepup(EntityPlayer player) {
ItemStack armor = ItemStack.EMPTY; // todo 1.13 BaublesApi.getBaublesHandler(player).getStackInSlot(3);
return !armor.isEmpty() && armor.getItem() instanceof ItemTravelBelt && ManaItemHandler.requestManaExact(armor, player, COST, false);
CuriosAPI.FinderData result = CuriosAPI.getCurioEquipped(s -> s.getItem() instanceof ItemTravelBelt, player);
return result != null && ManaItemHandler.requestManaExact(result.getStack(), player, COST, false);
}
@SubscribeEvent
@@ -146,12 +143,20 @@ public class ItemTravelBelt extends ItemBauble implements IBaubleRender, IManaUs
return texture;
}
@Override
@OnlyIn(Dist.CLIENT)
public void onPlayerBaubleRender(ItemStack stack, EntityPlayer player, RenderType type, float partialTicks) {
if(type == RenderType.BODY) {
Minecraft.getInstance().textureManager.bindTexture(getRenderTexture());
Helper.rotateIfSneaking(player);
public static class Curio extends BaseCurio {
public Curio(ItemStack stack) {
super(stack);
}
@Override
public boolean hasRender(String identifier, EntityLivingBase living) {
return true;
}
@Override
public void doRender(String identifier, EntityLivingBase player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
Minecraft.getInstance().textureManager.bindTexture(((ItemTravelBelt) stack.getItem()).getRenderTexture());
IBaubleRender.Helper.rotateIfSneaking(player);
GlStateManager.translatef(0F, 0.2F, 0F);
@@ -40,7 +40,9 @@ import vazkii.botania.api.item.ISequentialBreaker;
import vazkii.botania.api.item.IWireframeCoordinateListProvider;
import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.integration.curios.CurioIntegration;
import vazkii.botania.common.integration.curios.RelicCurio;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.tool.ToolCommons;
@@ -186,9 +188,9 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
}
private static ItemStack getLokiRing(EntityPlayer player) {
CuriosAPI.FinderData result = CuriosAPI.getCurioEquipped(ModItems.lokiRing, player);
if(result != null)
return result.getStack();
if(Botania.curiosLoaded) {
return CurioIntegration.findOrEmpty(ModItems.lokiRing, player);
}
return ItemStack.EMPTY;
}
@@ -14,6 +14,8 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.items.IItemHandler;
import vazkii.botania.common.Botania;
import vazkii.botania.common.integration.curios.CurioIntegration;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibItemNames;
import vazkii.botania.common.lib.LibMisc;
@@ -24,24 +26,15 @@ public class ItemThorRing extends ItemRelicBauble {
super(props);
}
/* todo 1.13
@Override
public BaubleType getBaubleType(ItemStack arg0) {
return BaubleType.RING;
}
*/
@Override
public ResourceLocation getAdvancement() {
return new ResourceLocation(LibMisc.MOD_ID, "challenge/thor_ring");
}
public static ItemStack getThorRing(EntityPlayer player) {
IItemHandler baubles = null; // BaublesApi.getBaublesHandler(player);
int slot = -1; // todo 1.13 BaublesApi.isBaubleEquipped(player, ModItems.thorRing);
if (slot < 0) {
return ItemStack.EMPTY;
if(Botania.curiosLoaded) {
return CurioIntegration.findOrEmpty(ModItems.thorRing, player);
}
return baubles.getStackInSlot(slot);
return ItemStack.EMPTY;
}
}
@@ -16,10 +16,7 @@ import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
@@ -27,8 +24,6 @@ import net.minecraft.nbt.NBTUtil;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.ITextComponent;
@@ -39,7 +34,6 @@ import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import vazkii.botania.api.BotaniaAPI;
@@ -52,7 +46,6 @@ import vazkii.botania.client.core.handler.ItemsRemainingRenderHandler;
import vazkii.botania.common.block.BlockCamo;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.item.ItemMod;
import vazkii.botania.common.lib.LibItemNames;
import javax.annotation.Nonnull;
import java.util.ArrayList;
@@ -273,7 +266,7 @@ public class ItemExchangeRod extends ItemMod implements IManaUsingItem, IWirefra
if(player.abilities.isCreativeMode)
return new ItemStack(block);
ItemStack outStack = removeFromInventory(player, BotaniaAPI.internalHandler.getBaublesInventoryWrapped(player), stack, block, doit);
ItemStack outStack = removeFromInventory(player, BotaniaAPI.internalHandler.getAccessoriesInventory(player), stack, block, doit);
if (outStack.isEmpty())
outStack = removeFromInventory(player, player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY), stack, block, doit);
return outStack;
@@ -283,7 +276,7 @@ public class ItemExchangeRod extends ItemMod implements IManaUsingItem, IWirefra
if(player.abilities.isCreativeMode)
return -1;
int baubleCount = getInventoryItemCount(player, BotaniaAPI.internalHandler.getBaublesInventoryWrapped(player), stack, block);
int baubleCount = getInventoryItemCount(player, BotaniaAPI.internalHandler.getAccessoriesInventory(player), stack, block);
if (baubleCount == -1) return -1;
int count = getInventoryItemCount(player, player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY), stack, block);
@@ -18,18 +18,6 @@ public final class LibMisc {
public static final String BUILD = "GRADLE:BUILD";
public static final String VERSION = "GRADLE:VERSION-" + BUILD;
public static final String MC_VERSION = "1.13.2";
public static final String DEPENDENCIES = "required-after:baubles@[1.5.2,);after:thaumcraft@[6.1.BETA21,);after:jei@[1.12.2-4.13.1.220,)";
// Network Contants
public static final String NETWORK_CHANNEL = MOD_ID;
// Proxy Constants
public static final String PROXY_SERVER = "vazkii.botania.common.core.proxy.ServerProxy";
public static final String PROXY_CLIENT = "vazkii.botania.client.core.proxy.ClientProxy";
public static final String GUI_FACTORY = "vazkii.botania.client.core.proxy.GuiFactory";
// IMC Keys
public static final String BLACKLIST_ITEM = "blackListItem";
public static final int[] CONTROL_CODE_COLORS = new int[] {
0x000000, 0x0000AA, 0x00AA00, 0x00AAAA,
@@ -18,8 +18,10 @@ import net.minecraft.util.SoundCategory;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraftforge.fml.network.NetworkEvent;
import net.minecraftforge.items.IItemHandler;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.integration.curios.CurioIntegration;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.bauble.ItemDodgeRing;
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraSword;
@@ -38,14 +40,16 @@ public class PacketDodge {
EntityPlayerMP player = ctx.get().getSender();
player.world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.dash, SoundCategory.PLAYERS, 1F, 1F);
// todo 1.13
IItemHandler baublesInv = null; // BaublesApi.getBaublesHandler(player);
int slot = -1; // BaublesApi.isBaubleEquipped(player, ModItems.dodgeRing);
if(slot < 0) {
ItemStack ringStack = ItemStack.EMPTY;
if(Botania.curiosLoaded) {
ringStack = CurioIntegration.findOrEmpty(ModItems.dodgeRing, player);
}
if(ringStack.isEmpty()) {
player.connection.disconnect(new TextComponentTranslation("botaniamisc.invalidDodge"));
return;
}
ItemStack ringStack = baublesInv.getStackInSlot(slot);
player.addExhaustion(0.3F);
ItemNBTHelper.setInt(ringStack, ItemDodgeRing.TAG_DODGE_COOLDOWN, ItemDodgeRing.MAX_CD);
});
@@ -10,16 +10,14 @@
*/
package vazkii.botania.common.network;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraftforge.fml.network.NetworkEvent;
import net.minecraftforge.items.IItemHandler;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.bauble.CloudPendantShim;
import vazkii.botania.common.Botania;
import vazkii.botania.common.integration.curios.CurioIntegration;
import vazkii.botania.common.item.equipment.bauble.ItemCloudPendant;
import vazkii.botania.common.item.equipment.bauble.ItemTravelBelt;
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraSword;
import java.util.function.Supplier;
@@ -33,20 +31,18 @@ public class PacketJump {
public void handle(Supplier<NetworkEvent.Context> ctx) {
ctx.get().enqueueWork(() -> {
EntityPlayerMP player = ctx.get().getSender();
/* todo 1.13
IItemHandler baublesInv = BaublesApi.getBaublesHandler(player);
ItemStack amuletStack = baublesInv.getStackInSlot(0);
if(!amuletStack.isEmpty() && amuletStack.getItem() instanceof CloudPendantShim) {
player.addExhaustion(0.3F);
player.fallDistance = 0;
if(Botania.curiosLoaded) {
ItemStack amuletStack = CurioIntegration.findOrEmpty(s -> s.getItem() instanceof ItemCloudPendant, player);
if(!amuletStack.isEmpty()) {
player.addExhaustion(0.3F);
player.fallDistance = 0;
ItemStack belt = BaublesApi.getBaublesHandler(player).getStackInSlot(3);
if(!belt.isEmpty() && belt.getItem() instanceof ItemTravelBelt)
player.fallDistance = -((ItemTravelBelt) belt.getItem()).fallBuffer * ((CloudPendantShim) amuletStack.getItem()).getMaxAllowedJumps();
ItemStack belt = CurioIntegration.findOrEmpty(s -> s.getItem() instanceof ItemTravelBelt, player);
if(!belt.isEmpty())
player.fallDistance = -((ItemTravelBelt) belt.getItem()).fallBuffer * ((ItemCloudPendant) amuletStack.getItem()).getMaxAllowedJumps();
}
}
*/
});
ctx.get().setPacketHandled(true);
}