mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 10:55:17 +00:00
More cleanups. Fix typo in CorporeaHelper classname, reformat
This commit is contained in:
1 parent
0c04fa30b1
commit
b14a964b1e
21 files changed
+112
-40
No files matched your search
@@ -14,9 +14,11 @@ import net.minecraft.util.LazyValue;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -25,7 +27,7 @@ import java.util.function.Function;
|
||||
public interface CorporeaHelper {
|
||||
LazyValue<CorporeaHelper> INSTANCE = new LazyValue<>(() -> {
|
||||
try {
|
||||
return (CorporeaHelper) Class.forName("vazkii.botania.common.impl.CorporeaHelperImpl").newInstance();
|
||||
return (CorporeaHelper) Class.forName("vazkii.botania.common.impl.corporea.CorporeaHelperImpl").newInstance();
|
||||
} catch (ReflectiveOperationException e) {
|
||||
LogManager.getLogger().warn("Unable to find CorporeaHelperImpl, using a dummy");
|
||||
return new CorporeaHelper() {};
|
||||
@@ -124,6 +126,7 @@ public interface CorporeaHelper {
|
||||
* <br>
|
||||
* When requesting counting of items, individual stacks may exceed maxStackSize for
|
||||
* purposes of counting huge amounts.
|
||||
*
|
||||
* @return Triple of stacks extracted, number of items matched, and number of items extracted
|
||||
*/
|
||||
default ICorporeaResult requestItem(ICorporeaRequestMatcher matcher, int itemCount, ICorporeaSpark spark, boolean doit) {
|
||||
|
||||
@@ -13,7 +13,8 @@ public interface ICorporeaRequest {
|
||||
ICorporeaRequestMatcher getMatcher();
|
||||
|
||||
/**
|
||||
* @return The amount still wanted by the request, -1 if the request wants everything matched by {@link #getMatcher}.
|
||||
* @return The amount still wanted by the request, -1 if the request wants everything matched by
|
||||
* {@link #getMatcher}.
|
||||
*/
|
||||
int getStillNeeded();
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ package vazkii.botania.api.corporea;
|
||||
public interface ICorporeaRequestor {
|
||||
|
||||
/**
|
||||
* Executes the passed in request.
|
||||
*/
|
||||
* Executes the passed in request.
|
||||
*/
|
||||
void doCorporeaRequest(ICorporeaRequestMatcher request, int count, ICorporeaSpark spark);
|
||||
|
||||
}
|
||||
@@ -1,3 +1,11 @@
|
||||
/*
|
||||
* 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.corporea;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -20,8 +20,8 @@ import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.client.core.helper.ShaderCallback;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.core.helper.ShaderCallback;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.entity.EntityDoppleganger;
|
||||
@@ -77,18 +77,17 @@ public final class BossBarHandler {
|
||||
}
|
||||
|
||||
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;
|
||||
ShaderHelper.BotaniaShader program = currentBoss.getBossBarShaderProgram(bg);
|
||||
|
||||
if (useShader) {
|
||||
ShaderCallback callback = currentBoss.getBossBarShaderCallback(bg, program);
|
||||
if (program != null) {
|
||||
ShaderCallback callback = currentBoss.getBossBarShaderCallback(bg);
|
||||
barUniformCallback.set(u, v, callback);
|
||||
ShaderHelper.useShader(program, barUniformCallback);
|
||||
}
|
||||
|
||||
RenderHelper.drawTexturedModalRect(x, y, u, v, w, h);
|
||||
|
||||
if (useShader) {
|
||||
if (program != null) {
|
||||
ShaderHelper.releaseShader();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.renderer.Atlases;
|
||||
@@ -45,7 +45,7 @@ public class LayerTerraHelmet extends LayerRenderer<AbstractClientPlayerEntity,
|
||||
IBakedModel model = MiscellaneousIcons.INSTANCE.terrasteelHelmWillModel;
|
||||
IVertexBuilder buffer = buffers.getBuffer(Atlases.getEntityCutout());
|
||||
Minecraft.getInstance().getBlockRendererDispatcher().getBlockModelRenderer()
|
||||
.render(ms.peek(), buffer, null, model, 1, 1, 1, light, OverlayTexture.DEFAULT_UV);
|
||||
.render(ms.peek(), buffer, null, model, 1, 1, 1, light, OverlayTexture.DEFAULT_UV);
|
||||
ms.pop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -90,31 +92,24 @@ public final class ShaderHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public static OptionalInt getShader(BotaniaShader shader) {
|
||||
ShaderProgram prog = PROGRAMS.get(shader);
|
||||
return prog == null ? OptionalInt.empty() : OptionalInt.of(prog.getProgram());
|
||||
}
|
||||
|
||||
public static void useShader(BotaniaShader shader, ShaderCallback callback) {
|
||||
ShaderProgram prog = PROGRAMS.get(shader);
|
||||
if (prog == null) {
|
||||
return;
|
||||
}
|
||||
useShader(prog.getProgram(), callback);
|
||||
}
|
||||
|
||||
public static void useShader(int shader, ShaderCallback callback) {
|
||||
public static void useShader(BotaniaShader shader, @Nullable ShaderCallback callback) {
|
||||
if (!useShaders()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ShaderLinkHelper.useProgram(shader);
|
||||
ShaderProgram prog = PROGRAMS.get(shader);
|
||||
if (prog == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int time = GlStateManager.getUniformLocation(shader, "time");
|
||||
int program = prog.getProgram();
|
||||
ShaderLinkHelper.useProgram(program);
|
||||
|
||||
int time = GlStateManager.getUniformLocation(program, "time");
|
||||
GlStateManager.uniform1(time, ClientTickHandler.ticksInGame);
|
||||
|
||||
if (callback != null) {
|
||||
callback.call(shader);
|
||||
callback.call(program);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import vazkii.botania.common.core.helper.ColorHelper;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.common.block.mana.BlockSpreader;
|
||||
import vazkii.botania.common.block.tile.mana.TileSpreader;
|
||||
import vazkii.botania.common.core.helper.ColorHelper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
@@ -33,9 +33,8 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.corporea.CorporeaHelper;
|
||||
import vazkii.botania.common.core.helper.ColorHelper;
|
||||
import vazkii.botania.api.capability.FloatingFlowerImpl;
|
||||
import vazkii.botania.api.corporea.CorporeaHelper;
|
||||
import vazkii.botania.api.item.IExoflameHeatable;
|
||||
import vazkii.botania.api.item.IFloatingFlower;
|
||||
import vazkii.botania.client.core.proxy.ClientProxy;
|
||||
@@ -62,6 +61,7 @@ import vazkii.botania.common.core.handler.IMCHandler;
|
||||
import vazkii.botania.common.core.handler.IMCSender;
|
||||
import vazkii.botania.common.core.handler.InternalMethodHandler;
|
||||
import vazkii.botania.common.core.handler.ManaNetworkHandler;
|
||||
import vazkii.botania.common.core.helper.ColorHelper;
|
||||
import vazkii.botania.common.core.loot.BindUuid;
|
||||
import vazkii.botania.common.core.loot.EnableRelics;
|
||||
import vazkii.botania.common.core.loot.LootHandler;
|
||||
|
||||
@@ -33,13 +33,13 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import vazkii.botania.common.core.helper.ColorHelper;
|
||||
import vazkii.botania.api.mana.ILens;
|
||||
import vazkii.botania.api.wand.IWandHUD;
|
||||
import vazkii.botania.api.wand.IWandable;
|
||||
import vazkii.botania.api.wand.IWireframeAABBProvider;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.block.tile.mana.TileSpreader;
|
||||
import vazkii.botania.common.core.helper.ColorHelper;
|
||||
import vazkii.botania.common.core.helper.InventoryHelper;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
|
||||
import vazkii.botania.common.core.helper.ColorHelper;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
import vazkii.botania.api.subtile.TileEntityGeneratingFlower;
|
||||
import vazkii.botania.common.core.helper.ColorHelper;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -15,10 +15,10 @@ import net.minecraftforge.fml.InterModComms;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
|
||||
import net.minecraftforge.registries.IRegistryDelegate;
|
||||
|
||||
import vazkii.botania.common.core.helper.ColorHelper;
|
||||
import vazkii.botania.api.imc.IMC;
|
||||
import vazkii.botania.api.imc.OreWeightMessage;
|
||||
import vazkii.botania.api.imc.PaintableBlockMessage;
|
||||
import vazkii.botania.common.core.helper.ColorHelper;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
public class IMCSender {
|
||||
|
||||
@@ -68,8 +68,8 @@ import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
|
||||
import vazkii.botania.client.core.helper.ShaderCallback;
|
||||
import vazkii.botania.client.core.handler.BossBarHandler;
|
||||
import vazkii.botania.client.core.helper.ShaderCallback;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.client.fx.WispParticleData;
|
||||
import vazkii.botania.common.Botania;
|
||||
@@ -977,14 +977,15 @@ public class EntityDoppleganger extends MobEntity implements IEntityAdditionalSp
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int getBossBarShaderProgram(boolean background) {
|
||||
return background ? 0 : ShaderHelper.getShader(ShaderHelper.BotaniaShader.DOPPLEGANGER_BAR).orElse(0);
|
||||
@Nullable
|
||||
public ShaderHelper.BotaniaShader getBossBarShaderProgram(boolean background) {
|
||||
return background ? null : ShaderHelper.BotaniaShader.DOPPLEGANGER_BAR;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT) private ShaderCallback shaderCallback;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public ShaderCallback getBossBarShaderCallback(boolean background, int shader) {
|
||||
public ShaderCallback getBossBarShaderCallback(boolean background) {
|
||||
if (shaderCallback == null) {
|
||||
shaderCallback = shader1 -> {
|
||||
int grainIntensityUniform = GlStateManager.getUniformLocation(shader1, "grainIntensity");
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
/*
|
||||
* 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.impl;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.mana.*;
|
||||
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
/*
|
||||
* 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.impl.corporea;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
@@ -11,6 +20,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.corporea.*;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaRetainer;
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
/*
|
||||
* 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.impl.corporea;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
import vazkii.botania.api.corporea.ICorporeaRequestMatcher;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
/*
|
||||
* 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.impl.corporea;
|
||||
|
||||
import vazkii.botania.api.corporea.ICorporeaRequest;
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
/*
|
||||
* 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.impl.corporea;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import vazkii.botania.api.corporea.ICorporeaResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,10 +1,20 @@
|
||||
/*
|
||||
* 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.impl.corporea;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import vazkii.botania.api.corporea.ICorporeaRequestMatcher;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -22,8 +22,8 @@ import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import vazkii.botania.common.core.helper.ColorHelper;
|
||||
import vazkii.botania.api.mana.IManaPool;
|
||||
import vazkii.botania.common.core.helper.ColorHelper;
|
||||
import vazkii.botania.common.item.Item16Colors;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
Reference in new issue
Block a user