Compare commits

...
15 Commits
Author SHA1 Message Date
Martin Robertz 30a5a634e5 Merge remote-tracking branch 'Aerindor-of-Arcane/PotionConfigs' into dev 2025-10-16 10:49:07 +02:00
Martin Robertz a858d3756d Merge remote-tracking branch 'origin/dispenser' into dev 2025-10-16 10:48:56 +02:00
Martin Robertz ce27ffd52d update 2025-10-16 10:48:22 +02:00
551cdf4a93 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-12 23:36:36 +02:00
Aerindor of Arcane dac1733935 Fix: Changed default values
Changed default values to previous values.
2025-10-12 01:01:12 -04:00
Aerindor of Arcane 5c1dc0ba68 Feat: Added All Potions configs 2025-10-12 00:48:20 -04:00
Aerindor of Arcane a7f1ae0c6f Fix: Updated initPotions..
Oops.. Now reads the config changes.. Uses the NextPotionID if config not valid.
2025-10-12 00:21:00 -04:00
Aerindor of Arcane d7db8c7849 Feat: config for VisBoost Potion
Added a config for VisBoost Potion, changed initPotions to preinit in eventhandler
2025-10-11 23:48:29 -04:00
Martin Robertz 5a14114583 update 2025-10-02 01:51:49 +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
koolkrafter5 543482942a Allow Alchemite, Blast Phials, Injections, Incubated Eggs, and Greatwood/Thaumium boats to be shot by dispensers. 2025-08-15 08:51:13 -04: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
23 changed files with 598 additions and 217 deletions

No files matched your search

