Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ dependencies {
runtimeOnly("com.azanor.baubles:Baubles:1.0.1.10:deobf")
compileOnly(rfg.deobf("curse.maven:ubc-72744:2304497"))
compileOnly("curse.maven:cofhcore-69162:2388751")

runtimeOnlyNonPublishable(rfg.deobf("maven.modrinth:salis-arcana:v2.4.0"))
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ usesMixins = true
separateMixinSourceSet =

# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false
usesMixinDebug = true

# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
Expand Down
39 changes: 39 additions & 0 deletions src/main/java/talonos/blightbuster/AddedResearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,45 @@ public static void initResearch() {
purityFocusResearch.registerResearchItem();
}

if (BlightbusterConfig.enableIsolationFocus) {
ShapedArcaneRecipe isolationFocusRecipe = ThaumcraftApi.addArcaneCraftingRecipe(
"ISOLATIONFOCUS",
new ItemStack(BBItems.isolationFocus),
new AspectList().add(Aspect.EARTH, 15)
.add(Aspect.AIR, 10),
"SQS",
"QAQ",
"SQS",
'S',
new ItemStack(ConfigItems.itemShard, 1, 3),
'A',
new ItemStack(ConfigBlocks.blockCosmeticOpaque),
'Q',
new ItemStack(Items.quartz),
'F',
new ItemStack(BBItems.purityFocus));

ResearchItem isolationFocusResearch = new ResearchItem(
"ISOLATIONFOCUS",
category,
new AspectList().add(Aspect.ORDER, 3)
.add(Aspect.MAGIC, 3)
.add(Aspect.AURA, 5)
.add(Aspect.ARMOR, 4),
-4,
-3,
2,
new ItemStack(BBItems.isolationFocus));

isolationFocusResearch.setPages(
new ResearchPage("tc.research_page.ISOLATIONFOCUS.1"),
new ResearchPage(isolationFocusRecipe));

isolationFocusResearch.setConcealed();
isolationFocusResearch.setParents("PURITYFOCUS");
isolationFocusResearch.registerResearchItem();
}

if (BlightbusterConfig.enableDawnTotem) {
InfusionRecipe dawnTotemRecipe = ThaumcraftApi.addInfusionCraftingRecipe(
"DAWNTOTEM",
Expand Down
1 change: 1 addition & 0 deletions src/main/java/talonos/blightbuster/BBStrings.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ public class BBStrings {
public static final String cyberTotemName = "cyberTotem";
public static final String offeringName = "offering";
public static final String dawnChargerName = "dawnCharger";
public static final String isolationFocusName = "isolationFocus";
}
3 changes: 3 additions & 0 deletions src/main/java/talonos/blightbuster/BlightbusterConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class BlightbusterConfig {
public static boolean enableSuperWorldTainter = false;
public static boolean enableDawnMachine = true;
public static boolean enablePurityFocus = true;
public static boolean enableIsolationFocus = true;
public static boolean enableSilverPotion = true;
public static boolean enableDawnTotem = true;
public static boolean enableDawnCharger = false;
Expand Down Expand Up @@ -76,6 +77,8 @@ public static void load(Configuration config) {
.getBoolean(enableDawnMachine);
enablePurityFocus = config.get("General", "Enable Purity Focus", enablePurityFocus)
.getBoolean(enablePurityFocus);
enableIsolationFocus = config.get("General", "Enable Node Isolation Focus", enableIsolationFocus)
.getBoolean(enableIsolationFocus);
enableSilverPotion = config.get("General", "Enable Silver Potion", enableSilverPotion)
.getBoolean(enableSilverPotion);
enableDawnTotem = config.get("General", "Enable Dawn Totem", enableDawnTotem)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@

package talonos.blightbuster.client;

import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;

import org.lwjgl.opengl.GL11;

public class StabilizedNodeRenderer {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be renamed to IsolatedNodeRenderer to match the focus name


// i have zero idea how any of this works so if you come across this in the future please don't judge me
// or ask me to explain it because i can't

public static void render(int bx, int by, int bz, float partialTicks) {
final float radius = 0.6f;
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer p = mc.thePlayer;
if (p == null) return;

double px = p.lastTickPosX + (p.posX - p.lastTickPosX) * partialTicks;
double py = p.lastTickPosY + (p.posY - p.lastTickPosY) * partialTicks;
double pz = p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * partialTicks;

double x = bx - px + 0.5;
double y = by - py + 0.5;
double z = bz - pz + 0.5;

float t = (System.currentTimeMillis() % 200000L) / 1000f;

GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
GL11.glPushMatrix();

GL11.glTranslated(x, y, z);

GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GL11.glDepthMask(false);

renderShimmeringLayers(t, radius);

GL11.glPopMatrix();
GL11.glPopAttrib();
GL11.glColor4f(1f, 1f, 1f, 1f);
}

private static void renderShimmeringLayers(float time, float radius) {
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
GL11.glLoadIdentity();
GL11.glTranslatef(time * 0.04f, time * 0.02f, 0);
GL11.glScalef(1.8f, 1.8f, 1);
GL11.glMatrixMode(GL11.GL_MODELVIEW);

GL11.glColor4f(0.8f, 0.9f, 1f, 1f);
drawSphere(radius, 24, 24);

GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);

GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
GL11.glLoadIdentity();
GL11.glTranslatef(time * -0.10f, time * 0.06f, 0);
GL11.glScalef(3.5f, 3.5f, 1);
GL11.glMatrixMode(GL11.GL_MODELVIEW);

GL11.glColor4f(0.9f, 1f, 1f, 1f);
drawSphere(radius, 24, 24);

GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
}

private static void drawSphere(float radius, int stacks, int slices) {
float time = (System.currentTimeMillis() % 100000) / 1000f;

for (int i = 0; i < stacks; i++) {
float lat0 = (float) Math.PI * (-0.5f + (float) i / stacks);
float z0 = (float) Math.sin(lat0);
float zr0 = (float) Math.cos(lat0);

float lat1 = (float) Math.PI * (-0.5f + (float) (i + 1) / stacks);
float z1 = (float) Math.sin(lat1);
float zr1 = (float) Math.cos(lat1);

GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
for (int j = 0; j <= slices; j++) {
float lng = 2f * (float) Math.PI * (j == slices ? 0 : j) / slices;
float x = (float) Math.cos(lng);
float y = (float) Math.sin(lng);

float bolt0 = Math.abs((float) Math.sin(time * 12 + lng * 6 + lat0 * 9));
float bolt1 = Math.abs((float) Math.sin(time * 12 + lng * 6 + lat1 * 9));
bolt0 = (float) Math.pow(bolt0, 2.2);
bolt1 = (float) Math.pow(bolt1, 2.2);

GL11.glColor4f(0.7f, 0.9f, 1f, bolt0 * 0.35f);
GL11.glVertex3f(radius * x * zr0, radius * z0, radius * y * zr0);

GL11.glColor4f(0.7f, 0.9f, 1f, bolt1 * 0.35f);
GL11.glVertex3f(radius * x * zr1, radius * z1, radius * y * zr1);
}
GL11.glEnd();
}
}
}
4 changes: 4 additions & 0 deletions src/main/java/talonos/blightbuster/items/BBItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class BBItems {
public static Item silverPotion;
public static Item worldTainter;
public static Item worldSuperTainter;
public static Item isolationFocus;

public static void init() {
if (BlightbusterConfig.enablePurityFocus) {
Expand All @@ -24,5 +25,8 @@ public static void init() {
if (BlightbusterConfig.enableSuperWorldTainter) {
worldSuperTainter = new ItemSuperTestWorldTainter();
}
if (BlightbusterConfig.enableIsolationFocus) {
isolationFocus = new ItemIsolationFocus();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package talonos.blightbuster.items;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;

import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import talonos.blightbuster.BBStrings;
import talonos.blightbuster.BlightBuster;
import talonos.blightbuster.lib.INodeIsolated;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.wands.FocusUpgradeType;
import thaumcraft.api.wands.ItemFocusBasic;
import thaumcraft.common.items.wands.ItemWandCasting;

public class ItemIsolationFocus extends ItemFocusBasic {

public ItemIsolationFocus() {
setUnlocalizedName(BlightBuster.MODID + "_" + BBStrings.isolationFocusName);
GameRegistry.registerItem(this, BlightBuster.MODID + ":" + BBStrings.isolationFocusName);
setCreativeTab(CreativeTabs.tabMaterials);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other BB items are in Thaum's creative tab.

Suggested change
setCreativeTab(CreativeTabs.tabMaterials);
setCreativeTab(Thaumcraft.tabTC);

setTextureName(BlightBuster.MODID + ":" + BBStrings.isolationFocusName);
}

public boolean onEntitySwing(EntityLivingBase entity, ItemStack stack) {
if ((stack.getItem() instanceof ItemWandCasting wand && entity instanceof EntityPlayer player)) {
MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(player.worldObj, player, true);
if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
if (!(player.worldObj
.getTileEntity(mop.blockX, mop.blockY, mop.blockZ) instanceof INodeIsolated node)) {
return super.onEntitySwing(player, stack);
}
if (!wand.consumeAllVis(stack, player, this.getVisCost(stack), true, false)) {
return super.onEntitySwing(player, stack);
}
node.setIsolated(!node.isIsolated());
}
}
return super.onEntitySwing(entity, stack);
}

@Override
public int getActivationCooldown(ItemStack focusstack) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still triggers the cooldown for every left click, even when not actually used to isolate a node. I thought maybe adding WandManager.setCooldown(player, 500) to onEntitySwing after node.setIsolated would work, but it seems to only apply the cooldown for 1 tick before it is overwritten by something else, so I'm not sure what the best way to solve this would be.

return 500;
}

@Override
public boolean onFocusBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) {
return player.getEntityWorld()
.getTileEntity(x, y, z) instanceof INodeIsolated && !player.isSneaking();
}

@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister register) {
this.itemIcon = register.registerIcon(this.getIconString());
this.icon = register.registerIcon(this.getIconString());
}

@Override
public int getFocusColor(ItemStack arg0) {
return 0x5a00cf;
}

@Override
public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack itemstack, int rank) {

return new FocusUpgradeType[0];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No Frugal?

}

@Override
public AspectList getVisCost(ItemStack itemstack) {
AspectList cost = new AspectList();
cost.add(Aspect.ORDER, 20);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.2 Ordo seems way too cheap. Not using terra or aer when those are the aspects used to craft it also seems odd. Maybe 100 (for 1 vis) Terra and 50 (0.5 vis) Aer would be a bit better. It should also probably be configurable.

return cost;
}
}
8 changes: 8 additions & 0 deletions src/main/java/talonos/blightbuster/lib/INodeIsolated.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package talonos.blightbuster.lib;

public interface INodeIsolated {

void setIsolated(boolean stable);

boolean isIsolated();
}
22 changes: 20 additions & 2 deletions src/main/java/talonos/blightbuster/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public enum Mixins {
DISABLE_SHEEP_SPREAD(new Builder("Disables tainted sheep taint spread").addTargetedMod(TargetedMod.THAUMCRAFT)
.setSide(Side.BOTH)
.setPhase(Phase.LATE)
.addMixinClasses("MixinTileNode")
.addMixinClasses("MixinTileNode_Taint")
.setApplyIf(() -> true)),
DISABLE_CREEPER_EXPLOSION(new Builder("Disabled tainted creeper explosions").addTargetedMod(TargetedMod.THAUMCRAFT)
.setSide(Side.BOTH)
Expand All @@ -43,7 +43,25 @@ public enum Mixins {
.setSide(Side.BOTH)
.setPhase(Phase.LATE)
.addMixinClasses("MixinUtils")
.setApplyIf(() -> true));
.setApplyIf(() -> true)),
ADD_TILE_RENDERER(new Builder("Add custom node tile renderer").addTargetedMod(TargetedMod.THAUMCRAFT)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ADD_TILE_RENDERER(new Builder("Add custom node tile renderer").addTargetedMod(TargetedMod.THAUMCRAFT)
ADD_TILE_RENDERER(new Builder("Add custom node tile renderer when isolated").addTargetedMod(TargetedMod.THAUMCRAFT)

.setSide(Side.CLIENT)
.setPhase(Phase.LATE)
.addMixinClasses("MixinTileNodeRenderer")
.setApplyIf(() -> true)),
ADD_NODE_STABILIZER(new Builder("Add node isolation functionality").addTargetedMod(TargetedMod.THAUMCRAFT)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably also be renamed to match the focus's actual name.

.setSide(Side.BOTH)
.setPhase(Phase.LATE)
.addMixinClasses("MixinTileNode_Isolate")
.setApplyIf(() -> true)),
STOP_STABILIZER_FOCUS_BREAK(
new Builder("Prevent isolation focus from breaking nodes").addTargetedMod(TargetedMod.THAUMCRAFT)
.setSide(Side.BOTH)
.setPhase(Phase.LATE)
.addMixinClasses("MixinItemWandCasting_FocusNoBreak")
.setApplyIf(() -> true)),

;

private final List<String> mixinClasses;
private final List<TargetedMod> targetedMods;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package talonos.blightbuster.mixins.late;

import net.minecraft.entity.EntityLivingBase;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;

import talonos.blightbuster.items.ItemIsolationFocus;
import thaumcraft.api.wands.ItemFocusBasic;
import thaumcraft.common.items.wands.ItemWandCasting;

@Mixin(ItemWandCasting.class)
public class MixinItemWandCasting_FocusNoBreak {

@WrapOperation(
method = "onBlockStartBreak",
at = @At(
value = "INVOKE",
target = "Lthaumcraft/common/items/wands/WandManager;isOnCooldown(Lnet/minecraft/entity/EntityLivingBase;)Z",
remap = false),
remap = false)
private boolean preventBreakIfFocusActive(EntityLivingBase entityLiving, Operation<Boolean> original,
@Local(name = "focus") ItemFocusBasic focus) {
if (focus instanceof ItemIsolationFocus) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could also check for the Purity focus here and remove ItemPurityFocus::onFocusBlockStartBreak.

return entityLiving.isSneaking(); // gets inverted in the original method, so will prevent breaking when not
// sneaking
}
return original.call(entityLiving);
}
}
Loading