move some API stuff around

This commit is contained in:
Ellpeck 2018-11-12 22:04:40 +01:00
parent a10210888c
commit 13d6cf778a
14 changed files with 94 additions and 97 deletions

View file

@ -1,10 +1,8 @@
package de.ellpeck.naturesaura;
import baubles.api.BaublesApi;
import de.ellpeck.naturesaura.api.NACapabilities;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityImpl;
import de.ellpeck.naturesaura.compat.Compat;
import net.minecraft.block.Block;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
@ -16,6 +14,7 @@ import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
@ -27,10 +26,10 @@ import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.ChunkProviderServer;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import org.lwjgl.opengl.GL11;
@ -174,13 +173,13 @@ public final class Helper {
@Override
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
return capability == NACapabilities.auraRecharge;
return capability == NaturesAuraAPI.capAuraRecharge;
}
@Nullable
@Override
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
return capability == NACapabilities.auraRecharge ? (T) this.recharge : null;
return capability == NaturesAuraAPI.capAuraRecharge ? (T) this.recharge : null;
}
};
}
@ -214,4 +213,19 @@ public final class Helper {
return state.withProperty(prop, value);
return null;
}
public static <T> void registerCap(Class<T> type) {
CapabilityManager.INSTANCE.register(type, new Capability.IStorage<T>() {
@Nullable
@Override
public NBTBase writeNBT(Capability capability, Object instance, EnumFacing side) {
return null;
}
@Override
public void readNBT(Capability capability, Object instance, EnumFacing side, NBTBase nbt) {
}
}, () -> null);
}
}

View file