+2 -2
View File
@@ -1,9 +1,9 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:Baubles-Expanded:2.1.7-GTNH:dev')
api('com.github.GTNewHorizons:Baubles-Expanded:2.2.0-GTNH:dev')
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.285:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.52.45:dev') {transitive = false}
}
+2 -2
View File
@@ -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.
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.38'
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;
}
}
@@ -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) {}
}
@@ -8,16 +8,24 @@ package com.kentington.thaumichorizons.common;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
import net.minecraft.dispenser.BehaviorProjectileDispense;
import net.minecraft.dispenser.IBlockSource;
import net.minecraft.dispenser.IPosition;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntityGhast;
@@ -44,7 +52,9 @@ import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.nbt.NBTTagByte;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
@@ -57,6 +67,7 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.google.common.collect.Sets;
import com.kentington.thaumichorizons.client.lib.RenderEventHandler;
import com.kentington.thaumichorizons.common.blocks.BlockAlchemite;
import com.kentington.thaumichorizons.common.blocks.BlockBloodInfuser;
@@ -132,6 +143,7 @@ import com.kentington.thaumichorizons.common.entities.EntitySyringe;
import com.kentington.thaumichorizons.common.entities.EntityTaintPig;
import com.kentington.thaumichorizons.common.entities.EntityVoltSlime;
import com.kentington.thaumichorizons.common.entities.ItemSpawnerEgg;
import com.kentington.thaumichorizons.common.handlers.BehaviorDispenseBoat;
import com.kentington.thaumichorizons.common.items.ItemAmuletMirror;
import com.kentington.thaumichorizons.common.items.ItemBarChocolate;
import com.kentington.thaumichorizons.common.items.ItemBoatGreatwood;
@@ -473,7 +485,7 @@ public class ThaumicHorizons {
} catch (Exception var8) {
log.error("Thaumic Horizons could not load its configuration file");
} finally {
if (config != null) {
if (config != null && config.hasChanged()) {
config.save();
}
}
@@ -752,6 +764,7 @@ public class ThaumicHorizons {
proxy.registerHandlers();
proxy.registerRenderers();
FMLCommonHandler.instance().bus().register(instance);
initPotions();
}
@EventHandler
@@ -796,7 +809,6 @@ public class ThaumicHorizons {
shapelessOreDictRecipe(
new ItemStack(ConfigItems.itemTripleMeatTreat),
new Object[] { Items.sugar, itemMeatNugget, ConfigItems.itemNuggetBeef, ConfigItems.itemNuggetFish });
initPotions();
ResearchCategories.registerCategory(
"ThaumicHorizons",
new ResourceLocation("thaumichorizons", "textures/misc/vat.png"),
@@ -3631,6 +3643,7 @@ public class ThaumicHorizons {
new ItemStack(Items.dye, 1, 0), new ItemStack(Items.dye, 1, 15) },
10));
addAspectsToAllTheThings();
registerDispenserBehavior();
}
public static CreatureInfusionRecipe getCreatureInfusion(EntityLivingBase entityContained,
@@ -3667,7 +3680,6 @@ public class ThaumicHorizons {
public static void initPotions() {
byte customPotions = 5;
int potionOffset = Potion.potionTypes.length;
boolean start = false;
int var4;
if (potionOffset < 128 - customPotions) {
Potion[] potionTypes = new Potion[potionOffset + customPotions];
@@ -3679,40 +3691,54 @@ public class ThaumicHorizons {
var4 = -1;
}
int visBoostPotionId = potionVisBoostID;
var4 = getNextPotionId(var4);
if (var4 >= 0) {
potionVisBoostID = var4;
PotionVisBoost.instance = new PotionVisBoost(potionVisBoostID, true, 6697847);
PotionVisBoost.init();
if (Potion.potionTypes[visBoostPotionId] != null) {
visBoostPotionId = getNextPotionId(visBoostPotionId);
}
potionVisBoostID = visBoostPotionId;
PotionVisBoost.instance = new PotionVisBoost(potionVisBoostID, true, 6697847);
PotionVisBoost.init();
int visRegenPotionId = potionVisRegenID;
var4 = getNextPotionId(var4);
if (Potion.potionTypes[visRegenPotionId] != null) {
visRegenPotionId = getNextPotionId(visRegenPotionId);
}
var4 = getNextPotionId(var4);
if (var4 >= 0) {
potionVisRegenID = var4;
PotionVisRegen.instance = new PotionVisRegen(potionVisRegenID, true, 5701759);
PotionVisRegen.init();
potionVisRegenID = visRegenPotionId;
PotionVisRegen.instance = new PotionVisRegen(potionVisRegenID, true, 5701759);
PotionVisRegen.init();
int vacuumPotionId = potionVacuumID;
if (Potion.potionTypes[vacuumPotionId] != null) {
vacuumPotionId = getNextPotionId(vacuumPotionId);
}
var4 = getNextPotionId(var4);
if (var4 >= 0) {
potionVacuumID = var4;
PotionVacuum.instance = new PotionVacuum(potionVacuumID, true, 4210752);
PotionVacuum.init();
potionVacuumID = vacuumPotionId;
PotionVacuum.instance = new PotionVacuum(potionVacuumID, true, 4210752);
PotionVacuum.init();
int shockPotionId = potionShockID;
if (Potion.potionTypes[shockPotionId] != null) {
shockPotionId = getNextPotionId(shockPotionId);
}
var4 = getNextPotionId(var4);
if (var4 >= 0) {
potionShockID = var4;
PotionShock.instance = new PotionShock(potionShockID, true, 11513861);
PotionShock.init();
potionShockID = shockPotionId;
PotionShock.instance = new PotionShock(potionShockID, true, 11513861);
PotionShock.init();
int synthesisPotionId = potionSynthesisID;
if (Potion.potionTypes[synthesisPotionId] != null) {
synthesisPotionId = getNextPotionId(synthesisPotionId);
}
var4 = getNextPotionId(var4);
if (var4 >= 0) {
potionSynthesisID = var4;
PotionSynthesis.instance = new PotionSynthesis(potionSynthesisID, false, 3253280);
PotionSynthesis.init();
}
potionSynthesisID = synthesisPotionId;
PotionSynthesis.instance = new PotionSynthesis(potionSynthesisID, false, 3253280);
PotionSynthesis.init();
}
static int getNextPotionId(int start) {
@@ -3889,6 +3915,96 @@ public class ThaumicHorizons {
(new AspectList()).add(Aspect.WEAPON, 3).add(Aspect.BEAST, 3));
}
private static void registerDispenserBehavior() {
BlockDispenser.dispenseBehaviorRegistry
.putObject(Item.getItemFromBlock(blockAlchemite), new BehaviorDefaultDispenseItem() {
@Override
protected ItemStack dispenseStack(IBlockSource dispenser, ItemStack dispensedItem) {
EnumFacing enumfacing = BlockDispenser.func_149937_b(dispenser.getBlockMetadata());
World world = dispenser.getWorld();
int x = dispenser.getXInt() + enumfacing.getFrontOffsetX();
int y = dispenser.getYInt() + enumfacing.getFrontOffsetY();
int z = dispenser.getZInt() + enumfacing.getFrontOffsetZ();
EntityAlchemitePrimed primedAlchemite = new EntityAlchemitePrimed(
world,
x + 0.5F,
y + 0.5F,
z + 0.5F,
null);
world.spawnEntityInWorld(primedAlchemite);
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "game.tnt.primed", 1.0F, 1.0F);
dispensedItem.stackSize--;
return dispensedItem;
}
});
BlockDispenser.dispenseBehaviorRegistry.putObject(itemSyringeInjection, new BehaviorDefaultDispenseItem() {
@Override
public ItemStack dispenseStack(IBlockSource dispenser, ItemStack stack) {
if (!(stack.getItem() instanceof ItemSyringeInjection)) {
return super.dispenseStack(dispenser, stack);
}
World world = dispenser.getWorld();
EnumFacing facing = BlockDispenser.func_149937_b(dispenser.getBlockMetadata());
double spawnX = dispenser.getX() + facing.getFrontOffsetX();
double spawnY = dispenser.getY() + facing.getFrontOffsetY();
double spawnZ = dispenser.getZ() + facing.getFrontOffsetZ();
IProjectile projectile = createProjectile(
(ItemSyringeInjection) stack.getItem(),
stack,
world,
spawnX,
spawnY,
spawnZ);
projectile.setThrowableHeading(
facing.getFrontOffsetX(),
facing.getFrontOffsetY() + 0.1F,
facing.getFrontOffsetZ(),
1.1F, // velocity
6F // inaccuracy
);
world.spawnEntityInWorld((Entity) projectile);
stack.stackSize--;
return stack;
}
private IProjectile createProjectile(ItemSyringeInjection item, ItemStack stack, World world, double x,
double y, double z) {
if (item.isPhial(stack.getItemDamage())) {
return new EntityBlastPhial(world, x, y, z, stack);
} else {
return new EntitySyringe(world, x, y, z, stack.stackTagCompound);
}
}
@Override
protected void playDispenseSound(IBlockSource source) {
source.getWorld().playAuxSFX(1002, source.getXInt(), source.getYInt(), source.getZInt(), 0);
}
});
BlockDispenser.dispenseBehaviorRegistry.putObject(itemEggIncubated, new BehaviorProjectileDispense() {
protected IProjectile getProjectileEntity(World worldIn, IPosition position) {
return new EntityEggIncubated(worldIn, position.getX(), position.getY(), position.getZ());
}
});
BlockDispenser.dispenseBehaviorRegistry.putObject(
itemBoatGreatwood,
new BehaviorDispenseBoat(Collections.singleton(Material.water), EntityBoatGreatwood::new));
BlockDispenser.dispenseBehaviorRegistry.putObject(
itemBoatThaumium,
new BehaviorDispenseBoat(Sets.newHashSet(Material.water, Material.lava), EntityBoatThaumium::new));
}
static IRecipe shapelessOreDictRecipe(ItemStack res, Object[] params) {
ShapelessOreRecipe rec = new ShapelessOreRecipe(res, params);
CraftingManager.getInstance().getRecipeList().add(rec);
@@ -3916,6 +4032,32 @@ public class ThaumicHorizons {
warpedTumorValueProperty.comment = "Points of warp held by warped tumor.";
warpedTumorValueProperty.setRequiresMcRestart(true);
warpedTumorValue = warpedTumorValueProperty.getInt();
Property visboostPotionProperty = config.get("potions", "visboostPotionID", 24);
visboostPotionProperty.comment = "Potion ID for the VisBoost Potion";
visboostPotionProperty.setRequiresMcRestart(true);
potionVisBoostID = visboostPotionProperty.getInt();
Property visregenPotionProperty = config.get("potions", "visregenPotionID", 25);
visregenPotionProperty.comment = "Potion ID for the VisRegen Potion";
visregenPotionProperty.setRequiresMcRestart(true);
potionVisRegenID = visregenPotionProperty.getInt();
Property vacuumPotionProperty = config.get("potions", "vacuumPotionID", 26);
vacuumPotionProperty.comment = "Potion ID for the Vacuum";
vacuumPotionProperty.setRequiresMcRestart(true);
potionVacuumID = vacuumPotionProperty.getInt();
Property shockPotionProperty = config.get("potions", "shockPotionID", 27);
shockPotionProperty.comment = "Potion ID for the Shock Potion";
shockPotionProperty.setRequiresMcRestart(true);
potionShockID = shockPotionProperty.getInt();
Property synthesisPotionProperty = config.get("potions", "synthesisPotionID", 28);
synthesisPotionProperty.comment = "Potion ID for the Sythesis Potion";
synthesisPotionProperty.setRequiresMcRestart(true);
potionSynthesisID = synthesisPotionProperty.getInt();
config.save();
}
@@ -29,6 +29,7 @@ public class BlockAlchemite extends BlockTNT {
this.setBlockName("ThaumicHorizons_alchemite");
this.setBlockTextureName("ThaumicHorizons:alchemite");
this.setCreativeTab(ThaumicHorizons.tabTH);
this.setStepSound(soundTypeGrass); // same place/break sound as TNT
}
public void onBlockDestroyedByExplosion(final World p_149723_1_, final int p_149723_2_, final int p_149723_3_,
@@ -12,23 +12,27 @@ import net.minecraft.world.World;
public class EntityBlastPhial extends EntityPotion {
public EntityBlastPhial(final World p_i1790_1_) {
super(p_i1790_1_);
public EntityBlastPhial(final World world) {
super(world);
}
public EntityBlastPhial(final World p_i1790_1_, final EntityLivingBase p_i1790_2_, final float power,
final ItemStack p_i1790_3_) {
super(p_i1790_1_, p_i1790_2_, p_i1790_3_);
public EntityBlastPhial(final World world, final double x, final double y, final double z, final ItemStack stack) {
super(world, x, y, z, stack);
}
public EntityBlastPhial(final World world, final EntityLivingBase thrower, final float power,
final ItemStack stack) {
super(world, thrower, stack);
this.setSize(0.25f, 0.25f);
this.setSize(0.5f, 0.5f);
this.setLocationAndAngles(
p_i1790_2_.posX,
p_i1790_2_.posY + p_i1790_2_.getEyeHeight(),
p_i1790_2_.posZ,
p_i1790_2_.rotationYaw,
p_i1790_2_.rotationPitch);
thrower.posX,
thrower.posY + thrower.getEyeHeight(),
thrower.posZ,
thrower.rotationYaw,
thrower.rotationPitch);
this.posX -= MathHelper.cos(this.rotationYaw / 180.0f * (float) Math.PI) * 0.16f;
this.posY -= 0.10000000149011612;
this.posY -= 0.1;
this.posZ -= MathHelper.sin(this.rotationYaw / 180.0f * (float) Math.PI) * 0.16f;
this.setPosition(this.posX, this.posY, this.posZ);
this.yOffset = 0.0f;
@@ -39,6 +39,7 @@ import io.netty.buffer.ByteBuf;
public class EntitySyringe extends Entity implements IProjectile, IEntityAdditionalSpawnData {
public int color;
public int canBePickedUp;
public NBTTagCompound effects;
private boolean inGround;
private int field_145791_d;
@@ -50,7 +51,6 @@ public class EntitySyringe extends Entity implements IProjectile, IEntityAdditio
private int ticksInAir;
private int knockbackStrength;
private EntityLivingBase shootingEntity;
private int canBePickedUp;
private byte arrowShake;
private double damage;
@@ -146,6 +146,13 @@ public class EntitySyringe extends Entity implements IProjectile, IEntityAdditio
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, p_i1756_3_ * 1.5f, 1.0f);
}
public EntitySyringe(World world, double x, double y, double z, NBTTagCompound effects) {
this(world, x, y, z);
this.effects = effects;
this.color = this.effects.getInteger("color");
this.canBePickedUp = 1;
}
public void writeEntityToNBT(final NBTTagCompound p_70014_1_) {
p_70014_1_.setTag("effects", this.effects);
p_70014_1_.setShort("xTile", (short) this.field_145791_d);
@@ -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,
@@ -0,0 +1,66 @@
package com.kentington.thaumichorizons.common.handlers;
import java.util.Set;
import net.minecraft.block.BlockDispenser;
import net.minecraft.block.material.Material;
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
import net.minecraft.dispenser.IBlockSource;
import net.minecraft.entity.item.EntityBoat;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
public class BehaviorDispenseBoat extends BehaviorDefaultDispenseItem {
public interface BoatFactory {
EntityBoat create(World world, double x, double y, double z);
}
private final Set<Material> validMaterials;
private final BoatFactory boatFactory;
public BehaviorDispenseBoat(Set<Material> validMaterials, BoatFactory boatFactory) {
this.validMaterials = validMaterials;
this.boatFactory = boatFactory;
}
@Override
protected ItemStack dispenseStack(IBlockSource dispenser, ItemStack stack) {
EnumFacing facing = BlockDispenser.func_149937_b(dispenser.getBlockMetadata());
World world = dispenser.getWorld();
// Calculate spawn position slightly in front of the dispenser
double spawnX = dispenser.getX() + (facing.getFrontOffsetX() * 1.25F);
double spawnY = dispenser.getY() + (facing.getFrontOffsetY() * 1.125F) - 0.5F;
double spawnZ = dispenser.getZ() + (facing.getFrontOffsetZ() * 1.25F);
// Block coordinates in front of the dispenser
int targetX = dispenser.getXInt() + facing.getFrontOffsetX();
int targetY = dispenser.getYInt() + facing.getFrontOffsetY();
int targetZ = dispenser.getZInt() + facing.getFrontOffsetZ();
Material frontMaterial = world.getBlock(targetX, targetY, targetZ).getMaterial();
if (validMaterials.contains(frontMaterial)) {
spawnY++;
} else if (!Material.air.equals(frontMaterial)) {
return stack;
}
EntityBoat boat = boatFactory.create(world, spawnX, spawnY, spawnZ);
boat.rotationYaw = switch (facing) {
case NORTH -> 90.0F;
case WEST -> 180.0F;
case EAST -> 0.0F;
default -> -90.0F; // SOUTH or other
};
world.spawnEntityInWorld(boat);
stack.stackSize--;
return stack;
}
}
@@ -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 }
]
}
}