Skip to content

Commit

Permalink
Salis changes
Browse files Browse the repository at this point in the history
  • Loading branch information
yorkeJohn committed Dec 21, 2021
1 parent ffd6452 commit 525649b
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 20 deletions.
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,7 @@ Additions:

- Fixed a bug where breaking any block with shears would drop Atropa Belladona.
- Removed logo from mcmod.info - reduces archive size.

----------------------------------------------------------- 8.1.0 --------------------------------------------------------------

- Changed the way Salis Aevus and Salis Tempestas work, and added visual effects.
81 changes: 63 additions & 18 deletions src/main/java/taintedmagic/common/items/ItemSalis.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package taintedmagic.common.items;

import java.util.List;
import java.util.Random;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import taintedmagic.common.TaintedMagic;
import thaumcraft.client.fx.ParticleEngine;
import thaumcraft.client.fx.particles.FXSparkle;

public class ItemSalis extends Item {

Expand Down Expand Up @@ -58,25 +61,67 @@ public String getUnlocalizedName (final ItemStack stack) {
}

@Override
public ItemStack onItemRightClick (final ItemStack stack, final World world, final EntityPlayer player) {
final int meta = stack.getItemDamage();
switch (meta) {
// Weather
case 0 : {
world.getWorldInfo().setRainTime(world.isRaining() ? 24000 : 0);
world.getWorldInfo().setRaining(!world.isRaining());
player.playSound("thaumcraft:wind", 0.3F, 1.0F + world.rand.nextFloat() * 0.5F);
player.inventory.decrStackSize(player.inventory.currentItem, 1);
return stack;
public boolean onEntityItemUpdate (final EntityItem entity) {
super.onEntityItemUpdate(entity);
final World world = entity.worldObj;
final int meta = entity.getEntityItem().getItemDamage();

if (entity.ticksExisted == 100) {
switch (meta) {
// Weather
case 0 : {
world.getWorldInfo().setRainTime(world.isRaining() ? 24000 : 0);
world.getWorldInfo().setRaining(!world.isRaining());
if (world.isRaining() && world.rand.nextInt(10) == 0) {
world.getWorldInfo().setThundering(true);
}
break;
}
// Time
case 1 : {
world.setWorldTime(world.isDaytime() ? 14000 : 24000);
break;
}
}
world.playSoundAtEntity(entity, "thaumcraft:ice", 0.3F, 1.0F + world.rand.nextFloat() * 0.25F);
entity.setDead();
if (world.isRemote) {
for (int i = 0; i < 200; i++) {
spawnParticles(entity, meta, true);
}
}
return false;
}
if (entity.ticksExisted % 30 == 1) {
world.playSoundAtEntity(entity, "thaumcraft:wind", 0.1F, 1.0F + world.rand.nextFloat() * 0.5F);
}
// Time
case 1 : {
world.setWorldTime(world.isDaytime() ? 14000 : 24000);
player.playSound("thaumcraft:wind", 0.3F, 1.0F + world.rand.nextFloat() * 0.5F);
player.inventory.decrStackSize(player.inventory.currentItem, 1);
return stack;
if (world.isRemote) {
spawnParticles(entity, meta, false);
}
return false;
}

@SideOnly (Side.CLIENT)
private void spawnParticles (final EntityItem entity, final int meta, final boolean death) {
final Random rand = entity.worldObj.rand;

final double theta = Math.random() * Math.PI;
final double phi = Math.random() * Math.PI * 2d;

final double x = Math.cos(phi) * Math.sin(theta) * 0.25d;
final double y = Math.sin(phi) * Math.sin(theta) * 0.25d;
final double z = Math.cos(theta) * 0.25d;

final FXSparkle fx = new FXSparkle(entity.worldObj, entity.posX + x, entity.boundingBox.maxY + y, entity.posZ + z,
1.75f, meta == 0 ? 7 : 6, death ? 30 + rand.nextInt(5) : 3 + rand.nextInt(2));
fx.setGravity(death ? 0f : -0.1f);
fx.noClip = true;

if (death) {
fx.motionX = x * 3d;
fx.motionY = y * 3d;
fx.motionZ = z * 3d;
}
return stack;
ParticleEngine.instance.addEffect(entity.worldObj, fx);
}
}
4 changes: 2 additions & 2 deletions src/main/resources/assets/taintedmagic/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,12 @@ tm.text.THAUMICDISASSEMBLER.1=You have constructed a high-tech magical multitool
#SKYSALT
tm.name.SKYSALT=Salis Tempestas
tm.tag.SKYSALT=Susano'o
tm.text.SKYSALT.1=By combining a Fragment of Creation with some other magical ingredients, you have created a peculiar new type of salis.<BR>When this salis is thrown into the air (via right-click), it instantly interacts with the primal aspects of the atmosphere. If the skies are stormy, they will soon become clear, or if the skies are clear, they will soon become stormy.
tm.text.SKYSALT.1=By combining a Fragment of Creation with some other magical ingredients, you have created a useful new type of salis.<BR>When thrown into the world, the salis will begin to interact with the worlds creation magics. After a few seconds, the item will dissipate. When the salis dissipates, if the skies are stormy, they will become clear, or if the skies are clear, they will become stormy.

#TIMESALT
tm.name.TIMESALT=Salis Aevus
tm.tag.TIMESALT=Amaterasu
tm.text.TIMESALT.1=By combining a Fragment of Creation with some other magical ingredients, you have created a peculiar new type of salis.<BR>When this salis is thrown into the air (via right-click), it instantly interacts with the primal aspects of the space-time continuum. If it is nighttime, it will instantly become day, or if it is daytime, it will instantly become night.
tm.text.TIMESALT.1=By combining a Fragment of Creation with some other magical ingredients, you have created a useful new type of salis.<BR>When thrown into the world, the salis will begin to interact with the world's creation magics. After a few seconds, the item will dissipate. When salis dissipates, if it is nighttime, it will become day, or if it is daytime, it will become night.

#VOIDSASH
tm.name.VOIDSASH=Voidwalker's Sash of Runic Shielding
Expand Down

0 comments on commit 525649b

Please sign in to comment.