mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-25 14:34:36 +00:00
Albedo support
This commit is contained in:
1 parent
678fd193da
commit
cb1b194e3f
10 files changed
+305
-30
No files matched your search
@@ -13,6 +13,8 @@ package vazkii.botania.client.core.helper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.resources.SimpleReloadableResourceManager;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
|
||||
import org.lwjgl.opengl.ARBFragmentShader;
|
||||
import org.lwjgl.opengl.ARBShaderObjects;
|
||||
import org.lwjgl.opengl.ARBVertexShader;
|
||||
@@ -44,6 +46,9 @@ public final class ShaderHelper {
|
||||
public static int gold = 0;
|
||||
public static int categoryButton = 0;
|
||||
public static int alpha = 0;
|
||||
|
||||
private static boolean hasIncompatibleMods = false;
|
||||
private static boolean checkedIncompatibility = false;
|
||||
|
||||
private static void deleteShader(int id) {
|
||||
if (id != 0) {
|
||||
@@ -112,7 +117,16 @@ public final class ShaderHelper {
|
||||
}
|
||||
|
||||
public static boolean useShaders() {
|
||||
return ConfigHandler.useShaders && OpenGlHelper.shadersSupported;
|
||||
return ConfigHandler.useShaders && OpenGlHelper.shadersSupported && checkIncompatibleMods();
|
||||
}
|
||||
|
||||
private static boolean checkIncompatibleMods() {
|
||||
if(!checkedIncompatibility) {
|
||||
hasIncompatibleMods = Loader.isModLoaded("albedo") || Loader.isModLoaded("optifine");
|
||||
checkedIncompatibility = true;
|
||||
}
|
||||
|
||||
return !hasIncompatibleMods;
|
||||
}
|
||||
|
||||
// Most of the code taken from the LWJGL wiki
|
||||
|
||||
@@ -10,6 +10,14 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.tile;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import elucent.albedo.lighting.ILightProvider;
|
||||
import elucent.albedo.lighting.Light;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -28,7 +36,9 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.LuminizerVariant;
|
||||
import vazkii.botania.api.wand.IWandBindable;
|
||||
@@ -39,11 +49,6 @@ import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TileLightRelay extends TileMod implements IWandBindable {
|
||||
|
||||
private static final int MAX_DIST = 20;
|
||||
@@ -229,7 +234,8 @@ public class TileLightRelay extends TileMod implements IWandBindable {
|
||||
cmp.setInteger(TAG_BIND_Z, bindPos.getZ());
|
||||
}
|
||||
|
||||
public static class EntityPlayerMover extends Entity {
|
||||
@Optional.Interface(iface="elucent.albedo.lighting.ILightProvider", modid="albedo")
|
||||
public static class EntityPlayerMover extends Entity implements ILightProvider {
|
||||
|
||||
private static final String TAG_EXIT_X = "exitX";
|
||||
private static final String TAG_EXIT_Y = "exitY";
|
||||
@@ -347,6 +353,17 @@ public class TileLightRelay extends TileMod implements IWandBindable {
|
||||
dataManager.set(EXIT_POS, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid="albedo")
|
||||
public Light provideLight() {
|
||||
if(getPassengers().isEmpty())
|
||||
return null;
|
||||
|
||||
Entity passenger = getPassengers().get(0);
|
||||
Color color = Color.getHSBColor(passenger.ticksExisted / 36F, 1F, 1F);
|
||||
return Light.builder().pos(this).color(color.getRGB(), false).radius(5).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,7 +21,9 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.handler.ModSounds;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
@@ -31,9 +33,14 @@ import vazkii.botania.common.item.equipment.tool.ToolCommons;
|
||||
import vazkii.botania.common.item.relic.ItemKingKey;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import elucent.albedo.lighting.ILightProvider;
|
||||
import elucent.albedo.lighting.Light;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EntityBabylonWeapon extends EntityThrowableCopy {
|
||||
@Optional.Interface(iface="elucent.albedo.lighting.ILightProvider", modid="albedo")
|
||||
public class EntityBabylonWeapon extends EntityThrowableCopy implements ILightProvider {
|
||||
|
||||
private static final String TAG_CHARGING = "charging";
|
||||
private static final String TAG_VARIETY = "variety";
|
||||
@@ -195,6 +202,12 @@ public class EntityBabylonWeapon extends EntityThrowableCopy {
|
||||
setRotation(cmp.getFloat(TAG_ROTATION));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid="albedo")
|
||||
public Light provideLight() {
|
||||
return Light.builder().pos(this).color(1F, 1F, 0F).radius(8).build();
|
||||
}
|
||||
|
||||
public boolean isCharging() {
|
||||
return dataManager.get(CHARGING);
|
||||
}
|
||||
|
||||
@@ -18,12 +18,17 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EntityFallingStar extends EntityThrowableCopy {
|
||||
import elucent.albedo.lighting.ILightProvider;
|
||||
import elucent.albedo.lighting.Light;
|
||||
|
||||
@Optional.Interface(iface="elucent.albedo.lighting.ILightProvider", modid="albedo")
|
||||
public class EntityFallingStar extends EntityThrowableCopy implements ILightProvider {
|
||||
|
||||
public EntityFallingStar(World world) {
|
||||
super(world);
|
||||
@@ -86,6 +91,12 @@ public class EntityFallingStar extends EntityThrowableCopy {
|
||||
|
||||
setDead();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid="albedo")
|
||||
public Light provideLight() {
|
||||
return Light.builder().pos(this).color(1F, 0F, 1F).radius(12).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
*/
|
||||
package vazkii.botania.common.entity;
|
||||
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
@@ -19,14 +18,19 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.helper.MathHelper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import elucent.albedo.lighting.ILightProvider;
|
||||
import elucent.albedo.lighting.Light;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class EntityFlameRing extends Entity {
|
||||
@Optional.Interface(iface="elucent.albedo.lighting.ILightProvider", modid="albedo")
|
||||
public class EntityFlameRing extends Entity implements ILightProvider {
|
||||
|
||||
public EntityFlameRing(World world) {
|
||||
super(world);
|
||||
@@ -96,10 +100,15 @@ public class EntityFlameRing extends Entity {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(@Nonnull NBTTagCompound var1) {}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(@Nonnull NBTTagCompound var1) {}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid="albedo")
|
||||
public Light provideLight() {
|
||||
return Light.builder().pos(this).color(1F, 0.5F, 0F).radius(20).build();
|
||||
}
|
||||
}
|
||||
@@ -19,13 +19,19 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.handler.ModSounds;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import elucent.albedo.lighting.ILightProvider;
|
||||
import elucent.albedo.lighting.Light;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EntityMagicLandmine extends Entity {
|
||||
@Optional.Interface(iface="elucent.albedo.lighting.ILightProvider", modid="albedo")
|
||||
public class EntityMagicLandmine extends Entity implements ILightProvider {
|
||||
|
||||
public EntityDoppleganger summoner;
|
||||
|
||||
@@ -86,4 +92,10 @@ public class EntityMagicLandmine extends Entity {
|
||||
protected void writeEntityToNBT(@Nonnull NBTTagCompound var1) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid="albedo")
|
||||
public Light provideLight() {
|
||||
return Light.builder().pos(this).color(0.6F, 0F, 1F).radius(15).build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,19 @@
|
||||
*/
|
||||
package vazkii.botania.common.entity;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import elucent.albedo.lighting.ILightProvider;
|
||||
import elucent.albedo.lighting.Light;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockBush;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
@@ -31,6 +44,7 @@ import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
@@ -50,17 +64,8 @@ import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemTinyPlanet;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
@Optional.Interface(iface="elucent.albedo.lighting.ILightProvider", modid="albedo")
|
||||
public class EntityManaBurst extends EntityThrowable implements IManaBurst, ILightProvider {
|
||||
|
||||
private static final String TAG_TICKS_EXISTED = "ticksExisted";
|
||||
private static final String TAG_COLOR = "color";
|
||||
@@ -453,10 +458,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
float r = color.getRed() / 255F;
|
||||
float g = color.getGreen() / 255F;
|
||||
float b = color.getBlue() / 255F;
|
||||
|
||||
int mana = getMana();
|
||||
int maxMana = getStartingMana();
|
||||
float osize = (float) mana / (float) maxMana;
|
||||
float osize = getParticleSize();
|
||||
float size = osize;
|
||||
|
||||
if(fake) {
|
||||
@@ -522,6 +524,10 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
Botania.proxy.setWispFXDepthTest(true);
|
||||
}
|
||||
}
|
||||
|
||||
public float getParticleSize() {
|
||||
return (float) getMana() / (float) getStartingMana();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact(@Nonnull RayTraceResult rtr) {
|
||||
@@ -799,6 +805,13 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
if(tile != null && tile instanceof IManaSpreader)
|
||||
((IManaSpreader) tile).setLastBurstDeathTick(getTicksExisted());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid="albedo")
|
||||
public Light provideLight() {
|
||||
int color = getColor();
|
||||
return Light.builder().pos(new Vec3d(posX - motionX, posY - motionY, posZ - motionZ)).color(color, false).radius(getParticleSize() * 8).build();
|
||||
}
|
||||
|
||||
public static class PositionProperties {
|
||||
|
||||
|
||||
@@ -20,11 +20,16 @@ import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import vazkii.botania.common.Botania;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class EntityPixie extends EntityFlying {
|
||||
import elucent.albedo.lighting.ILightProvider;
|
||||
import elucent.albedo.lighting.Light;
|
||||
|
||||
@Optional.Interface(iface="elucent.albedo.lighting.ILightProvider", modid="albedo")
|
||||
public class EntityPixie extends EntityFlying implements ILightProvider {
|
||||
|
||||
private static final DataParameter<Integer> TYPE = EntityDataManager.createKey(EntityPixie.class, DataSerializers.VARINT);
|
||||
|
||||
@@ -141,4 +146,13 @@ public class EntityPixie extends EntityFlying {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid="albedo")
|
||||
public Light provideLight() {
|
||||
if(getType() == 1)
|
||||
return null;
|
||||
|
||||
return Light.builder().pos(this).color(1F, 0F, 0.5F).radius(8).build();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user