@ -1,7 +1,6 @@
package de.ellpeck.naturesaura;
import baubles.api.BaublesApi;
import de.ellpeck.naturesaura.api.NACapabilities;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.compat.Compat;
@ -26,8 +25,8 @@ public class InternalHooks implements NaturesAuraAPI.IInternalHooks {
IItemHandler baubles = BaublesApi.getBaublesHandler(player);
for (int i = 0; i < baubles.getSlots(); i++) {
ItemStack stack = baubles.getStackInSlot(i);
if (!stack.isEmpty() && stack.hasCapability(NACapabilities.auraContainer, null)) {
amount -= stack.getCapability(NACapabilities.auraContainer, null).drainAura(amount, simulate);
if (!stack.isEmpty() && stack.hasCapability(NaturesAuraAPI.capAuraContainer, null)) {
amount -= stack.getCapability(NaturesAuraAPI.capAuraContainer, null).drainAura(amount, simulate);
if (amount <= 0)
return true;
}
@ -36,8 +35,8 @@ public class InternalHooks implements NaturesAuraAPI.IInternalHooks {
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack stack = player.inventory.getStackInSlot(i);
if (!stack.isEmpty() && stack.hasCapability(NACapabilities.auraContainer, null)) {
amount -= stack.getCapability(NACapabilities.auraContainer, null).drainAura(amount, simulate);
if (!stack.isEmpty() && stack.hasCapability(NaturesAuraAPI.capAuraContainer, null)) {
amount -= stack.getCapability(NaturesAuraAPI.capAuraContainer, null).drainAura(amount, simulate);
if (amount <= 0)
return true;
}
@ -58,8 +57,8 @@ public class InternalHooks implements NaturesAuraAPI.IInternalHooks {
for (int z = (pos.getZ() - radius) >> 4; z <= (pos.getZ() + radius) >> 4; z++) {
if (Helper.isChunkLoaded(world, x, z)) {
Chunk chunk = world.getChunk(x, z);
if (chunk.hasCapability(NACapabilities.auraChunk, null)) {
IAuraChunk auraChunk = chunk.getCapability(NACapabilities.auraChunk, null);
if (chunk.hasCapability(NaturesAuraAPI.capAuraChunk, null)) {
IAuraChunk auraChunk = chunk.getCapability(NaturesAuraAPI.capAuraChunk, null);
auraChunk.getSpotsInArea(pos, radius, consumer);
}
}

View file

@ -1,6 +1,5 @@
package de.ellpeck.naturesaura;
import de.ellpeck.naturesaura.api.NACapabilities.StorageImpl;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
@ -21,7 +20,6 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
@ -56,9 +54,9 @@ public final class NaturesAura {
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
NaturesAuraAPI.setInstance(new InternalHooks());
CapabilityManager.INSTANCE.register(IAuraContainer.class, new StorageImpl<>(), () -> null);
CapabilityManager.INSTANCE.register(IAuraRecharge.class, new StorageImpl<>(), () -> null);
CapabilityManager.INSTANCE.register(IAuraChunk.class, new StorageImpl<>(), () -> null);
Helper.registerCap(IAuraContainer.class);
Helper.registerCap(IAuraRecharge.class);
Helper.registerCap(IAuraChunk.class);
new ModBlocks();
new ModItems();

View file

@ -1,38 +0,0 @@
package de.ellpeck.naturesaura.api;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge;
import net.minecraft.nbt.NBTBase;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.Capability.IStorage;
import net.minecraftforge.common.capabilities.CapabilityInject;
import javax.annotation.Nullable;
public final class NACapabilities {
@CapabilityInject(IAuraContainer.class)
public static Capability<IAuraContainer> auraContainer;
@CapabilityInject(IAuraRecharge.class)
public static Capability<IAuraRecharge> auraRecharge;
@CapabilityInject(IAuraChunk.class)
public static Capability<IAuraChunk> auraChunk;
public static class StorageImpl<T> implements IStorage<T> {
@Nullable
@Override
public NBTBase writeNBT(Capability<T> capability, T instance, EnumFacing side) {
return null;
}
@Override
public void readNBT(Capability<T> capability, T instance, EnumFacing side, NBTBase nbt) {
}
}
}

View file

@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.api;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge;
import de.ellpeck.naturesaura.api.aura.type.BasicAuraType;
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.api.internal.StubHooks;
@ -14,6 +15,8 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.DimensionType;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
import org.apache.commons.lang3.mutable.MutableInt;
import java.util.ArrayList;
@ -66,6 +69,29 @@ public final class NaturesAuraAPI {
public static final IAuraType TYPE_END = new BasicAuraType(new ResourceLocation(MOD_ID, "end"), DimensionType.THE_END, 0x302624).register();
public static final IAuraType TYPE_OTHER = new BasicAuraType(new ResourceLocation(MOD_ID, "other"), null, 0x2fa8a0).register();
/**
* The capability for any item or block that stores Aura in the form of an
* {@link IAuraContainer}
*/
@CapabilityInject(IAuraContainer.class)
public static Capability<IAuraContainer> capAuraContainer;
/**
* The capability for any item that can be recharged from an Aura storage
* container like the Aura Cache in the form of {@link IAuraRecharge} by a
* player holding it in their hand
*/
@CapabilityInject(IAuraRecharge.class)
public static Capability<IAuraRecharge> capAuraRecharge;
/**
* The capability that any chunk in a world has to store Aura in it. As this
* is only applicable to chunks and all chunks in the world automatically
* get assigned this capability, using it directly is not necessary for
* addon developers. To retrieve this capability from any chunk, use the
* helper method {@link IAuraChunk#getAuraChunk(World, BlockPos)}.
*/
@CapabilityInject(IAuraChunk.class)
public static Capability<IAuraChunk> capAuraChunk;
/**
* This method returns the active {@link IInternalHooks} instance which can
* be used to hook into the mod's internal functionalities. This is

View file

@ -1,6 +1,5 @@
package de.ellpeck.naturesaura.api.aura.chunk;
import de.ellpeck.naturesaura.api.NACapabilities;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import net.minecraft.nbt.NBTTagCompound;
@ -37,8 +36,8 @@ public interface IAuraChunk extends ICapabilityProvider, INBTSerializable<NBTTag
*/
static IAuraChunk getAuraChunk(World world, BlockPos pos) {
Chunk chunk = world.getChunk(pos);
if (chunk.hasCapability(NACapabilities.auraChunk, null)) {
return chunk.getCapability(NACapabilities.auraChunk, null);
if (chunk.hasCapability(NaturesAuraAPI.capAuraChunk, null)) {
return chunk.getCapability(NaturesAuraAPI.capAuraChunk, null);
} else {
return null;
}

View file

@ -1,7 +1,7 @@
package de.ellpeck.naturesaura.aura.chunk;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NACapabilities;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect;
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
@ -129,13 +129,13 @@ public class AuraChunk implements IAuraChunk {
@Override
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
return capability == NACapabilities.auraChunk;
return capability == NaturesAuraAPI.capAuraChunk;
}
@Nullable
@Override
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
return capability == NACapabilities.auraChunk ? (T) this : null;
return capability == NaturesAuraAPI.capAuraChunk ? (T) this : null;
}
@Override

View file

@ -1,7 +1,7 @@
package de.ellpeck.naturesaura.aura.chunk.effect;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.NACapabilities;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect;
import de.ellpeck.naturesaura.api.aura.chunk.ISpotDrainable;
@ -22,8 +22,8 @@ public class ReplenishingEffect implements IDrainSpotEffect {
if (amount < 0) {
List<ISpotDrainable> tiles = new ArrayList<>();
Helper.getTileEntitiesInArea(world, pos, 25, tile -> {
if (tile.hasCapability(NACapabilities.auraContainer, null)) {
IAuraContainer container = tile.getCapability(NACapabilities.auraContainer, null);
if (tile.hasCapability(NaturesAuraAPI.capAuraContainer, null)) {
IAuraContainer container = tile.getCapability(NaturesAuraAPI.capAuraContainer, null);
if (container instanceof ISpotDrainable) {
tiles.add((ISpotDrainable) container);
}

View file

@ -1,6 +1,6 @@
package de.ellpeck.naturesaura.blocks.tiles;
import de.ellpeck.naturesaura.api.NACapabilities;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
@ -94,7 +94,7 @@ public class TileEntityImpl extends TileEntity {
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
return this.getItemHandler(facing) != null;
} else if (capability == NACapabilities.auraContainer) {
} else if (capability == NaturesAuraAPI.capAuraContainer) {
return this.getAuraContainer(facing) != null;
} else {
return super.hasCapability(capability, facing);
@ -106,7 +106,7 @@ public class TileEntityImpl extends TileEntity {
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
return (T) this.getItemHandler(facing);
} else if (capability == NACapabilities.auraContainer) {
} else if (capability == NaturesAuraAPI.capAuraContainer) {
return (T) this.getAuraContainer(facing);
} else {
return super.getCapability(capability, facing);

View file

@ -1,7 +1,6 @@
package de.ellpeck.naturesaura.blocks.tiles;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.NACapabilities;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.aura.container.BasicAuraContainer;
@ -39,13 +38,13 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable {
@Override
protected boolean canInsert(ItemStack stack, int slot) {
return getRecipeForInput(stack) != null || stack.hasCapability(NACapabilities.auraContainer, null);
return getRecipeForInput(stack) != null || stack.hasCapability(NaturesAuraAPI.capAuraContainer, null);
}
@Override
protected boolean canExtract(ItemStack stack, int slot, int amount) {
if (stack.hasCapability(NACapabilities.auraContainer, null))
return stack.getCapability(NACapabilities.auraContainer, null).storeAura(1, true) <= 0;
if (stack.hasCapability(NaturesAuraAPI.capAuraContainer, null))
return stack.getCapability(NaturesAuraAPI.capAuraContainer, null).storeAura(1, true) <= 0;
else
return getRecipeForInput(stack) == null;
}
@ -98,8 +97,8 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable {
}
ItemStack stack = this.items.getStackInSlot(0);
if (!stack.isEmpty() && stack.hasCapability(NACapabilities.auraContainer, null)) {
IAuraContainer container = stack.getCapability(NACapabilities.auraContainer, null);
if (!stack.isEmpty() && stack.hasCapability(NaturesAuraAPI.capAuraContainer, null)) {
IAuraContainer container = stack.getCapability(NaturesAuraAPI.capAuraContainer, null);
int theoreticalDrain = this.container.drainAura(10, true);
if (theoreticalDrain > 0) {
int stored = container.storeAura(theoreticalDrain, false);

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.events;
import baubles.api.BaublesApi;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NACapabilities;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
@ -124,7 +124,7 @@ public class ClientEvents {
}
if (!cache.isEmpty()) {
IAuraContainer container = cache.getCapability(NACapabilities.auraContainer, null);
IAuraContainer container = cache.getCapability(NaturesAuraAPI.capAuraContainer, null);
int width = MathHelper.ceil(container.getStoredAura() / (float) container.getMaxAura() * 80);
int x = res.getScaledWidth() / 2 - 173 - (mc.player.getHeldItemOffhand().isEmpty() ? 0 : 29);
int y = res.getScaledHeight() - 8;
@ -177,8 +177,8 @@ public class ClientEvents {
BlockPos pos = mc.objectMouseOver.getBlockPos();
if (pos != null) {
TileEntity tile = mc.world.getTileEntity(pos);
if (tile != null && tile.hasCapability(NACapabilities.auraContainer, null)) {
IAuraContainer container = tile.getCapability(NACapabilities.auraContainer, null);
if (tile != null && tile.hasCapability(NaturesAuraAPI.capAuraContainer, null)) {
IAuraContainer container = tile.getCapability(NaturesAuraAPI.capAuraContainer, null);
IBlockState state = mc.world.getBlockState(pos);
ItemStack blockStack = state.getBlock().getPickBlock(state, mc.objectMouseOver, mc.world, pos, mc.player);
@ -186,8 +186,8 @@ public class ClientEvents {
if (tile instanceof TileEntityNatureAltar) {
ItemStack tileStack = ((TileEntityNatureAltar) tile).getItemHandler(null).getStackInSlot(0);
if (!tileStack.isEmpty() && tileStack.hasCapability(NACapabilities.auraContainer, null)) {
IAuraContainer stackContainer = tileStack.getCapability(NACapabilities.auraContainer, null);
if (!tileStack.isEmpty() && tileStack.hasCapability(NaturesAuraAPI.capAuraContainer, null)) {
IAuraContainer stackContainer = tileStack.getCapability(NaturesAuraAPI.capAuraContainer, null);
this.drawContainerInfo(stackContainer, mc, res, 55, tileStack.getDisplayName());
}
}

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.events;
import de.ellpeck.naturesaura.ModConfig;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NACapabilities;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.aura.chunk.AuraChunk;
import de.ellpeck.naturesaura.packet.PacketHandler;
@ -36,8 +36,8 @@ public class CommonEvents {
Iterator<Chunk> chunks = event.world.getPersistentChunkIterable(((WorldServer) event.world).getPlayerChunkMap().getChunkIterator());
while (chunks.hasNext()) {
Chunk chunk = chunks.next();
if (chunk.hasCapability(NACapabilities.auraChunk, null)) {
AuraChunk auraChunk = (AuraChunk) chunk.getCapability(NACapabilities.auraChunk, null);
if (chunk.hasCapability(NaturesAuraAPI.capAuraChunk, null)) {
AuraChunk auraChunk = (AuraChunk) chunk.getCapability(NaturesAuraAPI.capAuraChunk, null);
auraChunk.update();
}
}
@ -49,8 +49,8 @@ public class CommonEvents {
@SubscribeEvent
public void onChunkWatch(ChunkWatchEvent.Watch event) {
Chunk chunk = event.getChunkInstance();
if (!chunk.getWorld().isRemote && chunk.hasCapability(NACapabilities.auraChunk, null)) {
AuraChunk auraChunk = (AuraChunk) chunk.getCapability(NACapabilities.auraChunk, null);
if (!chunk.getWorld().isRemote && chunk.hasCapability(NaturesAuraAPI.capAuraChunk, null)) {
AuraChunk auraChunk = (AuraChunk) chunk.getCapability(NaturesAuraAPI.capAuraChunk, null);
PacketHandler.sendTo(event.getPlayer(), auraChunk.makePacket());
}
}

View file

@ -1,7 +1,7 @@
package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.NACapabilities;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
import de.ellpeck.naturesaura.api.aura.container.ItemAuraContainer;
import de.ellpeck.naturesaura.renderers.ITrinketItem;
@ -37,9 +37,9 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem {
EntityPlayer player = (EntityPlayer) entityIn;
if (player.isSneaking()) {
ItemStack stack = player.getHeldItemMainhand();
if (stack.hasCapability(NACapabilities.auraRecharge, null)) {
IAuraContainer container = stackIn.getCapability(NACapabilities.auraContainer, null);
stack.getCapability(NACapabilities.auraRecharge, null).rechargeFromContainer(container);
if (stack.hasCapability(NaturesAuraAPI.capAuraRecharge, null)) {
IAuraContainer container = stackIn.getCapability(NaturesAuraAPI.capAuraContainer, null);
stack.getCapability(NaturesAuraAPI.capAuraRecharge, null).rechargeFromContainer(container);
}
}
}
@ -51,7 +51,7 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem {
items.add(new ItemStack(this));
ItemStack stack = new ItemStack(this);
IAuraContainer container = stack.getCapability(NACapabilities.auraContainer, null);
IAuraContainer container = stack.getCapability(NaturesAuraAPI.capAuraContainer, null);
container.storeAura(container.getMaxAura(), false);
items.add(stack);
}
@ -64,8 +64,8 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem {
@Override
public double getDurabilityForDisplay(ItemStack stack) {
if (stack.hasCapability(NACapabilities.auraContainer, null)) {
IAuraContainer container = stack.getCapability(NACapabilities.auraContainer, null);
if (stack.hasCapability(NaturesAuraAPI.capAuraContainer, null)) {
IAuraContainer container = stack.getCapability(NaturesAuraAPI.capAuraContainer, null);
return 1 - container.getStoredAura() / (double) container.getMaxAura();
} else {
return 0;
@ -80,13 +80,13 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem {
@Override
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
return capability == NACapabilities.auraContainer;
return capability == NaturesAuraAPI.capAuraContainer;
}
@Nullable
@Override
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
if (capability == NACapabilities.auraContainer) {
if (capability == NaturesAuraAPI.capAuraContainer) {
return (T) this.container;
} else {
return null;

View file

@ -1,7 +1,7 @@
package de.ellpeck.naturesaura.packet;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NACapabilities;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.aura.chunk.AuraChunk;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
@ -70,8 +70,8 @@ public class PacketAuraChunk implements IMessage {
World world = Minecraft.getMinecraft().world;
if (world != null) {
Chunk chunk = world.getChunk(message.chunkX, message.chunkZ);
if (chunk.hasCapability(NACapabilities.auraChunk, null)) {
AuraChunk auraChunk = (AuraChunk) chunk.getCapability(NACapabilities.auraChunk, null);
if (chunk.hasCapability(NaturesAuraAPI.capAuraChunk, null)) {
AuraChunk auraChunk = (AuraChunk) chunk.getCapability(NaturesAuraAPI.capAuraChunk, null);
auraChunk.setSpots(message.drainSpots);
}
}