Fold a couple interfaces together, we have way too many .-.

This commit is contained in:
Vincent Lee committed 2016-05-06 23:39:33 -05:00
1 parent afc5f93b55
commit d524a0b2e9
21 files changed
+107 -183

No files matched your search

@@ -16,6 +16,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.world.BossInfo;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.internal.ShaderCallback;
import java.awt.*;
import java.util.UUID;
@@ -63,4 +64,20 @@ public interface IBotaniaBoss {
*/
public UUID getBossInfoUuid();
/**
* The Shader Program to use for this boss's bar. Return 0 case
* you don't want a shader to be used. You can use separate shaders
* for the background and foreground.
* @param background True if rendering the background of the boss bar,
* false if rendering the bar itself that shows the HP.
* @return OpenGL program ID of the shader to use
*/
public int getBossBarShaderProgram(boolean background);
/**
* A callback for the shader, used to pass in uniforms. Return null for no callback.
* @return a ShaderCallback to use. If getBossBarShaderProgram returns an invalid shader the result of this method is ignored.
*/
public ShaderCallback getBossBarShaderCallback(boolean background, int shader);
}
@@ -1,38 +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 @ [Oct 29, 2014, 6:13:21 PM (GMT)]
*/
package vazkii.botania.api.boss;
import vazkii.botania.api.internal.ShaderCallback;
/**
* A Botania boss whose HP bar makes use of shaders. Shaders
* used through this have a few uniforms available:
* <li><b><i>int</i> time</b> - The amount of total ticks elapsed.</li>
* <li><b><i>int</i> startX</b> - The U coordinate passed in for the render of this bar's texture.</li>
* <li><b><i>int</i> startY</b> - The V coordinate passed in for the render of this bar's texture.</li>
*/
public interface IBotaniaBossWithShader extends IBotaniaBoss {
/**
* The Shader Program to use for this boss bar. Return 0 case
* you don't want a shader to be used. You can use separate shaders
* for the background and foreground.
* @param background True if rendering the background of the boss bar,
* false if rendering the bar itself that shows the HP.
*/
public int getBossBarShaderProgram(boolean background);
/**
* A callback for the shader, used to pass in uniforms. Return null for no callback.
*/
public ShaderCallback getBossBarShaderCallback(boolean background, int shader);
}
@@ -1,26 +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 @ [Jan 18, 2015, 12:20:44 AM (GMT)]
*/
package vazkii.botania.api.item;
import net.minecraft.item.EnumDyeColor;
/**
* Used to define a Mana Pool that can be dyed through floral powder.
*/
public interface IDyablePool {
public EnumDyeColor getColor();
public void setColor(EnumDyeColor color);
}
@@ -1,28 +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 @ [Apr 30, 2015, 1:43:17 PM (GMT)]
*/
package vazkii.botania.api.item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
/**
* An extension of IWireframeCoordinateListProvider that allows for
* rendering a single thicker wireframe.
*/
public interface IExtendedWireframeCoordinateListProvider extends IWireframeCoordinateListProvider {
/**
* Gets the source wireframe to draw, this one will be drawn thicker.
*/
public BlockPos getSourceWireframe(EntityPlayer player, ItemStack stack);
}
@@ -29,4 +29,12 @@ public interface IWireframeCoordinateListProvider {
*/
public List<BlockPos> getWireframesToDraw(EntityPlayer player, ItemStack stack);
/**
* Gets a wireframe to draw thicker than the rest.
* This is useful to indicate the precedence of some position over the others.
* @return The position of a single wireframe to draw thicker than all the others.
*/
public BlockPos getSourceWireframe(EntityPlayer player, ItemStack stack);
}
@@ -17,8 +17,32 @@ package vazkii.botania.api.mana;
*/
public interface IDirectioned {
/**
* @return The X rotation, in degrees
*/
public float getRotationX();
/**
* @return The Y rotation, in degrees
*/
public float getRotationY();
/**
* Set the X rotation
* @param rot X rotation, in degrees
*/
public void setRotationX(float rot);
/**
* Set the Y rotation
* @param rot Y rotation, in degrees
*/
public void setRotationY(float rot);
/**
* This should be called after rotation setting is done to allow
* for the block to re-calculate.
*/
public void commitRedirection();
}
@@ -1,23 +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 @ [Jun 19, 2015, 10:05:24 PM (GMT)]
*/
package vazkii.botania.api.mana;
import java.util.UUID;
/**
* This interface marks a TileEntity that can be identified through
* an UUID. This UUID must presist between sessions.
*/
public interface IIdentifiable {
public UUID getIdentifier();
}
@@ -10,6 +10,8 @@
*/
package vazkii.botania.api.mana;
import net.minecraft.item.EnumDyeColor;
/**
* Any TileEntity that implements this is considered a Mana Pool,
* by which nearby functional flowers will pull mana from it.<br>
@@ -27,4 +29,15 @@ public interface IManaPool extends IManaReceiver {
*/
public boolean isOutputtingPower();
/**
* @return The color of this pool.
*/
public EnumDyeColor getColor();
/**
* Sets the color of this pool.
* @param color The color to set.
*/
public void setColor(EnumDyeColor color);
}
@@ -18,7 +18,7 @@ import java.util.UUID;
* This describes an interface of a Mana Sender block that should be able to pingbackable
* by a burst to tell it that the burst is still alive.
*/
public interface IPingable extends IIdentifiable {
public interface IPingable {
/**
* Pings this object back, telling it that the burst passed in is still alive
@@ -28,4 +28,9 @@ public interface IPingable extends IIdentifiable {
*/
public void pingback(IManaBurst burst, UUID expectedIdentity);
/**
* @return A unique and persistent identifier for this IPingable
*/
public UUID getIdentifier();
}
@@ -1,29 +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 @ [15/11/2015, 19:28:18 (GMT)]
*/
package vazkii.botania.api.mana;
/**
* This is an extension of IDirectioned for TileEntities
* that allow for their rotation to be public and modifiable outside.
* This is used in botania for the Redirective mana lens.
*/
public interface IRedirectable extends IDirectioned {
public void setRotationX(float rot);
public void setRotationY(float rot);
/**
* This should be called after rotation setting is done to allow
* for the block to re-calculate.
*/
public void commitRedirection();
}
@@ -11,23 +11,17 @@
package vazkii.botania.client.core.handler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.opengl.ARBShaderObjects;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.boss.IBotaniaBoss;
import vazkii.botania.api.boss.IBotaniaBossWithShader;
import vazkii.botania.api.internal.ShaderCallback;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.core.helper.MathHelper;
import java.awt.*;
import java.util.HashSet;
@@ -75,13 +69,12 @@ public final class BossBarHandler {
}
private static void drawBar(IBotaniaBoss currentBoss, int x, int y, int u, int v, int w, int h, boolean bg) {
boolean useShader = currentBoss instanceof IBotaniaBossWithShader;
if(useShader) {
IBotaniaBossWithShader shader = (IBotaniaBossWithShader) currentBoss;
int program = shader.getBossBarShaderProgram(bg);
ShaderCallback callback = program == 0 ? null : shader.getBossBarShaderCallback(bg, program);
barUniformCallback.set(u, v, callback);
int program = currentBoss.getBossBarShaderProgram(bg);
boolean useShader = program > 0;
if(useShader) {
ShaderCallback callback = currentBoss.getBossBarShaderCallback(bg, program);
barUniformCallback.set(u, v, callback);
ShaderHelper.useShader(program, barUniformCallback);
}
@@ -30,7 +30,6 @@ import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.item.IExtendedWireframeCoordinateListProvider;
import vazkii.botania.api.item.IWireframeCoordinateListProvider;
import vazkii.botania.api.wand.ICoordBoundItem;
import vazkii.botania.api.wand.IWireframeAABBProvider;
@@ -77,11 +76,9 @@ public final class BoundTileRenderer {
for(BlockPos coords : coordsList)
renderBlockOutlineAt(coords, color);
if(stackInSlot.getItem() instanceof IExtendedWireframeCoordinateListProvider) {
BlockPos coords = ((IExtendedWireframeCoordinateListProvider) stackInSlot.getItem()).getSourceWireframe(player, stackInSlot);
if(coords != null && coords.getY() > -1)
renderBlockOutlineAt(coords, color, 5F);
}
BlockPos coords = provider.getSourceWireframe(player, stackInSlot);
if(coords != null && coords.getY() > -1)
renderBlockOutlineAt(coords, color, 5F);
}
}
@@ -34,7 +34,6 @@ import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.item.IDyablePool;
import vazkii.botania.api.item.IManaDissolvable;
import vazkii.botania.api.mana.IKeyLocked;
import vazkii.botania.api.mana.IManaItem;
@@ -48,7 +47,6 @@ import vazkii.botania.api.sound.BotaniaSoundEvents;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.state.enums.PoolVariant;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.client.core.handler.LightningHandler;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.Botania;
@@ -66,7 +64,7 @@ import vazkii.botania.common.network.PacketHandler;
import java.awt.*;
import java.util.List;
public class TilePool extends TileMod implements IManaPool, IDyablePool, IKeyLocked, ISparkAttachable, IThrottledPacket {
public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAttachable, IThrottledPacket {
public static final int MAX_MANA = 1000000;
public static final int MAX_MANA_DILLUTED = 10000;
@@ -37,6 +37,7 @@ import org.lwjgl.opengl.GL11;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.mana.BurstProperties;
import vazkii.botania.api.mana.IDirectioned;
import vazkii.botania.api.mana.IKeyLocked;
import vazkii.botania.api.mana.ILens;
import vazkii.botania.api.mana.ILensControl;
@@ -45,7 +46,6 @@ import vazkii.botania.api.mana.IManaCollector;
import vazkii.botania.api.mana.IManaPool;
import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.api.mana.IManaSpreader;
import vazkii.botania.api.mana.IRedirectable;
import vazkii.botania.api.mana.IThrottledPacket;
import vazkii.botania.api.mana.ManaNetworkEvent;
import vazkii.botania.api.sound.BotaniaSoundEvents;
@@ -65,7 +65,7 @@ import vazkii.botania.common.entity.EntityManaBurst.PositionProperties;
import java.util.List;
import java.util.UUID;
public class TileSpreader extends TileSimpleInventory implements IManaCollector, IWandBindable, IKeyLocked, IThrottledPacket, IManaSpreader, IRedirectable, ITickable {
public class TileSpreader extends TileSimpleInventory implements IManaCollector, IWandBindable, IKeyLocked, IThrottledPacket, IManaSpreader, IDirectioned, ITickable {
private static final int MAX_MANA = 1000;
private static final int ULTRA_MAX_MANA = 6400;
@@ -61,7 +61,7 @@ import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.ARBShaderObjects;
import vazkii.botania.api.boss.IBotaniaBossWithShader;
import vazkii.botania.api.boss.IBotaniaBoss;
import vazkii.botania.api.internal.ShaderCallback;
import vazkii.botania.api.lexicon.multiblock.Multiblock;
import vazkii.botania.api.lexicon.multiblock.MultiblockSet;
@@ -90,7 +90,7 @@ import java.util.List;
import java.util.UUID;
import java.util.regex.Pattern;
public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWithShader {
public class EntityDoppleganger extends EntityCreature implements IBotaniaBoss {
public static final float ARENA_RANGE = 12F;
private static final int SPAWN_TICKS = 160;
@@ -12,6 +12,7 @@ package vazkii.botania.common.item;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
@@ -228,6 +229,14 @@ public class ItemManaMirror extends ItemMod implements IManaItem, ICoordBoundIte
return false;
}
@Override
public EnumDyeColor getColor() {
return EnumDyeColor.WHITE;
}
@Override
public void setColor(EnumDyeColor color) {}
}
@Override
@@ -17,7 +17,7 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.mana.IRedirectable;
import vazkii.botania.api.mana.IDirectioned;
import vazkii.botania.api.mana.IThrottledPacket;
import vazkii.botania.common.core.helper.Vector3;
@@ -28,9 +28,9 @@ public class LensRedirect extends Lens {
BlockPos coords = burst.getBurstSourceBlockPos();
if(!entity.worldObj.isRemote && pos.entityHit == null && coords.getY() != -1 && (pos.getBlockPos() == null || !pos.getBlockPos().equals(coords))) {
TileEntity tile = entity.worldObj.getTileEntity(pos.getBlockPos());
if(tile != null && tile instanceof IRedirectable) {
if(tile != null && tile instanceof IDirectioned) {
if(!burst.isFake()) {
IRedirectable redir = (IRedirectable) tile;
IDirectioned redir = (IDirectioned) tile;
Vector3 tileVec = Vector3.fromTileEntityCenter(tile);
Vector3 sourceVec = new Vector3(coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5);
@@ -25,7 +25,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import vazkii.botania.api.item.IDyablePool;
import vazkii.botania.api.mana.IManaPool;
import vazkii.botania.common.item.Item16Colors;
import vazkii.botania.common.lib.LibItemNames;
@@ -47,10 +47,10 @@ public class ItemDye extends Item16Colors {
}
TileEntity tile = par3World.getTileEntity(pos);
if(tile instanceof IDyablePool) {
IDyablePool dyable = (IDyablePool) tile;
if(color != dyable.getColor()) {
dyable.setColor(color);
if(tile instanceof IManaPool) {
IManaPool pool = (IManaPool) tile;
if(color != pool.getColor()) {
pool.setColor(color);
par1ItemStack.stackSize--;
return EnumActionResult.SUCCESS;
}
@@ -29,7 +29,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.RecipeSorter.Category;
import vazkii.botania.api.item.IExtendedWireframeCoordinateListProvider;
import vazkii.botania.api.item.IWireframeCoordinateListProvider;
import vazkii.botania.common.achievement.ICraftAchievement;
import vazkii.botania.common.achievement.ModAchievements;
@@ -41,7 +40,7 @@ import vazkii.botania.common.lib.LibItemNames;
import java.util.List;
import java.util.UUID;
public class ItemAesirRing extends ItemRelicBauble implements IExtendedWireframeCoordinateListProvider, ICraftAchievement {
public class ItemAesirRing extends ItemRelicBauble implements IWireframeCoordinateListProvider, ICraftAchievement {
private final Multimap<String, AttributeModifier> attributes = HashMultimap.create();
@@ -101,7 +100,7 @@ public class ItemAesirRing extends ItemRelicBauble implements IExtendedWireframe
@Override
public BlockPos getSourceWireframe(EntityPlayer player, ItemStack stack) {
return ((IExtendedWireframeCoordinateListProvider) ModItems.lokiRing).getSourceWireframe(player, stack);
return ((IWireframeCoordinateListProvider) ModItems.lokiRing).getSourceWireframe(player, stack);
}
@Override
@@ -36,8 +36,8 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.item.IExtendedWireframeCoordinateListProvider;
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.core.helper.ItemNBTHelper;
@@ -48,7 +48,7 @@ import vazkii.botania.common.lib.LibItemNames;
import java.util.ArrayList;
import java.util.List;
public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeCoordinateListProvider, IManaUsingItem {
public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinateListProvider, IManaUsingItem {
private static final String TAG_CURSOR_LIST = "cursorList";
private static final String TAG_CURSOR_PREFIX = "cursor";
@@ -419,4 +419,9 @@ public class ItemExchangeRod extends ItemMod implements IManaUsingItem, IWirefra
return ImmutableList.of();
}
@Override
public BlockPos getSourceWireframe(EntityPlayer player, ItemStack stack) {
return null;
}
}