mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-20 20:22:33 +00:00
Merge internalhandler and api together
This commit is contained in:
1 parent
0f9e759307
commit
bcecfa188c
27 files changed
+211
-363
No files matched your search
@@ -9,30 +9,35 @@
|
||||
package vazkii.botania.api;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.entity.ai.attributes.RangedAttribute;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.item.DyeColor;
|
||||
import net.minecraft.item.IArmorMaterial;
|
||||
import net.minecraft.item.IItemTier;
|
||||
import net.minecraft.item.Rarity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.LazyValue;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
import net.minecraftforge.items.wrapper.EmptyHandler;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.IRegistryDelegate;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import vazkii.botania.api.brew.Brew;
|
||||
import vazkii.botania.api.internal.DummyMethodHandler;
|
||||
import vazkii.botania.api.internal.IInternalMethodHandler;
|
||||
import vazkii.botania.api.corporea.IWrappedInventory;
|
||||
import vazkii.botania.api.corporea.InvWithLocation;
|
||||
import vazkii.botania.api.internal.DummyManaNetwork;
|
||||
import vazkii.botania.api.internal.IManaNetwork;
|
||||
import vazkii.botania.api.subtile.TileEntitySpecialFlower;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -200,9 +205,42 @@ public interface BotaniaAPI {
|
||||
return Rarity.EPIC;
|
||||
}
|
||||
|
||||
// todo 1.15 combine with this and BotaniaAPIClient
|
||||
default IInternalMethodHandler internalHandler() {
|
||||
return new DummyMethodHandler();
|
||||
default IManaNetwork getManaNetworkInstance() {
|
||||
return DummyManaNetwork.instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return How many ticks a passive flower can have before it decays
|
||||
*/
|
||||
default int getPassiveFlowerDecay() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
default IItemHandlerModifiable getAccessoriesInventory(PlayerEntity player) {
|
||||
return new EmptyHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
* Break all the blocks the given player has selected with the loki ring.
|
||||
* The item passed must implement {@link vazkii.botania.api.item.ISequentialBreaker}.
|
||||
*/
|
||||
default void breakOnAllCursors(PlayerEntity player, ItemStack stack, BlockPos pos, Direction side) {}
|
||||
|
||||
default boolean hasSolegnoliaAround(Entity e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
default void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) {}
|
||||
|
||||
/**
|
||||
* See config value "flower.forceCheck" for more information
|
||||
*/
|
||||
default boolean shouldForceCheck() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// todo 1.16 reevaluate this
|
||||
default List<IWrappedInventory> wrapInventory(List<InvWithLocation> inventories) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,10 @@
|
||||
*/
|
||||
package vazkii.botania.api;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.LazyValue;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -55,4 +58,14 @@ public interface BotaniaAPIClient {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw a mana bar on the screen
|
||||
*/
|
||||
default void drawSimpleManaHUD(MatrixStack ms, int color, int mana, int maxMana, String name) {}
|
||||
|
||||
/**
|
||||
* Performs the effects of {@link #drawSimpleManaHUD}, then renders {@code bindDisplay}, and a checkmark or x-mark
|
||||
* dependong on the value of {@code properlyBound}.
|
||||
*/
|
||||
default void drawComplexManaHUD(MatrixStack ms, int color, int mana, int maxMana, String name, ItemStack bindDisplay, boolean properlyBound) {}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* This class is 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
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import vazkii.botania.api.corporea.IWrappedInventory;
|
||||
import vazkii.botania.api.corporea.InvWithLocation;
|
||||
import vazkii.botania.api.subtile.TileEntitySpecialFlower;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DummyMethodHandler implements IInternalMethodHandler {
|
||||
|
||||
@Override
|
||||
public IManaNetwork getManaNetworkInstance() {
|
||||
return DummyManaNetwork.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawSimpleManaHUD(MatrixStack ms, int color, int mana, int maxMana, String name) {}
|
||||
|
||||
@Override
|
||||
public void drawComplexManaHUD(MatrixStack ms, int color, int mana, int maxMana, String name, ItemStack bindDisplay, boolean properlyBound) {}
|
||||
|
||||
@Override
|
||||
public ItemStack getBindDisplayForFlowerType(TileEntitySpecialFlower e) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) {}
|
||||
|
||||
@Override
|
||||
public IItemHandlerModifiable getAccessoriesInventory(PlayerEntity player) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldForceCheck() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPassiveFlowerDecay() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getDefaultBossBarTexture() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakOnAllCursors(PlayerEntity player, Item item, ItemStack stack, BlockPos pos, Direction side) {}
|
||||
|
||||
@Override
|
||||
public boolean hasSolegnoliaAround(Entity e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getWorldElapsedTicks() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IWrappedInventory> wrapInventory(List<InvWithLocation> inventories) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* This class is 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
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import vazkii.botania.api.corporea.IWrappedInventory;
|
||||
import vazkii.botania.api.corporea.InvWithLocation;
|
||||
import vazkii.botania.api.subtile.TileEntitySpecialFlower;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Any methods that refer to internal methods in Botania are here.
|
||||
* This is defaulted to a dummy handler, whose methods do nothing.
|
||||
* This handler is set to a proper one on PreInit. Make sure to
|
||||
* make your mod load after Botania if you have any intention of
|
||||
* doing anythign with this on PreInit.
|
||||
*/
|
||||
public interface IInternalMethodHandler {
|
||||
|
||||
public IManaNetwork getManaNetworkInstance();
|
||||
|
||||
public boolean shouldForceCheck();
|
||||
|
||||
public int getPassiveFlowerDecay();
|
||||
|
||||
public IItemHandlerModifiable getAccessoriesInventory(PlayerEntity player);
|
||||
|
||||
public void breakOnAllCursors(PlayerEntity player, Item item, ItemStack stack, BlockPos pos, Direction side);
|
||||
|
||||
public boolean hasSolegnoliaAround(Entity e);
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void drawSimpleManaHUD(MatrixStack ms, int color, int mana, int maxMana, String name);
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void drawComplexManaHUD(MatrixStack ms, int color, int mana, int maxMana, String name, ItemStack bindDisplay, boolean properlyBound);
|
||||
|
||||
public ItemStack getBindDisplayForFlowerType(TileEntitySpecialFlower e);
|
||||
|
||||
public ResourceLocation getDefaultBossBarTexture();
|
||||
|
||||
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m);
|
||||
|
||||
public long getWorldElapsedTicks();
|
||||
|
||||
/**
|
||||
* Wrap inventories in the network into wrappers providing compatibility for storage mods.
|
||||
*/
|
||||
List<IWrappedInventory> wrapInventory(List<InvWithLocation> inventories);
|
||||
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
@@ -25,6 +26,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.BotaniaAPIClient;
|
||||
import vazkii.botania.api.internal.IManaNetwork;
|
||||
import vazkii.botania.api.mana.IManaPool;
|
||||
|
||||
@@ -32,7 +34,7 @@ import vazkii.botania.api.mana.IManaPool;
|
||||
* The basic class for a Functional Flower.
|
||||
*/
|
||||
public class TileEntityFunctionalFlower extends TileEntitySpecialFlower {
|
||||
|
||||
private static final ResourceLocation POOL_ID = new ResourceLocation(BotaniaAPI.MODID, "mana_pool");
|
||||
public static final int LINK_RANGE = 10;
|
||||
|
||||
private static final String TAG_MANA = "mana";
|
||||
@@ -91,7 +93,7 @@ public class TileEntityFunctionalFlower extends TileEntitySpecialFlower {
|
||||
float green = (color >> 8 & 0xFF) / 255F;
|
||||
float blue = (color & 0xFF) / 255F;
|
||||
if (Math.random() > particleChance) {
|
||||
BotaniaAPI.instance().internalHandler().sparkleFX(getWorld(), getPos().getX() + 0.3 + Math.random() * 0.5, getPos().getY() + 0.5 + Math.random() * 0.5, getPos().getZ() + 0.3 + Math.random() * 0.5, red, green, blue, (float) Math.random(), 5);
|
||||
BotaniaAPI.instance().sparkleFX(getWorld(), getPos().getX() + 0.3 + Math.random() * 0.5, getPos().getY() + 0.5 + Math.random() * 0.5, getPos().getZ() + 0.3 + Math.random() * 0.5, red, green, blue, (float) Math.random(), 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,9 +123,9 @@ public class TileEntityFunctionalFlower extends TileEntitySpecialFlower {
|
||||
}
|
||||
|
||||
if (needsNew && ticksExisted == 1) { // Only for new flowers
|
||||
IManaNetwork network = BotaniaAPI.instance().internalHandler().getManaNetworkInstance();
|
||||
IManaNetwork network = BotaniaAPI.instance().getManaNetworkInstance();
|
||||
int size = network.getAllPoolsInWorld(getWorld()).size();
|
||||
if (BotaniaAPI.instance().internalHandler().shouldForceCheck() || size != sizeLastCheck) {
|
||||
if (BotaniaAPI.instance().shouldForceCheck() || size != sizeLastCheck) {
|
||||
linkedPool = network.getClosestPool(getPos(), getWorld(), LINK_RANGE);
|
||||
sizeLastCheck = size;
|
||||
}
|
||||
@@ -235,12 +237,16 @@ public class TileEntityFunctionalFlower extends TileEntitySpecialFlower {
|
||||
&& getWorld().getTileEntity(linkedPool.getPos()) == linkedPool;
|
||||
}
|
||||
|
||||
public ItemStack getHudIcon() {
|
||||
return Registry.ITEM.getValue(POOL_ID).map(ItemStack::new).orElse(ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void renderHUD(MatrixStack ms, Minecraft mc) {
|
||||
String name = I18n.format(getBlockState().getBlock().getTranslationKey());
|
||||
int color = getColor();
|
||||
BotaniaAPI.instance().internalHandler().drawComplexManaHUD(ms, color, getMana(), getMaxMana(), name, BotaniaAPI.instance().internalHandler().getBindDisplayForFlowerType(this), isValidBinding());
|
||||
BotaniaAPIClient.instance().drawComplexManaHUD(ms, color, getMana(), getMaxMana(), name, getHudIcon(), isValidBinding());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
@@ -26,6 +27,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.BotaniaAPIClient;
|
||||
import vazkii.botania.api.internal.IManaNetwork;
|
||||
import vazkii.botania.api.mana.IManaCollector;
|
||||
|
||||
@@ -33,6 +35,7 @@ import vazkii.botania.api.mana.IManaCollector;
|
||||
* The basic class for a Generating Flower.
|
||||
*/
|
||||
public class TileEntityGeneratingFlower extends TileEntitySpecialFlower {
|
||||
private static final ResourceLocation SPREADER_ID = new ResourceLocation(BotaniaAPI.MODID, "mana_spreader");
|
||||
|
||||
public static final int LINK_RANGE = 6;
|
||||
|
||||
@@ -101,13 +104,13 @@ public class TileEntityGeneratingFlower extends TileEntitySpecialFlower {
|
||||
double x = getPos().getX() + offset.x;
|
||||
double y = getPos().getY() + offset.y;
|
||||
double z = getPos().getZ() + offset.z;
|
||||
BotaniaAPI.instance().internalHandler().sparkleFX(getWorld(), x + 0.3 + Math.random() * 0.5, y + 0.5 + Math.random() * 0.5, z + 0.3 + Math.random() * 0.5, red, green, blue, (float) Math.random(), 5);
|
||||
BotaniaAPI.instance().sparkleFX(getWorld(), x + 0.3 + Math.random() * 0.5, y + 0.5 + Math.random() * 0.5, z + 0.3 + Math.random() * 0.5, red, green, blue, (float) Math.random(), 5);
|
||||
}
|
||||
}
|
||||
|
||||
boolean passive = isPassiveFlower();
|
||||
if (!getWorld().isRemote) {
|
||||
int muhBalance = BotaniaAPI.instance().internalHandler().getPassiveFlowerDecay();
|
||||
int muhBalance = BotaniaAPI.instance().getPassiveFlowerDecay();
|
||||
|
||||
if (passive && muhBalance > 0 && passiveDecayTicks > muhBalance) {
|
||||
getWorld().destroyBlock(getPos(), false);
|
||||
@@ -147,9 +150,9 @@ public class TileEntityGeneratingFlower extends TileEntitySpecialFlower {
|
||||
}
|
||||
|
||||
if (needsNew && ticksExisted == 1) { // New flowers only
|
||||
IManaNetwork network = BotaniaAPI.instance().internalHandler().getManaNetworkInstance();
|
||||
IManaNetwork network = BotaniaAPI.instance().getManaNetworkInstance();
|
||||
int size = network.getAllCollectorsInWorld(getWorld()).size();
|
||||
if (BotaniaAPI.instance().internalHandler().shouldForceCheck() || size != sizeLastCheck) {
|
||||
if (BotaniaAPI.instance().shouldForceCheck() || size != sizeLastCheck) {
|
||||
linkedCollector = network.getClosestCollector(getPos(), getWorld(), LINK_RANGE);
|
||||
sizeLastCheck = size;
|
||||
}
|
||||
@@ -289,12 +292,16 @@ public class TileEntityGeneratingFlower extends TileEntitySpecialFlower {
|
||||
return linkedCollector != null && !linkedCollector.isRemoved() && getWorld().getTileEntity(linkedCollector.getPos()) == linkedCollector;
|
||||
}
|
||||
|
||||
public ItemStack getHudIcon() {
|
||||
return Registry.ITEM.getValue(SPREADER_ID).map(ItemStack::new).orElse(ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void renderHUD(MatrixStack ms, Minecraft mc) {
|
||||
String name = I18n.format(getBlockState().getBlock().getTranslationKey());
|
||||
int color = getColor();
|
||||
BotaniaAPI.instance().internalHandler().drawComplexManaHUD(ms, color, getMana(), getMaxMana(), name, BotaniaAPI.instance().internalHandler().getBindDisplayForFlowerType(this), isValidBinding());
|
||||
BotaniaAPIClient.instance().drawComplexManaHUD(ms, color, getMana(), getMaxMana(), name, getHudIcon(), isValidBinding());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,6 +42,7 @@ import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.capability.FloatingFlowerImpl;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.item.IFloatingFlower;
|
||||
@@ -62,7 +63,7 @@ import java.util.List;
|
||||
public class TileEntitySpecialFlower extends TileEntity implements ITickableTileEntity, IWandBindable {
|
||||
@CapabilityInject(IFloatingFlower.class)
|
||||
public static Capability<IFloatingFlower> FLOATING_FLOWER_CAP;
|
||||
public static final ResourceLocation DING_SOUND_EVENT = new ResourceLocation("botania", "ding");
|
||||
public static final ResourceLocation DING_SOUND_EVENT = new ResourceLocation(BotaniaAPI.MODID, "ding");
|
||||
public static final int SLOWDOWN_FACTOR_PODZOL = 5;
|
||||
public static final int SLOWDOWN_FACTOR_MYCEL = 10;
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public final class BoundTileRenderer {
|
||||
|
||||
LazyOptional<IItemHandler> mainInvCap = player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.UP);
|
||||
mainInvCap.ifPresent(mainInv -> {
|
||||
IItemHandlerModifiable acc = BotaniaAPI.instance().internalHandler().getAccessoriesInventory(player);
|
||||
IItemHandlerModifiable acc = BotaniaAPI.instance().getAccessoriesInventory(player);
|
||||
IItemHandler joined = acc != null ? new CombinedInvWrapper((IItemHandlerModifiable) mainInv, acc) : mainInv;
|
||||
|
||||
for (int i = 0; i < joined.getSlots(); i++) {
|
||||
|
||||
@@ -174,7 +174,7 @@ public final class HUDHandler {
|
||||
boolean creative = false;
|
||||
|
||||
IItemHandler mainInv = player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).orElse(EmptyHandler.INSTANCE);
|
||||
IItemHandler accInv = BotaniaAPI.instance().internalHandler().getAccessoriesInventory(player);
|
||||
IItemHandler accInv = BotaniaAPI.instance().getAccessoriesInventory(player);
|
||||
|
||||
int invSize = mainInv.getSlots();
|
||||
int size = invSize;
|
||||
|
||||
@@ -9,11 +9,14 @@
|
||||
package vazkii.botania.client.impl;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPIClient;
|
||||
import vazkii.botania.api.item.IFloatingFlower;
|
||||
import vazkii.botania.client.core.handler.HUDHandler;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
@@ -30,4 +33,14 @@ public class BotaniaAPIClientImpl implements BotaniaAPIClient {
|
||||
public Map<IFloatingFlower.IslandType, ResourceLocation> getRegisteredIslandTypeModels() {
|
||||
return Collections.unmodifiableMap(islandTypeModels);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawSimpleManaHUD(MatrixStack ms, int color, int mana, int maxMana, String name) {
|
||||
HUDHandler.drawSimpleManaHUD(ms, color, mana, maxMana, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawComplexManaHUD(MatrixStack ms, int color, int mana, int maxMana, String name, ItemStack bindDisplay, boolean properlyBound) {
|
||||
HUDHandler.drawComplexManaHUD(color, ms, mana, maxMana, name, bindDisplay, properlyBound);
|
||||
}
|
||||
}
|
||||
@@ -90,6 +90,7 @@ import vazkii.botania.common.core.proxy.ServerProxy;
|
||||
import vazkii.botania.common.crafting.ModRecipeTypes;
|
||||
import vazkii.botania.common.entity.EntityDoppleganger;
|
||||
import vazkii.botania.common.entity.ModEntities;
|
||||
import vazkii.botania.common.impl.BotaniaAPIImpl;
|
||||
import vazkii.botania.common.impl.corporea.CorporeaItemStackMatcher;
|
||||
import vazkii.botania.common.impl.corporea.CorporeaStringMatcher;
|
||||
import vazkii.botania.common.item.ItemGrassSeeds;
|
||||
@@ -295,29 +296,17 @@ public class Botania {
|
||||
});
|
||||
}
|
||||
|
||||
/* todo 1.13
|
||||
public void init(FMLInitializationEvent event) {
|
||||
FMLInterModComms.sendMessage("projecte", "interdictionblacklist", EntityManaBurst.class.getCanonicalName());
|
||||
|
||||
for(Block b : new Block[]{ ModBlocks.manaGlass, ModBlocks.elfGlass, ModBlocks.bifrostPerm })
|
||||
FMLInterModComms.sendMessage("chiselsandbits", "ignoreblocklogic", b.getRegistryName().toString());
|
||||
}
|
||||
*/
|
||||
|
||||
private void loadComplete(FMLLoadCompleteEvent event) {
|
||||
finishedLoading = true;
|
||||
}
|
||||
|
||||
// Overriding the internal method handler will break everything as it changes regularly.
|
||||
// So just don't be a moron and don't override it. Thanks.
|
||||
private void serverAboutToStart(FMLServerAboutToStartEvent event) {
|
||||
String clname = BotaniaAPI.instance().internalHandler().getClass().getName();
|
||||
String expect = "vazkii.botania.common.core.handler.InternalMethodHandler";
|
||||
if (!clname.equals(expect)) {
|
||||
throw new IllegalAccessError("The Botania API internal method handler has been overriden. "
|
||||
if (BotaniaAPI.instance().getClass() != BotaniaAPIImpl.class) {
|
||||
String clname = BotaniaAPI.instance().getClass().getName();
|
||||
throw new IllegalAccessError("The Botania API has been overriden. "
|
||||
+ "This will cause crashes and compatibility issues, and that's why it's marked as"
|
||||
+ " \"Do not Override\". Whoever had the brilliant idea of overriding it needs to go"
|
||||
+ " back to elementary school and learn to read. (Expected classname: " + expect + ", Actual classname: " + clname + ")");
|
||||
+ " back to elementary school and learn to read. (Actual classname: " + clname + ")");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -16,6 +16,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.sound.PlaySoundEvent;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.client.fx.SparkleParticleData;
|
||||
import vazkii.botania.common.block.tile.mana.TilePool;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -47,7 +48,8 @@ public class BergamuteEventHandler {
|
||||
float red = (color >> 16 & 0xFF) / 255F;
|
||||
float green = (color >> 8 & 0xFF) / 255F;
|
||||
float blue = (color & 0xFF) / 255F;
|
||||
BotaniaAPI.instance().internalHandler().sparkleFX(berg.getWorld(), berg.getEffectivePos().getX() + 0.3 + Math.random() * 0.5, berg.getEffectivePos().getY() + 0.5 + Math.random() * 0.5, berg.getEffectivePos().getZ() + 0.3 + Math.random() * 0.5, red, green, blue, (float) Math.random(), 5);
|
||||
SparkleParticleData data = SparkleParticleData.sparkle((float) Math.random(), red, green, blue, 5);
|
||||
berg.getWorld().addParticle(data, berg.getEffectivePos().getX() + 0.3 + Math.random() * 0.5, berg.getEffectivePos().getY() + 0.5 + Math.random() * 0.5, berg.getEffectivePos().getZ() + 0.3 + Math.random() * 0.5, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPIClient;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.item.IManaDissolvable;
|
||||
import vazkii.botania.api.mana.*;
|
||||
@@ -396,7 +397,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
|
||||
ItemStack pool = new ItemStack(getBlockState().getBlock());
|
||||
String name = pool.getDisplayName().getString();
|
||||
int color = 0x4444FF;
|
||||
HUDHandler.drawSimpleManaHUD(ms, color, getCurrentMana(), manaCap, name);
|
||||
BotaniaAPIClient.instance().drawSimpleManaHUD(ms, color, getCurrentMana(), manaCap, name);
|
||||
|
||||
int x = Minecraft.getInstance().getMainWindow().getScaledWidth() / 2 - 11;
|
||||
int y = Minecraft.getInstance().getMainWindow().getScaledHeight() / 2 + 30;
|
||||
|
||||
@@ -32,6 +32,7 @@ import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPIClient;
|
||||
import vazkii.botania.api.internal.IManaBurst;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.mana.*;
|
||||
@@ -541,7 +542,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
|
||||
public void renderHUD(MatrixStack ms, Minecraft mc) {
|
||||
String name = new ItemStack(getBlockState().getBlock()).getDisplayName().getString();
|
||||
int color = getVariant().hudColor;
|
||||
HUDHandler.drawSimpleManaHUD(ms, color, getCurrentMana(), getMaxMana(), name);
|
||||
BotaniaAPIClient.instance().drawSimpleManaHUD(ms, color, getCurrentMana(), getMaxMana(), name);
|
||||
|
||||
ItemStack lens = itemHandler.getStackInSlot(0);
|
||||
if (!lens.isEmpty()) {
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* This class is 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
|
||||
*/
|
||||
package vazkii.botania.common.core.handler;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
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.corporea.CorporeaHelper;
|
||||
import vazkii.botania.api.corporea.ICorporeaSpark;
|
||||
import vazkii.botania.api.corporea.IWrappedInventory;
|
||||
import vazkii.botania.api.corporea.InvWithLocation;
|
||||
import vazkii.botania.api.internal.DummyMethodHandler;
|
||||
import vazkii.botania.api.internal.IManaNetwork;
|
||||
import vazkii.botania.api.subtile.TileEntityFunctionalFlower;
|
||||
import vazkii.botania.api.subtile.TileEntityGeneratingFlower;
|
||||
import vazkii.botania.api.subtile.TileEntitySpecialFlower;
|
||||
import vazkii.botania.client.core.handler.BossBarHandler;
|
||||
import vazkii.botania.client.core.handler.HUDHandler;
|
||||
import vazkii.botania.client.fx.SparkleParticleData;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileSolegnolia;
|
||||
import vazkii.botania.common.integration.corporea.WrappedIInventory;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.relic.ItemLokiRing;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class InternalMethodHandler extends DummyMethodHandler {
|
||||
@Override
|
||||
public IManaNetwork getManaNetworkInstance() {
|
||||
return ManaNetworkHandler.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandlerModifiable getAccessoriesInventory(PlayerEntity player) {
|
||||
if (Botania.curiosLoaded) {
|
||||
LazyOptional<IItemHandlerModifiable> cap = EquipmentHandler.getAllWorn(player);
|
||||
return cap.orElseGet(EmptyHandler::new);
|
||||
}
|
||||
return new EmptyHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawSimpleManaHUD(MatrixStack ms, int color, int mana, int maxMana, String name) {
|
||||
HUDHandler.drawSimpleManaHUD(ms, color, mana, maxMana, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawComplexManaHUD(MatrixStack ms, int color, int mana, int maxMana, String name, ItemStack bindDisplay, boolean properlyBound) {
|
||||
HUDHandler.drawComplexManaHUD(color, ms, mana, maxMana, name, bindDisplay, properlyBound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getBindDisplayForFlowerType(TileEntitySpecialFlower e) {
|
||||
return e instanceof TileEntityGeneratingFlower ? new ItemStack(ModBlocks.manaSpreader) : e instanceof TileEntityFunctionalFlower ? new ItemStack(ModBlocks.manaPool) : new ItemStack(ModItems.twigWand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) {
|
||||
SparkleParticleData data = SparkleParticleData.sparkle(size, r, g, b, m);
|
||||
world.addParticle(data, x, y, z, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getDefaultBossBarTexture() {
|
||||
return BossBarHandler.defaultBossBar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldForceCheck() {
|
||||
return ConfigHandler.COMMON.flowerForceCheck.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPassiveFlowerDecay() {
|
||||
return LibMisc.PASSIVE_FLOWER_DECAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakOnAllCursors(PlayerEntity player, Item item, ItemStack stack, BlockPos pos, Direction side) {
|
||||
ItemLokiRing.breakOnAllCursors(player, item, stack, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSolegnoliaAround(Entity e) {
|
||||
return SubTileSolegnolia.hasSolegnoliaAround(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getWorldElapsedTicks() {
|
||||
return Botania.proxy.getWorldElapsedTicks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IWrappedInventory> wrapInventory(List<InvWithLocation> inventories) {
|
||||
List<IWrappedInventory> arrayList = new ArrayList<IWrappedInventory>();
|
||||
for (InvWithLocation inv : inventories) {
|
||||
ICorporeaSpark spark = CorporeaHelper.instance().getSparkForInventory(inv);
|
||||
IWrappedInventory wrapped = null;
|
||||
// try integrations
|
||||
|
||||
// last chance - this will always work
|
||||
if (wrapped == null) {
|
||||
wrapped = WrappedIInventory.wrap(inv, spark);
|
||||
}
|
||||
arrayList.add(wrapped);
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ public class EntitySpark extends EntitySparkBase implements ISparkEntity {
|
||||
stacks.addAll(player.inventory.mainInventory);
|
||||
stacks.addAll(player.inventory.armorInventory);
|
||||
|
||||
IItemHandler inv = BotaniaAPI.instance().internalHandler().getAccessoriesInventory(player);
|
||||
IItemHandler inv = BotaniaAPI.instance().getAccessoriesInventory(player);
|
||||
for (int i = 0; i < inv.getSlots(); i++) {
|
||||
stacks.add(inv.getStackInSlot(i));
|
||||
}
|
||||
|
||||
@@ -9,29 +9,48 @@
|
||||
package vazkii.botania.common.impl;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.LazyValue;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.wrapper.EmptyHandler;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.IRegistryDelegate;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.brew.Brew;
|
||||
import vazkii.botania.api.internal.IInternalMethodHandler;
|
||||
import vazkii.botania.api.corporea.CorporeaHelper;
|
||||
import vazkii.botania.api.corporea.ICorporeaSpark;
|
||||
import vazkii.botania.api.corporea.IWrappedInventory;
|
||||
import vazkii.botania.api.corporea.InvWithLocation;
|
||||
import vazkii.botania.api.internal.IManaNetwork;
|
||||
import vazkii.botania.api.subtile.TileEntityFunctionalFlower;
|
||||
import vazkii.botania.api.subtile.TileEntityGeneratingFlower;
|
||||
import vazkii.botania.api.subtile.TileEntitySpecialFlower;
|
||||
import vazkii.botania.client.fx.SparkleParticleData;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileSolegnolia;
|
||||
import vazkii.botania.common.brew.ModBrews;
|
||||
import vazkii.botania.common.core.handler.InternalMethodHandler;
|
||||
import vazkii.botania.common.core.handler.PixieHandler;
|
||||
import vazkii.botania.common.core.handler.*;
|
||||
import vazkii.botania.common.integration.corporea.WrappedIInventory;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.relic.ItemLokiRing;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
@@ -212,11 +231,61 @@ public class BotaniaAPIImpl implements BotaniaAPI {
|
||||
return RELIC_RARITY.getValue();
|
||||
}
|
||||
|
||||
private final InternalMethodHandler tmp = new InternalMethodHandler();
|
||||
@Override
|
||||
public IManaNetwork getManaNetworkInstance() {
|
||||
return ManaNetworkHandler.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInternalMethodHandler internalHandler() {
|
||||
return tmp;
|
||||
public int getPassiveFlowerDecay() {
|
||||
return LibMisc.PASSIVE_FLOWER_DECAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandlerModifiable getAccessoriesInventory(PlayerEntity player) {
|
||||
if (Botania.curiosLoaded) {
|
||||
LazyOptional<IItemHandlerModifiable> cap = EquipmentHandler.getAllWorn(player);
|
||||
return cap.orElseGet(EmptyHandler::new);
|
||||
}
|
||||
return new EmptyHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakOnAllCursors(PlayerEntity player, ItemStack stack, BlockPos pos, Direction side) {
|
||||
ItemLokiRing.breakOnAllCursors(player, stack, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSolegnoliaAround(Entity e) {
|
||||
return SubTileSolegnolia.hasSolegnoliaAround(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) {
|
||||
SparkleParticleData data = SparkleParticleData.sparkle(size, r, g, b, m);
|
||||
world.addParticle(data, x, y, z, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldForceCheck() {
|
||||
return ConfigHandler.COMMON.flowerForceCheck.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IWrappedInventory> wrapInventory(List<InvWithLocation> inventories) {
|
||||
List<IWrappedInventory> arrayList = new ArrayList<IWrappedInventory>();
|
||||
for (InvWithLocation inv : inventories) {
|
||||
ICorporeaSpark spark = CorporeaHelper.instance().getSparkForInventory(inv);
|
||||
IWrappedInventory wrapped = null;
|
||||
// try integrations
|
||||
|
||||
// last chance - this will always work
|
||||
if (wrapped == null) {
|
||||
wrapped = WrappedIInventory.wrap(inv, spark);
|
||||
}
|
||||
arrayList.add(wrapped);
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public Map<ResourceLocation, Integer> oreWeights = Collections.emptyMap();
|
||||
|
||||
@@ -94,7 +94,7 @@ public class CorporeaHelperImpl implements CorporeaHelper {
|
||||
@Override
|
||||
public Map<InvWithLocation, Integer> getInventoriesWithMatchInNetwork(ICorporeaRequestMatcher matcher, List<InvWithLocation> inventories) {
|
||||
Map<InvWithLocation, Integer> countMap = new HashMap<>();
|
||||
List<IWrappedInventory> wrappedInventories = BotaniaAPI.instance().internalHandler().wrapInventory(inventories);
|
||||
List<IWrappedInventory> wrappedInventories = BotaniaAPI.instance().wrapInventory(inventories);
|
||||
for (IWrappedInventory inv : wrappedInventories) {
|
||||
ICorporeaRequest request = new CorporeaRequest(matcher, -1);
|
||||
inv.countItems(request);
|
||||
@@ -127,7 +127,7 @@ public class CorporeaHelperImpl implements CorporeaHelper {
|
||||
|
||||
List<InvWithLocation> inventories = getInventoriesOnNetwork(spark);
|
||||
|
||||
List<IWrappedInventory> inventoriesW = BotaniaAPI.instance().internalHandler().wrapInventory(inventories);
|
||||
List<IWrappedInventory> inventoriesW = BotaniaAPI.instance().wrapInventory(inventories);
|
||||
Map<ICorporeaInterceptor, ICorporeaSpark> interceptors = new HashMap<>();
|
||||
|
||||
ICorporeaRequest request = new CorporeaRequest(matcher, itemCount);
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ManaItemHandlerImpl implements ManaItemHandler {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
IItemHandler acc = BotaniaAPI.instance().internalHandler().getAccessoriesInventory(player);
|
||||
IItemHandler acc = BotaniaAPI.instance().getAccessoriesInventory(player);
|
||||
if (acc == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class ItemBlockSpecialFlower extends BlockItem {
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
CompoundNBT tag = stack.getChildTag("BlockEntityTag");
|
||||
if (tag != null) {
|
||||
return tag.getInt(TileEntityGeneratingFlower.TAG_PASSIVE_DECAY_TICKS) / (double) BotaniaAPI.instance().internalHandler().getPassiveFlowerDecay();
|
||||
return tag.getInt(TileEntityGeneratingFlower.TAG_PASSIVE_DECAY_TICKS) / (double) BotaniaAPI.instance().getPassiveFlowerDecay();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.item.ItemTossEvent;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.item.IRelic;
|
||||
import vazkii.botania.api.mana.IManaItem;
|
||||
import vazkii.botania.client.fx.SparkleParticleData;
|
||||
@@ -63,7 +64,7 @@ public class ItemMagnetRing extends ItemBauble {
|
||||
|
||||
int cooldown = getCooldown(stack);
|
||||
|
||||
if (SubTileSolegnolia.hasSolegnoliaAround(living)) {
|
||||
if (BotaniaAPI.instance().hasSolegnoliaAround(living)) {
|
||||
if (cooldown < 0) {
|
||||
setCooldown(stack, 2);
|
||||
}
|
||||
@@ -103,7 +104,7 @@ public class ItemMagnetRing extends ItemBauble {
|
||||
}
|
||||
|
||||
private boolean canPullItem(ItemEntity item) {
|
||||
if (!item.isAlive() || item.pickupDelay >= 40 || SubTileSolegnolia.hasSolegnoliaAround(item) || item.getPersistentData().getBoolean("PreventRemoteMovement")) {
|
||||
if (!item.isAlive() || item.pickupDelay >= 40 || BotaniaAPI.instance().hasSolegnoliaAround(item) || item.getPersistentData().getBoolean("PreventRemoteMovement")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -14,7 +14,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.RegistryKey;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
@@ -28,7 +27,6 @@ import vazkii.botania.common.item.ItemTemperanceStone;
|
||||
import vazkii.botania.common.item.equipment.tool.ToolCommons;
|
||||
import vazkii.botania.common.item.equipment.tool.manasteel.ItemManasteelAxe;
|
||||
import vazkii.botania.common.item.relic.ItemLokiRing;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -80,7 +78,7 @@ public class ItemTerraAxe extends ItemManasteelAxe implements ISequentialBreaker
|
||||
if (raycast.getType() == RayTraceResult.Type.BLOCK) {
|
||||
Direction face = raycast.getFace();
|
||||
breakOtherBlock(player, stack, pos, pos, face);
|
||||
ItemLokiRing.breakOnAllCursors(player, this, stack, pos, face);
|
||||
BotaniaAPI.instance().breakOnAllCursors(player, stack, pos, face);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
+1
-2
@@ -144,8 +144,7 @@ public class ItemTerraPick extends ItemManasteelPick implements IManaItem, ISequ
|
||||
if (!player.world.isRemote && raycast.getType() == RayTraceResult.Type.BLOCK) {
|
||||
Direction face = raycast.getFace();
|
||||
breakOtherBlock(player, stack, pos, pos, face);
|
||||
ItemLokiRing.breakOnAllCursors(player, this, stack, pos, face);
|
||||
// ^ Doable with API access through the IInternalMethodHandler.
|
||||
BotaniaAPI.instance().breakOnAllCursors(player, stack, pos, face);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -136,7 +136,8 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
|
||||
}
|
||||
}
|
||||
|
||||
public static void breakOnAllCursors(PlayerEntity player, Item item, ItemStack stack, BlockPos pos, Direction side) {
|
||||
public static void breakOnAllCursors(PlayerEntity player, ItemStack stack, BlockPos pos, Direction side) {
|
||||
Item item = stack.getItem();
|
||||
ItemStack lokiRing = getLokiRing(player);
|
||||
if (lokiRing.isEmpty() || player.world.isRemote || !(item instanceof ISequentialBreaker)) {
|
||||
return;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ItemOdinRing extends ItemRelicBauble {
|
||||
|
||||
@Override
|
||||
public void onValidPlayerWornTick(PlayerEntity player) {
|
||||
if (player.isBurning() && ConfigHandler.COMMON.ringOfOdinFireResist.get()) {
|
||||
if (player.isBurning()) {
|
||||
player.extinguish();
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public class ItemOdinRing extends ItemRelicBauble {
|
||||
if (event.getEntityLiving() instanceof PlayerEntity) {
|
||||
PlayerEntity player = (PlayerEntity) event.getEntityLiving();
|
||||
boolean negate = damageNegations.contains(event.getSource().damageType)
|
||||
|| (ConfigHandler.COMMON.ringOfOdinFireResist.get() && fireNegations.contains(event.getSource().damageType));
|
||||
|| (fireNegations.contains(event.getSource().damageType));
|
||||
boolean hasRing = !EquipmentHandler.findOrEmpty(ModItems.odinRing, player).isEmpty();
|
||||
if (hasRing && negate) {
|
||||
event.setCanceled(true);
|
||||
|
||||
@@ -269,7 +269,7 @@ public class ItemExchangeRod extends Item implements IManaUsingItem, IWireframeC
|
||||
return new ItemStack(block);
|
||||
}
|
||||
|
||||
ItemStack outStack = removeFromInventory(player, BotaniaAPI.instance().internalHandler().getAccessoriesInventory(player), stack, block, doit);
|
||||
ItemStack outStack = removeFromInventory(player, BotaniaAPI.instance().getAccessoriesInventory(player), stack, block, doit);
|
||||
if (outStack.isEmpty()) {
|
||||
outStack = removeFromInventory(player, player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY), stack, block, doit);
|
||||
}
|
||||
@@ -281,7 +281,7 @@ public class ItemExchangeRod extends Item implements IManaUsingItem, IWireframeC
|
||||
return -1;
|
||||
}
|
||||
|
||||
int baubleCount = getInventoryItemCount(player, BotaniaAPI.instance().internalHandler().getAccessoriesInventory(player), stack, block);
|
||||
int baubleCount = getInventoryItemCount(player, BotaniaAPI.instance().getAccessoriesInventory(player), stack, block);
|
||||
if (baubleCount == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@ public final class LibMisc {
|
||||
|
||||
public static final String MOD_ID = "botania";
|
||||
public static final String MOD_NAME = "Botania";
|
||||
public static final String BUILD = "GRADLE:BUILD";
|
||||
public static final String VERSION = "GRADLE:VERSION-" + BUILD;
|
||||
public static final int PASSIVE_FLOWER_DECAY = 72000;
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user