Compare commits

...
13 Commits
Author SHA1 Message Date
Martin Robertz 1a23b89fbe update 2025-10-19 21:05:14 +02:00
16bfc3e949 Soul Beacon Event Handler Cleanup (#93)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-19 18:39:01 +02:00
Martin Robertz fc0cc6a074 update 2025-09-22 18:36:53 +02:00
Aerindor of Arcane 47c06267c1 Add client-side vortex sound in TileVortex (#96) 2025-09-22 11:55:29 +02:00
Alexdoru 76258cd038 Cache Tessellator#instance in local var (#92) 2025-07-18 12:48:17 -07:00
Maya 2ee312ccd1 update 2025-07-04 13:13:21 -06:00
Abdiel Kavash 5c7028c645 Fix Illumine Lens interaction with other sources of night vision. (#91) 2025-07-04 13:13:12 -06:00
Martin Robertz e94bc0d510 update 2025-05-16 22:08:54 +02:00
Caedis 8a84cfcd4d Replace Baubles with Baubles Expanded (#86) 2025-05-13 14:22:03 +02:00
Maya 52bd07d4c4 update 2025-04-08 22:56:28 -05:00
Glease b75095d013 fix missing draw call and missing texture bind (#84) 2025-04-08 22:56:20 -05:00
Martin Robertz 0c4a02cd0e update 2025-01-19 20:39:09 +01:00
b7b9c9a9b5 Fixes Liquefaction Focus (#72)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Co-authored-by: Maya <10861407+serenibyss@users.noreply.github.com>
2025-01-19 06:45:19 +00:00
25 changed files with 470 additions and 291 deletions

No files matched your search

+1
View File
@@ -29,3 +29,4 @@ src/main/resources/mixins.*.json
*.bat
*.DS_Store
!gradlew.bat
layout.json
+2 -2
View File
@@ -1,9 +1,9 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:Baubles:1.0.4:dev')
api('com.github.GTNewHorizons:Baubles-Expanded:2.1.16-GTNH:dev')
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.48:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.474:dev') {transitive = false}
}
+3 -3
View File
@@ -14,7 +14,7 @@ modId = ThaumicHorizons
modGroup = com.kentington.thaumichorizons
# Whether to use modGroup as the maven publishing group.
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
# When false, com.github.GTNewHorizons is used.
useModGroupForPublishing = false
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
@@ -45,7 +45,7 @@ enableModernJavaSyntax = true
# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = false
enableGenericInjection = true
# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
@@ -151,7 +151,7 @@ modrinthProjectId = 1wDWP1tN
# type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+2 -3
View File
@@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -206,7 +205,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.30'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.44'
}
@@ -5,6 +5,8 @@
package com.kentington.thaumichorizons.client;
import java.awt.Color;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@@ -28,6 +30,7 @@ import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
import com.kentington.thaumichorizons.client.audio.VortexSound;
import com.kentington.thaumichorizons.client.fx.FXSonic;
import com.kentington.thaumichorizons.client.gui.GuiBloodInfuser;
import com.kentington.thaumichorizons.client.gui.GuiCase;
@@ -555,4 +558,54 @@ public class ClientProxy extends CommonProxy {
1.0f,
0.1f);
}
private final Map<TileCoord, VortexSound> activeVortexSounds = new HashMap<>();
@Override
public void playVortexSound(TileVortex tile) {
if (tile == null || tile.isInvalid() || tile.getWorldObj() == null) return;
TileCoord pos = new TileCoord(tile.xCoord, tile.yCoord, tile.zCoord);
if (activeVortexSounds.containsKey(pos)) return;
VortexSound sound = new VortexSound(tile);
Minecraft.getMinecraft().getSoundHandler().playSound(sound);
activeVortexSounds.put(pos, sound);
}
@Override
public void stopVortexSound(TileVortex tile) {
if (tile == null) return;
TileCoord pos = new TileCoord(tile.xCoord, tile.yCoord, tile.zCoord);
VortexSound sound = activeVortexSounds.remove(pos);
if (sound != null) {
sound.markDone();
}
}
// Inner class to replace BlockPos for 1.7.10
private static class TileCoord {
final int x, y, z;
TileCoord(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
@Override
public boolean equals(Object o) {
if (!(o instanceof TileCoord)) return false;
TileCoord other = (TileCoord) o;
return this.x == other.x && this.y == other.y && this.z == other.z;
}
@Override
public int hashCode() {
return x * 31 * 31 + y * 31 + z;
}
}
}
@@ -0,0 +1,48 @@
package com.kentington.thaumichorizons.client.audio;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.MovingSound;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
public class VortexSound extends MovingSound {
private final TileEntity tile;
public VortexSound(TileEntity tile) {
super(new ResourceLocation("thaumichorizons:vortex"));
this.tile = tile;
this.repeat = true;
this.field_147665_h = 0;
this.volume = 1.0F;
}
// Let me know if update needs to be cached or if that's a good idea or not for performance.
@Override
public void update() {
if (tile == null || tile.isInvalid() || tile.getWorldObj() == null) {
this.donePlaying = true;
return;
}
// follow tile
this.xPosF = tile.xCoord + 0.5F;
this.yPosF = tile.yCoord + 0.5F;
this.zPosF = tile.zCoord + 0.5F;
// distance-based volume
EntityPlayer p = Minecraft.getMinecraft().thePlayer;
if (p != null) {
double dist = p.getDistance(this.xPosF, this.yPosF, this.zPosF);
this.volume = Math.max(0.0F, 1.0F / (1.0F + (float) (dist / 8.0F)));
}
}
public void markDone() {
this.donePlaying = true;
}
}
@@ -4,6 +4,7 @@
package com.kentington.thaumichorizons.client.fx;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
@@ -36,8 +37,9 @@ public class FXContainment extends EntityFX {
this.noClip = true;
}
public void renderParticle(final Tessellator p_70539_1_, final float p_70539_2_, final float p_70539_3_,
public void renderParticle(final Tessellator tessellator, final float p_70539_2_, final float p_70539_3_,
final float p_70539_4_, final float p_70539_5_, final float p_70539_6_, final float p_70539_7_) {
tessellator.draw();
final long nt = System.nanoTime();
final long time = nt / 50000000L;
final int frame = (int) time % 16;
@@ -54,26 +56,26 @@ public class FXContainment extends EntityFX {
final float f7 = (float) (this.posX - FXContainment.interpPosX);
final float f8 = (float) (this.posY - FXContainment.interpPosY);
final float f9 = (float) (this.posZ - FXContainment.interpPosZ);
p_70539_1_.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, 0.1f);
p_70539_1_.addVertexWithUV(
tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, 0.1f);
tessellator.addVertexWithUV(
f7 - p_70539_3_ * f6 - p_70539_6_ * f6,
f8 - p_70539_4_ * f6,
f9 - p_70539_5_ * f6 - p_70539_7_ * f6,
f2,
f4);
p_70539_1_.addVertexWithUV(
tessellator.addVertexWithUV(
f7 - p_70539_3_ * f6 + p_70539_6_ * f6,
f8 + p_70539_4_ * f6,
f9 - p_70539_5_ * f6 + p_70539_7_ * f6,
f3,
f4);
p_70539_1_.addVertexWithUV(
tessellator.addVertexWithUV(
f7 + p_70539_3_ * f6 + p_70539_6_ * f6,
f8 + p_70539_4_ * f6,
f9 + p_70539_5_ * f6 + p_70539_7_ * f6,
f3,
f5);
p_70539_1_.addVertexWithUV(
tessellator.addVertexWithUV(
f7 + p_70539_3_ * f6 - p_70539_6_ * f6,
f8 - p_70539_4_ * f6,
f9 + p_70539_5_ * f6 - p_70539_7_ * f6,
@@ -82,6 +84,8 @@ public class FXContainment extends EntityFX {
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
GL11.glPopMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(UtilsFX.getParticleTexture());
tessellator.startDrawingQuads();
}
public int getFXLayer() {
@@ -36,6 +36,7 @@ import com.kentington.thaumichorizons.common.ThaumicHorizons;
import com.kentington.thaumichorizons.common.entities.EntityBoatThaumium;
import com.kentington.thaumichorizons.common.items.lenses.ILens;
import com.kentington.thaumichorizons.common.items.lenses.ItemLensCase;
import com.kentington.thaumichorizons.common.items.lenses.ItemLensFire;
import com.kentington.thaumichorizons.common.items.lenses.LensManager;
import com.kentington.thaumichorizons.common.lib.THKeyHandler;
import com.kentington.thaumichorizons.common.lib.networking.PacketHandler;
@@ -97,8 +98,7 @@ public class RenderEventHandler {
if (LensManager.nightVisionOffTime > 0L
&& (goggles == null || !(goggles.getItem() instanceof IRevealer)
|| goggles.stackTagCompound == null)
&& mc.thePlayer.getActivePotionEffect(Potion.nightVision) != null
&& mc.thePlayer.getActivePotionEffect(Potion.nightVision).getIsAmbient()) {
&& ItemLensFire.isEffectGrantedByLens(mc.thePlayer.getActivePotionEffect(Potion.nightVision))) {
mc.thePlayer.removePotionEffect(Potion.nightVision.id);
LensManager.nightVisionOffTime = 0L;
}
@@ -29,8 +29,9 @@ public class BlockVatRender implements ISimpleBlockRenderingHandler {
if (boss == null) {
return false;
}
Tessellator.instance.setColorRGBA(255, 255, 255, 192);
Tessellator.instance.setBrightness(241);
final Tessellator tess = Tessellator.instance;
tess.setColorRGBA(255, 255, 255, 192);
tess.setBrightness(241);
renderer.enableAO = false;
final int dx = boss.xCoord - tco.xCoord;
final int dy = boss.yCoord - tco.yCoord;
@@ -42,7 +43,7 @@ public class BlockVatRender implements ISimpleBlockRenderingHandler {
renderer.renderFaceZPos(block, x, y, z, ((BlockVat) ThaumicHorizons.blockVat).iconGlassTR);
block.setBlockBounds(0.0f, 0.0f, 0.0f, 0.75f, 1.0f, 0.75f);
renderer.setRenderBoundsFromBlock(block);
Tessellator.instance.setColorRGBA(255, 255, 255, 255);
tess.setColorRGBA(255, 255, 255, 255);
renderer.renderFaceXPos(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
renderer.renderFaceZPos(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
@@ -52,7 +53,7 @@ public class BlockVatRender implements ISimpleBlockRenderingHandler {
renderer.renderFaceZPos(block, x, y, z, ((BlockVat) ThaumicHorizons.blockVat).iconGlassTL);
block.setBlockBounds(0.25f, 0.0f, 0.0f, 1.0f, 1.0f, 0.75f);
renderer.setRenderBoundsFromBlock(block);
Tessellator.instance.setColorRGBA(255, 255, 255, 255);
tess.setColorRGBA(255, 255, 255, 255);
renderer.renderFaceXNeg(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
renderer.renderFaceZPos(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
@@ -62,7 +63,7 @@ public class BlockVatRender implements ISimpleBlockRenderingHandler {
renderer.renderFaceZNeg(block, x, y, z, ((BlockVat) ThaumicHorizons.blockVat).iconGlassTR);
block.setBlockBounds(0.25f, 0.0f, 0.25f, 1.0f, 1.0f, 1.0f);
renderer.setRenderBoundsFromBlock(block);
Tessellator.instance.setColorRGBA(255, 255, 255, 255);
tess.setColorRGBA(255, 255, 255, 255);
renderer.renderFaceXNeg(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
renderer.renderFaceZNeg(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
@@ -72,7 +73,7 @@ public class BlockVatRender implements ISimpleBlockRenderingHandler {
renderer.renderFaceZNeg(block, x, y, z, ((BlockVat) ThaumicHorizons.blockVat).iconGlassTL);
block.setBlockBounds(0.0f, 0.0f, 0.25f, 0.75f, 1.0f, 1.0f);
renderer.setRenderBoundsFromBlock(block);
Tessellator.instance.setColorRGBA(255, 255, 255, 255);
tess.setColorRGBA(255, 255, 255, 255);
renderer.renderFaceXPos(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
renderer.renderFaceZNeg(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
@@ -82,7 +83,7 @@ public class BlockVatRender implements ISimpleBlockRenderingHandler {
renderer.renderFaceZPos(block, x, y, z, ((BlockVat) ThaumicHorizons.blockVat).iconGlassT);
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.75f);
renderer.setRenderBoundsFromBlock(block);
Tessellator.instance.setColorRGBA(255, 255, 255, 255);
tess.setColorRGBA(255, 255, 255, 255);
renderer.renderFaceZPos(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
renderer.setRenderBoundsFromBlock(block);
@@ -90,7 +91,7 @@ public class BlockVatRender implements ISimpleBlockRenderingHandler {
renderer.renderFaceZNeg(block, x, y, z, ((BlockVat) ThaumicHorizons.blockVat).iconGlassT);
block.setBlockBounds(0.0f, 0.0f, 0.25f, 1.0f, 1.0f, 1.0f);
renderer.setRenderBoundsFromBlock(block);
Tessellator.instance.setColorRGBA(255, 255, 255, 255);
tess.setColorRGBA(255, 255, 255, 255);
renderer.renderFaceZNeg(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
renderer.setRenderBoundsFromBlock(block);
@@ -100,7 +101,7 @@ public class BlockVatRender implements ISimpleBlockRenderingHandler {
renderer.renderFaceXPos(block, x, y, z, ((BlockVat) ThaumicHorizons.blockVat).iconGlassT);
block.setBlockBounds(0.0f, 0.0f, 0.0f, 0.75f, 1.0f, 1.0f);
renderer.setRenderBoundsFromBlock(block);
Tessellator.instance.setColorRGBA(255, 255, 255, 255);
tess.setColorRGBA(255, 255, 255, 255);
renderer.renderFaceXPos(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
renderer.setRenderBoundsFromBlock(block);
@@ -108,7 +109,7 @@ public class BlockVatRender implements ISimpleBlockRenderingHandler {
renderer.renderFaceXNeg(block, x, y, z, ((BlockVat) ThaumicHorizons.blockVat).iconGlassT);
block.setBlockBounds(0.25f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
renderer.setRenderBoundsFromBlock(block);
Tessellator.instance.setColorRGBA(255, 255, 255, 255);
tess.setColorRGBA(255, 255, 255, 255);
renderer.renderFaceXNeg(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
renderer.setRenderBoundsFromBlock(block);
@@ -122,7 +123,7 @@ public class BlockVatRender implements ISimpleBlockRenderingHandler {
renderer.renderFaceZPos(block, x, y, z, ((BlockVat) ThaumicHorizons.blockVat).iconGlassBR);
block.setBlockBounds(0.0f, 0.0f, 0.0f, 0.75f, 1.0f, 0.75f);
renderer.setRenderBoundsFromBlock(block);
Tessellator.instance.setColorRGBA(255, 255, 255, 255);
tess.setColorRGBA(255, 255, 255, 255);
renderer.renderFaceXPos(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
renderer.renderFaceZPos(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
@@ -132,7 +133,7 @@ public class BlockVatRender implements ISimpleBlockRenderingHandler {
renderer.renderFaceZPos(block, x, y, z, ((BlockVat) ThaumicHorizons.blockVat).iconGlassBL);
block.setBlockBounds(0.25f, 0.0f, 0.0f, 1.0f, 1.0f, 0.75f);
renderer.setRenderBoundsFromBlock(block);
Tessellator.instance.setColorRGBA(255, 255, 255, 255);
tess.setColorRGBA(255, 255, 255, 255);
renderer.renderFaceXNeg(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
renderer.renderFaceZPos(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
@@ -142,7 +143,7 @@ public class BlockVatRender implements ISimpleBlockRenderingHandler {
renderer.renderFaceZNeg(block, x, y, z, ((BlockVat) ThaumicHorizons.blockVat).iconGlassBR);
block.setBlockBounds(0.25f, 0.0f, 0.25f, 1.0f, 1.0f, 1.0f);
renderer.setRenderBoundsFromBlock(block);
Tessellator.instance.setColorRGBA(255, 255, 255, 255);
tess.setColorRGBA(255, 255, 255, 255);
renderer.renderFaceXNeg(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
renderer.renderFaceZNeg(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
@@ -152,7 +153,7 @@ public class BlockVatRender implements ISimpleBlockRenderingHandler {
renderer.renderFaceZNeg(block, x, y, z, ((BlockVat) ThaumicHorizons.blockVat).iconGlassBL);
block.setBlockBounds(0.0f, 0.0f, 0.25f, 0.75f, 1.0f, 1.0f);
renderer.setRenderBoundsFromBlock(block);
Tessellator.instance.setColorRGBA(255, 255, 255, 255);
tess.setColorRGBA(255, 255, 255, 255);
renderer.renderFaceXPos(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
renderer.renderFaceZNeg(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
@@ -162,7 +163,7 @@ public class BlockVatRender implements ISimpleBlockRenderingHandler {
renderer.renderFaceZPos(block, x, y, z, ((BlockVat) ThaumicHorizons.blockVat).iconGlassB);
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.75f);
renderer.setRenderBoundsFromBlock(block);
Tessellator.instance.setColorRGBA(255, 255, 255, 255);
tess.setColorRGBA(255, 255, 255, 255);
renderer.renderFaceZPos(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
renderer.setRenderBoundsFromBlock(block);
@@ -170,7 +171,7 @@ public class BlockVatRender implements ISimpleBlockRenderingHandler {
renderer.renderFaceZNeg(block, x, y, z, ((BlockVat) ThaumicHorizons.blockVat).iconGlassB);
block.setBlockBounds(0.0f, 0.0f, 0.25f, 1.0f, 1.0f, 1.0f);
renderer.setRenderBoundsFromBlock(block);
Tessellator.instance.setColorRGBA(255, 255, 255, 255);
tess.setColorRGBA(255, 255, 255, 255);
renderer.renderFaceZNeg(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
renderer.setRenderBoundsFromBlock(block);
@@ -180,7 +181,7 @@ public class BlockVatRender implements ISimpleBlockRenderingHandler {
renderer.renderFaceXPos(block, x, y, z, ((BlockVat) ThaumicHorizons.blockVat).iconGlassB);
block.setBlockBounds(0.0f, 0.0f, 0.0f, 0.75f, 1.0f, 1.0f);
renderer.setRenderBoundsFromBlock(block);
Tessellator.instance.setColorRGBA(255, 255, 255, 255);
tess.setColorRGBA(255, 255, 255, 255);
renderer.renderFaceXPos(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
renderer.setRenderBoundsFromBlock(block);
@@ -188,7 +189,7 @@ public class BlockVatRender implements ISimpleBlockRenderingHandler {
renderer.renderFaceXNeg(block, x, y, z, ((BlockVat) ThaumicHorizons.blockVat).iconGlassB);
block.setBlockBounds(0.25f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
renderer.setRenderBoundsFromBlock(block);
Tessellator.instance.setColorRGBA(255, 255, 255, 255);
tess.setColorRGBA(255, 255, 255, 255);
renderer.renderFaceXNeg(block, x, y, z, Blocks.water.getBlockTextureFromSide(0));
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
renderer.setRenderBoundsFromBlock(block);
@@ -23,13 +23,14 @@ public class BlockVatSolidRender implements ISimpleBlockRenderingHandler {
public boolean renderWorldBlock(final IBlockAccess world, final int x, final int y, final int z, final Block block,
final int modelId, final RenderBlocks renderer) {
final Tessellator tess = Tessellator.instance;
if (world.getTileEntity(x, y, z) instanceof final TileVatSlave tco) {
final TileVat boss = tco.getBoss(-1);
if (boss == null) {
return false;
}
Tessellator.instance.setColorOpaque_F(1.0f, 1.0f, 1.0f);
Tessellator.instance.setBrightness(150);
tess.setColorOpaque_F(1.0f, 1.0f, 1.0f);
tess.setBrightness(150);
renderer.enableAO = false;
final int dx = boss.xCoord - tco.xCoord;
final int dy = boss.yCoord - tco.yCoord;
@@ -303,7 +304,7 @@ public class BlockVatSolidRender implements ISimpleBlockRenderingHandler {
}
}
} else if (world.getBlockMetadata(x, y, z) == 7) {
Tessellator.instance.setColorOpaque_F(1.0f, 1.0f, 1.0f);
tess.setColorOpaque_F(1.0f, 1.0f, 1.0f);
renderer.enableAO = false;
renderer.renderFaceYPos(block, x, y, z, ((BlockVatSolid) ThaumicHorizons.blockVatSolid).iconLidCenterTop);
renderer.renderFaceYNeg(block, x, y, z, ((BlockVatSolid) ThaumicHorizons.blockVatSolid).iconInnerCenter);
@@ -29,6 +29,7 @@ import com.kentington.thaumichorizons.common.tiles.TileSoulExtractor;
import com.kentington.thaumichorizons.common.tiles.TileSoulforge;
import com.kentington.thaumichorizons.common.tiles.TileVat;
import com.kentington.thaumichorizons.common.tiles.TileVisDynamo;
import com.kentington.thaumichorizons.common.tiles.TileVortex;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.IGuiHandler;
@@ -134,4 +135,8 @@ public class CommonProxy implements IGuiHandler {
public void lightningBolt(final World worldObj, final double x, final double y, final double z,
final int boltLength) {}
public void playVortexSound(TileVortex tile) {}
public void stopVortexSound(TileVortex tile) {}
}
@@ -31,7 +31,7 @@ public class EntityAIHurtByTargetTH extends EntityAITargetTH {
this.field_142052_b = this.taskOwner.func_142015_aE();
if (this.entityCallsForHelp) {
final double d0 = this.getTargetDistance();
final List<EntityLiving> list = this.taskOwner.worldObj.getEntitiesWithinAABB(
final List<? extends EntityLiving> list = this.taskOwner.worldObj.getEntitiesWithinAABB(
this.taskOwner.getClass(),
AxisAlignedBB.getBoundingBox(
this.taskOwner.posX,
@@ -96,9 +96,9 @@ public class ItemFocusDisintegration extends ItemFocusBasic {
if (!wand.consumeAllVis(stack, p, this.getVisCost(stack), false, true)) {
p.stopUsingItem();
} else {
String pp = "R" + p.getCommandSenderName();
String pp = "SP|" + p.getCommandSenderName();
if (!p.worldObj.isRemote) {
pp = "S" + p.getCommandSenderName();
pp = "MP|" + p.getCommandSenderName();
}
ItemFocusDisintegration.soundDelay.putIfAbsent(pp, 0L);
ItemFocusDisintegration.breakcount.putIfAbsent(pp, 0.0f);
@@ -89,57 +89,72 @@ public class ItemFocusLiquefaction extends ItemFocusBasic {
}
@Override
public void onUsingFocusTick(final ItemStack stack, final EntityPlayer p, final int count) {
public void onUsingFocusTick(final ItemStack stack, final EntityPlayer player, final int count) {
final ItemWandCasting wand = (ItemWandCasting) stack.getItem();
final int size = 2 + wand.getFocusEnlarge(stack) * 8;
if (!wand.consumeAllVis(stack, p, this.getVisCost(stack), false, true)) {
p.stopUsingItem();
if (!wand.consumeAllVis(stack, player, this.getVisCost(stack), false, true)) {
player.stopUsingItem();
} else {
String pp = "R" + p.getCommandSenderName();
if (!p.worldObj.isRemote) {
pp = "S" + p.getCommandSenderName();
String playerProfile = "SP|" + player.getCommandSenderName();
if (!player.worldObj.isRemote) {
playerProfile = "MP|" + player.getCommandSenderName();
}
ItemFocusLiquefaction.soundDelay.putIfAbsent(pp, 0L);
ItemFocusLiquefaction.breakcount.putIfAbsent(pp, 0.0f);
ItemFocusLiquefaction.lastX.putIfAbsent(pp, 0);
ItemFocusLiquefaction.lastY.putIfAbsent(pp, 0);
ItemFocusLiquefaction.lastZ.putIfAbsent(pp, 0);
final MovingObjectPosition mop = BlockUtils.getTargetBlock(p.worldObj, p, true);
final Entity ent = getPointedEntity(p.worldObj, p, 10.0);
final Vec3 v = p.getLookVec();
double tx = p.posX + v.xCoord * 10.0;
double ty = p.posY + v.yCoord * 10.0;
double tz = p.posZ + v.zCoord * 10.0;
ItemFocusLiquefaction.soundDelay.putIfAbsent(playerProfile, 0L);
ItemFocusLiquefaction.breakcount.putIfAbsent(playerProfile, 0.0f);
ItemFocusLiquefaction.lastX.putIfAbsent(playerProfile, 0);
ItemFocusLiquefaction.lastY.putIfAbsent(playerProfile, 0);
ItemFocusLiquefaction.lastZ.putIfAbsent(playerProfile, 0);
final MovingObjectPosition mop = BlockUtils.getTargetBlock(player.worldObj, player, true);
final Entity ent = getPointedEntity(player.worldObj, player, 10.0);
final Vec3 v = player.getLookVec();
double tx = player.posX + v.xCoord * 10.0;
double ty = player.posY + v.yCoord * 10.0;
double tz = player.posZ + v.zCoord * 10.0;
byte impact = 0;
if ((ent == null || (ent instanceof EntityItem
&& FurnaceRecipes.smelting().getSmeltingResult(((EntityItem) ent).getEntityItem()) == null))
&& mop != null) {
tx = mop.hitVec.xCoord;
ty = mop.hitVec.yCoord;
tz = mop.hitVec.zCoord;
impact = 5;
if (!p.worldObj.isRemote && ItemFocusLiquefaction.soundDelay.get(pp) < System.currentTimeMillis()) {
p.worldObj.playSoundEffect(tx, ty, tz, "fire.fire", 8.0f, 1.0f);
ItemFocusLiquefaction.soundDelay.put(pp, System.currentTimeMillis() + 1200L);
ItemStack droppedItem = null;
ItemStack resultItem = null;
if (ent instanceof EntityItem) {
droppedItem = ((EntityItem) ent).getEntityItem();
if (droppedItem != null && droppedItem.stackSize > 0) {
ItemStack smeltingOutput = FurnaceRecipes.smelting().getSmeltingResult(droppedItem);
if (smeltingOutput != null) {
resultItem = smeltingOutput.copy();
}
}
} else if (ent != null) {
}
if (ent instanceof EntityLiving) {
tx = ent.posX;
ty = ent.posY;
tz = ent.posZ;
impact = 5;
if (!p.worldObj.isRemote && ItemFocusLiquefaction.soundDelay.get(pp) < System.currentTimeMillis()) {
p.worldObj.playSoundEffect(tx, ty, tz, "fire.fire", 0.3f, 1.0f);
ItemFocusLiquefaction.soundDelay.put(pp, System.currentTimeMillis() + 1200L);
if (!player.worldObj.isRemote
&& ItemFocusLiquefaction.soundDelay.get(playerProfile) < System.currentTimeMillis()) {
player.worldObj.playSoundEffect(tx, ty, tz, "fire.fire", 0.3f, 1.0f);
ItemFocusLiquefaction.soundDelay.put(playerProfile, System.currentTimeMillis() + 1200L);
}
} else if (resultItem == null && mop != null) {
tx = mop.hitVec.xCoord;
ty = mop.hitVec.yCoord;
tz = mop.hitVec.zCoord;
impact = 5;
if (!player.worldObj.isRemote
&& ItemFocusLiquefaction.soundDelay.get(playerProfile) < System.currentTimeMillis()) {
player.worldObj.playSoundEffect(tx, ty, tz, "fire.fire", 8.0f, 1.0f);
ItemFocusLiquefaction.soundDelay.put(playerProfile, System.currentTimeMillis() + 1200L);
}
} else {
ItemFocusLiquefaction.soundDelay.put(pp, 0L);
ItemFocusLiquefaction.soundDelay.put(playerProfile, 0L);
}
if (p.worldObj.isRemote) {
if (player.worldObj.isRemote) {
ItemFocusLiquefaction.beam.put(
pp,
playerProfile,
Thaumcraft.proxy.beamCont(
p.worldObj,
p,
player.worldObj,
player,
tx,
ty,
tz,
@@ -147,47 +162,62 @@ public class ItemFocusLiquefaction extends ItemFocusBasic {
16729156,
false,
(impact > 0) ? ((float) size) : 0.0f,
ItemFocusLiquefaction.beam.get(pp),
ItemFocusLiquefaction.beam.get(playerProfile),
5));
}
if ((ent == null || (!(ent instanceof EntityLiving) && (!(ent instanceof EntityItem)
|| FurnaceRecipes.smelting().getSmeltingResult(((EntityItem) ent).getEntityItem()) == null)))
&& mop != null
&& mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
final Block bi = p.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ);
final int md = p.worldObj.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ);
final int meltable = this.isMeltableBlock(bi, md);
final boolean flammable = bi
.isFlammable(p.worldObj, mop.blockX, mop.blockY, mop.blockZ, ForgeDirection.UNKNOWN);
if (meltable > 0 || flammable
|| FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(bi, 1, md)) != null) {
if (ent instanceof EntityLiving) {
if (wand.consumeAllVis(stack, player, ItemFocusLiquefaction.costCritter, true, true)) {
ThaumicHorizons.proxy.smeltFX(ent.posX - 0.5, ent.posY, ent.posZ - 0.5, player.worldObj, 5, false);
ent.attackEntityFrom(DamageSource.inFire, 1.0f + 0.5f * wand.getFocusPotency(stack));
}
} else if (resultItem != null) {
final int quantity = ((EntityItem) ent).getEntityItem().stackSize;
if (wand.consumeAllVis(stack, player, this.getVisCost(stack), true, true)) {
ThaumicHorizons.proxy
.smeltFX(ent.posX - 0.5, ent.posY, ent.posZ - 0.5, player.worldObj, 5 * quantity, false);
resultItem.stackSize = quantity;
((EntityItem) ent).setEntityItemStack(resultItem);
}
} else if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
final Block block = player.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ);
final int meta = player.worldObj.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ);
final ItemStack resultBlock = FurnaceRecipes.smelting()
.getSmeltingResult(new ItemStack(block, 1, meta));
final int meltingBehaviour = this.isMeltableBlock(block, meta);
final boolean flammable = block
.isFlammable(player.worldObj, mop.blockX, mop.blockY, mop.blockZ, ForgeDirection.UNKNOWN);
if (meltingBehaviour > 0 || flammable || resultBlock != null) {
final int pot = wand.getFocusPotency(stack);
final float speed = 0.15f + pot * 0.05f;
float hardness = 2.0f;
if (meltable > 0
|| bi.isFlammable(p.worldObj, mop.blockX, mop.blockY, mop.blockZ, ForgeDirection.UP)) {
hardness = 0.25f;
}
if (meltable == 6) {
if (meltingBehaviour == 6) {
hardness = 20.0f;
}
if (ItemFocusLiquefaction.lastX.get(pp) == mop.blockX
&& ItemFocusLiquefaction.lastY.get(pp) == mop.blockY
&& ItemFocusLiquefaction.lastZ.get(pp) == mop.blockZ) {
final float bc = ItemFocusLiquefaction.breakcount.get(pp);
if (p.worldObj.isRemote && bc > 0.0f && bi != null) {
final int gt = (int) (bc / hardness * 9.0f);
ThaumicHorizons.proxy.smeltFX(mop.blockX, mop.blockY, mop.blockZ, p.worldObj, 15, size > 2);
}
if (p.worldObj.isRemote) {
if (bc >= hardness) {
p.worldObj.playAuxSFX(2001, mop.blockX, mop.blockY, mop.blockZ, 0);
ItemFocusLiquefaction.breakcount.put(pp, 0.0f);
} else {
ItemFocusLiquefaction.breakcount.put(pp, bc + speed);
} else if (meltingBehaviour > 0 || block
.isFlammable(player.worldObj, mop.blockX, mop.blockY, mop.blockZ, ForgeDirection.UP)) {
hardness = 0.25f;
}
} else if (bc >= hardness) {
this.processBlock(mop.blockX, mop.blockY, mop.blockZ, wand, stack, p, pp);
if (ItemFocusLiquefaction.lastX.get(playerProfile) == mop.blockX
&& ItemFocusLiquefaction.lastY.get(playerProfile) == mop.blockY
&& ItemFocusLiquefaction.lastZ.get(playerProfile) == mop.blockZ) {
final float breakcount = ItemFocusLiquefaction.breakcount.get(playerProfile);
if (player.worldObj.isRemote) {
if (breakcount > 0.0f) {
ThaumicHorizons.proxy
.smeltFX(mop.blockX, mop.blockY, mop.blockZ, player.worldObj, 15, size > 2);
}
if (breakcount >= hardness) {
player.worldObj.playAuxSFX(2001, mop.blockX, mop.blockY, mop.blockZ, 0);
ItemFocusLiquefaction.breakcount.put(playerProfile, 0.0f);
} else {
ItemFocusLiquefaction.breakcount.put(playerProfile, breakcount + speed);
}
} else if (breakcount >= hardness) {
this.processBlock(mop.blockX, mop.blockY, mop.blockZ, wand, stack, player, playerProfile);
if (size > 2) {
for (int x = -1; x < 2; ++x) {
for (int y = -1; y < 2; ++y) {
@@ -199,52 +229,36 @@ public class ItemFocusLiquefaction extends ItemFocusBasic {
mop.blockZ + z,
wand,
stack,
p,
pp);
player,
playerProfile);
}
}
}
}
}
} else {
ItemFocusLiquefaction.breakcount.put(pp, bc + speed);
ItemFocusLiquefaction.breakcount.put(playerProfile, breakcount + speed);
}
} else {
ItemFocusLiquefaction.lastX.put(pp, mop.blockX);
ItemFocusLiquefaction.lastY.put(pp, mop.blockY);
ItemFocusLiquefaction.lastZ.put(pp, mop.blockZ);
ItemFocusLiquefaction.breakcount.put(pp, 0.0f);
ItemFocusLiquefaction.lastX.put(playerProfile, mop.blockX);
ItemFocusLiquefaction.lastY.put(playerProfile, mop.blockY);
ItemFocusLiquefaction.lastZ.put(playerProfile, mop.blockZ);
ItemFocusLiquefaction.breakcount.put(playerProfile, 0.0f);
}
}
} else if (ent instanceof EntityLiving
&& wand.consumeAllVis(stack, p, ItemFocusLiquefaction.costCritter, true, true)) {
ThaumicHorizons.proxy.smeltFX(ent.posX - 0.5, ent.posY, ent.posZ - 0.5, p.worldObj, 5, false);
ent.attackEntityFrom(DamageSource.inFire, 1.0f + 0.5f * wand.getFocusPotency(stack));
} else
if (ent instanceof EntityItem
&& FurnaceRecipes.smelting().getSmeltingResult(((EntityItem) ent).getEntityItem()) != null) {
final int num = ((EntityItem) ent).getEntityItem().stackSize;
if (wand.consumeAllVis(stack, p, this.getVisCost(stack), true, true)) {
ThaumicHorizons.proxy
.smeltFX(ent.posX - 0.5, ent.posY, ent.posZ - 0.5, p.worldObj, 5 * num, false);
final ItemStack stacky = FurnaceRecipes.smelting()
.getSmeltingResult(((EntityItem) ent).getEntityItem());
stacky.stackSize = num;
((EntityItem) ent).setEntityItemStack(stacky);
}
} else {
ItemFocusLiquefaction.lastX.put(pp, Integer.MAX_VALUE);
ItemFocusLiquefaction.lastY.put(pp, Integer.MAX_VALUE);
ItemFocusLiquefaction.lastZ.put(pp, Integer.MAX_VALUE);
ItemFocusLiquefaction.breakcount.put(pp, 0.0f);
}
} else {
ItemFocusLiquefaction.lastX.put(playerProfile, Integer.MAX_VALUE);
ItemFocusLiquefaction.lastY.put(playerProfile, Integer.MAX_VALUE);
ItemFocusLiquefaction.lastZ.put(playerProfile, Integer.MAX_VALUE);
ItemFocusLiquefaction.breakcount.put(playerProfile, 0.0f);
}
}
}
public void onPlayerStoppedUsing(final ItemStack stack, final World world, final EntityPlayer p, final int count) {
String pp = "R" + p.getCommandSenderName();
String pp = "SP|" + p.getCommandSenderName();
if (!p.worldObj.isRemote) {
pp = "S" + p.getCommandSenderName();
pp = "MP|" + p.getCommandSenderName();
}
ItemFocusLiquefaction.soundDelay.putIfAbsent(pp, 0L);
ItemFocusLiquefaction.breakcount.putIfAbsent(pp, 0.0f);
@@ -36,14 +36,20 @@ public class ItemLensFire extends Item implements ILens {
public void handleRender(final Minecraft mc, final float partialTicks) {
final boolean inWater = mc.thePlayer.isInsideOfMaterial(Material.water);
if (!inWater
&& (mc.thePlayer.getActivePotionEffect(Potion.nightVision) == null
|| mc.thePlayer.getActivePotionEffect(Potion.nightVision).getDuration() < 242)
&& Minecraft.getSystemTime() > LensManager.nightVisionOffTime) {
LensManager.nightVisionOffTime = Minecraft.getSystemTime();
mc.thePlayer.addPotionEffect(new PotionEffect(Potion.nightVision.id, 255, 0, true));
} else if (inWater) {
mc.thePlayer.removePotionEffect(Potion.nightVision.id);
final PotionEffect effect = mc.thePlayer.getActivePotionEffect(Potion.nightVision);
if (!inWater) {
// Apply effect.
if ((effect == null || (isEffectGrantedByLens(effect) && effect.getDuration() < 242))
&& Minecraft.getSystemTime() > LensManager.nightVisionOffTime) {
LensManager.nightVisionOffTime = Minecraft.getSystemTime();
mc.thePlayer.addPotionEffect(new IlluminePotionEffect(Potion.nightVision.id, 255, -1, true));
}
} else {
// Remove effect.
if (isEffectGrantedByLens(effect)) {
mc.thePlayer.removePotionEffect(Potion.nightVision.id);
}
}
}
@@ -62,7 +68,30 @@ public class ItemLensFire extends Item implements ILens {
}
public void handleRemoval(final EntityPlayer p) {
p.removePotionEffect(Potion.nightVision.id);
PacketHandler.INSTANCE.sendTo(new PacketRemoveNightvision(), (EntityPlayerMP) p);
if (isEffectGrantedByLens(p.getActivePotionEffect(Potion.nightVision))) {
p.removePotionEffect(Potion.nightVision.id);
PacketHandler.INSTANCE.sendTo(new PacketRemoveNightvision(), (EntityPlayerMP) p);
}
}
public static boolean isEffectGrantedByLens(PotionEffect effect) {
return effect instanceof IlluminePotionEffect illumineEffect && illumineEffect.isGrantedByLens;
}
private static class IlluminePotionEffect extends PotionEffect {
public boolean isGrantedByLens;
public IlluminePotionEffect(int potionID, int duration, int amplifier, boolean isAmbient) {
super(potionID, duration, amplifier, isAmbient);
isGrantedByLens = true;
}
public void combine(PotionEffect effect) {
// If this is replaced by another night vision effect, for example from drinking a potion, it should not be
// turned off by the lens.
super.combine(effect);
isGrantedByLens = effect instanceof IlluminePotionEffect;
}
}
}
@@ -5,7 +5,6 @@
package com.kentington.thaumichorizons.common.lib;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@@ -25,7 +24,6 @@ import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
@@ -69,7 +67,8 @@ import com.kentington.thaumichorizons.common.lib.networking.PacketPlayerInfusion
import com.kentington.thaumichorizons.common.tiles.TileSoulBeacon;
import com.kentington.thaumichorizons.common.tiles.TileVat;
import baubles.api.BaublesApi;
import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
@@ -82,6 +81,7 @@ import thaumcraft.common.config.ConfigBlocks;
import thaumcraft.common.config.ConfigItems;
import thaumcraft.common.entities.EntityAspectOrb;
import thaumcraft.common.entities.EntityFollowingItem;
import thaumcraft.common.entities.EntityPermanentItem;
import thaumcraft.common.items.relics.ItemHandMirror;
import thaumcraft.common.lib.network.fx.PacketFXShield;
import thaumcraft.common.lib.utils.EntityUtils;
@@ -678,6 +678,7 @@ public class EventHandlerEntity {
}
if (!event.entity.worldObj.isRemote && event.entity instanceof final EntityPlayer player
&& event.entityLiving.getHealth() - event.ammount <= 0.0f) {
// Clear player infusions
if (prop.tumorWarpPermanent > 0 || prop.tumorWarp > 0 || prop.tumorWarpTemp > 0) {
Thaumcraft.proxy.getPlayerKnowledge()
.addWarpPerm(event.entity.getCommandSenderName(), prop.tumorWarpPermanent);
@@ -687,150 +688,136 @@ public class EventHandlerEntity {
.addWarpTemp(event.entity.getCommandSenderName(), prop.tumorWarpTemp);
}
prop.resetPlayerInfusions();
final IInventory baubles = BaublesApi.getBaubles(player);
for (int a = 0; a < 4; ++a) {
final ItemStack amulet = baubles.getStackInSlot(a);
if (amulet != null) {
if (amulet.getItem() instanceof ItemAmuletMirror) {
boolean transportedSomething = false;
for (int i = 0; i < player.inventory.armorInventory.length; ++i) {
final ItemStack item = player.inventory.armorInventory[i];
if (item != null && ItemHandMirror.transport(amulet, item, player, player.worldObj)) {
transportedSomething = true;
player.inventory.armorInventory[i] = null;
}
}
for (int i = 0; i < player.inventory.mainInventory.length; ++i) {
final ItemStack item = player.inventory.mainInventory[i];
if (item != null && ItemHandMirror.transport(amulet, item, player, player.worldObj)) {
transportedSomething = true;
player.inventory.mainInventory[i] = null;
}
}
for (int b = 0; b < 4; ++b) {
if (a != b && baubles.getStackInSlot(b) != null
&& ItemHandMirror
.transport(amulet, baubles.getStackInSlot(b), player, player.worldObj)) {
transportedSomething = true;
baubles.setInventorySlotContents(b, null);
}
}
if (transportedSomething) {
PacketHandler.INSTANCE.sendToAllAround(
new PacketFXContainment(
player.posX,
player.posY + player.getEyeHeight(),
player.posZ),
new NetworkRegistry.TargetPoint(
player.worldObj.provider.dimensionId,
player.posX,
player.posY,
player.posZ,
32.0));
player.worldObj.playSoundEffect(
// Mirrored Amulet returning items
ItemStack amulet = null;
for (ItemStack bauble : PlayerHandler.getPlayerBaubles(player).stackList) {
if (bauble != null && bauble.getItem() instanceof ItemAmuletMirror) {
amulet = bauble;
break;
}
}
if (amulet != null) {
boolean transportedSomething = false;
for (int i = 0; i < player.inventory.armorInventory.length; ++i) {
final ItemStack item = player.inventory.armorInventory[i];
if (item != null && ItemHandMirror.transport(amulet, item, player, player.worldObj)) {
transportedSomething = true;
player.inventory.armorInventory[i] = null;
}
}
for (int i = 0; i < player.inventory.mainInventory.length; ++i) {
final ItemStack item = player.inventory.mainInventory[i];
if (item != null && ItemHandMirror.transport(amulet, item, player, player.worldObj)) {
transportedSomething = true;
player.inventory.mainInventory[i] = null;
}
}
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
int amuletIndex = 0;
for (int i = 0; i < baubles.stackList.length; ++i) {
final ItemStack item = baubles.stackList[i];
if (item == amulet) {
amuletIndex = i;
} else if (item != null && ItemHandMirror.transport(amulet, item, player, player.worldObj)) {
transportedSomething = true;
baubles.stackList[i] = null;
}
}
PlayerHandler.setPlayerBaubles(player, baubles);
if (transportedSomething) {
baubles.stackList[amuletIndex] = null;
PlayerHandler.setPlayerBaubles(player, baubles);
PacketHandler.INSTANCE.sendToAllAround(
new PacketFXContainment(
player.posX,
player.posY + player.getEyeHeight(),
player.posZ,
"thaumcraft:craftfail",
1.0f,
1.0f);
baubles.setInventorySlotContents(a, null);
player.inventory.markDirty();
baubles.markDirty();
final ItemStack droppedPearl = new ItemStack(ConfigItems.itemEldritchObject, 1, 3);
final EntityItem drop = new EntityItem(
player.worldObj,
player.posZ),
new NetworkRegistry.TargetPoint(
player.worldObj.provider.dimensionId,
player.posX,
player.posY,
player.posZ,
droppedPearl);
player.worldObj.spawnEntityInWorld(drop);
break;
}
break;
}
32.0));
player.worldObj.playSoundEffect(
player.posX,
player.posY + player.getEyeHeight(),
player.posZ,
"thaumcraft:craftfail",
1.0f,
1.0f);
player.inventory.markDirty();
final ItemStack droppedPearl = new ItemStack(ConfigItems.itemEldritchObject, 1, 3);
final EntityPermanentItem drop = new EntityPermanentItem(
player.worldObj,
player.posX,
player.posY,
player.posZ,
droppedPearl);
player.worldObj.spawnEntityInWorld(drop);
}
}
}
if (!event.entity.worldObj.isRemote && event.entityLiving instanceof EntityPlayer
&& event.entityLiving.getHealth() - event.ammount <= 0.0f
&& event.entityLiving.getEntityData().getBoolean("soulBeacon")) {
final EntityPlayer player = (EntityPlayer) event.entity;
final int dim = player.getEntityData().getInteger("soulBeaconDim");
final World world = MinecraftServer.getServer().worldServerForDimension(dim);
final int x = player.getEntityData().getIntArray("soulBeaconCoords")[0];
final int y = player.getEntityData().getIntArray("soulBeaconCoords")[1];
final int z = player.getEntityData().getIntArray("soulBeaconCoords")[2];
if (world.getTileEntity(x, y, z) instanceof TileSoulBeacon
&& world.getTileEntity(x, y - 1, z) instanceof TileVat
&& ((TileVat) world.getTileEntity(x, y - 1, z)).mode == 4) {
event.setCanceled(true);
if (!world.isRemote) {
world.createExplosion(
// Return to Soul Beacon before death
if (player.getEntityData().getBoolean("soulBeacon")) {
final int dim = player.getEntityData().getInteger("soulBeaconDim");
final World beaconWorld = MinecraftServer.getServer().worldServerForDimension(dim);
final World playerWorld = player.worldObj;
final int x = player.getEntityData().getIntArray("soulBeaconCoords")[0];
final int y = player.getEntityData().getIntArray("soulBeaconCoords")[1];
final int z = player.getEntityData().getIntArray("soulBeaconCoords")[2];
if (beaconWorld.getTileEntity(x, y, z) instanceof TileSoulBeacon
&& beaconWorld.getTileEntity(x, y - 1, z) instanceof TileVat vat
&& vat.mode == 4) {
event.setCanceled(true);
event.ammount = 0.0f;
playerWorld.createExplosion(
null,
player.posX,
player.posY + player.getEyeHeight(),
player.posZ,
0.0f,
false);
for (int a2 = 0; a2 < 25; ++a2) {
final int xx = (int) player.posX + world.rand.nextInt(8) - world.rand.nextInt(8);
final int yy = (int) player.posY + world.rand.nextInt(8) - world.rand.nextInt(8);
final int zz = (int) player.posZ + world.rand.nextInt(8) - world.rand.nextInt(8);
if (world.isAirBlock(xx, yy, zz)) {
for (int i = 0; i < 25; ++i) {
final int xx = (int) player.posX + playerWorld.rand.nextInt(8) - playerWorld.rand.nextInt(8);
final int yy = (int) player.posY + playerWorld.rand.nextInt(8) - playerWorld.rand.nextInt(8);
final int zz = (int) player.posZ + playerWorld.rand.nextInt(8) - playerWorld.rand.nextInt(8);
if (playerWorld.isAirBlock(xx, yy, zz)) {
if (yy <= (int) player.posY + 1) {
world.setBlock(xx, yy, zz, ConfigBlocks.blockFluxGoo, 8, 3);
playerWorld.setBlock(xx, yy, zz, ConfigBlocks.blockFluxGoo, 8, 3);
} else {
world.setBlock(xx, yy, zz, ConfigBlocks.blockFluxGas, 8, 3);
playerWorld.setBlock(xx, yy, zz, ConfigBlocks.blockFluxGas, 8, 3);
}
}
}
}
player.inventory.dropAllItems();
final IInventory baubles2 = BaublesApi.getBaubles(player);
for (int j = 0; j < 4; ++j) {
if (baubles2.getStackInSlot(j) != null) {
final EntityItem bauble = new EntityItem(
world,
player.posX,
player.posY,
player.posZ,
baubles2.getStackInSlot(j));
world.spawnEntityInWorld(bauble);
baubles2.setInventorySlotContents(j, null);
player.inventory.dropAllItems();
for (ItemStack bauble : PlayerHandler.getPlayerBaubles(player).stackList) {
if (bauble == null) {
continue;
}
player.func_146097_a(bauble, true, false);
}
PlayerHandler.clearPlayerBaubles(player);
player.inventory.markDirty();
PacketHandler.INSTANCE.sendTo(new PacketNoMoreItems(), (EntityPlayerMP) player);
player.curePotionEffects(new ItemStack(Items.milk_bucket));
player.heal(Float.MAX_VALUE);
if (dim != player.worldObj.provider.dimensionId) {
player.travelToDimension(dim);
}
player.setPositionAndUpdate(x + 0.5, y - 2.5, z + 0.5);
Thaumcraft.proxy.blockSparkle(beaconWorld, x, y - 2, z, 16777215, 20);
Thaumcraft.proxy.blockSparkle(beaconWorld, x, y - 3, z, 16777215, 20);
beaconWorld.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "thaumcraft:whispers", 1.0f, beaconWorld.rand.nextFloat());
this.applyPlayerInfusions(player, vat);
vat.selfInfusions = new int[12];
vat.mode = 0;
vat.setEntityContained(player);
beaconWorld.getTileEntity(x, y - 1, z).markDirty();
player.worldObj.markBlockForUpdate(x, y - 1, z);
}
baubles2.markDirty();
player.inventory.markDirty();
PacketHandler.INSTANCE.sendTo(new PacketNoMoreItems(), (EntityPlayerMP) player);
player.curePotionEffects(new ItemStack(Items.milk_bucket));
player.heal(999.0f);
if (dim != player.worldObj.provider.dimensionId) {
player.travelToDimension(dim);
}
player.setPositionAndUpdate(x + 0.5, y - 2.5, z + 0.5);
Thaumcraft.proxy.blockSparkle(world, x, y - 2, z, 16777215, 20);
Thaumcraft.proxy.blockSparkle(world, x, y - 3, z, 16777215, 20);
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "thaumcraft:whispers", 1.0f, world.rand.nextFloat());
this.applyPlayerInfusions(player, (TileVat) world.getTileEntity(x, y - 1, z));
((TileVat) world.getTileEntity(x, y - 1, z)).selfInfusions = new int[12];
((TileVat) world.getTileEntity(x, y - 1, z)).mode = 0;
((TileVat) world.getTileEntity(x, y - 1, z)).setEntityContained(player);
world.getTileEntity(x, y - 1, z).markDirty();
player.worldObj.markBlockForUpdate(x, y - 1, z);
}
} else if (event.entity.worldObj.isRemote && event.entityLiving instanceof EntityPlayer
&& event.entityLiving.getHealth() - event.ammount <= 0.0f
&& event.entityLiving.getEntityData().getBoolean("soulBeacon")) {
final EntityPlayer player = (EntityPlayer) event.entity;
Arrays.fill(player.inventory.mainInventory, null);
Arrays.fill(player.inventory.armorInventory, null);
final IInventory baubles3 = BaublesApi.getBaubles(player);
baubles3.setInventorySlotContents(0, null);
baubles3.setInventorySlotContents(1, null);
baubles3.setInventorySlotContents(2, null);
baubles3.setInventorySlotContents(3, null);
}
}
}
void applyPlayerInfusions(final EntityPlayer player, final TileVat tile) {
@@ -5,9 +5,9 @@
package com.kentington.thaumichorizons.common.lib.networking;
import net.minecraft.client.Minecraft;
import net.minecraft.inventory.IInventory;
import net.minecraft.client.entity.EntityClientPlayerMP;
import baubles.api.BaublesApi;
import baubles.common.lib.PlayerHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
@@ -19,12 +19,9 @@ public class PacketNoMoreItems implements IMessage, IMessageHandler<PacketNoMore
@SideOnly(Side.CLIENT)
public IMessage onMessage(final PacketNoMoreItems message, final MessageContext ctx) {
Minecraft.getMinecraft().thePlayer.inventory.clearInventory(null, -1);
final IInventory baubles = BaublesApi.getBaubles(Minecraft.getMinecraft().thePlayer);
baubles.setInventorySlotContents(0, null);
baubles.setInventorySlotContents(1, null);
baubles.setInventorySlotContents(2, null);
baubles.setInventorySlotContents(3, null);
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
player.inventory.clearInventory(null, -1);
PlayerHandler.clearPlayerBaubles(player);
return null;
}
@@ -231,7 +231,7 @@ public class TileTransductionAmplifier extends TileThaumcraft {
}
}
if (transducers > 1 && this.count % 50 == 0) {
final List<Entity> targets = (List<Entity>) this.worldObj.getEntitiesWithinAABB(
final List<EntityLivingBase> targets = this.worldObj.getEntitiesWithinAABB(
EntityLivingBase.class,
AxisAlignedBB.getBoundingBox(
this.xCoord,
@@ -240,7 +240,7 @@ public class TileTransductionAmplifier extends TileThaumcraft {
this.xCoord + 1,
this.yCoord + 1,
this.zCoord + 1).expand(10.0, 10.0, 10.0));
if (targets != null && targets.size() > 0) {
if (targets != null && !targets.isEmpty()) {
for (final Entity target : targets) {
PacketHandler.INSTANCE.sendToAllAround(
new PacketFXBlockZap(
@@ -1048,7 +1048,7 @@ public class TileVat extends TileThaumcraft implements IAspectContainer, IEssent
}
private void inEvZap(final boolean all) {
final List<Entity> targets = (List<Entity>) this.worldObj.getEntitiesWithinAABB(
final List<EntityLivingBase> targets = this.worldObj.getEntitiesWithinAABB(
EntityLivingBase.class,
AxisAlignedBB.getBoundingBox(
this.xCoord,
@@ -1057,7 +1057,7 @@ public class TileVat extends TileThaumcraft implements IAspectContainer, IEssent
this.xCoord + 1,
this.yCoord + 1,
this.zCoord + 1).expand(10.0, 10.0, 10.0));
if (targets != null && targets.size() > 0) {
if (targets != null && !targets.isEmpty()) {
for (final Entity target : targets) {
thaumcraft.common.lib.network.PacketHandler.INSTANCE.sendToAllAround(
new PacketFXBlockZap(
@@ -62,6 +62,7 @@ public class TileVortex extends TileThaumcraft implements IWandable, IAspectCont
public boolean cheat;
public ArrayList<ItemStack> items;
Thread ppThread;
private boolean soundStarted = false;
public TileVortex() {
this.aspects = new AspectList();
@@ -77,6 +78,11 @@ public class TileVortex extends TileThaumcraft implements IWandable, IAspectCont
public void updateEntity() {
super.updateEntity();
if (this.worldObj != null && this.worldObj.isRemote && !soundStarted) {
ThaumicHorizons.proxy.playVortexSound(this);
soundStarted = true;
}
if (this.generating) {
this.worldObj.createExplosion(
null,
@@ -572,4 +578,23 @@ public class TileVortex extends TileThaumcraft implements IWandable, IAspectCont
public int containerContains(final Aspect tag) {
return 0;
}
@Override
public void invalidate() {
super.invalidate();
stopSound();
}
@Override
public void onChunkUnload() {
super.onChunkUnload();
stopSound();
}
private void stopSound() {
if (this.worldObj != null && this.worldObj.isRemote) {
ThaumicHorizons.proxy.stopVortexSound(this);
}
soundStarted = false;
}
}
@@ -0,0 +1,15 @@
{
"vortex": {
"category": "ambient",
"sounds": [
{ "name": "thaumichorizons:vortex", "stream": true }
]
}
}