mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 11:19:19 +00:00
Cleanups, remove IBotaniaBoss (did anyone ever use this?)
This commit is contained in:
1 parent
4616924dae
commit
9af5cdbd2d
6 files changed
+14
-120
No files matched your search
@@ -1,85 +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.boss;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.server.ServerBossInfo;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import vazkii.botania.api.internal.ShaderCallback;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* A Botania boss, that is subject to special rendering.
|
||||
*/
|
||||
public interface IBotaniaBoss {
|
||||
|
||||
/**
|
||||
* The ResourceLocation to bind for this boss's boss bar.
|
||||
* You can use BotaniaAPI.internalMethodHandler.getDefaultBossBarTexture() to get
|
||||
* the one used by botania bosses.
|
||||
*/
|
||||
public ResourceLocation getBossBarTexture();
|
||||
|
||||
/**
|
||||
* A Rectangle instance delimiting the uv, width and height of this boss's
|
||||
* boss bar texture. This is for the background, not the bar that shows
|
||||
* the HP.
|
||||
*/
|
||||
public Rectangle getBossBarTextureRect();
|
||||
|
||||
/**
|
||||
* A Rectangle instance delimiting the uv, width and height of this boss's
|
||||
* boss bar HP texture. This is for the foreground that shows how much
|
||||
* HP the boss has. The width of the rectangle will be multiplied by the
|
||||
* faction of the boss's current HP by max HP.
|
||||
*/
|
||||
public Rectangle getBossBarHPTextureRect();
|
||||
|
||||
/**
|
||||
* A callback for when this boss's boss bar renders, you can do additional rendering
|
||||
* here if needed.
|
||||
*
|
||||
* @return How tall your auxiliary renders were
|
||||
*/
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int bossBarRenderCallback(int x, int y);
|
||||
|
||||
/**
|
||||
* Get the serverside UUID of the {@link ServerBossInfo} instance tracking this boss
|
||||
* Note that this is NOT the entity's UUID, nor is it the clientside UUID of the BossInfoServer instance!
|
||||
* You will most likely need to sync this yourself using IEntityAdditionalSpawnData or similar.
|
||||
*
|
||||
* @return The uuid.
|
||||
*/
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -20,11 +20,11 @@ import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.api.boss.IBotaniaBoss;
|
||||
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.entity.EntityDoppleganger;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -39,14 +39,14 @@ public final class BossBarHandler {
|
||||
private BossBarHandler() {}
|
||||
|
||||
// Only access on the client thread!
|
||||
public static final Set<IBotaniaBoss> bosses = Collections.newSetFromMap(new WeakHashMap<>());
|
||||
public static final Set<EntityDoppleganger> bosses = Collections.newSetFromMap(new WeakHashMap<>());
|
||||
public static final ResourceLocation defaultBossBar = new ResourceLocation(LibResources.GUI_BOSS_BAR);
|
||||
private static final BarCallback barUniformCallback = new BarCallback();
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onBarRender(RenderGameOverlayEvent.BossInfo evt) {
|
||||
UUID infoUuid = evt.getBossInfo().getUniqueId();
|
||||
for (IBotaniaBoss currentBoss : bosses) {
|
||||
for (EntityDoppleganger currentBoss : bosses) {
|
||||
if (currentBoss.getBossInfoUuid().equals(infoUuid)) {
|
||||
evt.setCanceled(true);
|
||||
|
||||
@@ -76,7 +76,7 @@ public final class BossBarHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private static void drawBar(IBotaniaBoss currentBoss, int x, int y, int u, int v, int w, int h, boolean bg) {
|
||||
private static void drawBar(EntityDoppleganger currentBoss, int x, int y, int u, int v, int w, int h, boolean bg) {
|
||||
int program = currentBoss.getBossBarShaderProgram(bg);
|
||||
boolean useShader = program > 0;
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import vazkii.botania.api.boss.IBotaniaBoss;
|
||||
import vazkii.botania.client.core.handler.BaubleRenderHandler;
|
||||
import vazkii.botania.client.core.handler.BossBarHandler;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
@@ -60,6 +59,7 @@ import vazkii.botania.common.block.decor.BlockModMushroom;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.core.proxy.IProxy;
|
||||
import vazkii.botania.common.entity.EntityDoppleganger;
|
||||
import vazkii.botania.common.item.ItemSextant;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemMonocle;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
@@ -75,19 +75,6 @@ import java.util.SortedMap;
|
||||
|
||||
public class ClientProxy implements IProxy {
|
||||
|
||||
public static final VertexFormat POSITION_TEX_LMAP_NORMAL =
|
||||
new VertexFormat(ImmutableList.<VertexFormatElement>builder()
|
||||
.add(DefaultVertexFormats.POSITION_3F)
|
||||
.add(DefaultVertexFormats.TEX_2F)
|
||||
.add(DefaultVertexFormats.LIGHT_ELEMENT)
|
||||
.add(DefaultVertexFormats.NORMAL_3B)
|
||||
.build());
|
||||
public static final VertexFormat POSITION_TEX_LMAP =
|
||||
new VertexFormat(ImmutableList.<VertexFormatElement>builder()
|
||||
.add(DefaultVertexFormats.POSITION_3F)
|
||||
.add(DefaultVertexFormats.TEX_2F)
|
||||
.add(DefaultVertexFormats.LIGHT_ELEMENT)
|
||||
.build());
|
||||
public static boolean jingleTheBells = false;
|
||||
public static boolean dootDoot = false;
|
||||
|
||||
@@ -222,12 +209,12 @@ public class ClientProxy implements IProxy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBoss(IBotaniaBoss boss) {
|
||||
public void addBoss(EntityDoppleganger boss) {
|
||||
BossBarHandler.bosses.add(boss);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBoss(IBotaniaBoss boss) {
|
||||
public void removeBoss(EntityDoppleganger boss) {
|
||||
BossBarHandler.bosses.remove(boss);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import vazkii.botania.api.boss.IBotaniaBoss;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.entity.EntityDoppleganger;
|
||||
import vazkii.patchouli.api.IMultiblock;
|
||||
|
||||
public interface IProxy {
|
||||
@@ -36,9 +36,9 @@ public interface IProxy {
|
||||
|
||||
void lightningFX(Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner);
|
||||
|
||||
void addBoss(IBotaniaBoss boss);
|
||||
void addBoss(EntityDoppleganger boss);
|
||||
|
||||
void removeBoss(IBotaniaBoss boss);
|
||||
void removeBoss(EntityDoppleganger boss);
|
||||
|
||||
int getClientRenderDistance();
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
||||
|
||||
import vazkii.botania.api.boss.IBotaniaBoss;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.entity.EntityDoppleganger;
|
||||
|
||||
public class ServerProxy implements IProxy {
|
||||
|
||||
@@ -42,10 +42,10 @@ public class ServerProxy implements IProxy {
|
||||
public void lightningFX(Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) {}
|
||||
|
||||
@Override
|
||||
public void addBoss(IBotaniaBoss boss) {}
|
||||
public void addBoss(EntityDoppleganger boss) {}
|
||||
|
||||
@Override
|
||||
public void removeBoss(IBotaniaBoss boss) {}
|
||||
public void removeBoss(EntityDoppleganger boss) {}
|
||||
|
||||
@Override
|
||||
public int getClientRenderDistance() {
|
||||
|
||||
@@ -68,7 +68,6 @@ import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
|
||||
import vazkii.botania.api.boss.IBotaniaBoss;
|
||||
import vazkii.botania.api.internal.ShaderCallback;
|
||||
import vazkii.botania.client.core.handler.BossBarHandler;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
@@ -96,7 +95,7 @@ import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEntityAdditionalSpawnData {
|
||||
public class EntityDoppleganger extends MobEntity implements IEntityAdditionalSpawnData {
|
||||
@ObjectHolder(LibMisc.MOD_ID + ":doppleganger") public static EntityType<EntityDoppleganger> TYPE;
|
||||
|
||||
public static final float ARENA_RANGE = 12F;
|
||||
@@ -933,7 +932,6 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public ResourceLocation getBossBarTexture() {
|
||||
return BossBarHandler.defaultBossBar;
|
||||
@@ -942,7 +940,6 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
|
||||
@OnlyIn(Dist.CLIENT) private static Rectangle barRect;
|
||||
@OnlyIn(Dist.CLIENT) private static Rectangle hpBarRect;
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public Rectangle getBossBarTextureRect() {
|
||||
if (barRect == null) {
|
||||
@@ -951,7 +948,6 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
|
||||
return barRect;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public Rectangle getBossBarHPTextureRect() {
|
||||
if (hpBarRect == null) {
|
||||
@@ -960,7 +956,6 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
|
||||
return hpBarRect;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int bossBarRenderCallback(int x, int y) {
|
||||
RenderSystem.pushMatrix();
|
||||
@@ -977,12 +972,10 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getBossInfoUuid() {
|
||||
return bossInfoUUID;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int getBossBarShaderProgram(boolean background) {
|
||||
return background ? 0 : ShaderHelper.getShader(ShaderHelper.BotaniaShader.DOPPLEGANGER_BAR).orElse(0);
|
||||
@@ -990,7 +983,6 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
|
||||
|
||||
@OnlyIn(Dist.CLIENT) private ShaderCallback shaderCallback;
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public ShaderCallback getBossBarShaderCallback(boolean background, int shader) {
|
||||
if (shaderCallback == null) {
|
||||
|
||||
Reference in new issue
Block a user