mirror of
https://github.com/GTNewHorizons/Tainted-Magic.git
synced 2026-11-18 11:19:24 +00:00
Cleanup & reformat
This commit is contained in:
1 parent
f479b19255
commit
38e0cefaa2
76 files changed
+2371
-2766
No files matched your search
@@ -4,7 +4,6 @@ import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IHeldItemHUD
|
||||
{
|
||||
abstract void renderHUD (ScaledResolution res, EntityPlayer player, ItemStack stack, float partialTicks, float fract);
|
||||
public interface IHeldItemHUD {
|
||||
void renderHUD (ScaledResolution res, EntityPlayer player, ItemStack stack, float partialTicks, float fract);
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package taintedmagic.api;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IRenderInventoryItem
|
||||
{
|
||||
abstract void render (EntityPlayer player, ItemStack stack, float partialTicks);
|
||||
public interface IRenderInventoryItem {
|
||||
void render (EntityPlayer player, ItemStack stack, float partialTicks);
|
||||
}
|
||||
@@ -11,62 +11,64 @@ import taintedmagic.common.items.ItemVoidBlood;
|
||||
/**
|
||||
* Custom recipe for aplpying Voidsent Blood to armour.
|
||||
*/
|
||||
public class RecipeVoidBlood implements IRecipe
|
||||
{
|
||||
public class RecipeVoidBlood implements IRecipe {
|
||||
|
||||
@Override
|
||||
public boolean matches (InventoryCrafting inv, World world)
|
||||
{
|
||||
public boolean matches (final InventoryCrafting inv, final World world) {
|
||||
boolean foundBlood = false;
|
||||
boolean foundArmour = false;
|
||||
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
final ItemStack stack = inv.getStackInSlot(i);
|
||||
|
||||
if (stack != null)
|
||||
{
|
||||
if (stack.getItem() instanceof ItemVoidBlood && !foundBlood) foundBlood = true;
|
||||
else if (stack.getItem() instanceof ItemArmor && !foundArmour) foundArmour = true;
|
||||
|
||||
else return false;
|
||||
if (stack != null) {
|
||||
if (stack.getItem() instanceof ItemVoidBlood && !foundBlood) {
|
||||
foundBlood = true;
|
||||
}
|
||||
else if (stack.getItem() instanceof ItemArmor && !foundArmour) {
|
||||
foundArmour = true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return foundBlood && foundArmour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult (InventoryCrafting inv)
|
||||
{
|
||||
public ItemStack getCraftingResult (final InventoryCrafting inv) {
|
||||
ItemStack copy = null;
|
||||
ItemStack armor = null;
|
||||
ItemStack blood = null;
|
||||
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++)
|
||||
{
|
||||
if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).getItem() instanceof ItemArmor)
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).getItem() instanceof ItemArmor) {
|
||||
armor = inv.getStackInSlot(i);
|
||||
else if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).getItem() instanceof ItemVoidBlood)
|
||||
}
|
||||
else if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).getItem() instanceof ItemVoidBlood) {
|
||||
blood = inv.getStackInSlot(i);
|
||||
}
|
||||
}
|
||||
if (armor != null && blood != null && (armor.getTagCompound() == null
|
||||
|| (armor.getTagCompound() != null && !armor.getTagCompound().getBoolean("voidtouched"))))
|
||||
{
|
||||
|| armor.getTagCompound() != null && !armor.getTagCompound().getBoolean("voidtouched"))) {
|
||||
copy = armor.copy();
|
||||
if (copy.getTagCompound() == null) copy.setTagCompound(new NBTTagCompound());
|
||||
if (copy.getTagCompound() != null) copy.getTagCompound().setBoolean("voidtouched", true);
|
||||
if (copy.getTagCompound() == null) {
|
||||
copy.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
if (copy.getTagCompound() != null) {
|
||||
copy.getTagCompound().setBoolean("voidtouched", true);
|
||||
}
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize ()
|
||||
{
|
||||
public int getRecipeSize () {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput ()
|
||||
{
|
||||
public ItemStack getRecipeOutput () {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -23,41 +23,36 @@ import taintedmagic.common.entities.EntityHomingShard;
|
||||
import taintedmagic.common.registry.ItemRegistry;
|
||||
import thaumcraft.client.renderers.entity.RenderEldritchOrb;
|
||||
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
public class ClientProxy extends CommonProxy {
|
||||
|
||||
@Override
|
||||
public void preInit (FMLPreInitializationEvent event)
|
||||
{
|
||||
public void preInit (final FMLPreInitializationEvent event) {
|
||||
super.preInit(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init (FMLInitializationEvent event)
|
||||
{
|
||||
public void init (final FMLInitializationEvent event) {
|
||||
super.init(event);
|
||||
registerRenderers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit (FMLPostInitializationEvent event)
|
||||
{
|
||||
public void postInit (final FMLPostInitializationEvent event) {
|
||||
super.postInit(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerHandlers ()
|
||||
{
|
||||
public void registerHandlers () {
|
||||
super.registerHandlers();
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new HUDHandler());
|
||||
|
||||
|
||||
FMLCommonHandler.instance().bus().register(new ClientHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new ClientHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRenderers ()
|
||||
{
|
||||
public void registerRenderers () {
|
||||
// Entities
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityDarkMatter.class, new RenderEldritchOrb());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityHomingShard.class, new RenderEntityHomingShard());
|
||||
@@ -68,14 +63,12 @@ public class ClientProxy extends CommonProxy
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPlayer getClientPlayer ()
|
||||
{
|
||||
public EntityPlayer getClientPlayer () {
|
||||
return Minecraft.getMinecraft().thePlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getClientWorld ()
|
||||
{
|
||||
public World getClientWorld () {
|
||||
return FMLClientHandler.instance().getClient().theWorld;
|
||||
}
|
||||
}
|
||||
@@ -15,29 +15,28 @@ import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import taintedmagic.api.IRenderInventoryItem;
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public class ClientHandler
|
||||
{
|
||||
public class ClientHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void tickEnd (TickEvent event)
|
||||
{
|
||||
if (event.phase == TickEvent.Phase.END) HUDHandler.updateTicks();
|
||||
public void tickEnd (final TickEvent event) {
|
||||
if (event.phase == TickEvent.Phase.END) {
|
||||
HUDHandler.updateTicks();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Render items implementing IRenderInventoryItem
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public void onPlayerRender (RenderPlayerEvent.Specials.Post event)
|
||||
{
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
if (player.getActivePotionEffect(Potion.invisibility) != null) return;
|
||||
public void onPlayerRender (final RenderPlayerEvent.Specials.Post event) {
|
||||
final EntityPlayer player = event.entityPlayer;
|
||||
if (player.getActivePotionEffect(Potion.invisibility) != null)
|
||||
return;
|
||||
|
||||
ItemStack[] inv = player.inventory.mainInventory;
|
||||
List<Item> rendering = new ArrayList<Item>();
|
||||
for (ItemStack stack : inv)
|
||||
{
|
||||
if (stack != null && stack.getItem() instanceof IRenderInventoryItem && !rendering.contains(stack.getItem()))
|
||||
{
|
||||
final ItemStack[] inv = player.inventory.mainInventory;
|
||||
final List<Item> rendering = new ArrayList<>();
|
||||
for (final ItemStack stack : inv) {
|
||||
if (stack != null && stack.getItem() instanceof IRenderInventoryItem && !rendering.contains(stack.getItem())) {
|
||||
((IRenderInventoryItem) stack.getItem()).render(player, stack, event.partialRenderTick);
|
||||
rendering.add(stack.getItem());
|
||||
}
|
||||
|
||||
@@ -18,14 +18,12 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import taintedmagic.api.IHeldItemHUD;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
|
||||
public final class HUDHandler
|
||||
{
|
||||
public final class HUDHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void renderGameOverlayEvent (RenderGameOverlayEvent.Post event)
|
||||
{
|
||||
if (event.type == ElementType.ALL)
|
||||
{
|
||||
public void renderGameOverlayEvent (final RenderGameOverlayEvent.Post event) {
|
||||
if (event.type == ElementType.ALL) {
|
||||
renderHeldItemHUD(event.partialTicks);
|
||||
renderString();
|
||||
}
|
||||
@@ -36,78 +34,91 @@ public final class HUDHandler
|
||||
private static ItemStack last = null;
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
private void renderHeldItemHUD (float partialTicks)
|
||||
{
|
||||
EntityPlayer player = TaintedMagic.proxy.getClientPlayer();
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
private void renderHeldItemHUD (final float partialTicks) {
|
||||
final EntityPlayer player = TaintedMagic.proxy.getClientPlayer();
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
final ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
|
||||
if (stack != null && stack.getItem() instanceof IHeldItemHUD) last = stack.copy();
|
||||
if (stack != null && stack.getItem() instanceof IHeldItemHUD) {
|
||||
last = stack.copy();
|
||||
}
|
||||
stack = player.getCurrentEquippedItem();
|
||||
|
||||
boolean b = false;
|
||||
if (stack != null && stack.getItem() instanceof IHeldItemHUD) b = true;
|
||||
else b = false;
|
||||
if (stack != null && stack.getItem() instanceof IHeldItemHUD) {
|
||||
b = true;
|
||||
}
|
||||
else {
|
||||
b = false;
|
||||
}
|
||||
|
||||
float time = 30.0F;
|
||||
if (b) ticksEquipped = Math.min(time, ticksEquipped + partialTicks);
|
||||
else ticksEquipped = Math.max(0F, ticksEquipped - partialTicks);
|
||||
final float time = 30.0F;
|
||||
if (b) {
|
||||
ticksEquipped = Math.min(time, ticksEquipped + partialTicks);
|
||||
}
|
||||
else {
|
||||
ticksEquipped = Math.max(0F, ticksEquipped - partialTicks);
|
||||
}
|
||||
|
||||
float fract = ticksEquipped / time;
|
||||
final float fract = ticksEquipped / time;
|
||||
|
||||
if (b) ((IHeldItemHUD) stack.getItem()).renderHUD(res, player, stack, partialTicks, fract);
|
||||
else if (!b && ticksEquipped != 0) ((IHeldItemHUD) last.getItem()).renderHUD(res, player, last, partialTicks, fract);
|
||||
if (b) {
|
||||
((IHeldItemHUD) stack.getItem()).renderHUD(res, player, stack, partialTicks, fract);
|
||||
}
|
||||
else if (!b && ticksEquipped != 0) {
|
||||
((IHeldItemHUD) last.getItem()).renderHUD(res, player, last, partialTicks, fract);
|
||||
}
|
||||
}
|
||||
|
||||
private static String currentText;
|
||||
private static int time, ticks;
|
||||
private static boolean gay;
|
||||
private static int time;
|
||||
private static int ticks;
|
||||
private static boolean isRainbow;
|
||||
|
||||
/**
|
||||
* Displays text above the health bar for a specified duration.
|
||||
*
|
||||
*
|
||||
* @param text The string to display.
|
||||
* @param duration The duration to display it for (in ticks).
|
||||
* @param rainbow Setting this to true makes things absolutely fabulous.
|
||||
* @param duration The duration to display for (in ticks).
|
||||
* @param rainbow Display the string in rainbow.
|
||||
*/
|
||||
public static void displayString (String text, int duration, boolean rainbow)
|
||||
{
|
||||
public static void displayString (final String text, final int duration, final boolean rainbow) {
|
||||
currentText = text;
|
||||
ticks = time = duration;
|
||||
gay = rainbow;
|
||||
isRainbow = rainbow;
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public static void updateTicks ()
|
||||
{
|
||||
if (ticks > 0) ticks--;
|
||||
public static void updateTicks () {
|
||||
if (ticks > 0) {
|
||||
ticks--;
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
private void renderString ()
|
||||
{
|
||||
if (ticks > 0 && !MathHelper.stringNullOrLengthZero(currentText))
|
||||
{
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
int x = res.getScaledWidth();
|
||||
int y = res.getScaledHeight();
|
||||
FontRenderer font = mc.fontRenderer;
|
||||
private void renderString () {
|
||||
if (ticks > 0 && !MathHelper.stringNullOrLengthZero(currentText)) {
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
final ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
final int x = res.getScaledWidth();
|
||||
final int y = res.getScaledHeight();
|
||||
final FontRenderer font = mc.fontRenderer;
|
||||
|
||||
int startX = (x - font.getStringWidth(currentText)) / 2;
|
||||
int startY = y - 72;
|
||||
final int startX = (x - font.getStringWidth(currentText)) / 2;
|
||||
final int startY = y - 72;
|
||||
|
||||
int opacity = ticks > ((float) time * 0.25F) ? 255 : (int) (255F * ((float) ticks / ((float) time * 0.25F)));
|
||||
if (opacity < 5) opacity = 0;
|
||||
int opacity = ticks > time * 0.25F ? 255 : (int) (255F * (ticks / (time * 0.25F)));
|
||||
if (opacity < 5) {
|
||||
opacity = 0;
|
||||
}
|
||||
|
||||
int rgb = Color.HSBtoRGB( ((float) (time - ticks) / (float) time), 1.0F, 1.0F);
|
||||
final int rgb = Color.HSBtoRGB((float) (time - ticks) / (float) time, 1.0F, 1.0F);
|
||||
|
||||
if (opacity > 0)
|
||||
{
|
||||
if (opacity > 0) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
font.drawStringWithShadow(currentText, startX, startY, (gay ? rgb : 0xFFFFFF) + (opacity << 24));
|
||||
font.drawStringWithShadow(currentText, startX, startY, (isRainbow ? rgb : 0xFFFFFF) + (opacity << 24));
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -6,44 +6,31 @@ import net.minecraft.client.model.ModelRenderer;
|
||||
/**
|
||||
* Katana model - created by <wiiv> using Tabula 4.1.1
|
||||
*/
|
||||
public class ModelKatana extends ModelBase
|
||||
{
|
||||
public class ModelKatana extends ModelBase {
|
||||
public ModelRenderer blade;
|
||||
public ModelRenderer grip1;
|
||||
public ModelRenderer grip2;
|
||||
|
||||
public ModelKatana ()
|
||||
{
|
||||
this.textureWidth = 32;
|
||||
this.textureHeight = 64;
|
||||
public ModelKatana () {
|
||||
textureWidth = 32;
|
||||
textureHeight = 64;
|
||||
|
||||
this.grip2 = new ModelRenderer(this, 22, 0);
|
||||
this.grip2.setRotationPoint(0.0F, 0.0F, 0.0F);
|
||||
this.grip2.addBox(-1.0F, -12.0F, -1.5F, 2, 12, 3, 0.0F);
|
||||
grip2 = new ModelRenderer(this, 22, 0);
|
||||
grip2.setRotationPoint(0.0F, 0.0F, 0.0F);
|
||||
grip2.addBox(-1.0F, -12.0F, -1.5F, 2, 12, 3, 0.0F);
|
||||
|
||||
this.blade = new ModelRenderer(this, 0, 0);
|
||||
this.blade.setRotationPoint(0.0F, -40.0F, 0.0F);
|
||||
this.blade.addBox(-0.5F, 0.0F, -2.0F, 1, 48, 4, -0.75F);
|
||||
blade = new ModelRenderer(this, 0, 0);
|
||||
blade.setRotationPoint(0.0F, -40.0F, 0.0F);
|
||||
blade.addBox(-0.5F, 0.0F, -2.0F, 1, 48, 4, -0.75F);
|
||||
|
||||
this.grip1 = new ModelRenderer(this, 0, 52);
|
||||
this.grip1.setRotationPoint(0.0F, -40.0F, 0.0F);
|
||||
this.grip1.addBox(-2.5F, 0.0F, -3.5F, 5, 1, 7, 0.0F);
|
||||
this.grip1.addChild(this.grip2);
|
||||
grip1 = new ModelRenderer(this, 0, 52);
|
||||
grip1.setRotationPoint(0.0F, -40.0F, 0.0F);
|
||||
grip1.addBox(-2.5F, 0.0F, -3.5F, 5, 1, 7, 0.0F);
|
||||
grip1.addChild(grip2);
|
||||
}
|
||||
|
||||
public void render (float size)
|
||||
{
|
||||
this.blade.render(size);
|
||||
this.grip1.render(size);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a helper function from Tabula to set the rotation of model parts
|
||||
*/
|
||||
private void setRotation (ModelRenderer m, float x, float y, float z)
|
||||
{
|
||||
m.rotateAngleX = x;
|
||||
m.rotateAngleY = y;
|
||||
m.rotateAngleZ = z;
|
||||
public void render (final float size) {
|
||||
blade.render(size);
|
||||
grip1.render(size);
|
||||
}
|
||||
}
|
||||
@@ -6,30 +6,26 @@ import net.minecraft.client.model.ModelRenderer;
|
||||
/**
|
||||
* Saya model - created by <wiiv> using Tabula 4.1.1
|
||||
*/
|
||||
public class ModelSaya extends ModelBase
|
||||
{
|
||||
public class ModelSaya extends ModelBase {
|
||||
public ModelRenderer saya;
|
||||
|
||||
public ModelSaya ()
|
||||
{
|
||||
this.textureWidth = 32;
|
||||
this.textureHeight = 64;
|
||||
public ModelSaya () {
|
||||
textureWidth = 32;
|
||||
textureHeight = 64;
|
||||
|
||||
this.saya = new ModelRenderer(this, 10, 0);
|
||||
this.saya.setRotationPoint(0.0F, -40.0F, 0.0F);
|
||||
this.saya.addBox(-1.0F, 0.5F, -2.0F, 2, 48, 4, 0.0F);
|
||||
saya = new ModelRenderer(this, 10, 0);
|
||||
saya.setRotationPoint(0.0F, -40.0F, 0.0F);
|
||||
saya.addBox(-1.0F, 0.5F, -2.0F, 2, 48, 4, 0.0F);
|
||||
}
|
||||
|
||||
public void render (float size)
|
||||
{
|
||||
this.saya.render(size);
|
||||
public void render (final float size) {
|
||||
saya.render(size);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a helper function from Tabula to set the rotation of model parts
|
||||
*/
|
||||
public void setRotation (ModelRenderer m, float x, float y, float z)
|
||||
{
|
||||
public void setRotation (final ModelRenderer m, final float x, final float y, final float z) {
|
||||
m.rotateAngleX = x;
|
||||
m.rotateAngleY = y;
|
||||
m.rotateAngleZ = z;
|
||||
|
||||
@@ -10,44 +10,43 @@ import taintedmagic.common.entities.EntityDiffusion;
|
||||
import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
|
||||
public class RenderEntityDiffusion extends Render
|
||||
{
|
||||
public class RenderEntityDiffusion extends Render {
|
||||
|
||||
@Override
|
||||
public void doRender (Entity entity, double x, double y, double z, float f, float partialTicks)
|
||||
{
|
||||
public void doRender (final Entity entity, final double x, final double y, final double z, final float f,
|
||||
final float partialTicks) {
|
||||
render((EntityDiffusion) entity, x, y, z, f, partialTicks);
|
||||
}
|
||||
|
||||
public void render (EntityDiffusion entity, double x, double y, double z, float f, float partialTicks)
|
||||
{
|
||||
Tessellator t = Tessellator.instance;
|
||||
public void render (final EntityDiffusion entity, final double x, final double y, final double z, final float f,
|
||||
final float partialTicks) {
|
||||
final Tessellator t = Tessellator.instance;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
float color = 0.1F;
|
||||
float alpha = (20.0F - (float) entity.ticksExisted) / 40.0F;
|
||||
final float color = 0.1F;
|
||||
final float alpha = (20.0F - entity.ticksExisted) / 40.0F;
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
UtilsFX.bindTexture(ParticleEngine.particleTexture);
|
||||
|
||||
float f2 = entity.ticksExisted % 13 / 16.0F;
|
||||
float f3 = f2 + 0.0624375F;
|
||||
float f4 = 0.1875F;
|
||||
float f5 = f4 + 0.0624375F;
|
||||
float f6 = 1.0F;
|
||||
float f7 = 0.5F;
|
||||
float f8 = 0.5F;
|
||||
final float f2 = entity.ticksExisted % 13 / 16.0F;
|
||||
final float f3 = f2 + 0.0625F;
|
||||
final float f4 = 0.1875F;
|
||||
final float f5 = f4 + 0.0625F;
|
||||
final float f6 = 1.0F;
|
||||
final float f7 = 0.5F;
|
||||
|
||||
GL11.glColor4f(color, color, color, alpha);
|
||||
|
||||
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(180.0F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
|
||||
|
||||
float s = 0.5F;
|
||||
final float s = 0.5F;
|
||||
GL11.glScalef(s, s, s);
|
||||
|
||||
t.startDrawingQuads();
|
||||
@@ -55,10 +54,10 @@ public class RenderEntityDiffusion extends Render
|
||||
t.setNormal(0.0F, 1.0F, 0.0F);
|
||||
t.setColorRGBA_F(color, color, color, alpha);
|
||||
|
||||
t.addVertexWithUV(0.0F - f7, 0.0F - f8, 0.0D, f2, f5);
|
||||
t.addVertexWithUV(f6 - f7, 0.0F - f8, 0.0D, f3, f5);
|
||||
t.addVertexWithUV(f6 - f7, 1.0F - f8, 0.0D, f3, f4);
|
||||
t.addVertexWithUV(0.0F - f7, 1.0F - f8, 0.0D, f2, f4);
|
||||
t.addVertexWithUV(0.0F - f7, 0.0F - f7, 0.0D, f2, f5);
|
||||
t.addVertexWithUV(f6 - f7, 0.0F - f7, 0.0D, f3, f5);
|
||||
t.addVertexWithUV(f6 - f7, 1.0F - f7, 0.0D, f3, f4);
|
||||
t.addVertexWithUV(0.0F - f7, 1.0F - f7, 0.0D, f2, f4);
|
||||
|
||||
t.draw();
|
||||
|
||||
@@ -68,8 +67,7 @@ public class RenderEntityDiffusion extends Render
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture (Entity entity)
|
||||
{
|
||||
protected ResourceLocation getEntityTexture (final Entity entity) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -15,23 +15,21 @@ import thaumcraft.client.lib.UtilsFX;
|
||||
/**
|
||||
* This class is based off of RenderHomingShard.class created by <Azanor> as part of Thaumcraft 5.
|
||||
*/
|
||||
public class RenderEntityHomingShard extends Render
|
||||
{
|
||||
public RenderEntityHomingShard ()
|
||||
{
|
||||
super();
|
||||
this.shadowSize = 0.0F;
|
||||
public class RenderEntityHomingShard extends Render {
|
||||
|
||||
public RenderEntityHomingShard () {
|
||||
shadowSize = 0.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender (Entity entity, double x, double y, double z, float f, float partialTicks)
|
||||
{
|
||||
public void doRender (final Entity entity, final double x, final double y, final double z, final float f,
|
||||
final float partialTicks) {
|
||||
render((EntityHomingShard) entity, x, y, z, f, partialTicks);
|
||||
}
|
||||
|
||||
public void render (EntityHomingShard entity, double x, double y, double z, float f, float partialTicks)
|
||||
{
|
||||
Tessellator t = Tessellator.instance;
|
||||
public void render (final EntityHomingShard entity, final double x, final double y, final double z, final float f,
|
||||
final float partialTicks) {
|
||||
final Tessellator t = Tessellator.instance;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
@@ -42,19 +40,18 @@ public class RenderEntityHomingShard extends Render
|
||||
|
||||
UtilsFX.bindTexture(ParticleEngine.particleTexture);
|
||||
|
||||
float f2 = (8 + entity.ticksExisted % 8) / 16.0F;
|
||||
float f3 = f2 + 0.0625F;
|
||||
float f4 = 0.25F;
|
||||
float f5 = f4 + 0.0625F;
|
||||
final float f2 = (8 + entity.ticksExisted % 8) / 16.0F;
|
||||
final float f3 = f2 + 0.0625F;
|
||||
final float f4 = 0.25F;
|
||||
final float f5 = f4 + 0.0625F;
|
||||
|
||||
float f6 = 1.0F;
|
||||
float f7 = 0.5F;
|
||||
float f8 = 0.5F;
|
||||
final float f6 = 1.0F;
|
||||
final float f7 = 0.5F;
|
||||
|
||||
float red = 0.405F;
|
||||
float green = 0.075F;
|
||||
float blue = 0.525F;
|
||||
float alpha = 1.0F;
|
||||
final float red = 0.405F;
|
||||
final float green = 0.075F;
|
||||
final float blue = 0.525F;
|
||||
final float alpha = 1.0F;
|
||||
|
||||
GL11.glColor4f(red, green, blue, alpha);
|
||||
|
||||
@@ -62,8 +59,8 @@ public class RenderEntityHomingShard extends Render
|
||||
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(180.0F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glScalef(0.4F + 0.1F * entity.getStrength(), 0.4F + 0.1F * entity.getStrength(),
|
||||
0.4F + 0.1F * entity.getStrength());
|
||||
|
||||
@@ -73,10 +70,10 @@ public class RenderEntityHomingShard extends Render
|
||||
t.setNormal(0.0F, 1.0F, 0.0F);
|
||||
t.setBrightness(240);
|
||||
|
||||
t.addVertexWithUV(-f7, -f8, 0.0D, f2, f5);
|
||||
t.addVertexWithUV(f6 - f7, -f8, 0.0D, f3, f5);
|
||||
t.addVertexWithUV(f6 - f7, 1.0F - f8, 0.0D, f3, f4);
|
||||
t.addVertexWithUV(-f7, 1.0F - f8, 0.0D, f2, f4);
|
||||
t.addVertexWithUV(-f7, -f7, 0.0D, f2, f5);
|
||||
t.addVertexWithUV(f6 - f7, -f7, 0.0D, f3, f5);
|
||||
t.addVertexWithUV(f6 - f7, 1.0F - f7, 0.0D, f3, f4);
|
||||
t.addVertexWithUV(-f7, 1.0F - f7, 0.0D, f2, f4);
|
||||
|
||||
t.draw();
|
||||
|
||||
@@ -90,8 +87,7 @@ public class RenderEntityHomingShard extends Render
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture (Entity entity)
|
||||
{
|
||||
protected ResourceLocation getEntityTexture (final Entity entity) {
|
||||
return TextureMap.locationBlocksTexture;
|
||||
}
|
||||
}
|
||||
@@ -15,48 +15,41 @@ import taintedmagic.common.items.tools.ItemKatana;
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public class RenderItemKatana implements IItemRenderer
|
||||
{
|
||||
public class RenderItemKatana implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType (ItemStack stack, ItemRenderType type)
|
||||
{
|
||||
public boolean handleRenderType (final ItemStack stack, final ItemRenderType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper (ItemRenderType type, ItemStack stack, ItemRendererHelper helper)
|
||||
{
|
||||
public boolean shouldUseRenderHelper (final ItemRenderType type, final ItemStack stack, final ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem (ItemRenderType type, ItemStack stack, Object... data)
|
||||
{
|
||||
EntityPlayer player = TaintedMagic.proxy.getClientPlayer();
|
||||
public void renderItem (final ItemRenderType type, final ItemStack stack, final Object... data) {
|
||||
final EntityPlayer player = TaintedMagic.proxy.getClientPlayer();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glScalef(1.4F, 1.4F, 1.4F);
|
||||
|
||||
if ( (player.getHeldItem() == null || player.getHeldItem() != stack) && type != ItemRenderType.EQUIPPED)
|
||||
{
|
||||
if ( (player.getHeldItem() == null || player.getHeldItem() != stack) && type != ItemRenderType.EQUIPPED) {
|
||||
GL11.glPushMatrix();
|
||||
if (type == ItemRenderType.ENTITY)
|
||||
{
|
||||
if (type == ItemRenderType.ENTITY) {
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
GL11.glTranslatef(0F, 0.5F, 0F);
|
||||
GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
else if (type == ItemRenderType.INVENTORY)
|
||||
{
|
||||
else if (type == ItemRenderType.INVENTORY) {
|
||||
GL11.glScalef(0.4F, 0.4F, 0.4F);
|
||||
GL11.glRotatef(-65, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(-50, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(1F, 1F, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
GL11.glTranslatef(0.0F, -0.7F, 0.0F);
|
||||
}
|
||||
|
||||
@@ -68,17 +61,14 @@ public class RenderItemKatana implements IItemRenderer
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (type == ItemRenderType.ENTITY)
|
||||
{
|
||||
if (type == ItemRenderType.ENTITY) {
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
GL11.glTranslatef(0F, 0.5F, 0F);
|
||||
GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON)
|
||||
{
|
||||
if (player.isUsingItem())
|
||||
{
|
||||
else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
if (player.isUsingItem()) {
|
||||
GL11.glTranslatef(5.0F, 1.0F, -0.2F);
|
||||
GL11.glRotatef(155.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-20.0F, 1.0F, 0.0F, 0.0F);
|
||||
@@ -89,15 +79,13 @@ public class RenderItemKatana implements IItemRenderer
|
||||
GL11.glRotatef(-10F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-10F, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
else if (type == ItemRenderType.INVENTORY)
|
||||
{
|
||||
else if (type == ItemRenderType.INVENTORY) {
|
||||
GL11.glScalef(0.4F, 0.4F, 0.4F);
|
||||
GL11.glRotatef(-65, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(-50, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(1F, 1F, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
GL11.glRotatef(60, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(-40, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(70, 0.0F, 1.0F, 0.0F);
|
||||
@@ -109,27 +97,24 @@ public class RenderItemKatana implements IItemRenderer
|
||||
ItemKatana.KATANA.render(0.0625F);
|
||||
|
||||
// Runes
|
||||
if (ItemKatana.hasAnyInscription(stack))
|
||||
{
|
||||
if (ItemKatana.hasAnyInscription(stack)) {
|
||||
GL11.glPushMatrix();
|
||||
int j = 200;
|
||||
int k = j % 65536;
|
||||
int l = j / 65536;
|
||||
final int j = 200;
|
||||
final int k = j % 65536;
|
||||
final int l = j / 65536;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, k / 1.0F, l / 1.0F);
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GL11.glRotated(90.0D, 0.0D, 1.0D, 0.0D);
|
||||
for (int a = 0; a < 14; a++)
|
||||
{
|
||||
int rune = (a * 3) % 16;
|
||||
for (int a = 0; a < 14; a++) {
|
||||
final int rune = a * 3 % 16;
|
||||
drawRune(-1.65D + a * 0.14D, 0D, -0.03D, rune, player);
|
||||
}
|
||||
GL11.glRotated(180.0D, 0.0D, 1.0D, 0.0D);
|
||||
for (int a = 0; a < 14; a++)
|
||||
{
|
||||
int rune = (a + 1 * 3) % 16;
|
||||
for (int a = 0; a < 14; a++) {
|
||||
final int rune = (a + 1 * 3) % 16;
|
||||
drawRune(-1.65D + a * 0.14D, 0D, -0.03D, rune, player);
|
||||
}
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
@@ -149,27 +134,26 @@ public class RenderItemKatana implements IItemRenderer
|
||||
/**
|
||||
* TC method to draw runes on runed staves
|
||||
*/
|
||||
public static void drawRune (double x, double y, double z, int rune, EntityPlayer player)
|
||||
{
|
||||
public static void drawRune (final double x, final double y, final double z, final int rune, final EntityPlayer player) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
UtilsFX.bindTexture("textures/misc/script.png");
|
||||
|
||||
float r = MathHelper.sin( (player.ticksExisted + rune * 5) / 5.0F) * 0.1F + 0.88F;
|
||||
float g = MathHelper.sin( (player.ticksExisted + rune * 5) / 7.0F) * 0.1F + 0.63F;
|
||||
float alpha = MathHelper.sin( (player.ticksExisted + rune * 5) / 10.0F) * 0.3F;
|
||||
final float r = MathHelper.sin( (player.ticksExisted + rune * 5) / 5.0F) * 0.1F + 0.88F;
|
||||
final float g = MathHelper.sin( (player.ticksExisted + rune * 5) / 7.0F) * 0.1F + 0.63F;
|
||||
final float alpha = MathHelper.sin( (player.ticksExisted + rune * 5) / 10.0F) * 0.3F;
|
||||
|
||||
GL11.glColor4f(r, g, 0.2F, alpha + 0.6F);
|
||||
|
||||
GL11.glRotated(90.0D, 0.0D, 0.0D, 1.0D);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
Tessellator t = Tessellator.instance;
|
||||
final Tessellator t = Tessellator.instance;
|
||||
|
||||
float f = 0.0625F * rune;
|
||||
float f1 = f + 0.0625F;
|
||||
float f2 = 0.0F;
|
||||
float f3 = 1.0F;
|
||||
final float f = 0.0625F * rune;
|
||||
final float f1 = f + 0.0625F;
|
||||
final float f2 = 0.0F;
|
||||
final float f3 = 1.0F;
|
||||
|
||||
t.startDrawingQuads();
|
||||
|
||||
|
||||
@@ -20,10 +20,9 @@ import taintedmagic.common.registry.RecipeRegistry;
|
||||
import taintedmagic.common.registry.ResearchRegistry;
|
||||
import taintedmagic.common.registry.TMEntityRegistry;
|
||||
|
||||
public class CommonProxy
|
||||
{
|
||||
public void preInit (FMLPreInitializationEvent event)
|
||||
{
|
||||
public class CommonProxy {
|
||||
|
||||
public void preInit (final FMLPreInitializationEvent event) {
|
||||
ConfigHandler.config = new Configuration(event.getSuggestedConfigurationFile());
|
||||
ConfigHandler.initConfig();
|
||||
|
||||
@@ -35,37 +34,33 @@ public class CommonProxy
|
||||
RecipeRegistry.initRecipes();
|
||||
OreDictRegistry.initOreDict();
|
||||
|
||||
if (ConfigHandler.NOTIFY_UPDATE) UpdateHandler.checkForUpdate();
|
||||
if (ConfigHandler.NOTIFY_UPDATE) {
|
||||
UpdateHandler.checkForUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public void init (FMLInitializationEvent event)
|
||||
{
|
||||
public void init (final FMLInitializationEvent event) {
|
||||
registerHandlers();
|
||||
TMFocusUpgrades.initFocusUpgrades();
|
||||
}
|
||||
|
||||
public void postInit (FMLPostInitializationEvent event)
|
||||
{
|
||||
public void postInit (final FMLPostInitializationEvent event) {
|
||||
ResearchRegistry.initResearch();
|
||||
}
|
||||
|
||||
public void registerHandlers ()
|
||||
{
|
||||
public void registerHandlers () {
|
||||
MinecraftForge.EVENT_BUS.register(new TMEventHandler());
|
||||
FMLCommonHandler.instance().bus().register(new TMEventHandler());
|
||||
}
|
||||
|
||||
public void registerRenderers ()
|
||||
{
|
||||
public void registerRenderers () {
|
||||
}
|
||||
|
||||
public EntityPlayer getClientPlayer ()
|
||||
{
|
||||
public EntityPlayer getClientPlayer () {
|
||||
return null;
|
||||
}
|
||||
|
||||
public World getClientWorld ()
|
||||
{
|
||||
public World getClientWorld () {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -13,51 +13,52 @@ import taintedmagic.common.registry.ItemRegistry;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
public class TMCreativeTab extends CreativeTabs
|
||||
{
|
||||
public List list = new ArrayList();
|
||||
public class TMCreativeTab extends CreativeTabs {
|
||||
|
||||
public TMCreativeTab ()
|
||||
{
|
||||
public TMCreativeTab () {
|
||||
super(LibInfo.MODID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayAllReleventItems (List list)
|
||||
{
|
||||
public void displayAllReleventItems (final List list) {
|
||||
super.displayAllReleventItems(list);
|
||||
|
||||
ItemStack stack = new ItemStack(ConfigItems.itemWandCasting);
|
||||
ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
final ItemStack stack = new ItemStack(ConfigItems.itemWandCasting);
|
||||
final ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
|
||||
wand.setCap(stack, ItemRegistry.WAND_CAP_SHADOWMETAL);
|
||||
wand.setRod(stack, ItemRegistry.STAFF_ROD_WARPWOOD);
|
||||
wand.storeAllVis(stack, TaintedMagicHelper.getPrimals(wand.getMaxVis(stack)));
|
||||
|
||||
if (list != null) list.add(0, stack);
|
||||
if (list != null) {
|
||||
list.add(0, stack);
|
||||
}
|
||||
|
||||
ItemStack stack2 = stack.copy();
|
||||
ItemWandCasting wand2 = (ItemWandCasting) stack2.getItem();
|
||||
final ItemStack stack2 = stack.copy();
|
||||
final ItemWandCasting wand2 = (ItemWandCasting) stack2.getItem();
|
||||
|
||||
wand2.setRod(stack2, ItemRegistry.WAND_ROD_WARPWOOD);
|
||||
wand2.storeAllVis(stack2, TaintedMagicHelper.getPrimals(wand2.getMaxVis(stack2)));
|
||||
|
||||
if (list != null) list.add(1, stack2);
|
||||
if (list != null) {
|
||||
list.add(1, stack2);
|
||||
}
|
||||
|
||||
ItemStack stack3 = stack2.copy();
|
||||
ItemWandCasting wand3 = (ItemWandCasting) stack3.getItem();
|
||||
final ItemStack stack3 = stack2.copy();
|
||||
final ItemWandCasting wand3 = (ItemWandCasting) stack3.getItem();
|
||||
|
||||
stack3.setTagInfo("sceptre", new NBTTagByte((byte) 1));
|
||||
wand3.storeAllVis(stack3, TaintedMagicHelper.getPrimals(wand3.getMaxVis(stack3)));
|
||||
|
||||
if (list != null) list.add(2, stack3);
|
||||
if (list != null) {
|
||||
list.add(2, stack3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack ()
|
||||
{
|
||||
ItemStack stack = new ItemStack(ConfigItems.itemWandCasting);
|
||||
ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
public ItemStack getIconItemStack () {
|
||||
final ItemStack stack = new ItemStack(ConfigItems.itemWandCasting);
|
||||
final ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
|
||||
wand.setCap(stack, ItemRegistry.WAND_CAP_SHADOWMETAL);
|
||||
wand.setRod(stack, ItemRegistry.WAND_ROD_WARPWOOD);
|
||||
@@ -66,8 +67,7 @@ public class TMCreativeTab extends CreativeTabs
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getTabIconItem ()
|
||||
{
|
||||
public Item getTabIconItem () {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,8 @@ import net.minecraftforge.common.util.EnumHelper;
|
||||
import taintedmagic.common.lib.LibInfo;
|
||||
|
||||
@Mod (modid = LibInfo.MODID, name = LibInfo.NAME, version = LibInfo.VERSION, dependencies = LibInfo.DEPENDENCIES)
|
||||
public class TaintedMagic
|
||||
{
|
||||
public class TaintedMagic {
|
||||
|
||||
@Mod.Instance ("TaintedMagic")
|
||||
public static TaintedMagic instance;
|
||||
|
||||
@@ -36,24 +36,21 @@ public class TaintedMagic
|
||||
|
||||
// Pre init
|
||||
@EventHandler
|
||||
public static void preInit (FMLPreInitializationEvent event)
|
||||
{
|
||||
public static void preInit (final FMLPreInitializationEvent event) {
|
||||
logger.info("Pre-initializing Tainted Magic!");
|
||||
proxy.preInit(event);
|
||||
}
|
||||
|
||||
// Init
|
||||
@EventHandler
|
||||
public static void init (FMLInitializationEvent event)
|
||||
{
|
||||
public static void init (final FMLInitializationEvent event) {
|
||||
logger.info("Initializing Tainted Magic!");
|
||||
proxy.init(event);
|
||||
}
|
||||
|
||||
// Post init
|
||||
@EventHandler
|
||||
public static void postInit (FMLPostInitializationEvent event)
|
||||
{
|
||||
public static void postInit (final FMLPostInitializationEvent event) {
|
||||
logger.info("Post-initializing Tainted Magic!");
|
||||
proxy.postInit(event);
|
||||
logger.info("Loading complete!");
|
||||
|
||||
@@ -17,34 +17,34 @@ import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.fx.particles.FXSparkle;
|
||||
import thaumcraft.common.config.Config;
|
||||
|
||||
public class BlockLumos extends Block implements ITileEntityProvider
|
||||
{
|
||||
public BlockLumos ()
|
||||
{
|
||||
public class BlockLumos extends Block implements ITileEntityProvider {
|
||||
|
||||
public BlockLumos () {
|
||||
super(Config.airyMaterial);
|
||||
this.setStepSound(new Block.SoundType("stone", -1, -1));
|
||||
this.setBlockName("BlockLumos");
|
||||
this.setTickRandomly(false);
|
||||
this.setLightLevel(1.0F);
|
||||
this.setBlockTextureName("thaumcraft:blank");
|
||||
setStepSound(new Block.SoundType("stone", -1, -1));
|
||||
setBlockName("BlockLumos");
|
||||
setTickRandomly(false);
|
||||
setLightLevel(1.0F);
|
||||
setBlockTextureName("thaumcraft:blank");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByPlayer (World world, int x, int y, int z, int meta)
|
||||
{
|
||||
public void onBlockDestroyedByPlayer (final World world, final int x, final int y, final int z, final int meta) {
|
||||
super.onBlockDestroyedByPlayer(world, x, y, z, meta);
|
||||
|
||||
world.playSound(x, y, z, "thaumcraft:ice", 0.3F, 1.1F + world.rand.nextFloat() * 0.1F, true);
|
||||
|
||||
for (int i = 0; i < 9; i++)
|
||||
if (world.isRemote) spawnBreakParticles(world, x, y, z);
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (world.isRemote) {
|
||||
spawnBreakParticles(world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
void spawnBreakParticles (World world, double x, double y, double z)
|
||||
{
|
||||
FXSparkle fx = new FXSparkle(world, x + world.rand.nextFloat(), y + world.rand.nextFloat(), z + world.rand.nextFloat(),
|
||||
1.75F, 6, 3 + world.rand.nextInt(3));
|
||||
void spawnBreakParticles (final World world, final double x, final double y, final double z) {
|
||||
final FXSparkle fx = new FXSparkle(world, x + world.rand.nextFloat(), y + world.rand.nextFloat(),
|
||||
z + world.rand.nextFloat(), 1.75F, 6, 3 + world.rand.nextInt(3));
|
||||
fx.motionX += world.rand.nextGaussian() * 0.1D;
|
||||
fx.motionY += world.rand.nextGaussian() * 0.1D;
|
||||
fx.motionZ += world.rand.nextGaussian() * 0.1D;
|
||||
@@ -53,75 +53,68 @@ public class BlockLumos extends Block implements ITileEntityProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 0) setBlockBounds(0.3F, 0.3F, 0.3F, 0.7F, 0.7F, 0.7F);
|
||||
else setBlockBounds(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F);
|
||||
public void setBlockBoundsBasedOnState (final IBlockAccess world, final int x, final int y, final int z) {
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 0) {
|
||||
setBlockBounds(0.3F, 0.3F, 0.3F, 0.7F, 0.7F, 0.7F);
|
||||
}
|
||||
else {
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
|
||||
{
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool (final World world, final int x, final int y, final int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
public int getRenderType () {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid (IBlockAccess world, int x, int y, int z, ForgeDirection side)
|
||||
{
|
||||
public boolean isSideSolid (final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockNormalCube ()
|
||||
{
|
||||
public boolean isBlockNormalCube () {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube () {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public boolean isReplaceable (final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeReplacedByLeaves (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public boolean canBeReplacedByLeaves (final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
@Override
|
||||
public boolean renderAsNormalBlock () {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped (int a, Random random, int b)
|
||||
{
|
||||
public Item getItemDropped (final int a, final Random random, final int b) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItem (World world, int x, int y, int z)
|
||||
{
|
||||
public Item getItem (final World world, final int x, final int y, final int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World world, int m)
|
||||
{
|
||||
public TileEntity createNewTileEntity (final World world, final int m) {
|
||||
return new TileLumos();
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@ import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
@@ -23,61 +22,51 @@ import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.registry.BlockRegistry;
|
||||
import taintedmagic.common.registry.ItemRegistry;
|
||||
|
||||
public class BlockNightshadeBush extends BlockBush
|
||||
{
|
||||
public BlockNightshadeBush ()
|
||||
{
|
||||
public class BlockNightshadeBush extends BlockBush {
|
||||
|
||||
public BlockNightshadeBush () {
|
||||
super(Material.plants);
|
||||
this.setBlockName("BlockNightshadeBush");
|
||||
this.setBlockTextureName("taintedmagic:BlockNightshadeBush");
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setStepSound(soundTypeGrass);
|
||||
setBlockName("BlockNightshadeBush");
|
||||
setBlockTextureName("taintedmagic:BlockNightshadeBush");
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setStepSound(soundTypeGrass);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
public Item getItemDropped (int a, Random random, int b)
|
||||
{
|
||||
@Override
|
||||
public Item getItemDropped (final int a, final Random random, final int b) {
|
||||
return ItemRegistry.ItemNightshadeBerries;
|
||||
}
|
||||
|
||||
public int quantityDropped (Random random)
|
||||
{
|
||||
@Override
|
||||
public int quantityDropped (final Random random) {
|
||||
return 1 + random.nextInt(3);
|
||||
}
|
||||
|
||||
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock (final World world, final int x, final int y, final int z, final Entity entity) {
|
||||
super.onEntityCollidedWithBlock(world, x, y, z, entity);
|
||||
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
if (entity instanceof EntityLivingBase) {
|
||||
entity.attackEntityFrom(new DamageSource("nightshade"), 1.0F);
|
||||
try
|
||||
{
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.poison.id, 140, 0));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.poison.id, 140, 0));
|
||||
}
|
||||
}
|
||||
|
||||
public int getFlammability (IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
@Override
|
||||
public int getFlammability (final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getFireSpreadSpeed (IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
@Override
|
||||
public int getFireSpreadSpeed (final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBreak (BlockEvent.HarvestDropsEvent event)
|
||||
{
|
||||
public void onBreak (final BlockEvent.HarvestDropsEvent event) {
|
||||
if (event.harvester != null && event.harvester.getHeldItem() != null
|
||||
&& event.harvester.getHeldItem().getItem() instanceof ItemShears)
|
||||
{
|
||||
&& event.harvester.getHeldItem().getItem() instanceof ItemShears) {
|
||||
event.drops.clear();
|
||||
event.drops.add(new ItemStack(BlockRegistry.BlockNightshadeBush, 1, 0));
|
||||
}
|
||||
|
||||
@@ -21,284 +21,238 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.registry.BlockRegistry;
|
||||
|
||||
public class BlockWarpwoodLeaves extends Block implements IShearable
|
||||
{
|
||||
int[] adjacentTreeBlocks;
|
||||
public class BlockWarpwoodLeaves extends Block implements IShearable {
|
||||
|
||||
private int[] adjacentTreeBlocks;
|
||||
private IIcon opaqueIcon;
|
||||
private IIcon transparentIcon;
|
||||
|
||||
public BlockWarpwoodLeaves ()
|
||||
{
|
||||
public BlockWarpwoodLeaves () {
|
||||
super(Material.leaves);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setLightOpacity(0);
|
||||
this.setHardness(0.1F);
|
||||
this.setStepSound(soundTypeGrass);
|
||||
this.setBlockName("BlockWarpwoodLeaves");
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setLightOpacity(0);
|
||||
setHardness(0.1F);
|
||||
setStepSound(soundTypeGrass);
|
||||
setBlockName("BlockWarpwoodLeaves");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public boolean shouldSideBeRendered (IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
public boolean shouldSideBeRendered (final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
return !Blocks.leaves.isOpaqueCube() || super.shouldSideBeRendered(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube () {
|
||||
return Blocks.leaves.isOpaqueCube();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon (final int side, final int meta) {
|
||||
return !Blocks.leaves.isOpaqueCube() ? transparentIcon : opaqueIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister ir)
|
||||
{
|
||||
public void registerBlockIcons (final IIconRegister ir) {
|
||||
opaqueIcon = ir.registerIcon("taintedmagic:BlockWarpwoodLeaves_opaque");
|
||||
transparentIcon = ir.registerIcon("taintedmagic:BlockWarpwoodLeaves_transparent");
|
||||
}
|
||||
|
||||
public void breakBlock (World world, int x, int y, int z, Block block, int i)
|
||||
{
|
||||
byte var7 = 1;
|
||||
int var8 = var7 + 1;
|
||||
@Override
|
||||
public void breakBlock (final World world, final int x, final int y, final int z, final Block block, final int meta) {
|
||||
final byte dist = 1;
|
||||
final int off = dist + 1;
|
||||
|
||||
if (world.checkChunksExist(x - var8, y - var8, z - var8, x + var8, y + var8, z + var8))
|
||||
{
|
||||
for (int var9 = -var7; var9 <= var7; var9++)
|
||||
{
|
||||
for (int var10 = -var7; var10 <= var7; var10++)
|
||||
{
|
||||
for (int var11 = -var7; var11 <= var7; var11++)
|
||||
{
|
||||
Block var12 = world.getBlock(x + var9, y + var10, z + var11);
|
||||
if (world.checkChunksExist(x - off, y - off, z - off, x + off, y + off, z + off)) {
|
||||
for (int i = -dist; i <= dist; i++) {
|
||||
for (int j = -dist; j <= dist; j++) {
|
||||
for (int k = -dist; k <= dist; k++) {
|
||||
final Block b = world.getBlock(x + i, y + j, z + k);
|
||||
|
||||
if (var12 == Blocks.air) continue;
|
||||
var12.beginLeavesDecay(world, x + var9, y + var10, z + var11);
|
||||
if (b == Blocks.air) {
|
||||
continue;
|
||||
}
|
||||
b.beginLeavesDecay(world, x + i, y + j, z + k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateTick (World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
int var6 = world.getBlockMetadata(x, y, z);
|
||||
@Override
|
||||
public void updateTick (final World world, final int x, final int y, final int z, final Random random) {
|
||||
if (!world.isRemote) {
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if ( ( (var6 & 0x8) != 0) && ( (var6 & 0x4) == 0))
|
||||
{
|
||||
byte var7 = 4;
|
||||
int var8 = var7 + 1;
|
||||
byte var9 = 32;
|
||||
int var10 = var9 * var9;
|
||||
int var11 = var9 / 2;
|
||||
if ( (meta & 0x8) != 0 && (meta & 0x4) == 0) {
|
||||
final byte pos = 4;
|
||||
final int off = pos + 1;
|
||||
final byte dist = 32;
|
||||
final int dist2 = dist * dist;
|
||||
final int half = dist / 2;
|
||||
|
||||
if (this.adjacentTreeBlocks == null)
|
||||
{
|
||||
this.adjacentTreeBlocks = new int[var9 * var9 * var9];
|
||||
if (adjacentTreeBlocks == null) {
|
||||
adjacentTreeBlocks = new int[dist * dist * dist];
|
||||
}
|
||||
|
||||
if (world.checkChunksExist(x - var8, y - var8, z - var8, x + var8, y + var8, z + var8))
|
||||
{
|
||||
for (int var12 = -var7; var12 <= var7; var12++)
|
||||
{
|
||||
for (int var13 = -var7; var13 <= var7; var13++)
|
||||
{
|
||||
for (int var14 = -var7; var14 <= var7; var14++)
|
||||
{
|
||||
Block block = world.getBlock(x + var12, y + var13, z + var14);
|
||||
if (world.checkChunksExist(x - off, y - off, z - off, x + off, y + off, z + off)) {
|
||||
for (int i = -pos; i <= pos; i++) {
|
||||
for (int j = -pos; j <= pos; j++) {
|
||||
for (int k = -pos; k <= pos; k++) {
|
||||
final Block block = world.getBlock(x + i, y + j, z + k);
|
||||
|
||||
if ( (block != null) && (block.canSustainLeaves(world, x + var12, y + var13, z + var14)))
|
||||
{
|
||||
this.adjacentTreeBlocks[ ( (var12 + var11) * var10 + (var13 + var11) * var9 + var14
|
||||
+ var11)] = 0;
|
||||
if (block != null && block.canSustainLeaves(world, x + i, y + j, z + k)) {
|
||||
adjacentTreeBlocks[ (i + half) * dist2 + (j + half) * dist + k + half] = 0;
|
||||
}
|
||||
else if ( (block != null) && (block.isLeaves(world, x + var12, y + var13, z + var14)))
|
||||
{
|
||||
this.adjacentTreeBlocks[ ( (var12 + var11) * var10 + (var13 + var11) * var9 + var14
|
||||
+ var11)] = -2;
|
||||
else if (block != null && block.isLeaves(world, x + i, y + j, z + k)) {
|
||||
adjacentTreeBlocks[ (i + half) * dist2 + (j + half) * dist + k + half] = -2;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.adjacentTreeBlocks[ ( (var12 + var11) * var10 + (var13 + var11) * var9 + var14
|
||||
+ var11)] = -1;
|
||||
else {
|
||||
adjacentTreeBlocks[ (i + half) * dist2 + (j + half) * dist + k + half] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int var15 = 0;
|
||||
for (int var12 = 1; var12 <= 4; var12++)
|
||||
{
|
||||
for (int var13 = -var7; var13 <= var7; var13++)
|
||||
{
|
||||
for (int var14 = -var7; var14 <= var7; var14++)
|
||||
{
|
||||
for (var15 = -var7; var15 <= var7; var15++)
|
||||
{
|
||||
if (this.adjacentTreeBlocks[ ( (var13 + var11) * var10 + (var14 + var11) * var9 + var15
|
||||
+ var11)] != var12 - 1)
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
for (int j = -pos; j <= pos; j++) {
|
||||
for (int k = -pos; k <= pos; k++) {
|
||||
for (int l = -pos; l <= pos; l++) {
|
||||
if (adjacentTreeBlocks[ (j + half) * dist2 + (k + half) * dist + l + half] != i - 1) {
|
||||
continue;
|
||||
if (this.adjacentTreeBlocks[ ( (var13 + var11 - 1) * var10 + (var14 + var11) * var9 + var15
|
||||
+ var11)] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[ ( (var13 + var11 - 1) * var10 + (var14 + var11) * var9 + var15
|
||||
+ var11)] = var12;
|
||||
}
|
||||
if (adjacentTreeBlocks[ (j + half - 1) * dist2 + (k + half) * dist + l + half] == -2) {
|
||||
adjacentTreeBlocks[ (j + half - 1) * dist2 + (k + half) * dist + l + half] = i;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[ ( (var13 + var11 + 1) * var10 + (var14 + var11) * var9 + var15
|
||||
+ var11)] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[ ( (var13 + var11 + 1) * var10 + (var14 + var11) * var9 + var15
|
||||
+ var11)] = var12;
|
||||
if (adjacentTreeBlocks[ (j + half + 1) * dist2 + (k + half) * dist + l + half] == -2) {
|
||||
adjacentTreeBlocks[ (j + half + 1) * dist2 + (k + half) * dist + l + half] = i;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[ ( (var13 + var11) * var10 + (var14 + var11 - 1) * var9 + var15
|
||||
+ var11)] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[ ( (var13 + var11) * var10 + (var14 + var11 - 1) * var9 + var15
|
||||
+ var11)] = var12;
|
||||
if (adjacentTreeBlocks[ (j + half) * dist2 + (k + half - 1) * dist + l + half] == -2) {
|
||||
adjacentTreeBlocks[ (j + half) * dist2 + (k + half - 1) * dist + l + half] = i;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[ ( (var13 + var11) * var10 + (var14 + var11 + 1) * var9 + var15
|
||||
+ var11)] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[ ( (var13 + var11) * var10 + (var14 + var11 + 1) * var9 + var15
|
||||
+ var11)] = var12;
|
||||
if (adjacentTreeBlocks[ (j + half) * dist2 + (k + half + 1) * dist + l + half] == -2) {
|
||||
adjacentTreeBlocks[ (j + half) * dist2 + (k + half + 1) * dist + l + half] = i;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[ ( (var13 + var11) * var10 + (var14 + var11) * var9
|
||||
+ (var15 + var11 - 1))] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[ ( (var13 + var11) * var10 + (var14 + var11) * var9
|
||||
+ (var15 + var11 - 1))] = var12;
|
||||
if (adjacentTreeBlocks[ (j + half) * dist2 + (k + half) * dist + l + half - 1] == -2) {
|
||||
adjacentTreeBlocks[ (j + half) * dist2 + (k + half) * dist + l + half - 1] = i;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[ ( (var13 + var11) * var10 + (var14 + var11) * var9 + var15
|
||||
+ var11 + 1)] != -2)
|
||||
if (adjacentTreeBlocks[ (j + half) * dist2 + (k + half) * dist + l + half + 1] != -2) {
|
||||
continue;
|
||||
this.adjacentTreeBlocks[ ( (var13 + var11) * var10 + (var14 + var11) * var9 + var15 + var11
|
||||
+ 1)] = var12;
|
||||
}
|
||||
adjacentTreeBlocks[ (j + half) * dist2 + (k + half) * dist + l + half + 1] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int var12 = this.adjacentTreeBlocks[ (var11 * var10 + var11 * var9 + var11)];
|
||||
final int adj = adjacentTreeBlocks[half * dist2 + half * dist + half];
|
||||
|
||||
if (var12 >= 0)
|
||||
{
|
||||
world.setBlock(x, y, z, this, var6 & 0xFFFFFFF7, 3);
|
||||
if (adj >= 0) {
|
||||
world.setBlock(x, y, z, this, meta & 0xFFFFFFF7, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
removeLeaves(world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeLeaves (World world, int x, int y, int z)
|
||||
{
|
||||
private void removeLeaves (final World world, final int x, final int y, final int z) {
|
||||
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
public void dropBlockAsItemWithChance (World world, int x, int y, int z, int m, float f, int i)
|
||||
{
|
||||
if ( (!world.isRemote) && ( (m & 0x8) != 0) && ( (m & 0x4) == 0))
|
||||
{
|
||||
if ( ( (m & 0x1) == 0) && (world.rand.nextInt(50) == 0))
|
||||
{
|
||||
@Override
|
||||
public void dropBlockAsItemWithChance (final World world, final int x, final int y, final int z, final int m, final float f,
|
||||
final int i) {
|
||||
if (!world.isRemote && (m & 0x8) != 0 && (m & 0x4) == 0) {
|
||||
if ( (m & 0x1) == 0 && world.rand.nextInt(50) == 0) {
|
||||
dropBlockAsItem(world, x, y, z, new ItemStack(BlockRegistry.BlockWarpwoodSapling));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void harvestBlock (World world, EntityPlayer player, int x, int y, int z, int i)
|
||||
{
|
||||
@Override
|
||||
public void harvestBlock (final World world, final EntityPlayer player, final int x, final int y, final int z,
|
||||
final int i) {
|
||||
super.harvestBlock(world, player, x, y, z, i);
|
||||
}
|
||||
|
||||
public int damageDropped (int i)
|
||||
{
|
||||
@Override
|
||||
public int damageDropped (final int i) {
|
||||
return i & 0x1;
|
||||
}
|
||||
|
||||
public int quantityDropped (Random random)
|
||||
{
|
||||
@Override
|
||||
public int quantityDropped (final Random random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Item getItemDropped (int i, Random random, int i2)
|
||||
{
|
||||
@Override
|
||||
public Item getItemDropped (final int i, final Random random, final int i2) {
|
||||
return Item.getItemById(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeaves (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public boolean isLeaves (final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void beginLeavesDecay (World world, int x, int y, int z)
|
||||
{
|
||||
@Override
|
||||
public void beginLeavesDecay (final World world, final int x, final int y, final int z) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) | 0x8, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public int getBlockColor ()
|
||||
{
|
||||
public int getBlockColor () {
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
public ItemStack getPickBlock (MovingObjectPosition mop, World world, int x, int y, int z)
|
||||
{
|
||||
int m = world.getBlockMetadata(x, y, z);
|
||||
@Override
|
||||
public ItemStack getPickBlock (final MovingObjectPosition mop, final World world, final int x, final int y, final int z) {
|
||||
final int m = world.getBlockMetadata(x, y, z);
|
||||
return new ItemStack(this, 1, m & 0x1);
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderColor (int m)
|
||||
{
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public int colorMultiplier (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public int getRenderColor (final int m) {
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShearable (ItemStack stack, IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
@SideOnly (Side.CLIENT)
|
||||
public int colorMultiplier (final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShearable (final ItemStack stack, final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ArrayList<ItemStack> onSheared (ItemStack stack, IBlockAccess world, int x, int y, int z, int fortune)
|
||||
{
|
||||
ArrayList ret = new ArrayList();
|
||||
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 0x3));
|
||||
return ret;
|
||||
@Override
|
||||
public ArrayList<ItemStack> onSheared (final ItemStack stack, final IBlockAccess world, final int x, final int y,
|
||||
final int z, final int fortune) {
|
||||
final ArrayList drops = new ArrayList();
|
||||
drops.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 0x3));
|
||||
return drops;
|
||||
}
|
||||
|
||||
public int getFlammability (IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
@Override
|
||||
public int getFlammability (final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getFireSpreadSpeed (IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
@Override
|
||||
public int getFireSpreadSpeed (final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -18,73 +18,77 @@ import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.fx.particles.FXWisp;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
|
||||
public class BlockWarpwoodLog extends BlockRotatedPillar
|
||||
{
|
||||
IIcon top, side, knot;
|
||||
public class BlockWarpwoodLog extends BlockRotatedPillar {
|
||||
|
||||
public BlockWarpwoodLog ()
|
||||
{
|
||||
private IIcon top;
|
||||
private IIcon side;
|
||||
private IIcon knot;
|
||||
|
||||
public BlockWarpwoodLog () {
|
||||
super(Material.wood);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setHardness(2.5F);
|
||||
this.setStepSound(soundTypeWood);
|
||||
this.setBlockName("BlockWarpwoodLog");
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setHardness(2.5F);
|
||||
setStepSound(soundTypeWood);
|
||||
setBlockName("BlockWarpwoodLog");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
protected IIcon getTopIcon (int meta)
|
||||
{
|
||||
protected IIcon getTopIcon (final int meta) {
|
||||
return top;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
protected IIcon getSideIcon (int meta)
|
||||
{
|
||||
protected IIcon getSideIcon (final int meta) {
|
||||
return meta == 2 ? knot : side;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister ir)
|
||||
{
|
||||
public void registerBlockIcons (final IIconRegister ir) {
|
||||
side = ir.registerIcon("taintedmagic:BlockWarpwoodLog_side");
|
||||
top = ir.registerIcon("taintedmagic:BlockWarpwoodLog_top");
|
||||
knot = ir.registerIcon("taintedmagic:BlockWarpwoodLog_knot");
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBlockHardness (World world, int x, int y, int z)
|
||||
{
|
||||
if (world.getBlockMetadata(x, y, z) == 2) return 25.0F;
|
||||
public float getBlockHardness (final World world, final int x, final int y, final int z) {
|
||||
if (world.getBlockMetadata(x, y, z) == 2)
|
||||
return 25.0F;
|
||||
return super.getBlockHardness(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops (World world, int x, int y, int z, int meta, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
|
||||
if (meta == 2) drops.add(new ItemStack(ConfigItems.itemResource, world.rand.nextInt(5) + 1, 17));
|
||||
else drops.add(new ItemStack(this, 1, 0));
|
||||
public ArrayList<ItemStack> getDrops (final World world, final int x, final int y, final int z, final int meta,
|
||||
final int fortune) {
|
||||
final ArrayList<ItemStack> drops = new ArrayList<>();
|
||||
|
||||
if (meta == 2) {
|
||||
drops.add(new ItemStack(ConfigItems.itemResource, world.rand.nextInt(5) + 1, 17));
|
||||
}
|
||||
else {
|
||||
drops.add(new ItemStack(this, 1, 0));
|
||||
}
|
||||
return drops;
|
||||
}
|
||||
|
||||
public boolean addDestroyEffects (World world, int x, int y, int z, int meta, EffectRenderer ef)
|
||||
{
|
||||
if (meta == 2)
|
||||
{
|
||||
if (world.isRemote) particles(world, x, y, z);
|
||||
@Override
|
||||
public boolean addDestroyEffects (final World world, final int x, final int y, final int z, final int meta,
|
||||
final EffectRenderer ef) {
|
||||
if (meta == 2) {
|
||||
if (world.isRemote) {
|
||||
particles(world, x, y, z);
|
||||
}
|
||||
world.playSound(x + 0.5D, y + 0.5D, z + 0.5D, "thaumcraft:craftfail", 1.0F, 1.0F, false);
|
||||
}
|
||||
return super.addDestroyEffects(world, x, y, z, meta, ef);
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
private void particles (World world, int x, int y, int z)
|
||||
{
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
FXWisp fx = new FXWisp(world, x + 0.5D + (Math.random() - Math.random()) * 0.5D,
|
||||
private void particles (final World world, final int x, final int y, final int z) {
|
||||
for (int i = 0; i < 15; i++) {
|
||||
final FXWisp fx = new FXWisp(world, x + 0.5D + (Math.random() - Math.random()) * 0.5D,
|
||||
y + 0.5D + (Math.random() - Math.random()) * 0.5D, z + 0.5D + (Math.random() - Math.random()) * 0.5D,
|
||||
0.25F + (float) Math.random() * 0.25F, 5);
|
||||
|
||||
@@ -97,23 +101,23 @@ public class BlockWarpwoodLog extends BlockRotatedPillar
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canSustainLeaves (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
@Override
|
||||
public boolean canSustainLeaves (final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isWood (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
@Override
|
||||
public boolean isWood (final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getFlammability (IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
@Override
|
||||
public int getFlammability (final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getFireSpreadSpeed (IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
@Override
|
||||
public int getFireSpreadSpeed (final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -4,15 +4,14 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
|
||||
public class BlockWarpwoodPlanks extends Block
|
||||
{
|
||||
public BlockWarpwoodPlanks ()
|
||||
{
|
||||
public class BlockWarpwoodPlanks extends Block {
|
||||
|
||||
public BlockWarpwoodPlanks () {
|
||||
super(Material.wood);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setBlockName("BlockWarpwoodPlanks");
|
||||
this.setBlockTextureName("taintedmagic:BlockWarpwoodPlanks");
|
||||
this.setHardness(0.8F);
|
||||
this.setStepSound(soundTypeWood);
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setBlockName("BlockWarpwoodPlanks");
|
||||
setBlockTextureName("taintedmagic:BlockWarpwoodPlanks");
|
||||
setHardness(0.8F);
|
||||
setStepSound(soundTypeWood);
|
||||
}
|
||||
}
|
||||
@@ -15,55 +15,49 @@ import net.minecraft.world.World;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.world.WorldGenWarpwoodTree;
|
||||
|
||||
public class BlockWarpwoodSapling extends BlockSapling
|
||||
{
|
||||
public BlockWarpwoodSapling ()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setBlockName("BlockWarpwoodSapling");
|
||||
this.setStepSound(soundTypeGrass);
|
||||
public class BlockWarpwoodSapling extends BlockSapling {
|
||||
|
||||
public BlockWarpwoodSapling () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setBlockName("BlockWarpwoodSapling");
|
||||
setStepSound(soundTypeGrass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_149878_d (World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
public void func_149878_d (final World world, final int x, final int y, final int z, final Random random) {
|
||||
if (!world.isRemote) {
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
world.setBlockToAir(x, y, z);
|
||||
|
||||
WorldGenWarpwoodTree tree = new WorldGenWarpwoodTree(true, 7, 5);
|
||||
final WorldGenWarpwoodTree tree = new WorldGenWarpwoodTree(true, 7, 5);
|
||||
|
||||
if (!tree.generate(world, random, x, y, z)) world.setBlock(x, y, z, this, meta, 2);
|
||||
if (!tree.generate(world, random, x, y, z)) {
|
||||
world.setBlock(x, y, z, this, meta, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void getSubBlocks (Item item, CreativeTabs tab, List list)
|
||||
{
|
||||
public void getSubBlocks (final Item item, final CreativeTabs tab, final List list) {
|
||||
list.add(new ItemStack(this, 1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped (int i, Random random, int i2)
|
||||
{
|
||||
public Item getItemDropped (final int i, final Random random, final int i2) {
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister ir)
|
||||
{
|
||||
this.blockIcon = ir.registerIcon("taintedmagic:BlockWarpwoodSapling");
|
||||
public void registerBlockIcons (final IIconRegister ir) {
|
||||
blockIcon = ir.registerIcon("taintedmagic:BlockWarpwoodSapling");
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
return this.blockIcon;
|
||||
public IIcon getIcon (final int side, final int meta) {
|
||||
return blockIcon;
|
||||
}
|
||||
}
|
||||
@@ -15,79 +15,72 @@ import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.fx.particles.FXSparkle;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
public class TileLumos extends TileEntity
|
||||
{
|
||||
int ticksExisted;
|
||||
public class TileLumos extends TileEntity {
|
||||
|
||||
public TileLumos ()
|
||||
{
|
||||
public TileLumos () {
|
||||
}
|
||||
|
||||
public boolean canUpdate ()
|
||||
{
|
||||
@Override
|
||||
public boolean canUpdate () {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity ()
|
||||
{
|
||||
ticksExisted++;
|
||||
public void updateEntity () {
|
||||
final Block block = worldObj.getBlock(xCoord, yCoord, zCoord);
|
||||
final int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
|
||||
Block block = worldObj.getBlock(xCoord, yCoord, zCoord);
|
||||
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
if (block instanceof BlockLumos) {
|
||||
final EntityPlayer player = worldObj.getClosestPlayer(xCoord, yCoord, zCoord, 4);
|
||||
|
||||
if (block instanceof BlockLumos)
|
||||
{
|
||||
EntityPlayer player = worldObj.getClosestPlayer(xCoord, yCoord, zCoord, 4);
|
||||
|
||||
if (meta == 0 && worldObj.rand.nextInt(15) == 0)
|
||||
{
|
||||
if (worldObj.isRemote) spawnParticles();
|
||||
if ( (meta == 0 && worldObj.rand.nextInt(15) == 0) && worldObj.isRemote) {
|
||||
spawnParticles();
|
||||
}
|
||||
if ( (meta == 1 || meta == 2) && player == null)
|
||||
{
|
||||
if ( (meta == 1 || meta == 2) && player == null) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
else if (meta == 1 && player != null)
|
||||
{
|
||||
else if (meta == 1 && player != null) {
|
||||
if (player.getHeldItem() == null
|
||||
|| (player.getHeldItem() != null && ! (player.getHeldItem().getItem() instanceof ItemWandCasting)))
|
||||
|| player.getHeldItem() != null && ! (player.getHeldItem().getItem() instanceof ItemWandCasting)) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
else if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemWandCasting)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem();
|
||||
ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
}
|
||||
else if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemWandCasting) {
|
||||
final ItemStack stack = player.getHeldItem();
|
||||
final ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
|
||||
if (wand.getFocus(stack) == null
|
||||
|| (wand.getFocus(stack) != null && wand.getFocus(stack) != ItemRegistry.ItemFocusLumos))
|
||||
|| wand.getFocus(stack) != null && wand.getFocus(stack) != ItemRegistry.ItemFocusLumos) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (meta == 2 && player != null)
|
||||
{
|
||||
IInventory baub = BaublesApi.getBaubles(player);
|
||||
if (baub.getStackInSlot(1) == null && baub.getStackInSlot(2) == null)
|
||||
if (meta == 2 && player != null) {
|
||||
final IInventory baub = BaublesApi.getBaubles(player);
|
||||
if (baub.getStackInSlot(1) == null && baub.getStackInSlot(2) == null) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
else if ( (baub.getStackInSlot(1) != null && baub.getStackInSlot(2) == null)
|
||||
&& ! (baub.getStackInSlot(1).getItem() instanceof ItemLumosRing))
|
||||
}
|
||||
else if (baub.getStackInSlot(1) != null && baub.getStackInSlot(2) == null
|
||||
&& ! (baub.getStackInSlot(1).getItem() instanceof ItemLumosRing)) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
else if ( (baub.getStackInSlot(1) == null && baub.getStackInSlot(2) != null)
|
||||
&& ! (baub.getStackInSlot(2).getItem() instanceof ItemLumosRing))
|
||||
}
|
||||
else if (baub.getStackInSlot(1) == null && baub.getStackInSlot(2) != null
|
||||
&& ! (baub.getStackInSlot(2).getItem() instanceof ItemLumosRing)) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
else if ( (baub.getStackInSlot(1) != null && baub.getStackInSlot(2) != null)
|
||||
&& (! (baub.getStackInSlot(1).getItem() instanceof ItemLumosRing)
|
||||
&& ! (baub.getStackInSlot(2).getItem() instanceof ItemLumosRing)))
|
||||
}
|
||||
else if (baub.getStackInSlot(1) != null && baub.getStackInSlot(2) != null
|
||||
&& ! (baub.getStackInSlot(1).getItem() instanceof ItemLumosRing)
|
||||
&& ! (baub.getStackInSlot(2).getItem() instanceof ItemLumosRing)) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
void spawnParticles ()
|
||||
{
|
||||
FXSparkle fx = new FXSparkle(worldObj, (double) xCoord + 0.5D + (worldObj.rand.nextGaussian() * 0.1D),
|
||||
(double) yCoord + 0.5D + (worldObj.rand.nextGaussian() * 0.1D),
|
||||
(double) zCoord + 0.5D + (worldObj.rand.nextGaussian() * 0.1D), 1.75F, 6, 3 + worldObj.rand.nextInt(2));
|
||||
void spawnParticles () {
|
||||
final FXSparkle fx = new FXSparkle(worldObj, xCoord + 0.5D + worldObj.rand.nextGaussian() * 0.1D,
|
||||
yCoord + 0.5D + worldObj.rand.nextGaussian() * 0.1D, zCoord + 0.5D + worldObj.rand.nextGaussian() * 0.1D, 1.75F,
|
||||
6, 3 + worldObj.rand.nextInt(2));
|
||||
fx.slowdown = true;
|
||||
fx.setGravity(-0.5F);
|
||||
ParticleEngine.instance.addEffect(worldObj, fx);
|
||||
|
||||
@@ -2,9 +2,7 @@ package taintedmagic.common.entities;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
@@ -12,19 +10,18 @@ import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.common.entities.projectile.EntityEldritchOrb;
|
||||
|
||||
public class EntityDarkMatter extends EntityEldritchOrb
|
||||
{
|
||||
public class EntityDarkMatter extends EntityEldritchOrb {
|
||||
|
||||
private float dmg = 0.0F;
|
||||
private int enlarge;
|
||||
private boolean corrosive;
|
||||
|
||||
public EntityDarkMatter (World world)
|
||||
{
|
||||
public EntityDarkMatter (final World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityDarkMatter (World world, EntityLivingBase entity, float dmg, int enlarge, boolean corrosive)
|
||||
{
|
||||
public EntityDarkMatter (final World world, final EntityLivingBase entity, final float dmg, final int enlarge,
|
||||
final boolean corrosive) {
|
||||
super(world, entity);
|
||||
this.dmg = dmg;
|
||||
this.enlarge = enlarge;
|
||||
@@ -32,43 +29,30 @@ public class EntityDarkMatter extends EntityEldritchOrb
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRenderInPass (int pass)
|
||||
{
|
||||
public boolean shouldRenderInPass (final int pass) {
|
||||
return pass == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact (MovingObjectPosition mop)
|
||||
{
|
||||
if (!this.worldObj.isRemote && getThrower() != null)
|
||||
{
|
||||
double expand = 1.0D + (double) enlarge * 0.5D;
|
||||
protected void onImpact (final MovingObjectPosition mop) {
|
||||
if (!worldObj.isRemote && getThrower() != null) {
|
||||
final double expand = 1.5D + enlarge * 0.5D;
|
||||
System.out.println(expand);
|
||||
List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(getThrower(),
|
||||
this.boundingBox.expand(expand, expand, expand));
|
||||
final List<EntityLivingBase> list =
|
||||
worldObj.getEntitiesWithinAABBExcludingEntity(getThrower(), boundingBox.expand(expand, expand, expand));
|
||||
|
||||
for (Entity entity : list)
|
||||
{
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
((EntityLivingBase) entity).attackEntityFrom(DamageSource.causeIndirectMagicDamage(this, getThrower()),
|
||||
this.dmg);
|
||||
try
|
||||
{
|
||||
if (this.corrosive)
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.wither.id, 160, 1));
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.weakness.id, 160, 1));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
for (final EntityLivingBase entity : list) {
|
||||
if (mop.entityHit != null) {
|
||||
entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(this, getThrower()), dmg);
|
||||
if (corrosive) {
|
||||
entity.addPotionEffect(new PotionEffect(Potion.wither.id, 160, 1));
|
||||
}
|
||||
entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 160, 1));
|
||||
}
|
||||
}
|
||||
this.worldObj.playSoundAtEntity(this, "random.fizz", 0.5F,
|
||||
2.6F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.8F);
|
||||
this.ticksExisted = 100;
|
||||
this.worldObj.setEntityState(this, (byte) 16);
|
||||
worldObj.playSoundAtEntity(this, "random.fizz", 0.5F, 2.6F + (rand.nextFloat() - rand.nextFloat()) * 0.8F);
|
||||
ticksExisted = 100;
|
||||
worldObj.setEntityState(this, (byte) 16);
|
||||
}
|
||||
setDead();
|
||||
}
|
||||
|
||||
@@ -16,153 +16,132 @@ import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
|
||||
public class EntityDiffusion extends EntityThrowable
|
||||
{
|
||||
public class EntityDiffusion extends EntityThrowable {
|
||||
|
||||
public static final String TAG_DAMAGE = "dmg";
|
||||
|
||||
public boolean corrosive = false;
|
||||
public float dmg = 0.0F;
|
||||
|
||||
public EntityDiffusion (World world)
|
||||
{
|
||||
public EntityDiffusion (final World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityDiffusion (World world, EntityLivingBase entity, float scatter, float dmg, boolean corrosive)
|
||||
{
|
||||
public EntityDiffusion (final World world, final EntityLivingBase entity, final float scatter, final float dmg,
|
||||
final boolean corrosive) {
|
||||
super(world, entity);
|
||||
this.corrosive = corrosive;
|
||||
this.dmg = dmg;
|
||||
setThrowableHeading(this.motionX, this.motionY, this.motionZ, func_70182_d(), scatter);
|
||||
setThrowableHeading(motionX, motionY, motionZ, func_70182_d(), scatter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRenderInPass (int pass)
|
||||
{
|
||||
public boolean shouldRenderInPass (final int pass) {
|
||||
return pass == 1;
|
||||
}
|
||||
|
||||
protected float getGravityVelocity ()
|
||||
{
|
||||
@Override
|
||||
protected float getGravityVelocity () {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
protected float func_70182_d ()
|
||||
{
|
||||
@Override
|
||||
protected float func_70182_d () {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
public void handleHealthUpdate (byte b)
|
||||
{
|
||||
if (b == 16)
|
||||
{
|
||||
if (this.worldObj.isRemote)
|
||||
{
|
||||
float fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F;
|
||||
float fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F;
|
||||
float fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F;
|
||||
Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F,
|
||||
this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 5, true, 0.02F);
|
||||
@Override
|
||||
public void handleHealthUpdate (final byte b) {
|
||||
if (b == 16) {
|
||||
if (worldObj.isRemote) {
|
||||
final float fx = (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.3F;
|
||||
final float fy = (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.3F;
|
||||
final float fz = (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.3F;
|
||||
Thaumcraft.proxy.wispFX3(worldObj, posX + fx, posY + fy, posZ + fz, posX + fx * 8.0F, posY + fy * 8.0F,
|
||||
posZ + fz * 8.0F, 0.3F, 5, true, 0.02F);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
super.handleHealthUpdate(b);
|
||||
}
|
||||
}
|
||||
|
||||
public void onUpdate ()
|
||||
{
|
||||
if (this.ticksExisted > 20) setDead();
|
||||
|
||||
this.motionX *= 0.95D;
|
||||
this.motionY *= 0.95D;
|
||||
this.motionZ *= 0.95D;
|
||||
|
||||
if (this.onGround)
|
||||
{
|
||||
this.motionX *= 0.66D;
|
||||
this.motionY *= 0.66D;
|
||||
this.motionZ *= 0.66D;
|
||||
@Override
|
||||
public void onUpdate () {
|
||||
if (ticksExisted > 20) {
|
||||
setDead();
|
||||
}
|
||||
|
||||
motionX *= 0.95D;
|
||||
motionY *= 0.95D;
|
||||
motionZ *= 0.95D;
|
||||
|
||||
if (onGround) {
|
||||
motionX *= 0.66D;
|
||||
motionY *= 0.66D;
|
||||
motionZ *= 0.66D;
|
||||
}
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
public void writeSpawnData (ByteBuf buf)
|
||||
{
|
||||
buf.writeFloat(this.dmg);
|
||||
public void writeSpawnData (final ByteBuf buf) {
|
||||
buf.writeFloat(dmg);
|
||||
}
|
||||
|
||||
public void readSpawnData (ByteBuf buf)
|
||||
{
|
||||
this.dmg = buf.readFloat();
|
||||
public void readSpawnData (final ByteBuf buf) {
|
||||
dmg = buf.readFloat();
|
||||
}
|
||||
|
||||
protected void onImpact (MovingObjectPosition mop)
|
||||
{
|
||||
if (!this.worldObj.isRemote && getThrower() != null)
|
||||
{
|
||||
List entities =
|
||||
this.worldObj.getEntitiesWithinAABBExcludingEntity(getThrower(), this.boundingBox.expand(1.0D, 1.0D, 1.0D));
|
||||
@Override
|
||||
protected void onImpact (final MovingObjectPosition mop) {
|
||||
if (!worldObj.isRemote && getThrower() != null) {
|
||||
final List<EntityLivingBase> entities =
|
||||
worldObj.getEntitiesWithinAABBExcludingEntity(getThrower(), boundingBox.expand(1.0D, 1.0D, 1.0D));
|
||||
|
||||
for (int i = 0; i < entities.size(); i++)
|
||||
{
|
||||
Entity entity = (Entity) entities.get(i);
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
if (mop.entityHit != null)
|
||||
{
|
||||
((EntityLivingBase) entity).attackEntityFrom(DamageSource.causeIndirectMagicDamage(this, getThrower()),
|
||||
this.dmg);
|
||||
try
|
||||
{
|
||||
if (this.corrosive)
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.wither.id, 40, 1));
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.weakness.id, 40, 1));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
for (final EntityLivingBase entity : entities) {
|
||||
if (mop.entityHit != null) {
|
||||
entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(this, getThrower()), dmg);
|
||||
if (corrosive) {
|
||||
entity.addPotionEffect(new PotionEffect(Potion.wither.id, 40, 1));
|
||||
}
|
||||
entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 40, 1));
|
||||
}
|
||||
}
|
||||
this.worldObj.setEntityState(this, (byte) 16);
|
||||
worldObj.setEntityState(this, (byte) 16);
|
||||
}
|
||||
setDead();
|
||||
}
|
||||
|
||||
protected boolean canTriggerWalking ()
|
||||
{
|
||||
@Override
|
||||
protected boolean canTriggerWalking () {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public float getShadowSize ()
|
||||
{
|
||||
public float getShadowSize () {
|
||||
return 0.1F;
|
||||
}
|
||||
|
||||
public void writeEntityToNBT (NBTTagCompound tag)
|
||||
{
|
||||
@Override
|
||||
public void writeEntityToNBT (final NBTTagCompound tag) {
|
||||
super.writeEntityToNBT(tag);
|
||||
tag.setFloat(TAG_DAMAGE, this.dmg);
|
||||
tag.setFloat(TAG_DAMAGE, dmg);
|
||||
}
|
||||
|
||||
public void readEntityFromNBT (NBTTagCompound tag)
|
||||
{
|
||||
@Override
|
||||
public void readEntityFromNBT (final NBTTagCompound tag) {
|
||||
super.readEntityFromNBT(tag);
|
||||
this.dmg = tag.getInteger(TAG_DAMAGE);
|
||||
dmg = tag.getInteger(TAG_DAMAGE);
|
||||
}
|
||||
|
||||
public boolean canBeCollidedWith ()
|
||||
{
|
||||
@Override
|
||||
public boolean canBeCollidedWith () {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean attackEntityFrom (DamageSource dmg, float f)
|
||||
{
|
||||
@Override
|
||||
public boolean attackEntityFrom (final DamageSource dmg, final float f) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package taintedmagic.common.entities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
@@ -21,191 +22,168 @@ import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.lib.utils.EntityUtils;
|
||||
|
||||
/**
|
||||
* this class is based off of EntityHomingShard.class created by <Azanor> as
|
||||
* part of Thaumcraft 5
|
||||
* This class is based off of EntityHomingShard.class created by <Azanor> as part of Thaumcraft 5
|
||||
*/
|
||||
public class EntityHomingShard extends EntityThrowable implements IEntityAdditionalSpawnData
|
||||
{
|
||||
Class targetClass = null;
|
||||
boolean persistant = false;
|
||||
public class EntityHomingShard extends EntityThrowable implements IEntityAdditionalSpawnData {
|
||||
|
||||
int targetID = 0;
|
||||
EntityLivingBase target;
|
||||
private Class targetClass;
|
||||
private boolean persistent;
|
||||
private EntityLivingBase target;
|
||||
|
||||
Material[] mats = { Material.plants, Material.air, Material.leaves, Material.portal, Material.vine, Material.web };
|
||||
private static final Material[] MATS =
|
||||
{ Material.plants, Material.air, Material.leaves, Material.portal, Material.vine, Material.web };
|
||||
|
||||
public EntityHomingShard (World world)
|
||||
{
|
||||
public EntityHomingShard (final World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityHomingShard (World world, EntityLivingBase thrower, EntityLivingBase target, int strength, boolean b)
|
||||
{
|
||||
public EntityHomingShard (final World world, final EntityLivingBase thrower, final EntityLivingBase target,
|
||||
final int strength, final boolean persistent) {
|
||||
super(world, thrower);
|
||||
this.target = target;
|
||||
this.targetClass = target.getClass();
|
||||
this.persistant = b;
|
||||
this.persistent = persistent;
|
||||
setStrength(strength);
|
||||
Vec3 vec = thrower.getLookVec();
|
||||
final Vec3 vec = thrower.getLookVec();
|
||||
setLocationAndAngles(thrower.posX + vec.xCoord / 2.0D, thrower.posY + thrower.getEyeHeight() + vec.yCoord / 2.0D,
|
||||
thrower.posZ + vec.zCoord / 2.0D, thrower.rotationYaw, thrower.rotationPitch);
|
||||
float f = 0.5F;
|
||||
float ry = thrower.rotationYaw + (this.rand.nextFloat() - this.rand.nextFloat()) * 60.0F;
|
||||
float rp = thrower.rotationPitch + (this.rand.nextFloat() - this.rand.nextFloat()) * 60.0F;
|
||||
this.motionX = (-MathHelper.sin(ry / 180.0F * (float) Math.PI) * MathHelper.cos(rp / 180.0F * (float) Math.PI) * f);
|
||||
this.motionZ = (MathHelper.cos(ry / 180.0F * (float) Math.PI) * MathHelper.cos(rp / 180.0F * (float) Math.PI) * f);
|
||||
this.motionY = (-MathHelper.sin(rp / 180.0F * (float) Math.PI) * f);
|
||||
final float f = 0.5F;
|
||||
final float ry = thrower.rotationYaw + (rand.nextFloat() - rand.nextFloat()) * 60.0F;
|
||||
final float rp = thrower.rotationPitch + (rand.nextFloat() - rand.nextFloat()) * 60.0F;
|
||||
motionX = -MathHelper.sin(ry / 180.0F * (float) Math.PI) * MathHelper.cos(rp / 180.0F * (float) Math.PI) * f;
|
||||
motionZ = MathHelper.cos(ry / 180.0F * (float) Math.PI) * MathHelper.cos(rp / 180.0F * (float) Math.PI) * f;
|
||||
motionY = -MathHelper.sin(rp / 180.0F * (float) Math.PI) * f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRenderInPass (int pass)
|
||||
{
|
||||
public boolean shouldRenderInPass (final int pass) {
|
||||
return pass == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void entityInit ()
|
||||
{
|
||||
public void entityInit () {
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(17, (byte) 0);
|
||||
dataWatcher.addObject(17, (byte) 0);
|
||||
}
|
||||
|
||||
public void setStrength (int strength)
|
||||
{
|
||||
this.dataWatcher.updateObject(17, Byte.valueOf((byte) strength));
|
||||
public void setStrength (final int strength) {
|
||||
dataWatcher.updateObject(17, Byte.valueOf((byte) strength));
|
||||
}
|
||||
|
||||
public int getStrength ()
|
||||
{
|
||||
return this.dataWatcher.getWatchableObjectByte(17);
|
||||
public int getStrength () {
|
||||
return dataWatcher.getWatchableObjectByte(17);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getGravityVelocity ()
|
||||
{
|
||||
protected float getGravityVelocity () {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSpawnData (ByteBuf buf)
|
||||
{
|
||||
public void writeSpawnData (final ByteBuf buf) {
|
||||
int id = -1;
|
||||
if (this.target != null) id = this.target.getEntityId();
|
||||
if (target != null) {
|
||||
id = target.getEntityId();
|
||||
}
|
||||
buf.writeInt(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSpawnData (ByteBuf buf)
|
||||
{
|
||||
int id = buf.readInt();
|
||||
try
|
||||
{
|
||||
if (id >= 0) this.target = ((EntityLivingBase) this.worldObj.getEntityByID(id));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
public void readSpawnData (final ByteBuf buf) {
|
||||
final int id = buf.readInt();
|
||||
if (id >= 0) {
|
||||
target = (EntityLivingBase) worldObj.getEntityByID(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact (MovingObjectPosition mop)
|
||||
{
|
||||
if (!this.worldObj.isRemote && mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY
|
||||
&& (getThrower() == null || (getThrower() != null && mop.entityHit != getThrower())))
|
||||
{
|
||||
protected void onImpact (final MovingObjectPosition mop) {
|
||||
if (!worldObj.isRemote && mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY
|
||||
&& (getThrower() == null || getThrower() != null && mop.entityHit != getThrower())) {
|
||||
mop.entityHit.attackEntityFrom(DamageSource.causeIndirectMagicDamage(this, getThrower()),
|
||||
2.0F + getStrength() * 0.5F);
|
||||
this.worldObj.playSoundAtEntity(this, "thaumcraft:zap", 1.0F,
|
||||
1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
|
||||
this.worldObj.setEntityState(this, (byte) 16);
|
||||
worldObj.playSoundAtEntity(this, "thaumcraft:zap", 1.0F, 1.0F + (rand.nextFloat() - rand.nextFloat()) * 0.2F);
|
||||
worldObj.setEntityState(this, (byte) 16);
|
||||
setDead();
|
||||
}
|
||||
|
||||
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
Block block = this.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ);
|
||||
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
final Block block = worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ);
|
||||
|
||||
List<Material> whitelisted = new ArrayList<Material>(mats.length);
|
||||
for (int i = 0; i < mats.length; i++)
|
||||
whitelisted.add(mats[i]);
|
||||
final List<Material> whitelisted = new ArrayList<>(MATS.length);
|
||||
Collections.addAll(whitelisted, MATS);
|
||||
|
||||
if (!whitelisted.contains(block.getMaterial()))
|
||||
{
|
||||
this.motionZ *= -0.8D;
|
||||
this.motionX *= -0.8D;
|
||||
this.motionY *= -0.8D;
|
||||
if (!whitelisted.contains(block.getMaterial())) {
|
||||
motionZ *= -0.8D;
|
||||
motionX *= -0.8D;
|
||||
motionY *= -0.8D;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void handleHealthUpdate (byte b)
|
||||
{
|
||||
if (b == 16) Thaumcraft.proxy.burst(worldObj, this.posX, this.posY, this.posZ, 0.3F);
|
||||
else super.handleHealthUpdate(b);
|
||||
public void handleHealthUpdate (final byte b) {
|
||||
if (b == 16) {
|
||||
Thaumcraft.proxy.burst(worldObj, posX, posY, posZ, 0.3F);
|
||||
}
|
||||
else {
|
||||
super.handleHealthUpdate(b);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate ()
|
||||
{
|
||||
double motion = Math.abs(this.motionX) + Math.abs(this.motionY) + Math.abs(this.motionZ);
|
||||
if (motion > 0.0D && this.worldObj.isRemote) Thaumcraft.proxy.sparkle(
|
||||
(float) this.posX + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.25F,
|
||||
(float) this.posY + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.25F,
|
||||
(float) this.posZ + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.25F, 0.5F, 0, 0.0F);
|
||||
public void onUpdate () {
|
||||
final double motion = Math.abs(motionX) + Math.abs(motionY) + Math.abs(motionZ);
|
||||
if (motion > 0.0D && worldObj.isRemote) {
|
||||
Thaumcraft.proxy.sparkle((float) posX + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.25F,
|
||||
(float) posY + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.25F,
|
||||
(float) posZ + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.25F, 0.5F, 0, 0.0F);
|
||||
}
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.persistant
|
||||
&& (this.target == null || this.target.isDead || this.target.getDistanceSqToEntity(this) > 1250.0D))
|
||||
{
|
||||
ArrayList<Entity> ents = EntityUtils.getEntitiesInRange(this.worldObj, this.posX, this.posY, this.posZ, this,
|
||||
this.targetClass, 16.0D);
|
||||
if (!worldObj.isRemote) {
|
||||
if (persistent && (target == null || target.isDead || target.getDistanceSqToEntity(this) > 1250.0D)) {
|
||||
final ArrayList<Entity> ents =
|
||||
EntityUtils.getEntitiesInRange(worldObj, posX, posY, posZ, this, targetClass, 16.0D);
|
||||
|
||||
for (Entity entity : ents)
|
||||
{
|
||||
for (final Entity entity : ents) {
|
||||
if (entity instanceof EntityLivingBase && !entity.isDead
|
||||
&& (getThrower() == null || entity.getEntityId() != getThrower().getEntityId()))
|
||||
{
|
||||
this.target = ((EntityLivingBase) entity);
|
||||
&& (getThrower() == null || entity.getEntityId() != getThrower().getEntityId())) {
|
||||
target = (EntityLivingBase) entity;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.target == null || this.target.isDead)
|
||||
{
|
||||
this.worldObj.setEntityState(this, (byte) 16);
|
||||
if (target == null || target.isDead) {
|
||||
worldObj.setEntityState(this, (byte) 16);
|
||||
setDead();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.ticksExisted > 300)
|
||||
{
|
||||
this.worldObj.setEntityState(this, (byte) 16);
|
||||
if (ticksExisted > 300) {
|
||||
worldObj.setEntityState(this, (byte) 16);
|
||||
setDead();
|
||||
}
|
||||
|
||||
if (this.ticksExisted % 10 == 0 && this.target != null && !this.target.isDead)
|
||||
{
|
||||
double d = getDistanceToEntity(this.target);
|
||||
double dx = this.target.posX - this.posX;
|
||||
double dy = this.target.boundingBox.minY + this.target.height * 0.6D - this.posY;
|
||||
double dz = this.target.posZ - this.posZ;
|
||||
if (ticksExisted % 10 == 0 && target != null && !target.isDead) {
|
||||
final double d = getDistanceToEntity(target);
|
||||
double dx = target.posX - posX;
|
||||
double dy = target.boundingBox.minY + target.height * 0.6D - posY;
|
||||
double dz = target.posZ - posZ;
|
||||
dx /= d;
|
||||
dy /= d;
|
||||
dz /= d;
|
||||
|
||||
this.motionX = dx;
|
||||
this.motionY = dy;
|
||||
this.motionZ = dz;
|
||||
motionX = dx;
|
||||
motionY = dy;
|
||||
motionZ = dz;
|
||||
|
||||
this.worldObj.playSoundAtEntity(this, "taintedmagic:shard", 0.1F, 2.0F * this.worldObj.rand.nextFloat());
|
||||
worldObj.playSoundAtEntity(this, "taintedmagic:shard", 0.1F, 2.0F * worldObj.rand.nextFloat());
|
||||
}
|
||||
this.motionX *= 0.85D;
|
||||
this.motionY *= 0.85D;
|
||||
this.motionZ *= 0.85D;
|
||||
motionX *= 0.85D;
|
||||
motionY *= 0.85D;
|
||||
motionZ *= 0.85D;
|
||||
}
|
||||
}
|
||||
@@ -4,27 +4,22 @@ import net.minecraftforge.common.config.Configuration;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import thaumcraft.api.wands.FocusUpgradeType;
|
||||
|
||||
public class ConfigHandler
|
||||
{
|
||||
public class ConfigHandler {
|
||||
|
||||
public static Configuration config;
|
||||
|
||||
public static boolean NOTIFY_UPDATE = true;
|
||||
|
||||
public static boolean RESEARCH_TAGS = true;
|
||||
public static boolean CUSTOM_RESEARCH_TAB_BACK = false;
|
||||
|
||||
public static double MAGE_MACE_DMG_INC_BASE = 8.0D;
|
||||
|
||||
public static float WARP_WAND_REFRESH_BASE = 10000.0F;
|
||||
|
||||
public static int SANITY_UPGRADE_ID = 64;
|
||||
public static int ANTIBODY_UPGRADE_ID = 65;
|
||||
public static int CORROSIVE_UPGRADE_ID = 66;
|
||||
public static int PERSISTENT_UPGRADE_ID = 67;
|
||||
public static int DIFFUSION_UPGRADE_ID = 68;
|
||||
|
||||
public static void initConfig ()
|
||||
{
|
||||
public static void initConfig () {
|
||||
TaintedMagic.logger.info("Loading config...");
|
||||
|
||||
config.load();
|
||||
@@ -38,7 +33,7 @@ public class ConfigHandler
|
||||
CUSTOM_RESEARCH_TAB_BACK = config.getBoolean("CUSTOM_RESEARCH_TAB_BACK", "research", false,
|
||||
"Setting this to true will bring back the old Tainted Magic research tab background.");
|
||||
|
||||
MAGE_MACE_DMG_INC_BASE = (double) config.getFloat("MAGE_MACE_DMG_INC_BASE", "wands_and_foci", 8.0F, 1.0F, 100.0F,
|
||||
MAGE_MACE_DMG_INC_BASE = config.getFloat("MAGE_MACE_DMG_INC_BASE", "wands_and_foci", 8.0F, 1.0F, 100.0F,
|
||||
"Defines the base amount of damage to increase wand / staff attack damage by "
|
||||
+ "when the Mage's Mace focus is equipped.");
|
||||
|
||||
|
||||
@@ -3,13 +3,10 @@ package taintedmagic.common.handler;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import baubles.api.BaublesApi;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -42,16 +39,12 @@ import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import thaumcraft.common.lib.network.PacketHandler;
|
||||
import thaumcraft.common.lib.network.playerdata.PacketResearchComplete;
|
||||
|
||||
public class TMEventHandler
|
||||
{
|
||||
Random random = new Random();
|
||||
public class TMEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerTick (LivingEvent.LivingUpdateEvent event)
|
||||
{
|
||||
if (event.entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.entity;
|
||||
public void playerTick (final LivingEvent.LivingUpdateEvent event) {
|
||||
if (event.entity instanceof EntityPlayer) {
|
||||
final EntityPlayer player = (EntityPlayer) event.entity;
|
||||
|
||||
repairItems(player);
|
||||
createLumos(player);
|
||||
@@ -62,14 +55,14 @@ public class TMEventHandler
|
||||
/**
|
||||
* Repair "Voidtouched" items
|
||||
*/
|
||||
public void repairItems (EntityPlayer player)
|
||||
{
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack stack = player.inventory.getStackInSlot(i);
|
||||
public void repairItems (final EntityPlayer player) {
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
final ItemStack stack = player.inventory.getStackInSlot(i);
|
||||
if (!player.worldObj.isRemote && stack != null && stack.stackTagCompound != null
|
||||
&& stack.stackTagCompound.getBoolean("voidtouched") && stack.isItemDamaged())
|
||||
if (player.ticksExisted % 20 == 0) stack.setItemDamage(stack.getItemDamage() - 1);
|
||||
if (player.ticksExisted % 20 == 0) {
|
||||
stack.setItemDamage(stack.getItemDamage() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,54 +70,49 @@ public class TMEventHandler
|
||||
* Create Lumos lightsource blocks when the player is holding a wand or staff
|
||||
* with the Lumos focus equipped or when the Lumos ring is equipped.
|
||||
*/
|
||||
public void createLumos (EntityPlayer player)
|
||||
{
|
||||
int x = (int) Math.floor(player.posX);
|
||||
int y = (int) Math.floor(player.posY) + 1;
|
||||
int z = (int) Math.floor(player.posZ);
|
||||
public void createLumos (final EntityPlayer player) {
|
||||
final int x = (int) Math.floor(player.posX);
|
||||
final int y = (int) Math.floor(player.posY) + 1;
|
||||
final int z = (int) Math.floor(player.posZ);
|
||||
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemWandCasting)
|
||||
{
|
||||
ItemStack held = player.getHeldItem();
|
||||
ItemWandCasting wand = (ItemWandCasting) held.getItem();
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemWandCasting) {
|
||||
final ItemStack held = player.getHeldItem();
|
||||
final ItemWandCasting wand = (ItemWandCasting) held.getItem();
|
||||
|
||||
if (wand.getFocus(held) != null && wand.getFocus(held) == ItemRegistry.ItemFocusLumos && !player.worldObj.isRemote
|
||||
&& player.worldObj.isAirBlock(x, y, z))
|
||||
&& player.worldObj.isAirBlock(x, y, z)) {
|
||||
player.worldObj.setBlock(x, y, z, BlockRegistry.BlockLumos, 1, 3);
|
||||
}
|
||||
}
|
||||
|
||||
IInventory baub = BaublesApi.getBaubles(player);
|
||||
if ( (baub.getStackInSlot(1) != null && baub.getStackInSlot(1).getItem() instanceof ItemLumosRing)
|
||||
|| (baub.getStackInSlot(2) != null && baub.getStackInSlot(2).getItem() instanceof ItemLumosRing)
|
||||
&& !player.worldObj.isRemote && player.worldObj.isAirBlock(x, y, z))
|
||||
final IInventory baub = BaublesApi.getBaubles(player);
|
||||
if (baub.getStackInSlot(1) != null && baub.getStackInSlot(1).getItem() instanceof ItemLumosRing
|
||||
|| baub.getStackInSlot(2) != null && baub.getStackInSlot(2).getItem() instanceof ItemLumosRing
|
||||
&& !player.worldObj.isRemote && player.worldObj.isAirBlock(x, y, z)) {
|
||||
player.worldObj.setBlock(x, y, z, BlockRegistry.BlockLumos, 2, 3);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Some hacky code to make the Mage's Mace work...
|
||||
*/
|
||||
public void modifyAttackDamage (EntityPlayer player)
|
||||
{
|
||||
if (!player.worldObj.isRemote)
|
||||
{
|
||||
IInventory inv = player.inventory;
|
||||
public void modifyAttackDamage (final EntityPlayer player) {
|
||||
if (!player.worldObj.isRemote) {
|
||||
final IInventory inv = player.inventory;
|
||||
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++)
|
||||
{
|
||||
if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).getItem() instanceof ItemWandCasting)
|
||||
{
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
ItemWandCasting wand = (ItemWandCasting) inv.getStackInSlot(i).getItem();
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).getItem() instanceof ItemWandCasting) {
|
||||
final ItemStack stack = inv.getStackInSlot(i);
|
||||
final ItemWandCasting wand = (ItemWandCasting) inv.getStackInSlot(i).getItem();
|
||||
|
||||
if (wand.getFocus(stack) != null && wand.getFocus(stack) == ItemRegistry.ItemFocusMageMace
|
||||
&& wand.getRod(stack) instanceof WandRod)
|
||||
{
|
||||
NBTTagList tags = new NBTTagList();
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
&& wand.getRod(stack) instanceof WandRod) {
|
||||
final NBTTagList tags = new NBTTagList();
|
||||
final NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName());
|
||||
|
||||
UUID uuid = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
AttributeModifier am = new AttributeModifier(uuid, "Weapon modifier",
|
||||
final UUID uuid = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
final AttributeModifier am = new AttributeModifier(uuid, "Weapon modifier",
|
||||
ConfigHandler.MAGE_MACE_DMG_INC_BASE + wand.getFocusPotency(stack), 0);
|
||||
|
||||
tag.setString("Name", am.getName());
|
||||
@@ -136,23 +124,20 @@ public class TMEventHandler
|
||||
tags.appendTag(tag);
|
||||
stack.stackTagCompound.setTag("AttributeModifiers", tags);
|
||||
}
|
||||
else if (wand.getRod(stack) instanceof WandRod)
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
{
|
||||
else if (wand.getRod(stack) instanceof WandRod) {
|
||||
if (!stack.hasTagCompound()) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
stack.stackTagCompound.removeTag("AttributeModifiers");
|
||||
}
|
||||
if (wand.getFocus(stack) != null && wand.getFocus(stack) == ItemRegistry.ItemFocusMageMace
|
||||
&& wand.getRod(stack) instanceof StaffRod)
|
||||
{
|
||||
NBTTagList tags = new NBTTagList();
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
&& wand.getRod(stack) instanceof StaffRod) {
|
||||
final NBTTagList tags = new NBTTagList();
|
||||
final NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName());
|
||||
|
||||
UUID uuid = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
AttributeModifier am = new AttributeModifier(uuid, "Weapon modifier",
|
||||
final UUID uuid = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
final AttributeModifier am = new AttributeModifier(uuid, "Weapon modifier",
|
||||
5.0D + ConfigHandler.MAGE_MACE_DMG_INC_BASE + wand.getFocusPotency(stack), 0);
|
||||
|
||||
tag.setString("Name", am.getName());
|
||||
@@ -164,14 +149,13 @@ public class TMEventHandler
|
||||
tags.appendTag(tag);
|
||||
stack.stackTagCompound.setTag("AttributeModifiers", tags);
|
||||
}
|
||||
else if (wand.getRod(stack) instanceof StaffRod)
|
||||
{
|
||||
NBTTagList tags = new NBTTagList();
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
else if (wand.getRod(stack) instanceof StaffRod) {
|
||||
final NBTTagList tags = new NBTTagList();
|
||||
final NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName());
|
||||
|
||||
UUID uuid = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
AttributeModifier am = new AttributeModifier(uuid, "Weapon modifier", 6.0D, 0);
|
||||
final UUID uuid = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
final AttributeModifier am = new AttributeModifier(uuid, "Weapon modifier", 6.0D, 0);
|
||||
|
||||
tag.setString("Name", am.getName());
|
||||
tag.setDouble("Amount", am.getAmount());
|
||||
@@ -188,44 +172,42 @@ public class TMEventHandler
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void entityAttacked (LivingAttackEvent event)
|
||||
{
|
||||
if (event.source.getEntity() instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
public void entityAttacked (final LivingAttackEvent event) {
|
||||
if (event.source.getEntity() instanceof EntityPlayer) {
|
||||
final EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
|
||||
/**
|
||||
* Consume vis for Mage's Mace hits
|
||||
*/
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemWandCasting)
|
||||
{
|
||||
ItemStack held = player.getHeldItem();
|
||||
ItemWandCasting wand = (ItemWandCasting) held.getItem();
|
||||
ItemFocusBasic focus = wand.getFocus(held);
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemWandCasting) {
|
||||
final ItemStack held = player.getHeldItem();
|
||||
final ItemWandCasting wand = (ItemWandCasting) held.getItem();
|
||||
final ItemFocusBasic focus = wand.getFocus(held);
|
||||
|
||||
if (focus != null && focus instanceof ItemFocusMageMace)
|
||||
{
|
||||
if (wand.consumeAllVis(held, player, focus.getVisCost(held), true, false));
|
||||
else event.setCanceled(true);
|
||||
if (focus != null && focus instanceof ItemFocusMageMace) {
|
||||
if (wand.consumeAllVis(held, player, focus.getVisCost(held), true, false)) {
|
||||
;
|
||||
}
|
||||
else {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill phials with blood when an entity is hit using the Hollow Dagger
|
||||
*/
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemHollowDagger)
|
||||
{
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++)
|
||||
{
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemHollowDagger) {
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
if (player.inventory.getStackInSlot(i) != null
|
||||
&& player.inventory.getStackInSlot(i).getItem() instanceof ItemEssence
|
||||
&& player.inventory.getStackInSlot(i).getItemDamage() == 0)
|
||||
{
|
||||
&& player.inventory.getStackInSlot(i).getItemDamage() == 0) {
|
||||
player.inventory.decrStackSize(i, 1);
|
||||
|
||||
if (player.inventory.addItemStackToInventory(new ItemStack(ItemRegistry.ItemCrimsonBlood)) == false)
|
||||
if (!player.worldObj.isRemote)
|
||||
player.entityDropItem(new ItemStack(ItemRegistry.ItemCrimsonBlood), 2.0F);
|
||||
if (!player.inventory.addItemStackToInventory(new ItemStack(ItemRegistry.ItemCrimsonBlood))
|
||||
&& !player.worldObj.isRemote) {
|
||||
player.entityDropItem(new ItemStack(ItemRegistry.ItemCrimsonBlood), 2.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -236,54 +218,41 @@ public class TMEventHandler
|
||||
* Update notifications
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public void playerLoggedIn (PlayerEvent.PlayerLoggedInEvent event)
|
||||
{
|
||||
if (UpdateHandler.show) event.player.addChatMessage(new ChatComponentText(UpdateHandler.updateStatus));
|
||||
public void playerLoggedIn (final PlayerEvent.PlayerLoggedInEvent event) {
|
||||
if (UpdateHandler.updateStatus != null) {
|
||||
event.player.addChatMessage(new ChatComponentText(UpdateHandler.updateStatus));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect when the player crafts a Shard of Creation
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public void itemCrafted (ItemCraftedEvent event)
|
||||
{
|
||||
if (event.crafting.getItem() == ItemRegistry.ItemMaterial && event.crafting.getItemDamage() == 5)
|
||||
public void itemCrafted (final ItemCraftedEvent event) {
|
||||
if (event.crafting.getItem() == ItemRegistry.ItemMaterial && event.crafting.getItemDamage() == 5) {
|
||||
giveResearch(event.player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Give the player the Creation research upon crafting the Shard of Creation
|
||||
*/
|
||||
public void giveResearch (EntityPlayer player)
|
||||
{
|
||||
if (!player.worldObj.isRemote)
|
||||
{
|
||||
if (!ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "CREATION")
|
||||
&& ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "CREATIONSHARD"))
|
||||
{
|
||||
Thaumcraft.proxy.getResearchManager().completeResearch(player, "CREATION");
|
||||
PacketHandler.INSTANCE.sendTo(new PacketResearchComplete("CREATION"), (EntityPlayerMP) player);
|
||||
player.addChatMessage(new ChatComponentText(
|
||||
EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("text.creation")));
|
||||
player.playSound("thaumcraft:wind", 1.0F, 5.0F);
|
||||
public void giveResearch (final EntityPlayer player) {
|
||||
if (!player.worldObj.isRemote && (!ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "CREATION")
|
||||
&& ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "CREATIONSHARD"))) {
|
||||
Thaumcraft.proxy.getResearchManager().completeResearch(player, "CREATION");
|
||||
PacketHandler.INSTANCE.sendTo(new PacketResearchComplete("CREATION"), (EntityPlayerMP) player);
|
||||
player.addChatMessage(
|
||||
new ChatComponentText(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("text.creation")));
|
||||
player.playSound("thaumcraft:wind", 1.0F, 5.0F);
|
||||
|
||||
if (!ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "OUTERREV")
|
||||
&& ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "CREATION"))
|
||||
{
|
||||
Thaumcraft.proxy.getResearchManager().completeResearch(player, "OUTERREV");
|
||||
PacketHandler.INSTANCE.sendTo(new PacketResearchComplete("OUTERREV"), (EntityPlayerMP) player);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(Potion.blindness.id, 80, 0));
|
||||
player.addPotionEffect(new PotionEffect(Config.potionBlurredID, 200, 0));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (!ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "OUTERREV")
|
||||
&& ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "CREATION")) {
|
||||
Thaumcraft.proxy.getResearchManager().completeResearch(player, "OUTERREV");
|
||||
PacketHandler.INSTANCE.sendTo(new PacketResearchComplete("OUTERREV"), (EntityPlayerMP) player);
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(Potion.blindness.id, 80, 0));
|
||||
player.addPotionEffect(new PotionEffect(Config.potionBlurredID, 200, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,18 +260,15 @@ public class TMEventHandler
|
||||
* Modify certain tooltips
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public void itemTooltip (ItemTooltipEvent event)
|
||||
{
|
||||
if (event.itemStack.getItem() instanceof ItemFocusMageMace)
|
||||
{
|
||||
if (event.toolTip.contains(StatCollector.translateToLocal("item.Focus.cost1")))
|
||||
{
|
||||
event.toolTip.remove(StatCollector.translateToLocal("item.Focus.cost1"));
|
||||
event.toolTip.add(1, StatCollector.translateToLocal("item.Focus.cost3"));
|
||||
}
|
||||
public void itemTooltip (final ItemTooltipEvent event) {
|
||||
if (event.itemStack.getItem() instanceof ItemFocusMageMace
|
||||
&& event.toolTip.contains(StatCollector.translateToLocal("item.Focus.cost1"))) {
|
||||
event.toolTip.remove(StatCollector.translateToLocal("item.Focus.cost1"));
|
||||
event.toolTip.add(1, StatCollector.translateToLocal("item.Focus.cost3"));
|
||||
}
|
||||
|
||||
if (event.itemStack.stackTagCompound != null && event.itemStack.stackTagCompound.getBoolean("voidtouched"))
|
||||
if (event.itemStack.stackTagCompound != null && event.itemStack.stackTagCompound.getBoolean("voidtouched")) {
|
||||
event.toolTip.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("text.voidtouched"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package taintedmagic.common.handler;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Scanner;
|
||||
|
||||
@@ -7,51 +9,40 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.lib.LibInfo;
|
||||
|
||||
public class UpdateHandler
|
||||
{
|
||||
public class UpdateHandler {
|
||||
private static String currentVersion = LibInfo.VERSION;
|
||||
private static String newestVersion;
|
||||
public static String updateStatus = null;
|
||||
public static boolean show = false;
|
||||
|
||||
public static void checkForUpdate ()
|
||||
{
|
||||
public static void checkForUpdate () {
|
||||
getNewestVersion();
|
||||
|
||||
if (newestVersion != null)
|
||||
{
|
||||
if (newestVersion.equalsIgnoreCase(currentVersion))
|
||||
{
|
||||
show = false;
|
||||
if (newestVersion != null) {
|
||||
if (newestVersion.equalsIgnoreCase(currentVersion)) {
|
||||
}
|
||||
else if (!newestVersion.equalsIgnoreCase(currentVersion))
|
||||
{
|
||||
show = true;
|
||||
updateStatus = (EnumChatFormatting.RED + "Tainted Magic is out of date! The latest version is "
|
||||
+ EnumChatFormatting.GREEN + newestVersion);
|
||||
TaintedMagic.logger.warn("Mod out of date! You're still running " + currentVersion + " ... the latest version is "
|
||||
+ newestVersion);
|
||||
else if (!newestVersion.equalsIgnoreCase(currentVersion)) {
|
||||
updateStatus = EnumChatFormatting.RED + "Tainted Magic is out of date! The latest version is "
|
||||
+ EnumChatFormatting.GREEN + newestVersion;
|
||||
TaintedMagic.logger.warn("Mod out of date! You're still running {} ... the latest version is {}",
|
||||
currentVersion, newestVersion);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
show = true;
|
||||
updateStatus = (EnumChatFormatting.RED + "Tainted Magic failed to connect to the update server!");
|
||||
else {
|
||||
updateStatus = EnumChatFormatting.RED + "Tainted Magic failed to connect to the update server!";
|
||||
}
|
||||
}
|
||||
|
||||
private static void getNewestVersion ()
|
||||
{
|
||||
try
|
||||
{
|
||||
URL url = new URL("https://raw.githubusercontent.com/yorkeJohn/Tainted-Magic/master/version.txt");
|
||||
Scanner scan = new Scanner(url.openStream());
|
||||
private static void getNewestVersion () {
|
||||
try {
|
||||
final URL url = new URL("https://raw.githubusercontent.com/yorkeJohn/Tainted-Magic/master/version.txt");
|
||||
final Scanner scan = new Scanner(url.openStream());
|
||||
newestVersion = scan.next();
|
||||
scan.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
catch (final MalformedURLException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
catch (IOException e) {
|
||||
TaintedMagic.logger.error("Could not connect to GitHub repository!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,26 +8,28 @@ import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.config.Config;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
public class WandHandler implements IWandRodOnUpdate
|
||||
{
|
||||
Aspect primals[] = Aspect.getPrimalAspects().toArray(new Aspect[0]);
|
||||
public class WandHandler implements IWandRodOnUpdate {
|
||||
|
||||
public void onUpdate (ItemStack stack, EntityPlayer player)
|
||||
{
|
||||
if (!player.isPotionActive(Config.potionWarpWardID))
|
||||
{
|
||||
int permwarp = Thaumcraft.proxy.getPlayerKnowledge().getWarpPerm(player.getCommandSenderName());
|
||||
@Override
|
||||
public void onUpdate (final ItemStack stack, final EntityPlayer player) {
|
||||
if (!player.isPotionActive(Config.potionWarpWardID)) {
|
||||
final int permwarp = Thaumcraft.proxy.getPlayerKnowledge().getWarpPerm(player.getCommandSenderName());
|
||||
|
||||
if (permwarp == 0) return;
|
||||
if (permwarp == 0)
|
||||
return;
|
||||
|
||||
// Exponential decay in the form 1/x
|
||||
float base = ConfigHandler.WARP_WAND_REFRESH_BASE;
|
||||
float period = base / (float) permwarp;
|
||||
final float base = ConfigHandler.WARP_WAND_REFRESH_BASE;
|
||||
final float period = base / permwarp;
|
||||
|
||||
int roundPeriod = (period < 1.0F) ? 1 : Math.round(period);
|
||||
final int roundPeriod = period < 1.0F ? 1 : Math.round(period);
|
||||
|
||||
if (player.ticksExisted % roundPeriod == 0) for (int i = 0; i < primals.length; i++)
|
||||
((ItemWandCasting) stack.getItem()).addVis(stack, this.primals[i], 1, true);
|
||||
if (player.ticksExisted % roundPeriod == 0) {
|
||||
Aspect[] primals = Aspect.getPrimalAspects().toArray(new Aspect[0]);
|
||||
for (final Aspect primal : primals) {
|
||||
((ItemWandCasting) stack.getItem()).addVis(stack, primal, 1, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,79 +11,68 @@ import thaumcraft.codechicken.lib.vec.Vector3;
|
||||
import thaumcraft.common.items.baubles.ItemAmuletVis;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
public class TaintedMagicHelper
|
||||
{
|
||||
public class TaintedMagicHelper {
|
||||
/**
|
||||
* Returns an aspect list containing the specified amount of each primal aspect.
|
||||
*
|
||||
*
|
||||
* @param amount The amount of each primal aspect.
|
||||
*/
|
||||
public static AspectList getPrimals (int amount)
|
||||
{
|
||||
public static AspectList getPrimals (final int amount) {
|
||||
return new AspectList().add(Aspect.FIRE, amount).add(Aspect.WATER, amount).add(Aspect.EARTH, amount)
|
||||
.add(Aspect.AIR, amount).add(Aspect.ORDER, amount).add(Aspect.ENTROPY, amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the player has adaquate vis to be consumed from their inventory (wands, baubles, etc)
|
||||
*
|
||||
*
|
||||
* @param player The player
|
||||
* @param aspects The cost to be consumed
|
||||
* @param doit Should the vis actually be consumed
|
||||
*/
|
||||
public static boolean consumeVisFromInventory (EntityPlayer player, AspectList aspects, boolean doit)
|
||||
{
|
||||
IInventory baubles = BaublesApi.getBaubles(player);
|
||||
public static boolean consumeVisFromInventory (final EntityPlayer player, final AspectList aspects, final boolean doit) {
|
||||
final IInventory baubles = BaublesApi.getBaubles(player);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (baubles.getStackInSlot(i) != null && baubles.getStackInSlot(i).getItem() instanceof ItemAmuletVis)
|
||||
{
|
||||
if ( ((ItemAmuletVis) baubles.getStackInSlot(i).getItem()).consumeAllVis(baubles.getStackInSlot(i), player,
|
||||
aspects, doit, true))
|
||||
return true;
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (baubles.getStackInSlot(i) != null && baubles.getStackInSlot(i).getItem() instanceof ItemAmuletVis
|
||||
&& ((ItemAmuletVis) baubles.getStackInSlot(i).getItem()).consumeAllVis(baubles.getStackInSlot(i), player,
|
||||
aspects, doit, true))
|
||||
return true;
|
||||
|
||||
}
|
||||
for (int i = 0; i < player.inventory.mainInventory.length; i++)
|
||||
{
|
||||
ItemStack stack = player.inventory.mainInventory[i];
|
||||
if (stack != null && stack.getItem() instanceof ItemWandCasting)
|
||||
{
|
||||
if ( ((ItemWandCasting) stack.getItem()).consumeAllVis(stack, player, aspects, doit, true)) return true;
|
||||
}
|
||||
for (final ItemStack stack : player.inventory.mainInventory) {
|
||||
if (stack != null && stack.getItem() instanceof ItemWandCasting
|
||||
&& ((ItemWandCasting) stack.getItem()).consumeAllVis(stack, player, aspects, doit, true))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a vector between two entities.
|
||||
*
|
||||
*
|
||||
* @param origin The origin entity.
|
||||
* @param target The target entity.
|
||||
*/
|
||||
public static Vector3 getVectorBetweenEntities (Entity origin, Entity target)
|
||||
{
|
||||
Vector3 fromPosition = new Vector3(origin.posX, origin.posY, origin.posZ);
|
||||
Vector3 toPosition = new Vector3(target.posX, target.posY, target.posZ);
|
||||
Vector3 dist = fromPosition.sub(toPosition);
|
||||
public static Vector3 getVectorBetweenEntities (final Entity origin, final Entity target) {
|
||||
final Vector3 fromPosition = new Vector3(origin.posX, origin.posY, origin.posZ);
|
||||
final Vector3 toPosition = new Vector3(target.posX, target.posY, target.posZ);
|
||||
final Vector3 dist = fromPosition.sub(toPosition);
|
||||
dist.normalize();
|
||||
return dist;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the distance from the player to a point (x, y, z)
|
||||
*
|
||||
*
|
||||
* @param player The player.
|
||||
* @param x The X coordinate.
|
||||
* @param y The Y coordinate.
|
||||
* @param z The Z coordinate.
|
||||
*/
|
||||
public static double getDistanceTo (EntityPlayer player, double x, double y, double z)
|
||||
{
|
||||
double distX = player.posX - x;
|
||||
double distY = player.posY - y;
|
||||
double distZ = player.posZ - z;
|
||||
public static double getDistanceTo (final EntityPlayer player, final double x, final double y, final double z) {
|
||||
final double distX = player.posX - x;
|
||||
final double distY = player.posY - y;
|
||||
final double distZ = player.posZ - z;
|
||||
return distX * distX + distY * distY + distZ * distZ;
|
||||
}
|
||||
}
|
||||
@@ -8,19 +8,18 @@ import net.minecraft.item.ItemStack;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
|
||||
public class ItemCrimsonBlood extends Item
|
||||
{
|
||||
public ItemCrimsonBlood ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setTextureName("taintedmagic:ItemCrimsonBlood");
|
||||
this.setUnlocalizedName("ItemCrimsonBlood");
|
||||
this.setContainerItem(ConfigItems.itemEssence);
|
||||
public class ItemCrimsonBlood extends Item {
|
||||
|
||||
public ItemCrimsonBlood () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setTextureName("taintedmagic:ItemCrimsonBlood");
|
||||
setUnlocalizedName("ItemCrimsonBlood");
|
||||
setContainerItem(ConfigItems.itemEssence);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -24,66 +24,59 @@ import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
|
||||
public class ItemFlyteCharm extends Item implements IWarpingGear, IRenderInventoryItem
|
||||
{
|
||||
// Vis used per tick while flying / boosting / gliding
|
||||
public class ItemFlyteCharm extends Item implements IWarpingGear, IRenderInventoryItem {
|
||||
|
||||
// Vis costs per tick
|
||||
private static final AspectList COST_FLIGHT = new AspectList().add(Aspect.AIR, 15);
|
||||
private static final AspectList COST_GLIDE = new AspectList().add(Aspect.AIR, 5);
|
||||
|
||||
// Magic circle texture
|
||||
private static final ResourceLocation MAGIC_CIRCLE = new ResourceLocation("taintedmagic:textures/misc/circle.png");
|
||||
|
||||
public ItemFlyteCharm ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setUnlocalizedName("ItemFlyteCharm");
|
||||
this.setMaxStackSize(1);
|
||||
this.setTextureName("taintedmagic:ItemFlyteCharm");
|
||||
public ItemFlyteCharm () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setUnlocalizedName("ItemFlyteCharm");
|
||||
setMaxStackSize(1);
|
||||
setTextureName("taintedmagic:ItemFlyteCharm");
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return TaintedMagic.rarityCreation;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void updateFlight (LivingEvent.LivingUpdateEvent event)
|
||||
{
|
||||
if (event.entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
public void updateFlight (final LivingEvent.LivingUpdateEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
final EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
|
||||
if (shouldPlayerHaveFlight(player))
|
||||
{
|
||||
boolean isFlying = player.capabilities.isFlying;
|
||||
if (shouldPlayerHaveFlight(player)) {
|
||||
final boolean isFlying = player.capabilities.isFlying;
|
||||
|
||||
if (TaintedMagicHelper.consumeVisFromInventory(player, COST_FLIGHT, isFlying))
|
||||
if (TaintedMagicHelper.consumeVisFromInventory(player, COST_FLIGHT, isFlying)) {
|
||||
player.capabilities.allowFlying = true; // Allow flight
|
||||
else if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
}
|
||||
else if (!player.capabilities.isCreativeMode) {
|
||||
player.capabilities.allowFlying = false;
|
||||
player.capabilities.isFlying = false;
|
||||
}
|
||||
|
||||
if (!isFlying)
|
||||
{
|
||||
if (!isFlying) {
|
||||
// Glide
|
||||
if (player.isSneaking() && !player.onGround && player.fallDistance > 0.5F
|
||||
&& TaintedMagicHelper.consumeVisFromInventory(player, COST_GLIDE, true))
|
||||
{
|
||||
double speed = 0.1D;
|
||||
&& TaintedMagicHelper.consumeVisFromInventory(player, COST_GLIDE, true)) {
|
||||
final double speed = 0.1D;
|
||||
player.motionY = -speed;
|
||||
player.motionX += Math.cos(Math.toRadians(player.rotationYawHead + 90)) * speed;
|
||||
player.motionZ += Math.sin(Math.toRadians(player.rotationYawHead + 90)) * speed;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
else if (!player.capabilities.isCreativeMode) {
|
||||
player.capabilities.allowFlying = false;
|
||||
player.capabilities.isFlying = false;
|
||||
}
|
||||
@@ -92,11 +85,10 @@ public class ItemFlyteCharm extends Item implements IWarpingGear, IRenderInvento
|
||||
|
||||
/**
|
||||
* Determines if the player should be able to fly.
|
||||
*
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
private boolean shouldPlayerHaveFlight (EntityPlayer player)
|
||||
{
|
||||
private boolean shouldPlayerHaveFlight (final EntityPlayer player) {
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++)
|
||||
if (player.inventory.getStackInSlot(i) != null
|
||||
&& player.inventory.getStackInSlot(i).getItem() instanceof ItemFlyteCharm)
|
||||
@@ -105,16 +97,14 @@ public class ItemFlyteCharm extends Item implements IWarpingGear, IRenderInvento
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarp (ItemStack stack, EntityPlayer player)
|
||||
{
|
||||
public int getWarp (final ItemStack stack, final EntityPlayer player) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
// Render magic circle
|
||||
@Override
|
||||
public void render (EntityPlayer player, ItemStack stack, float partialTicks)
|
||||
{
|
||||
Tessellator t = Tessellator.instance;
|
||||
public void render (final EntityPlayer player, final ItemStack stack, final float partialTicks) {
|
||||
final Tessellator t = Tessellator.instance;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
|
||||
@@ -21,17 +21,16 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
import taintedmagic.client.handler.ClientHandler;
|
||||
import taintedmagic.client.handler.HUDHandler;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import thaumcraft.api.IWarpingGear;
|
||||
import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.fx.particles.FXSparkle;
|
||||
|
||||
public class ItemGateKey extends Item implements IWarpingGear
|
||||
{
|
||||
IIcon icon;
|
||||
IIcon overlay;
|
||||
public class ItemGateKey extends Item implements IWarpingGear {
|
||||
|
||||
private IIcon icon;
|
||||
private IIcon overlay;
|
||||
|
||||
private static final String TAG_X = "posX";
|
||||
private static final String TAG_Y = "posY";
|
||||
@@ -39,107 +38,97 @@ public class ItemGateKey extends Item implements IWarpingGear
|
||||
private static final String TAG_DIM = "dimID";
|
||||
private static final String TAG_COLOUR = "colour";
|
||||
|
||||
public ItemGateKey ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setUnlocalizedName("ItemGateKey");
|
||||
this.setMaxStackSize(1);
|
||||
public ItemGateKey () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setUnlocalizedName("ItemGateKey");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return TaintedMagic.rarityCreation;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.icon = ir.registerIcon("taintedmagic:ItemGateKey");
|
||||
this.overlay = ir.registerIcon("taintedmagic:ItemGateKey_overlay");
|
||||
public void registerIcons (final IIconRegister ir) {
|
||||
icon = ir.registerIcon("taintedmagic:ItemGateKey");
|
||||
overlay = ir.registerIcon("taintedmagic:ItemGateKey_overlay");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses ()
|
||||
{
|
||||
public boolean requiresMultipleRenderPasses () {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public int getRenderPasses (int meta)
|
||||
{
|
||||
public int getRenderPasses (final int meta) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public IIcon getIconFromDamageForRenderPass (int meta, int pass)
|
||||
{
|
||||
return (pass == 1) ? this.overlay : this.icon;
|
||||
public IIcon getIconFromDamageForRenderPass (final int meta, final int pass) {
|
||||
return pass == 1 ? overlay : icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack (ItemStack stack, int pass)
|
||||
{
|
||||
public int getColorFromItemStack (final ItemStack stack, final int pass) {
|
||||
if (pass == 1 && stack.stackTagCompound != null && stack.stackTagCompound.getInteger(TAG_COLOUR) != 0)
|
||||
{
|
||||
return Color.HSBtoRGB((float) stack.stackTagCompound.getInteger(TAG_COLOUR) / 360F, 1.0F,
|
||||
0.2F * (float) Math.sin((double) TaintedMagic.proxy.getClientPlayer().ticksExisted / 10D) + 0.8F);
|
||||
}
|
||||
return Color.HSBtoRGB(stack.stackTagCompound.getInteger(TAG_COLOUR) / 360F, 1.0F,
|
||||
0.2F * (float) Math.sin(TaintedMagic.proxy.getClientPlayer().ticksExisted / 10D) + 0.8F);
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarp (ItemStack stack, EntityPlayer player)
|
||||
{
|
||||
public int getWarp (final ItemStack stack, final EntityPlayer player) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean b)
|
||||
{
|
||||
if (stack.stackTagCompound != null)
|
||||
{
|
||||
public void addInformation (final ItemStack stack, final EntityPlayer player, final List list, final boolean b) {
|
||||
if (stack.stackTagCompound != null) {
|
||||
list.add(EnumChatFormatting.GREEN + StatCollector.translateToLocal("key.bound"));
|
||||
|
||||
int dim = stack.stackTagCompound.getInteger(TAG_DIM);
|
||||
final int dim = stack.stackTagCompound.getInteger(TAG_DIM);
|
||||
list.add(WorldProvider.getProviderForDimension(dim).getDimensionName());
|
||||
|
||||
int x = stack.stackTagCompound.getInteger(TAG_X);
|
||||
int y = stack.stackTagCompound.getInteger(TAG_Y);
|
||||
int z = stack.stackTagCompound.getInteger(TAG_Z);
|
||||
final int x = stack.stackTagCompound.getInteger(TAG_X);
|
||||
final int y = stack.stackTagCompound.getInteger(TAG_Y);
|
||||
final int z = stack.stackTagCompound.getInteger(TAG_Z);
|
||||
list.add(x + ", " + y + ", " + z);
|
||||
}
|
||||
else list.add(EnumChatFormatting.RED + StatCollector.translateToLocal("key.unbound"));
|
||||
else {
|
||||
list.add(EnumChatFormatting.RED + StatCollector.translateToLocal("key.unbound"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction (ItemStack stack)
|
||||
{
|
||||
public EnumAction getItemUseAction (final ItemStack stack) {
|
||||
return EnumAction.bow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration (ItemStack stack)
|
||||
{
|
||||
public int getMaxItemUseDuration (final ItemStack stack) {
|
||||
return 40;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (stack.stackTagCompound != null) player.setItemInUse(stack, getMaxItemUseDuration(stack));
|
||||
public ItemStack onItemRightClick (final ItemStack stack, final World world, final EntityPlayer player) {
|
||||
if (stack.stackTagCompound != null) {
|
||||
player.setItemInUse(stack, getMaxItemUseDuration(stack));
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int face, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
if (stack.stackTagCompound == null)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
public boolean onItemUse (final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y,
|
||||
final int z, final int face, final float hitX, final float hitY, final float hitZ) {
|
||||
if (stack.stackTagCompound == null) {
|
||||
if (!world.isRemote) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
stack.stackTagCompound.setInteger(TAG_COLOUR, world.rand.nextInt(360) + 1);
|
||||
stack.stackTagCompound.setInteger(TAG_X, x);
|
||||
@@ -147,63 +136,65 @@ public class ItemGateKey extends Item implements IWarpingGear
|
||||
stack.stackTagCompound.setInteger(TAG_Z, z);
|
||||
stack.stackTagCompound.setInteger(TAG_DIM, world.provider.dimensionId);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
player.swingItem();
|
||||
for (int a = 0; a < 9; a++)
|
||||
for (int a = 0; a < 9; a++) {
|
||||
sparkle(world, x + 0.5D, y, z + 0.5D);
|
||||
}
|
||||
}
|
||||
world.playSoundAtEntity(player, "thaumcraft:wand", 0.5F + ((float) Math.random() * 0.5F), 1.0F);
|
||||
world.playSoundAtEntity(player, "thaumcraft:wand", 0.5F + (float) Math.random() * 0.5F, 1.0F);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void sparkle (World world, double x, double y, double z)
|
||||
{
|
||||
FXSparkle fx = new FXSparkle(world, x + 0.33F * world.rand.nextGaussian(), y + 0.5D + world.rand.nextFloat(),
|
||||
public void sparkle (final World world, final double x, final double y, final double z) {
|
||||
final FXSparkle fx = new FXSparkle(world, x + 0.33F * world.rand.nextGaussian(), y + 0.5D + world.rand.nextFloat(),
|
||||
z + 0.33F * world.rand.nextGaussian(), 1.75F, 6, 3 + world.rand.nextInt(3));
|
||||
fx.setGravity(0.1F);
|
||||
ParticleEngine.instance.addEffect(world, fx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUsingTick (ItemStack stack, EntityPlayer player, int i)
|
||||
{
|
||||
public void onUsingTick (final ItemStack stack, final EntityPlayer player, final int i) {
|
||||
super.onUsingTick(stack, player, i);
|
||||
|
||||
if (player.worldObj.isRemote) sparkle(player.worldObj, player.posX, player.boundingBox.minY, player.posZ);
|
||||
if (player.worldObj.isRemote) {
|
||||
sparkle(player.worldObj, player.posX, player.boundingBox.minY, player.posZ);
|
||||
}
|
||||
|
||||
float f = 1.0F + ((float) Math.random() * 0.25F);
|
||||
if (player.ticksExisted % 5 == 0) player.worldObj.playSoundAtEntity(player, "thaumcraft:wind", f * 0.1F, f);
|
||||
final float f = 1.0F + (float) Math.random() * 0.25F;
|
||||
if (player.ticksExisted % 5 == 0) {
|
||||
player.worldObj.playSoundAtEntity(player, "thaumcraft:wind", f * 0.1F, f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onEaten (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
public ItemStack onEaten (final ItemStack stack, final World world, final EntityPlayer player) {
|
||||
super.onEaten(stack, world, player);
|
||||
if (stack.stackTagCompound != null)
|
||||
{
|
||||
int x = stack.stackTagCompound.getInteger(TAG_X);
|
||||
int y = stack.stackTagCompound.getInteger(TAG_Y);
|
||||
int z = stack.stackTagCompound.getInteger(TAG_Z);
|
||||
int dim = stack.stackTagCompound.getInteger(TAG_DIM);
|
||||
if (stack.stackTagCompound != null) {
|
||||
final int x = stack.stackTagCompound.getInteger(TAG_X);
|
||||
final int y = stack.stackTagCompound.getInteger(TAG_Y);
|
||||
final int z = stack.stackTagCompound.getInteger(TAG_Z);
|
||||
final int dim = stack.stackTagCompound.getInteger(TAG_DIM);
|
||||
|
||||
if (y > -1 && dim == world.provider.dimensionId && world.getBlock(x, y, z) == Blocks.air
|
||||
&& world.getBlock(x, y + 1, z) == Blocks.air)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (player instanceof EntityPlayerMP)
|
||||
((EntityPlayerMP) player).playerNetServerHandler.setPlayerLocation((double) x + 0.5D, (double) y,
|
||||
(double) z + 0.5D, player.rotationYaw, player.rotationPitch);
|
||||
&& world.getBlock(x, y + 1, z) == Blocks.air) {
|
||||
if (!world.isRemote) {
|
||||
if (player instanceof EntityPlayerMP) {
|
||||
((EntityPlayerMP) player).playerNetServerHandler.setPlayerLocation(x + 0.5D, y, z + 0.5D,
|
||||
player.rotationYaw, player.rotationPitch);
|
||||
}
|
||||
world.playSoundAtEntity(player, "mob.endermen.portal", 5.0F, 1.0F);
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(Potion.confusion.id, 160, 0));
|
||||
}
|
||||
else if (dim != world.provider.dimensionId)
|
||||
else if (dim != world.provider.dimensionId) {
|
||||
HUDHandler.displayString(EnumChatFormatting.RED + StatCollector.translateToLocal("key.invaliddim"), 300, false);
|
||||
else HUDHandler.displayString(EnumChatFormatting.RED + StatCollector.translateToLocal("key.error"), 300, false);
|
||||
}
|
||||
else {
|
||||
HUDHandler.displayString(EnumChatFormatting.RED + StatCollector.translateToLocal("key.error"), 300, false);
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package taintedmagic.common.items;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -19,45 +17,40 @@ import thaumcraft.common.lib.network.PacketHandler;
|
||||
import thaumcraft.common.lib.network.playerdata.PacketAspectPool;
|
||||
import thaumcraft.common.lib.research.ResearchManager;
|
||||
|
||||
public class ItemMagicFunguar extends ItemFood
|
||||
{
|
||||
Aspect aspects[] = Aspect.getPrimalAspects().toArray(new Aspect[0]);
|
||||
public class ItemMagicFunguar extends ItemFood {
|
||||
|
||||
public ItemMagicFunguar (int healAmount, float saturation, boolean b)
|
||||
{
|
||||
public ItemMagicFunguar (final int healAmount, final float saturation, final boolean b) {
|
||||
super(healAmount, saturation, b);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setTextureName("taintedmagic:ItemMagicFunguar");
|
||||
this.setAlwaysEdible();
|
||||
this.setUnlocalizedName("ItemMagicFunguar");
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setTextureName("taintedmagic:ItemMagicFunguar");
|
||||
setAlwaysEdible();
|
||||
setUnlocalizedName("ItemMagicFunguar");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFoodEaten (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
protected void onFoodEaten (final ItemStack stack, final World world, final EntityPlayer player) {
|
||||
super.onFoodEaten(stack, world, player);
|
||||
|
||||
// Potion effects
|
||||
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 60, 1));
|
||||
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 100, 2));
|
||||
|
||||
int i = world.rand.nextInt(aspects.length);
|
||||
Aspect[] aspects = Aspect.getPrimalAspects().toArray(new Aspect[0]);
|
||||
final int i = world.rand.nextInt(aspects.length);
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
Thaumcraft.proxy.playerKnowledge.addAspectPool(player.getCommandSenderName(), aspects[i],
|
||||
Short.valueOf((short) (1)));
|
||||
if (!world.isRemote) {
|
||||
Thaumcraft.proxy.playerKnowledge.addAspectPool(player.getCommandSenderName(), aspects[i], (short) 1);
|
||||
ResearchManager.scheduleSave(player);
|
||||
PacketHandler.INSTANCE.sendTo(
|
||||
new PacketAspectPool(aspects[i].getTag(), Short.valueOf((short) 1), Short.valueOf(
|
||||
Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(player.getCommandSenderName(), aspects[i]))),
|
||||
new PacketAspectPool(aspects[i].getTag(), (short) 1,
|
||||
Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(player.getCommandSenderName(), aspects[i])),
|
||||
(EntityPlayerMP) player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -15,9 +15,8 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
|
||||
public class ItemMaterial extends Item
|
||||
{
|
||||
int SUBTYPES = 12;
|
||||
public class ItemMaterial extends Item {
|
||||
|
||||
/**
|
||||
* 0 Shadow Metal Ingot
|
||||
* 1 Shadow-imbued Cloth
|
||||
@@ -32,21 +31,19 @@ public class ItemMaterial extends Item
|
||||
* 10 Primordial Mote
|
||||
* 11 Fragment of Creation
|
||||
*/
|
||||
private static final int SUBTYPES = 12;
|
||||
private IIcon[] icons = new IIcon[SUBTYPES];
|
||||
|
||||
IIcon[] icons = new IIcon[SUBTYPES];
|
||||
|
||||
public ItemMaterial ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setUnlocalizedName("ItemMaterial");
|
||||
this.setHasSubtypes(true);
|
||||
public ItemMaterial () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setUnlocalizedName("ItemMaterial");
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
int meta = stack.getItemDamage();
|
||||
switch (meta)
|
||||
{
|
||||
@Override
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
final int meta = stack.getItemDamage();
|
||||
switch (meta) {
|
||||
case 0 :
|
||||
return EnumRarity.uncommon;
|
||||
case 1 :
|
||||
@@ -75,37 +72,39 @@ public class ItemMaterial extends Item
|
||||
return EnumRarity.common;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
for (int i = 0; i < icons.length; i++)
|
||||
this.icons[i] = ir.registerIcon("taintedmagic:ItemMaterial" + i);
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public IIcon getIconFromDamage (int meta)
|
||||
{
|
||||
return this.icons[meta];
|
||||
public void registerIcons (final IIconRegister ir) {
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
icons[i] = ir.registerIcon("taintedmagic:ItemMaterial" + i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean b)
|
||||
{
|
||||
@SideOnly (Side.CLIENT)
|
||||
public IIcon getIconFromDamage (final int meta) {
|
||||
return icons[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (final ItemStack stack, final EntityPlayer player, final List list, final boolean b) {
|
||||
super.addInformation(stack, player, list, b);
|
||||
|
||||
if (stack.getItemDamage() == 5)
|
||||
if (stack.getItemDamage() == 5) {
|
||||
list.add(EnumChatFormatting.LIGHT_PURPLE + StatCollector.translateToLocal("text.shard.1"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void getSubItems (Item item, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < SUBTYPES; i++)
|
||||
public void getSubItems (final Item item, final CreativeTabs tab, final List list) {
|
||||
for (int i = 0; i < SUBTYPES; i++) {
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public String getUnlocalizedName (final ItemStack stack) {
|
||||
return super.getUnlocalizedName() + "." + stack.getItemDamage();
|
||||
}
|
||||
}
|
||||
@@ -10,27 +10,27 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
|
||||
public class ItemNightshadeBerries extends ItemFood
|
||||
{
|
||||
public ItemNightshadeBerries (int healAmount, float saturation, boolean b)
|
||||
{
|
||||
public class ItemNightshadeBerries extends ItemFood {
|
||||
|
||||
public ItemNightshadeBerries (final int healAmount, final float saturation, final boolean b) {
|
||||
super(healAmount, saturation, b);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setUnlocalizedName("ItemNightshadeBerries");
|
||||
this.setTextureName("taintedmagic:ItemNightshadeBerries");
|
||||
this.setAlwaysEdible();
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setUnlocalizedName("ItemNightshadeBerries");
|
||||
setTextureName("taintedmagic:ItemNightshadeBerries");
|
||||
setAlwaysEdible();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFoodEaten (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
protected void onFoodEaten (final ItemStack stack, final World world, final EntityPlayer player) {
|
||||
super.onFoodEaten(stack, world, player);
|
||||
if (!world.isRemote) player.attackEntityFrom(new DamageSource("nightshade"), Short.MAX_VALUE);
|
||||
if (!world.isRemote) {
|
||||
player.attackEntityFrom(new DamageSource("nightshade"), Short.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,58 +14,55 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
|
||||
public class ItemSalis extends Item
|
||||
{
|
||||
int SUBTYPES = 2;
|
||||
IIcon[] icons = new IIcon[SUBTYPES];
|
||||
public class ItemSalis extends Item {
|
||||
|
||||
public ItemSalis ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.hasSubtypes = true;
|
||||
this.setUnlocalizedName("ItemSalis");
|
||||
private static final int SUBTYPES = 2;
|
||||
private IIcon[] icons = new IIcon[SUBTYPES];
|
||||
|
||||
public ItemSalis () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
hasSubtypes = true;
|
||||
setUnlocalizedName("ItemSalis");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return TaintedMagic.rarityCreation;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
for (int i = 0; i < icons.length; i++)
|
||||
this.icons[i] = ir.registerIcon("taintedmagic:ItemSalis" + i);
|
||||
public void registerIcons (final IIconRegister ir) {
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
icons[i] = ir.registerIcon("taintedmagic:ItemSalis" + i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public IIcon getIconFromDamage (int meta)
|
||||
{
|
||||
return this.icons[meta];
|
||||
public IIcon getIconFromDamage (final int meta) {
|
||||
return icons[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void getSubItems (Item item, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < SUBTYPES; i++)
|
||||
public void getSubItems (final Item item, final CreativeTabs tab, final List list) {
|
||||
for (int i = 0; i < SUBTYPES; i++) {
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public String getUnlocalizedName (final ItemStack stack) {
|
||||
return super.getUnlocalizedName() + "." + stack.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
int meta = stack.getItemDamage();
|
||||
switch (meta)
|
||||
{
|
||||
public ItemStack onItemRightClick (final ItemStack stack, final World world, final EntityPlayer player) {
|
||||
final int meta = stack.getItemDamage();
|
||||
switch (meta) {
|
||||
// Weather
|
||||
case 0 :
|
||||
{
|
||||
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);
|
||||
@@ -73,8 +70,7 @@ public class ItemSalis extends Item
|
||||
return stack;
|
||||
}
|
||||
// Time
|
||||
case 1 :
|
||||
{
|
||||
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);
|
||||
|
||||
@@ -12,22 +12,21 @@ import taintedmagic.api.RecipeVoidBlood;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
|
||||
public class ItemVoidBlood extends Item
|
||||
{
|
||||
public ItemVoidBlood ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setTextureName("taintedmagic:ItemVoidBlood");
|
||||
this.setUnlocalizedName("ItemVoidBlood");
|
||||
this.setContainerItem(ConfigItems.itemEssence);
|
||||
public class ItemVoidBlood extends Item {
|
||||
|
||||
public ItemVoidBlood () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setTextureName("taintedmagic:ItemVoidBlood");
|
||||
setUnlocalizedName("ItemVoidBlood");
|
||||
setContainerItem(ConfigItems.itemEssence);
|
||||
|
||||
GameRegistry.addRecipe(new RecipeVoidBlood());
|
||||
RecipeSorter.register("taintedmagic:ItemVoidBlood", RecipeVoidBlood.class, Category.SHAPELESS, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
}
|
||||
@@ -14,19 +14,18 @@ import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.fx.particles.FXWisp;
|
||||
import thaumcraft.common.blocks.BlockCustomPlant;
|
||||
|
||||
public class ItemWarpFertilizer extends Item
|
||||
{
|
||||
public ItemWarpFertilizer ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setUnlocalizedName("ItemWarpFertilizer");
|
||||
this.setTextureName("taintedmagic:ItemWarpFertilizer");
|
||||
public class ItemWarpFertilizer extends Item {
|
||||
|
||||
public ItemWarpFertilizer () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setUnlocalizedName("ItemWarpFertilizer");
|
||||
setTextureName("taintedmagic:ItemWarpFertilizer");
|
||||
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
}
|
||||
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@@ -34,29 +33,26 @@ public class ItemWarpFertilizer extends Item
|
||||
* Turn Silverwood Saplings into Warpwood Saplings
|
||||
*/
|
||||
@Override
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
public boolean onItemUse (final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y,
|
||||
final int z, final int side, final float hitX, final float hitY, final float hitZ) {
|
||||
super.onItemUse(stack, player, world, x, y, z, side, hitX, hitY, hitZ);
|
||||
if (world.getBlock(x, y, z) instanceof BlockCustomPlant && world.getBlockMetadata(x, y, z) == 1)
|
||||
{
|
||||
if (world.isRemote) particles(world, x, y, z, 10 + world.rand.nextInt(11));
|
||||
|
||||
world.playSound((double) x, (double) y, (double) z, "thaumcraft:roots", 1.0F, 1.0F, false);
|
||||
world.setBlock(x, y, z, BlockRegistry.BlockWarpwoodSapling, 0, 1 | 2);
|
||||
stack.stackSize--;
|
||||
|
||||
return true;
|
||||
if (! (world.getBlock(x, y, z) instanceof BlockCustomPlant) || (world.getBlockMetadata(x, y, z) != 1))
|
||||
return false;
|
||||
if (world.isRemote) {
|
||||
particles(world, x, y, z, 10 + world.rand.nextInt(11));
|
||||
}
|
||||
else return false;
|
||||
|
||||
world.playSound(x, y, z, "thaumcraft:roots", 1.0F, 1.0F, false);
|
||||
world.setBlock(x, y, z, BlockRegistry.BlockWarpwoodSapling, 0, 1 | 2);
|
||||
stack.stackSize--;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void particles (World world, int x, int y, int z, int count)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
FXWisp fx = new FXWisp(world, x + 0.5D + (Math.random() - Math.random()) * 0.5D,
|
||||
public void particles (final World world, final int x, final int y, final int z, final int count) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
final FXWisp fx = new FXWisp(world, x + 0.5D + (Math.random() - Math.random()) * 0.5D,
|
||||
y + 0.5D + (Math.random() - Math.random()) * 0.5D, z + 0.5D + (Math.random() - Math.random()) * 0.5D,
|
||||
0.25F + (float) Math.random() * 0.25F, 5);
|
||||
|
||||
|
||||
@@ -10,53 +10,46 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
|
||||
public class ItemLumosRing extends Item implements IBauble
|
||||
{
|
||||
public ItemLumosRing ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setTextureName("taintedmagic:ItemLumosRing");
|
||||
this.setMaxDamage(-1);
|
||||
this.setMaxStackSize(1);
|
||||
this.setUnlocalizedName("ItemLumosRing");
|
||||
public class ItemLumosRing extends Item implements IBauble {
|
||||
|
||||
public ItemLumosRing () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setTextureName("taintedmagic:ItemLumosRing");
|
||||
setMaxDamage(-1);
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName("ItemLumosRing");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquip (ItemStack stack, EntityLivingBase entity)
|
||||
{
|
||||
public boolean canEquip (final ItemStack stack, final EntityLivingBase entity) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUnequip (ItemStack stack, EntityLivingBase entity)
|
||||
{
|
||||
public boolean canUnequip (final ItemStack stack, final EntityLivingBase entity) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaubleType getBaubleType (ItemStack stack)
|
||||
{
|
||||
public BaubleType getBaubleType (final ItemStack stack) {
|
||||
return BaubleType.RING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEquipped (ItemStack stack, EntityLivingBase entity)
|
||||
{
|
||||
public void onEquipped (final ItemStack stack, final EntityLivingBase entity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnequipped (ItemStack stack, EntityLivingBase entity)
|
||||
{
|
||||
public void onUnequipped (final ItemStack stack, final EntityLivingBase entity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWornTick (ItemStack stack, EntityLivingBase entity)
|
||||
{
|
||||
public void onWornTick (final ItemStack stack, final EntityLivingBase entity) {
|
||||
}
|
||||
}
|
||||
@@ -21,90 +21,82 @@ import thaumcraft.api.IWarpingGear;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.common.items.armor.ItemFortressArmor;
|
||||
|
||||
public class ItemShadowFortressArmor extends ItemFortressArmor implements IWarpingGear, IVisDiscountGear, ISpecialArmor
|
||||
{
|
||||
public ItemShadowFortressArmor (ArmorMaterial material, int j, int k)
|
||||
{
|
||||
public class ItemShadowFortressArmor extends ItemFortressArmor implements IWarpingGear, IVisDiscountGear, ISpecialArmor {
|
||||
|
||||
public ItemShadowFortressArmor (final ArmorMaterial material, final int j, final int k) {
|
||||
super(material, j, k);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.iconHelm = ir.registerIcon("taintedmagic:ItemShadowFortressHelmet");
|
||||
this.iconChest = ir.registerIcon("taintedmagic:ItemShadowFortressChestplate");
|
||||
this.iconLegs = ir.registerIcon("taintedmagic:ItemShadowFortressLeggings");
|
||||
public void registerIcons (final IIconRegister ir) {
|
||||
iconHelm = ir.registerIcon("taintedmagic:ItemShadowFortressHelmet");
|
||||
iconChest = ir.registerIcon("taintedmagic:ItemShadowFortressChestplate");
|
||||
iconLegs = ir.registerIcon("taintedmagic:ItemShadowFortressLeggings");
|
||||
}
|
||||
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean b)
|
||||
{
|
||||
@Override
|
||||
public void addInformation (final ItemStack stack, final EntityPlayer player, final List list, final boolean b) {
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("tc.visdiscount") + ": "
|
||||
+ getVisDiscount(stack, player, null) + "%");
|
||||
super.addInformation(stack, player, list, b);
|
||||
}
|
||||
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String type)
|
||||
{
|
||||
@Override
|
||||
public String getArmorTexture (final ItemStack stack, final Entity entity, final int slot, final String type) {
|
||||
return "taintedmagic:textures/models/ModelShadowFortressArmor.png";
|
||||
}
|
||||
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
public boolean getIsRepairable (ItemStack stack, ItemStack repairItem)
|
||||
{
|
||||
@Override
|
||||
public boolean getIsRepairable (final ItemStack stack, final ItemStack repairItem) {
|
||||
return repairItem.isItemEqual(new ItemStack(ItemRegistry.ItemMaterial, 1, 0)) ? true
|
||||
: super.getIsRepairable(stack, repairItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVisDiscount (ItemStack stack, EntityPlayer player, Aspect aspect)
|
||||
{
|
||||
public int getVisDiscount (final ItemStack stack, final EntityPlayer player, final Aspect aspect) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarp (ItemStack stack, EntityPlayer player)
|
||||
{
|
||||
public int getWarp (final ItemStack stack, final EntityPlayer player) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpecialArmor.ArmorProperties getProperties (EntityLivingBase entity, ItemStack stack, DamageSource source,
|
||||
double dmg, int slot)
|
||||
{
|
||||
public ISpecialArmor.ArmorProperties getProperties (final EntityLivingBase entity, final ItemStack stack,
|
||||
final DamageSource source, final double dmg, final int slot) {
|
||||
int priority = 0;
|
||||
double ratio = this.damageReduceAmount / 25.0D;
|
||||
double ratio = damageReduceAmount / 25.0D;
|
||||
|
||||
if (source.isMagicDamage())
|
||||
{
|
||||
if (source.isMagicDamage()) {
|
||||
priority = 1;
|
||||
ratio = this.damageReduceAmount / 35.0D;
|
||||
ratio = damageReduceAmount / 35.0D;
|
||||
}
|
||||
else if (source.isFireDamage() || source.isExplosion())
|
||||
{
|
||||
else if (source.isFireDamage() || source.isExplosion()) {
|
||||
priority = 1;
|
||||
ratio = this.damageReduceAmount / 20.0D;
|
||||
ratio = damageReduceAmount / 20.0D;
|
||||
}
|
||||
else if (source.isUnblockable())
|
||||
{
|
||||
else if (source.isUnblockable()) {
|
||||
priority = 0;
|
||||
ratio = 0.0D;
|
||||
}
|
||||
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
if (entity instanceof EntityPlayer) {
|
||||
double set = 0.750D;
|
||||
for (int a = 1; a < 4; a++)
|
||||
{
|
||||
ItemStack piece = ((EntityPlayer) entity).inventory.armorInventory[a];
|
||||
if (piece != null && piece.getItem() instanceof ItemFortressArmor)
|
||||
{
|
||||
for (int a = 1; a < 4; a++) {
|
||||
final ItemStack piece = ((EntityPlayer) entity).inventory.armorInventory[a];
|
||||
if (piece != null && piece.getItem() instanceof ItemFortressArmor) {
|
||||
set += 0.150D;
|
||||
if (piece.hasTagCompound() && piece.stackTagCompound.hasKey("mask")) set += 0.05D;
|
||||
if (piece.hasTagCompound() && piece.stackTagCompound.hasKey("mask")) {
|
||||
set += 0.05D;
|
||||
}
|
||||
}
|
||||
}
|
||||
ratio *= set;
|
||||
@@ -113,13 +105,16 @@ public class ItemShadowFortressArmor extends ItemFortressArmor implements IWarpi
|
||||
return new ISpecialArmor.ArmorProperties(priority, ratio, stack.getMaxDamage() + 1 - stack.getItemDamage());
|
||||
}
|
||||
|
||||
public int getArmorDisplay (EntityPlayer player, ItemStack stack, int slot)
|
||||
{
|
||||
return this.damageReduceAmount;
|
||||
@Override
|
||||
public int getArmorDisplay (final EntityPlayer player, final ItemStack stack, final int slot) {
|
||||
return damageReduceAmount;
|
||||
}
|
||||
|
||||
public void damageArmor (EntityLivingBase entity, ItemStack stack, DamageSource source, int dmg, int slot)
|
||||
{
|
||||
if (source != DamageSource.fall) stack.damageItem(dmg, entity);
|
||||
@Override
|
||||
public void damageArmor (final EntityLivingBase entity, final ItemStack stack, final DamageSource source, final int dmg,
|
||||
final int slot) {
|
||||
if (source != DamageSource.fall) {
|
||||
stack.damageItem(dmg, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,62 +19,62 @@ import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumcraft.common.items.armor.ItemFortressArmor;
|
||||
|
||||
public class ItemVoidFortressArmor extends ItemFortressArmor implements IWarpingGear, IVisDiscountGear
|
||||
{
|
||||
public ItemVoidFortressArmor (ArmorMaterial material, int j, int k)
|
||||
{
|
||||
public class ItemVoidFortressArmor extends ItemFortressArmor implements IWarpingGear, IVisDiscountGear {
|
||||
|
||||
public ItemVoidFortressArmor (final ArmorMaterial material, final int j, final int k) {
|
||||
super(material, j, k);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.iconHelm = ir.registerIcon("taintedmagic:ItemVoidFortressHelmet");
|
||||
this.iconChest = ir.registerIcon("taintedmagic:ItemVoidFortressChestplate");
|
||||
this.iconLegs = ir.registerIcon("taintedmagic:ItemVoidFortressLeggings");
|
||||
public void registerIcons (final IIconRegister ir) {
|
||||
iconHelm = ir.registerIcon("taintedmagic:ItemVoidFortressHelmet");
|
||||
iconChest = ir.registerIcon("taintedmagic:ItemVoidFortressChestplate");
|
||||
iconLegs = ir.registerIcon("taintedmagic:ItemVoidFortressLeggings");
|
||||
}
|
||||
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean b)
|
||||
{
|
||||
@Override
|
||||
public void addInformation (final ItemStack stack, final EntityPlayer player, final List list, final boolean b) {
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("tc.visdiscount") + ": "
|
||||
+ getVisDiscount(stack, player, null) + "%");
|
||||
super.addInformation(stack, player, list, b);
|
||||
}
|
||||
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String type)
|
||||
{
|
||||
@Override
|
||||
public String getArmorTexture (final ItemStack stack, final Entity entity, final int slot, final String type) {
|
||||
return "taintedmagic:textures/models/ModelVoidFortressArmor.png";
|
||||
}
|
||||
|
||||
public boolean getIsRepairable (ItemStack stack, ItemStack repairItem)
|
||||
{
|
||||
@Override
|
||||
public boolean getIsRepairable (final ItemStack stack, final ItemStack repairItem) {
|
||||
return repairItem.isItemEqual(new ItemStack(ConfigItems.itemResource, 1, 16)) ? true
|
||||
: super.getIsRepairable(stack, repairItem);
|
||||
}
|
||||
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int i, boolean b)
|
||||
{
|
||||
@Override
|
||||
public void onUpdate (final ItemStack stack, final World world, final Entity entity, final int i, final boolean b) {
|
||||
super.onUpdate(stack, world, entity, i, b);
|
||||
if (!world.isRemote && stack.isItemDamaged() && entity.ticksExisted % 20 == 0 && entity instanceof EntityLivingBase)
|
||||
if (!world.isRemote && stack.isItemDamaged() && entity.ticksExisted % 20 == 0 && entity instanceof EntityLivingBase) {
|
||||
stack.damageItem(-1, (EntityLivingBase) entity);
|
||||
}
|
||||
|
||||
public void onArmorTick (World world, EntityPlayer player, ItemStack stack)
|
||||
{
|
||||
super.onArmorTick(world, player, stack);
|
||||
if (!world.isRemote && stack.isItemDamaged() && player.ticksExisted % 20 == 0) stack.damageItem(-1, player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarp (ItemStack stack, EntityPlayer player)
|
||||
{
|
||||
public void onArmorTick (final World world, final EntityPlayer player, final ItemStack stack) {
|
||||
super.onArmorTick(world, player, stack);
|
||||
if (!world.isRemote && stack.isItemDamaged() && player.ticksExisted % 20 == 0) {
|
||||
stack.damageItem(-1, player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarp (final ItemStack stack, final EntityPlayer player) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVisDiscount (ItemStack stack, EntityPlayer player, Aspect aspect)
|
||||
{
|
||||
public int getVisDiscount (final ItemStack stack, final EntityPlayer player, final Aspect aspect) {
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
@@ -14,53 +14,53 @@ import thaumcraft.api.IWarpingGear;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.common.items.armor.ItemGoggles;
|
||||
|
||||
public class ItemVoidmetalGoggles extends ItemGoggles implements IWarpingGear
|
||||
{
|
||||
public ItemVoidmetalGoggles (ArmorMaterial material, int j, int k)
|
||||
{
|
||||
public class ItemVoidmetalGoggles extends ItemGoggles implements IWarpingGear {
|
||||
|
||||
public ItemVoidmetalGoggles (final ArmorMaterial material, final int j, final int k) {
|
||||
super(material, j, k);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setUnlocalizedName("ItemVoidmetalGoggles");
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setUnlocalizedName("ItemVoidmetalGoggles");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.icon = ir.registerIcon("taintedmagic:ItemVoidmetalGoggles");
|
||||
public void registerIcons (final IIconRegister ir) {
|
||||
icon = ir.registerIcon("taintedmagic:ItemVoidmetalGoggles");
|
||||
}
|
||||
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String type)
|
||||
{
|
||||
@Override
|
||||
public String getArmorTexture (final ItemStack stack, final Entity entity, final int slot, final String type) {
|
||||
return "taintedmagic:textures/models/ModelVoidmetalGoggles.png";
|
||||
}
|
||||
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarp (ItemStack stack, EntityPlayer player)
|
||||
{
|
||||
public int getWarp (final ItemStack stack, final EntityPlayer player) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVisDiscount (ItemStack stack, EntityPlayer player, Aspect aspect)
|
||||
{
|
||||
public int getVisDiscount (final ItemStack stack, final EntityPlayer player, final Aspect aspect) {
|
||||
return 12;
|
||||
}
|
||||
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int i, boolean b)
|
||||
{
|
||||
@Override
|
||||
public void onUpdate (final ItemStack stack, final World world, final Entity entity, final int i, final boolean b) {
|
||||
super.onUpdate(stack, world, entity, i, b);
|
||||
if (!world.isRemote && stack.isItemDamaged() && entity.ticksExisted % 20 == 0 && entity instanceof EntityLivingBase)
|
||||
if (!world.isRemote && stack.isItemDamaged() && entity.ticksExisted % 20 == 0 && entity instanceof EntityLivingBase) {
|
||||
stack.damageItem(-1, (EntityLivingBase) entity);
|
||||
}
|
||||
}
|
||||
|
||||
public void onArmorTick (World world, EntityPlayer player, ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public void onArmorTick (final World world, final EntityPlayer player, final ItemStack stack) {
|
||||
super.onArmorTick(world, player, stack);
|
||||
if (!world.isRemote && stack.isItemDamaged() && player.ticksExisted % 20 == 0) stack.damageItem(-1, player);
|
||||
if (!world.isRemote && stack.isItemDamaged() && player.ticksExisted % 20 == 0) {
|
||||
stack.damageItem(-1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,65 +32,53 @@ import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.items.armor.Hover;
|
||||
|
||||
public class ItemVoidwalkerBoots extends ItemArmor
|
||||
implements IVisDiscountGear, IWarpingGear, IRunicArmor, IRepairable, ISpecialArmor
|
||||
{
|
||||
public ItemVoidwalkerBoots (ArmorMaterial material, int j, int k)
|
||||
{
|
||||
implements IVisDiscountGear, IWarpingGear, IRunicArmor, IRepairable, ISpecialArmor {
|
||||
|
||||
public ItemVoidwalkerBoots (final ArmorMaterial material, final int j, final int k) {
|
||||
super(material, j, k);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setUnlocalizedName("ItemVoidwalkerBoots");
|
||||
this.setTextureName("taintedmagic:ItemVoidwalkerBoots");
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setUnlocalizedName("ItemVoidwalkerBoots");
|
||||
setTextureName("taintedmagic:ItemVoidwalkerBoots");
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String type)
|
||||
{
|
||||
@Override
|
||||
public String getArmorTexture (final ItemStack stack, final Entity entity, final int slot, final String type) {
|
||||
return "taintedmagic:textures/models/ModelVoidwalkerBoots.png";
|
||||
}
|
||||
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRunicCharge (ItemStack stack)
|
||||
{
|
||||
public int getRunicCharge (final ItemStack stack) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarp (ItemStack stack, EntityPlayer player)
|
||||
{
|
||||
public int getWarp (final ItemStack stack, final EntityPlayer player) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVisDiscount (ItemStack stack, EntityPlayer player, Aspect aspect)
|
||||
{
|
||||
public int getVisDiscount (final ItemStack stack, final EntityPlayer player, final Aspect aspect) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpecialArmor.ArmorProperties getProperties (EntityLivingBase entity, ItemStack stack, DamageSource source,
|
||||
double dmg, int slot)
|
||||
{
|
||||
public ISpecialArmor.ArmorProperties getProperties (final EntityLivingBase entity, final ItemStack stack,
|
||||
final DamageSource source, final double dmg, final int slot) {
|
||||
int priority = 0;
|
||||
double ratio = this.damageReduceAmount / 90.0D;
|
||||
double ratio = damageReduceAmount / 90.0D;
|
||||
|
||||
if (source.isMagicDamage())
|
||||
{
|
||||
if (source.isMagicDamage() || (source.isFireDamage() || source.isExplosion())) {
|
||||
priority = 1;
|
||||
ratio = this.damageReduceAmount / 80.0D;
|
||||
ratio = damageReduceAmount / 80.0D;
|
||||
}
|
||||
else if (source.isFireDamage() || source.isExplosion())
|
||||
{
|
||||
priority = 1;
|
||||
ratio = this.damageReduceAmount / 80.0D;
|
||||
}
|
||||
else if (source.isUnblockable())
|
||||
{
|
||||
else if (source.isUnblockable()) {
|
||||
priority = 0;
|
||||
ratio = 0.0D;
|
||||
}
|
||||
@@ -98,89 +86,97 @@ public class ItemVoidwalkerBoots extends ItemArmor
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorDisplay (EntityPlayer player, ItemStack stack, int slot)
|
||||
{
|
||||
return this.damageReduceAmount;
|
||||
public int getArmorDisplay (final EntityPlayer player, final ItemStack stack, final int slot) {
|
||||
return damageReduceAmount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damageArmor (EntityLivingBase entity, ItemStack stack, DamageSource source, int dmg, int slot)
|
||||
{
|
||||
if (source != DamageSource.fall) stack.damageItem(dmg, entity);
|
||||
public void damageArmor (final EntityLivingBase entity, final ItemStack stack, final DamageSource source, final int dmg,
|
||||
final int slot) {
|
||||
if (source != DamageSource.fall) {
|
||||
stack.damageItem(dmg, entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean b)
|
||||
{
|
||||
public void addInformation (final ItemStack stack, final EntityPlayer player, final List list, final boolean b) {
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("tc.visdiscount") + ": "
|
||||
+ getVisDiscount(stack, player, null) + "%");
|
||||
}
|
||||
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int j, boolean k)
|
||||
{
|
||||
@Override
|
||||
public void onUpdate (final ItemStack stack, final World world, final Entity entity, final int j, final boolean k) {
|
||||
super.onUpdate(stack, world, entity, j, k);
|
||||
if (!world.isRemote && stack.isItemDamaged() && entity.ticksExisted % 20 == 0 && entity instanceof EntityLivingBase)
|
||||
if (!world.isRemote && stack.isItemDamaged() && entity.ticksExisted % 20 == 0 && entity instanceof EntityLivingBase) {
|
||||
stack.damageItem(-1, (EntityLivingBase) entity);
|
||||
}
|
||||
}
|
||||
|
||||
public void onArmorTick (World world, EntityPlayer player, ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public void onArmorTick (final World world, final EntityPlayer player, final ItemStack stack) {
|
||||
super.onArmorTick(world, player, stack);
|
||||
// repair
|
||||
if (!world.isRemote && stack.isItemDamaged() && player.ticksExisted % 20 == 0) stack.damageItem(-1, player);
|
||||
if (!world.isRemote && stack.isItemDamaged() && player.ticksExisted % 20 == 0) {
|
||||
stack.damageItem(-1, player);
|
||||
}
|
||||
|
||||
// particles
|
||||
double motion = Math.abs(player.motionX) + Math.abs(player.motionZ) + Math.abs(0.5 * player.motionY);
|
||||
if (world.isRemote && (motion > 0.1D || !player.onGround) && world.rand.nextInt(3) == 0) particles(world, player);
|
||||
final double motion = Math.abs(player.motionX) + Math.abs(player.motionZ) + Math.abs(0.5 * player.motionY);
|
||||
if (world.isRemote && (motion > 0.1D || !player.onGround) && world.rand.nextInt(3) == 0) {
|
||||
particles(world, player);
|
||||
}
|
||||
|
||||
if (player.moveForward > 0.0F)
|
||||
{
|
||||
if (player.moveForward > 0.0F) {
|
||||
// increased step height
|
||||
if (player.worldObj.isRemote && !player.isSneaking())
|
||||
{
|
||||
if (!Thaumcraft.instance.entityEventHandler.prevStep.containsKey(player.getEntityId()))
|
||||
{
|
||||
if (player.worldObj.isRemote && !player.isSneaking()) {
|
||||
if (!Thaumcraft.instance.entityEventHandler.prevStep.containsKey(player.getEntityId())) {
|
||||
Thaumcraft.instance.entityEventHandler.prevStep.put(player.getEntityId(), player.stepHeight);
|
||||
}
|
||||
player.stepHeight = 1.0F;
|
||||
}
|
||||
|
||||
// speed boost
|
||||
if (player.onGround || player.capabilities.isFlying)
|
||||
{
|
||||
if (player.onGround || player.capabilities.isFlying) {
|
||||
float bonus = 0.12F;
|
||||
ItemStack sash = PlayerHandler.getPlayerBaubles(player).getStackInSlot(3);
|
||||
if (sash != null && sash.getItem() instanceof ItemVoidwalkerSash && ItemVoidwalkerSash.isSpeedEnabled(sash))
|
||||
final ItemStack sash = PlayerHandler.getPlayerBaubles(player).getStackInSlot(3);
|
||||
if (sash != null && sash.getItem() instanceof ItemVoidwalkerSash && ItemVoidwalkerSash.isSpeedEnabled(sash)) {
|
||||
bonus *= 2.0F;
|
||||
}
|
||||
|
||||
player.moveFlying(0.0F, 1.0F, player.capabilities.isFlying ? (bonus * 0.75F) : bonus);
|
||||
player.moveFlying(0.0F, 1.0F, player.capabilities.isFlying ? bonus * 0.75F : bonus);
|
||||
}
|
||||
else if (Hover.getHover(player.getEntityId())) {
|
||||
player.jumpMovementFactor = 0.03F;
|
||||
}
|
||||
else {
|
||||
player.jumpMovementFactor = player.isSprinting() ? 0.045F : 0.04F;
|
||||
}
|
||||
else if (Hover.getHover(player.getEntityId())) player.jumpMovementFactor = 0.03F;
|
||||
else player.jumpMovementFactor = player.isSprinting() ? 0.045F : 0.04F;
|
||||
}
|
||||
// negate fall damage
|
||||
if (player.fallDistance > 3.0F) player.fallDistance = 1.0F;
|
||||
if (player.fallDistance > 3.0F) {
|
||||
player.fallDistance = 1.0F;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerJumps (LivingEvent.LivingJumpEvent event)
|
||||
{
|
||||
if (event.entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.entity;
|
||||
ItemStack boots = player.inventory.armorItemInSlot(0);
|
||||
ItemStack sash = PlayerHandler.getPlayerBaubles(player).getStackInSlot(3);
|
||||
public void playerJumps (final LivingEvent.LivingJumpEvent event) {
|
||||
if (event.entity instanceof EntityPlayer) {
|
||||
final EntityPlayer player = (EntityPlayer) event.entity;
|
||||
final ItemStack boots = player.inventory.armorItemInSlot(0);
|
||||
final ItemStack sash = PlayerHandler.getPlayerBaubles(player).getStackInSlot(3);
|
||||
|
||||
if (boots != null && boots.getItem() == ItemRegistry.ItemVoidwalkerBoots) player.motionY *= 1.25D;
|
||||
if (sash != null && sash.getItem() instanceof ItemVoidwalkerSash && ItemVoidwalkerSash.isSpeedEnabled(sash))
|
||||
if (boots != null && boots.getItem() == ItemRegistry.ItemVoidwalkerBoots) {
|
||||
player.motionY *= 1.25D;
|
||||
}
|
||||
if (sash != null && sash.getItem() instanceof ItemVoidwalkerSash && ItemVoidwalkerSash.isSpeedEnabled(sash)) {
|
||||
player.motionY *= 1.05D;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
private void particles (World world, EntityPlayer player)
|
||||
{
|
||||
FXWispEG fx = new FXWispEG(world, player.posX + (Math.random() - Math.random()) * 0.5D,
|
||||
private void particles (final World world, final EntityPlayer player) {
|
||||
final FXWispEG fx = new FXWispEG(world, player.posX + (Math.random() - Math.random()) * 0.5D,
|
||||
player.boundingBox.minY + 0.05D + (Math.random() - Math.random()) * 0.1D,
|
||||
player.posZ + (Math.random() - Math.random()) * 0.5D, player);
|
||||
ParticleEngine.instance.addEffect(world, fx);
|
||||
|
||||
@@ -21,102 +21,95 @@ import thaumcraft.api.IWarpingGear;
|
||||
import thaumcraft.api.ItemRunic;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
|
||||
public class ItemVoidwalkerSash extends ItemRunic implements IRunicArmor, IWarpingGear, IBauble
|
||||
{
|
||||
public class ItemVoidwalkerSash extends ItemRunic implements IRunicArmor, IWarpingGear, IBauble {
|
||||
|
||||
public static final String TAG_MODE = "mode";
|
||||
|
||||
public ItemVoidwalkerSash ()
|
||||
{
|
||||
public ItemVoidwalkerSash () {
|
||||
super(20);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setTextureName("taintedmagic:ItemVoidwalkerSash");
|
||||
this.setMaxDamage(-1);
|
||||
this.setMaxStackSize(1);
|
||||
this.setUnlocalizedName("ItemVoidwalkerSash");
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setTextureName("taintedmagic:ItemVoidwalkerSash");
|
||||
setMaxDamage(-1);
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName("ItemVoidwalkerSash");
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
}
|
||||
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean b)
|
||||
{
|
||||
if (isSpeedEnabled(stack)) list.add(EnumChatFormatting.GREEN + StatCollector.translateToLocal("text.sash.speed.on"));
|
||||
else list.add(EnumChatFormatting.RED + StatCollector.translateToLocal("text.sash.speed.off"));
|
||||
public void addInformation (final ItemStack stack, final EntityPlayer player, final List list, final boolean b) {
|
||||
if (isSpeedEnabled(stack)) {
|
||||
list.add(EnumChatFormatting.GREEN + StatCollector.translateToLocal("text.sash.speed.on"));
|
||||
}
|
||||
else {
|
||||
list.add(EnumChatFormatting.RED + StatCollector.translateToLocal("text.sash.speed.off"));
|
||||
}
|
||||
|
||||
list.add(" ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarp (ItemStack stack, EntityPlayer player)
|
||||
{
|
||||
public int getWarp (final ItemStack stack, final EntityPlayer player) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRunicCharge (ItemStack stack)
|
||||
{
|
||||
public int getRunicCharge (final ItemStack stack) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquip (ItemStack stack, EntityLivingBase entity)
|
||||
{
|
||||
public boolean canEquip (final ItemStack stack, final EntityLivingBase entity) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUnequip (ItemStack stack, EntityLivingBase entity)
|
||||
{
|
||||
public boolean canUnequip (final ItemStack stack, final EntityLivingBase entity) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaubleType getBaubleType (ItemStack stack)
|
||||
{
|
||||
public BaubleType getBaubleType (final ItemStack stack) {
|
||||
return BaubleType.BELT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEquipped (ItemStack stack, EntityLivingBase entity)
|
||||
{
|
||||
public void onEquipped (final ItemStack stack, final EntityLivingBase entity) {
|
||||
Thaumcraft.instance.runicEventHandler.isDirty = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnequipped (ItemStack stack, EntityLivingBase entity)
|
||||
{
|
||||
public void onUnequipped (final ItemStack stack, final EntityLivingBase entity) {
|
||||
Thaumcraft.instance.runicEventHandler.isDirty = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWornTick (ItemStack stack, EntityLivingBase entity)
|
||||
{
|
||||
public void onWornTick (final ItemStack stack, final EntityLivingBase entity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote && player.isSneaking())
|
||||
{
|
||||
if (stack.stackTagCompound == null)
|
||||
{
|
||||
public ItemStack onItemRightClick (final ItemStack stack, final World world, final EntityPlayer player) {
|
||||
if (!world.isRemote && player.isSneaking()) {
|
||||
if (stack.stackTagCompound == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
stack.stackTagCompound.setBoolean(TAG_MODE, true);
|
||||
}
|
||||
if (stack.stackTagCompound != null)
|
||||
{
|
||||
if (stack.stackTagCompound != null) {
|
||||
stack.stackTagCompound.setBoolean(TAG_MODE, !stack.stackTagCompound.getBoolean(TAG_MODE));
|
||||
if (isSpeedEnabled(stack))
|
||||
if (isSpeedEnabled(stack)) {
|
||||
HUDHandler.displayString(EnumChatFormatting.GREEN + StatCollector.translateToLocal("text.sash.speed.on"),
|
||||
300, false);
|
||||
else HUDHandler.displayString(EnumChatFormatting.RED + StatCollector.translateToLocal("text.sash.speed.off"),
|
||||
300, false);
|
||||
}
|
||||
else {
|
||||
HUDHandler.displayString(EnumChatFormatting.RED + StatCollector.translateToLocal("text.sash.speed.off"),
|
||||
300, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
@@ -125,10 +118,10 @@ public class ItemVoidwalkerSash extends ItemRunic implements IRunicArmor, IWarpi
|
||||
/**
|
||||
* Returns true if the speed boost feature is enabled.
|
||||
*/
|
||||
public static boolean isSpeedEnabled (ItemStack stack)
|
||||
{
|
||||
if (stack.stackTagCompound == null) return true;
|
||||
else return stack.stackTagCompound.getBoolean(TAG_MODE);
|
||||
public static boolean isSpeedEnabled (final ItemStack stack) {
|
||||
if (stack.stackTagCompound == null)
|
||||
return true;
|
||||
return stack.stackTagCompound.getBoolean(TAG_MODE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,39 +12,37 @@ import taintedmagic.common.registry.ItemRegistry;
|
||||
import thaumcraft.api.IWarpingGear;
|
||||
import thaumcraft.common.items.armor.ItemGoggles;
|
||||
|
||||
public class ItemWarpedGoggles extends ItemGoggles implements IWarpingGear
|
||||
{
|
||||
public ItemWarpedGoggles (ArmorMaterial material, int j, int k)
|
||||
{
|
||||
public class ItemWarpedGoggles extends ItemGoggles implements IWarpingGear {
|
||||
|
||||
public ItemWarpedGoggles (final ArmorMaterial material, final int j, final int k) {
|
||||
super(material, j, k);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setUnlocalizedName("ItemWarpedGoggles");
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setUnlocalizedName("ItemWarpedGoggles");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.icon = ir.registerIcon("taintedmagic:ItemWarpedGoggles");
|
||||
public void registerIcons (final IIconRegister ir) {
|
||||
icon = ir.registerIcon("taintedmagic:ItemWarpedGoggles");
|
||||
}
|
||||
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String type)
|
||||
{
|
||||
@Override
|
||||
public String getArmorTexture (final ItemStack stack, final Entity entity, final int slot, final String type) {
|
||||
return "taintedmagic:textures/models/ModelWarpedGoggles.png";
|
||||
}
|
||||
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarp (ItemStack stack, EntityPlayer player)
|
||||
{
|
||||
public int getWarp (final ItemStack stack, final EntityPlayer player) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public boolean getIsRepairable (ItemStack stack, ItemStack repairItem)
|
||||
{
|
||||
@Override
|
||||
public boolean getIsRepairable (final ItemStack stack, final ItemStack repairItem) {
|
||||
return repairItem.isItemEqual(new ItemStack(ItemRegistry.ItemMaterial, 1, 0)) ? true
|
||||
: super.getIsRepairable(stack, repairItem);
|
||||
}
|
||||
|
||||
@@ -6,20 +6,18 @@ import net.minecraft.item.ItemSword;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import thaumcraft.api.IRepairable;
|
||||
|
||||
public class ItemHollowDagger extends ItemSword implements IRepairable
|
||||
{
|
||||
public ItemHollowDagger (ToolMaterial material)
|
||||
{
|
||||
public class ItemHollowDagger extends ItemSword implements IRepairable {
|
||||
|
||||
public ItemHollowDagger (final ToolMaterial material) {
|
||||
super(material);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setUnlocalizedName("ItemHollowDagger");
|
||||
this.setMaxStackSize(1);
|
||||
this.setTextureName("taintedmagic:ItemHollowDagger");
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setUnlocalizedName("ItemHollowDagger");
|
||||
setMaxStackSize(1);
|
||||
setTextureName("taintedmagic:ItemHollowDagger");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -47,149 +47,139 @@ import thaumcraft.api.IWarpingGear;
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
import thaumcraft.codechicken.lib.vec.Vector3;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.config.Config;
|
||||
import thaumcraft.common.entities.projectile.EntityExplosiveOrb;
|
||||
|
||||
public class ItemKatana extends Item implements IWarpingGear, IRepairable, IRenderInventoryItem, IHeldItemHUD
|
||||
{
|
||||
private final int SUBTYPES = 3;
|
||||
public class ItemKatana extends Item implements IWarpingGear, IRepairable, IRenderInventoryItem, IHeldItemHUD {
|
||||
|
||||
private static final int SUBTYPES = 3;
|
||||
|
||||
// NBT tags
|
||||
public static final String TAG_INSCRIPTION = "inscription";
|
||||
public static final String TAG_COOLDOWN = "cooldown";
|
||||
|
||||
// ticks to fully charge (1 second)
|
||||
public static final int CHARGE_TICKS = 20;
|
||||
private static final int CHARGE_TICKS = 20;
|
||||
// inscription attack cooldown (7 seconds)
|
||||
public static final int COOLDOWN_TICKS = 140;
|
||||
private static final int COOLDOWN_TICKS = 140;
|
||||
|
||||
public static final ResourceLocation TEXTURE_THAUMIUM =
|
||||
private static final ResourceLocation TEXTURE_THAUMIUM =
|
||||
new ResourceLocation("taintedmagic:textures/models/ModelKatanaThaumium.png");
|
||||
public static final ResourceLocation TEXTURE_VOIDMETAL =
|
||||
private static final ResourceLocation TEXTURE_VOIDMETAL =
|
||||
new ResourceLocation("taintedmagic:textures/models/ModelKatanaVoidmetal.png");
|
||||
public static final ResourceLocation TEXTURE_SHADOWMETAL =
|
||||
private static final ResourceLocation TEXTURE_SHADOWMETAL =
|
||||
new ResourceLocation("taintedmagic:textures/models/ModelKatanaShadowmetal.png");
|
||||
|
||||
public static final ModelKatana KATANA = new ModelKatana();
|
||||
public static final ModelSaya SAYA = new ModelSaya();
|
||||
|
||||
int ticksInUse = 0;
|
||||
private int ticksInUse = 0;
|
||||
|
||||
public ItemKatana ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setUnlocalizedName("ItemKatana");
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxStackSize(1);
|
||||
public ItemKatana () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setUnlocalizedName("ItemKatana");
|
||||
setHasSubtypes(true);
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFull3D ()
|
||||
{
|
||||
public boolean isFull3D () {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock (Block block, ItemStack stack)
|
||||
{
|
||||
public boolean canHarvestBlock (final Block block, final ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction (ItemStack stack)
|
||||
{
|
||||
public EnumAction getItemUseAction (final ItemStack stack) {
|
||||
return EnumAction.bow;
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
@Override
|
||||
public void getSubItems (Item item, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int a = 0; a < SUBTYPES; a++)
|
||||
public void getSubItems (final Item item, final CreativeTabs tab, final List list) {
|
||||
for (int a = 0; a < SUBTYPES; a++) {
|
||||
list.add(new ItemStack(this, 1, a));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName (ItemStack stack)
|
||||
{
|
||||
public String getUnlocalizedName (final ItemStack stack) {
|
||||
return super.getUnlocalizedName() + "." + stack.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean b)
|
||||
{
|
||||
if (stack.getItemDamage() == 1)
|
||||
public void addInformation (final ItemStack stack, final EntityPlayer player, final List list, final boolean b) {
|
||||
if (stack.getItemDamage() == 1) {
|
||||
list.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("enchantment.special.sapless"));
|
||||
}
|
||||
|
||||
if (stack.getItemDamage() == 2)
|
||||
if (stack.getItemDamage() == 2) {
|
||||
list.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("enchantment.special.sapgreat"));
|
||||
}
|
||||
|
||||
list.add(" ");
|
||||
list.add("\u00A79+" + getAttackDamage(stack) + " " + StatCollector.translateToLocal("text.attackdamage"));
|
||||
|
||||
if (stack.hasTagCompound() && stack.stackTagCompound.hasKey(TAG_INSCRIPTION))
|
||||
if (stack.hasTagCompound() && stack.stackTagCompound.hasKey(TAG_INSCRIPTION)) {
|
||||
list.add(EnumChatFormatting.GOLD + StatCollector
|
||||
.translateToLocal("text.katana.inscription." + stack.stackTagCompound.getInteger(TAG_INSCRIPTION)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarp (ItemStack stack, EntityPlayer player)
|
||||
{
|
||||
public int getWarp (final ItemStack stack, final EntityPlayer player) {
|
||||
return stack.getItemDamage() == 0 ? 0 : stack.getItemDamage() == 1 ? 3 : 7;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity (ItemStack stack, EntityLivingBase entity, EntityLivingBase player)
|
||||
{
|
||||
public boolean hitEntity (final ItemStack stack, final EntityLivingBase entity, final EntityLivingBase player) {
|
||||
if (!entity.worldObj.isRemote && (! (entity instanceof EntityPlayer) || ! (player instanceof EntityPlayer)
|
||||
|| MinecraftServer.getServer().isPVPEnabled()))
|
||||
{
|
||||
|| MinecraftServer.getServer().isPVPEnabled())) {
|
||||
// Sapping effects
|
||||
if (stack.getItemDamage() == 1)
|
||||
{
|
||||
if (stack.getItemDamage() == 1) {
|
||||
entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 60)); // lesser sapping
|
||||
|
||||
}
|
||||
if (stack.getItemDamage() == 2)
|
||||
{
|
||||
if (stack.getItemDamage() == 2) {
|
||||
entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 60)); // greater sapping
|
||||
entity.addPotionEffect(new PotionEffect(Potion.hunger.id, 120));
|
||||
}
|
||||
|
||||
// Inscription effects
|
||||
if (hasAnyInscription(stack)) switch (getInscription(stack))
|
||||
{
|
||||
case 0 :
|
||||
{
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) player).setFireDamage(),
|
||||
getAttackDamage(stack));
|
||||
entity.setFire(3);
|
||||
break;
|
||||
if (hasAnyInscription(stack)) {
|
||||
switch (getInscription(stack)) {
|
||||
case 0 : {
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) player).setFireDamage(),
|
||||
getAttackDamage(stack));
|
||||
entity.setFire(3);
|
||||
break;
|
||||
}
|
||||
case 1 : {
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) player).setMagicDamage(),
|
||||
getAttackDamage(stack));
|
||||
entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 140));
|
||||
break;
|
||||
}
|
||||
case 2 : {
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) player).setMagicDamage(),
|
||||
getAttackDamage(stack));
|
||||
entity.addPotionEffect(new PotionEffect(Potion.wither.id, 60));
|
||||
break;
|
||||
}
|
||||
default :
|
||||
break;
|
||||
}
|
||||
}
|
||||
case 1 :
|
||||
{
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) player).setMagicDamage(),
|
||||
getAttackDamage(stack));
|
||||
entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 140));
|
||||
break;
|
||||
else {
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) player), getAttackDamage(stack));
|
||||
}
|
||||
case 2 :
|
||||
{
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) player).setMagicDamage(),
|
||||
getAttackDamage(stack));
|
||||
entity.addPotionEffect(new PotionEffect(Potion.wither.id, 60));
|
||||
break;
|
||||
}
|
||||
default :
|
||||
break;
|
||||
}
|
||||
else entity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) player), getAttackDamage(stack));
|
||||
}
|
||||
// Sound effect
|
||||
player.worldObj.playSoundAtEntity(player, "thaumcraft:swing", 0.5F + (float) Math.random(),
|
||||
@@ -199,66 +189,67 @@ public class ItemKatana extends Item implements IWarpingGear, IRepairable, IRend
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration (ItemStack stack)
|
||||
{
|
||||
public int getMaxItemUseDuration (final ItemStack stack) {
|
||||
return 72000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (!hasCooldown(stack)) player.setItemInUse(stack, getMaxItemUseDuration(stack));
|
||||
public ItemStack onItemRightClick (final ItemStack stack, final World world, final EntityPlayer player) {
|
||||
if (!hasCooldown(stack)) {
|
||||
player.setItemInUse(stack, getMaxItemUseDuration(stack));
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUsingTick (ItemStack stack, EntityPlayer player, int i)
|
||||
{
|
||||
public void onUsingTick (final ItemStack stack, final EntityPlayer player, final int i) {
|
||||
super.onUsingTick(stack, player, i);
|
||||
|
||||
this.ticksInUse = getMaxItemUseDuration(stack) - i;
|
||||
ticksInUse = getMaxItemUseDuration(stack) - i;
|
||||
|
||||
float j = 0.75F + ((float) Math.random() * 0.25F);
|
||||
if (player.ticksExisted % 5 == 0) player.worldObj.playSoundAtEntity(player, "thaumcraft:wind", j * 0.1F, j);
|
||||
final float j = 0.75F + (float) Math.random() * 0.25F;
|
||||
if (player.ticksExisted % 5 == 0) {
|
||||
player.worldObj.playSoundAtEntity(player, "thaumcraft:wind", j * 0.1F, j);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing (ItemStack stack, World world, EntityPlayer player, int i)
|
||||
{
|
||||
public void onPlayerStoppedUsing (final ItemStack stack, final World world, final EntityPlayer player, final int i) {
|
||||
super.onPlayerStoppedUsing(stack, world, player, i);
|
||||
|
||||
if (isFullyCharged(player))
|
||||
{
|
||||
if (!hasAnyInscription(stack) || player.isSneaking())
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
MovingObjectPosition mop = Minecraft.getMinecraft().objectMouseOver;
|
||||
if (isFullyCharged(player)) {
|
||||
if (!hasAnyInscription(stack) || player.isSneaking()) {
|
||||
if (world.isRemote) {
|
||||
final MovingObjectPosition mop = Minecraft.getMinecraft().objectMouseOver;
|
||||
|
||||
// charged strike damage multiplier
|
||||
float mul = 1.5F;
|
||||
if (world.rand.nextInt(10) == 0) mul += 1.0F; // crit
|
||||
if (world.rand.nextInt(10) == 0) {
|
||||
mul += 1.0F; // crit
|
||||
}
|
||||
|
||||
if (mop.entityHit != null) PacketHandler.INSTANCE
|
||||
.sendToServer(new PacketKatanaAttack(mop.entityHit, player, this.getAttackDamage(stack) * mul));
|
||||
if (mop.entityHit != null) {
|
||||
PacketHandler.INSTANCE
|
||||
.sendToServer(new PacketKatanaAttack(mop.entityHit, player, getAttackDamage(stack) * mul));
|
||||
}
|
||||
}
|
||||
player.worldObj.playSoundAtEntity(player, "thaumcraft:swing", 0.5F + (float) Math.random(),
|
||||
0.5F + (float) Math.random());
|
||||
player.swingItem();
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (getInscription(stack))
|
||||
{
|
||||
else {
|
||||
switch (getInscription(stack)) {
|
||||
case 0 : // fireball
|
||||
{
|
||||
EntityExplosiveOrb proj = new EntityExplosiveOrb(world, player);
|
||||
final EntityExplosiveOrb proj = new EntityExplosiveOrb(world, player);
|
||||
proj.strength = getAttackDamage(stack) * .25F;
|
||||
proj.posX += proj.motionX;
|
||||
proj.posY += proj.motionY;
|
||||
proj.posZ += proj.motionZ;
|
||||
|
||||
if (!world.isRemote) world.spawnEntityInWorld(proj);
|
||||
if (!world.isRemote) {
|
||||
world.spawnEntityInWorld(proj);
|
||||
}
|
||||
player.swingItem();
|
||||
|
||||
break;
|
||||
@@ -266,20 +257,22 @@ public class ItemKatana extends Item implements IWarpingGear, IRepairable, IRend
|
||||
case 1 : // thunder
|
||||
{
|
||||
// get entities within 10 block radius
|
||||
List<EntityLivingBase> ents = world.getEntitiesWithinAABB(EntityLivingBase.class,
|
||||
final List<EntityLivingBase> ents = world.getEntitiesWithinAABB(EntityLivingBase.class,
|
||||
AxisAlignedBB.getBoundingBox(player.posX, player.posY, player.posZ, player.posX + 1,
|
||||
player.posY + 1, player.posZ + 1).expand(10.0D, 10.0D, 10.0D));
|
||||
|
||||
if (ents != null && ents.size() > 0) for (EntityLivingBase entity : ents)
|
||||
{
|
||||
if (entity != player && entity.isEntityAlive() && !entity.isEntityInvulnerable())
|
||||
{
|
||||
entity.attackEntityFrom(DamageSource.magic, getAttackDamage(stack) * 0.25F);
|
||||
if (ents != null && ents.size() > 0) {
|
||||
for (final EntityLivingBase entity : ents) {
|
||||
if (entity != player && entity.isEntityAlive() && !entity.isEntityInvulnerable()) {
|
||||
entity.attackEntityFrom(DamageSource.magic, getAttackDamage(stack) * 0.25F);
|
||||
|
||||
Vector3 movement = TaintedMagicHelper.getVectorBetweenEntities(entity, player);
|
||||
entity.addVelocity(movement.x * 5.0D, 1.5D, movement.z * 5.0D);
|
||||
final Vector3 movement = TaintedMagicHelper.getVectorBetweenEntities(entity, player);
|
||||
entity.addVelocity(movement.x * 5.0D, 1.5D, movement.z * 5.0D);
|
||||
|
||||
if (world.isRemote) ItemFocusShockwave.spawnParticles(world, player, entity);
|
||||
if (world.isRemote) {
|
||||
ItemFocusShockwave.spawnParticles(world, player, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,24 +287,25 @@ public class ItemKatana extends Item implements IWarpingGear, IRepairable, IRend
|
||||
player.heal( (player.getMaxHealth() - player.getHealth()) * 0.5F);
|
||||
|
||||
// get entities within 5 blocks
|
||||
List<EntityLivingBase> ents = world.getEntitiesWithinAABB(EntityLivingBase.class,
|
||||
final List<EntityLivingBase> ents = world.getEntitiesWithinAABB(EntityLivingBase.class,
|
||||
AxisAlignedBB.getBoundingBox(player.posX, player.posY, player.posZ, player.posX + 1,
|
||||
player.posY + 1, player.posZ + 1).expand(5.0D, 5.0D, 5.0D));
|
||||
|
||||
// add wither to all entities in range
|
||||
if (ents != null && ents.size() > 0) for (EntityLivingBase entity : ents)
|
||||
if (entity != player && entity.isEntityAlive() && !entity.isEntityInvulnerable())
|
||||
entity.addPotionEffect(new PotionEffect(Potion.wither.id, 100, 1));
|
||||
if (ents != null && ents.size() > 0) {
|
||||
for (final EntityLivingBase entity : ents)
|
||||
if (entity != player && entity.isEntityAlive() && !entity.isEntityInvulnerable()) {
|
||||
entity.addPotionEffect(new PotionEffect(Potion.wither.id, 100, 1));
|
||||
}
|
||||
}
|
||||
|
||||
// beneficial effects on the player
|
||||
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 60, 1));
|
||||
player.addPotionEffect(new PotionEffect(Potion.resistance.id, 120, 1));
|
||||
|
||||
// particles similar to pech focus
|
||||
if (world.isRemote)
|
||||
{
|
||||
for (int a = 0; a < 18; a++)
|
||||
{
|
||||
if (world.isRemote) {
|
||||
for (int a = 0; a < 18; a++) {
|
||||
Thaumcraft.proxy.wispFX2(world, player.posX + world.rand.nextGaussian() * 0.25F,
|
||||
player.boundingBox.minY + 1.0F + world.rand.nextGaussian() * 0.5F,
|
||||
player.posZ + world.rand.nextGaussian() * 0.25F, 0.25F + (float) Math.random() * 0.25F, 3,
|
||||
@@ -337,52 +331,47 @@ public class ItemKatana extends Item implements IWarpingGear, IRepairable, IRend
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int i, boolean b)
|
||||
{
|
||||
public void onUpdate (final ItemStack stack, final World world, final Entity entity, final int i, final boolean b) {
|
||||
// update the cooldown every tick
|
||||
if (hasCooldown(stack)) setCooldown(stack, getCooldown(stack) - 1);
|
||||
if (hasCooldown(stack)) {
|
||||
setCooldown(stack, getCooldown(stack) - 1);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isFullyCharged (EntityPlayer player)
|
||||
{
|
||||
float f = Math.min((float) this.ticksInUse / (float) CHARGE_TICKS, 1.0F);
|
||||
private boolean isFullyCharged (final EntityPlayer player) {
|
||||
final float f = Math.min((float) ticksInUse / (float) CHARGE_TICKS, 1.0F);
|
||||
return f == 1.0F;
|
||||
}
|
||||
|
||||
public static boolean hasAnyInscription (ItemStack stack)
|
||||
{
|
||||
public static boolean hasAnyInscription (final ItemStack stack) {
|
||||
return stack.hasTagCompound() && stack.stackTagCompound.hasKey(TAG_INSCRIPTION);
|
||||
}
|
||||
|
||||
private int getInscription (ItemStack stack)
|
||||
{
|
||||
private int getInscription (final ItemStack stack) {
|
||||
if (stack.hasTagCompound() && stack.stackTagCompound.hasKey(TAG_INSCRIPTION))
|
||||
return stack.stackTagCompound.getInteger(TAG_INSCRIPTION);
|
||||
else return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
private boolean hasCooldown (ItemStack stack)
|
||||
{
|
||||
private boolean hasCooldown (final ItemStack stack) {
|
||||
return stack.hasTagCompound() && stack.stackTagCompound.getInteger(TAG_COOLDOWN) > 0;
|
||||
}
|
||||
|
||||
private void setCooldown (ItemStack stack, int cooldown)
|
||||
{
|
||||
if (!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound();
|
||||
private void setCooldown (final ItemStack stack, final int cooldown) {
|
||||
if (!stack.hasTagCompound()) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
stack.stackTagCompound.setInteger(TAG_COOLDOWN, cooldown);
|
||||
}
|
||||
|
||||
private int getCooldown (ItemStack stack)
|
||||
{
|
||||
private int getCooldown (final ItemStack stack) {
|
||||
if (stack.hasTagCompound() && stack.stackTagCompound.hasKey(TAG_COOLDOWN))
|
||||
return stack.stackTagCompound.getInteger(TAG_COOLDOWN);
|
||||
else return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
private float getAttackDamage (ItemStack stack)
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
private float getAttackDamage (final ItemStack stack) {
|
||||
switch (stack.getItemDamage()) {
|
||||
case 0 :
|
||||
return 14.25F;
|
||||
case 1 :
|
||||
@@ -393,11 +382,8 @@ public class ItemKatana extends Item implements IWarpingGear, IRepairable, IRend
|
||||
return 0;
|
||||
}
|
||||
|
||||
// get texture based on the item damage
|
||||
public static ResourceLocation getTexture (ItemStack stack)
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
public static ResourceLocation getTexture (final ItemStack stack) {
|
||||
switch (stack.getItemDamage()) {
|
||||
case 0 :
|
||||
return TEXTURE_THAUMIUM;
|
||||
case 1 :
|
||||
@@ -409,19 +395,19 @@ public class ItemKatana extends Item implements IWarpingGear, IRepairable, IRend
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderHUD (ScaledResolution res, EntityPlayer player, ItemStack stack, float partialTicks, float fract)
|
||||
{
|
||||
Tessellator t = Tessellator.instance;
|
||||
public void renderHUD (final ScaledResolution res, final EntityPlayer player, final ItemStack stack,
|
||||
final float partialTicks, final float fract) {
|
||||
final Tessellator t = Tessellator.instance;
|
||||
|
||||
float overlay = Math.min(hasCooldown(stack) ? ((float) getCooldown(stack) / (float) COOLDOWN_TICKS)
|
||||
final float overlay = Math.min(hasCooldown(stack) ? (float) getCooldown(stack) / (float) COOLDOWN_TICKS
|
||||
: (float) player.getItemInUseDuration() / (float) CHARGE_TICKS, 1.0F);
|
||||
|
||||
float scale = 0.315F;
|
||||
final float scale = 0.315F;
|
||||
|
||||
double x = (double) res.getScaledWidth() / 2d / scale + 30d;
|
||||
double x2 = x + 16;
|
||||
double y = (double) res.getScaledHeight() / scale - (player.capabilities.isCreativeMode ? 100d : 150d);
|
||||
double y2 = y + 16;
|
||||
final double x = res.getScaledWidth() / 2d / scale + 30d;
|
||||
final double x2 = x + 16;
|
||||
final double y = (double) res.getScaledHeight() / scale - (player.capabilities.isCreativeMode ? 100d : 150d);
|
||||
final double y2 = y + 16;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
@@ -433,48 +419,48 @@ public class ItemKatana extends Item implements IWarpingGear, IRepairable, IRend
|
||||
|
||||
UtilsFX.bindTexture(new ResourceLocation("thaumcraft:textures/misc/script.png"));
|
||||
|
||||
for (int rune = 0; rune < 16; rune++)
|
||||
{
|
||||
for (int rune = 0; rune < 16; rune++) {
|
||||
float red = MathHelper.sin( (player.ticksExisted + rune * 5) / 5.0F) * 0.1F + 0.8F;
|
||||
float green = MathHelper.sin( (player.ticksExisted + rune * 5) / 7.0F) * 0.1F + 0.7F;
|
||||
float blue = 0.4F;
|
||||
float alpha = MathHelper.sin( (player.ticksExisted + rune * 5) / 10.0F) * 0.3F;
|
||||
final float alpha = MathHelper.sin( (player.ticksExisted + rune * 5) / 10.0F) * 0.3F;
|
||||
|
||||
float f = 0.0625F * rune;
|
||||
float f1 = f + 0.0625F;
|
||||
float f2 = 0.0F;
|
||||
float f3 = 1.0F;
|
||||
final float f = 0.0625F * rune;
|
||||
final float f1 = f + 0.0625F;
|
||||
final float f2 = 0.0F;
|
||||
final float f3 = 1.0F;
|
||||
|
||||
t.startDrawingQuads();
|
||||
|
||||
t.setBrightness(240);
|
||||
t.setColorRGBA_F(red, green, blue, (alpha + 0.7F) * fract);
|
||||
t.addVertexWithUV(x + (rune * 16) - alpha, y2 + alpha, 0, f, f3);
|
||||
t.addVertexWithUV(x2 + (rune * 16) + alpha, y2 + alpha, 0, f1, f3);
|
||||
t.addVertexWithUV(x2 + (rune * 16) + alpha, y - alpha, 0, f1, f2);
|
||||
t.addVertexWithUV(x + (rune * 16) - alpha, y - alpha, 0, f, f2);
|
||||
t.addVertexWithUV(x + rune * 16 - alpha, y2 + alpha, 0, f, f3);
|
||||
t.addVertexWithUV(x2 + rune * 16 + alpha, y2 + alpha, 0, f1, f3);
|
||||
t.addVertexWithUV(x2 + rune * 16 + alpha, y - alpha, 0, f1, f2);
|
||||
t.addVertexWithUV(x + rune * 16 - alpha, y - alpha, 0, f, f2);
|
||||
|
||||
t.draw();
|
||||
|
||||
if (Math.ceil(16 * overlay) > rune)
|
||||
{
|
||||
if (Math.ceil(16 * overlay) > rune) {
|
||||
// red to green gradient
|
||||
Color color = new Color(Color.HSBtoRGB((float) rune / 16F * 0.3F, 1.0F, 1.0F));
|
||||
Color color = new Color(Color.HSBtoRGB(rune / 16F * 0.3F, 1.0F, 1.0F));
|
||||
// flip the gradient when cooling down
|
||||
if (hasCooldown(stack)) color = new Color(Color.HSBtoRGB( (16F - (float) rune) / 16F * 0.3F, 1.0F, 1.0F));
|
||||
if (hasCooldown(stack)) {
|
||||
color = new Color(Color.HSBtoRGB( (16F - rune) / 16F * 0.3F, 1.0F, 1.0F));
|
||||
}
|
||||
// convert to float rgb
|
||||
red = (float) color.getRed() / 255F;
|
||||
green = (float) color.getGreen() / 255F;
|
||||
blue = (float) color.getBlue() / 255F;
|
||||
red = color.getRed() / 255F;
|
||||
green = color.getGreen() / 255F;
|
||||
blue = color.getBlue() / 255F;
|
||||
|
||||
t.startDrawingQuads();
|
||||
|
||||
t.setBrightness(240);
|
||||
t.setColorRGBA_F(red, green, blue, 0.9F + alpha);
|
||||
t.addVertexWithUV(x + (rune * 16) - alpha, y2 + alpha, 0, f, f3);
|
||||
t.addVertexWithUV(x2 + (rune * 16) + alpha, y2 + alpha, 0, f1, f3);
|
||||
t.addVertexWithUV(x2 + (rune * 16) + alpha, y - alpha, 0, f1, f2);
|
||||
t.addVertexWithUV(x + (rune * 16) - alpha, y - alpha, 0, f, f2);
|
||||
t.addVertexWithUV(x + rune * 16 - alpha, y2 + alpha, 0, f, f3);
|
||||
t.addVertexWithUV(x2 + rune * 16 + alpha, y2 + alpha, 0, f1, f3);
|
||||
t.addVertexWithUV(x2 + rune * 16 + alpha, y - alpha, 0, f1, f2);
|
||||
t.addVertexWithUV(x + rune * 16 - alpha, y - alpha, 0, f, f2);
|
||||
|
||||
t.draw();
|
||||
}
|
||||
@@ -486,13 +472,12 @@ public class ItemKatana extends Item implements IWarpingGear, IRepairable, IRend
|
||||
|
||||
// render katana on hip
|
||||
@Override
|
||||
public void render (EntityPlayer player, ItemStack stack, float partialTicks)
|
||||
{
|
||||
public void render (final EntityPlayer player, final ItemStack stack, final float partialTicks) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
int light = player.getBrightnessForRender(0);
|
||||
int lightmapX = light % 65536;
|
||||
int lightmapY = light / 65536;
|
||||
final int light = player.getBrightnessForRender(0);
|
||||
final int lightmapX = light % 65536;
|
||||
final int lightmapY = light / 65536;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
@@ -510,8 +495,7 @@ public class ItemKatana extends Item implements IWarpingGear, IRepairable, IRend
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if (player.getHeldItem() == null || player.getHeldItem() != stack)
|
||||
{
|
||||
if (player.getHeldItem() == null || player.getHeldItem() != stack) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
|
||||
@@ -21,28 +21,27 @@ import taintedmagic.common.helper.TaintedMagicHelper;
|
||||
import thaumcraft.api.IRepairable;
|
||||
import thaumcraft.api.IWarpingGear;
|
||||
|
||||
public class ItemPrimalBlade extends ItemSword implements IWarpingGear, IRepairable
|
||||
{
|
||||
public ItemPrimalBlade (ToolMaterial material)
|
||||
{
|
||||
public class ItemPrimalBlade extends ItemSword implements IWarpingGear, IRepairable {
|
||||
|
||||
public ItemPrimalBlade (final ToolMaterial material) {
|
||||
super(material);
|
||||
this.setTextureName("taintedmagic:ItemPrimalBlade");
|
||||
this.setUnlocalizedName("ItemPrimalBlade");
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
setTextureName("taintedmagic:ItemPrimalBlade");
|
||||
setUnlocalizedName("ItemPrimalBlade");
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
}
|
||||
|
||||
public EnumAction getItemUseAction (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public EnumAction getItemUseAction (final ItemStack stack) {
|
||||
return EnumAction.block;
|
||||
}
|
||||
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return TaintedMagic.rarityCreation;
|
||||
}
|
||||
|
||||
public boolean hitEntity (ItemStack stack, EntityLivingBase entity, EntityLivingBase player)
|
||||
{
|
||||
@Override
|
||||
public boolean hitEntity (final ItemStack stack, final EntityLivingBase entity, final EntityLivingBase player) {
|
||||
super.hitEntity(stack, entity, player);
|
||||
|
||||
entity.addPotionEffect(new PotionEffect(Potion.wither.id, 60, 1));
|
||||
@@ -54,66 +53,63 @@ public class ItemPrimalBlade extends ItemSword implements IWarpingGear, IRepaira
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
public ItemStack onItemRightClick (final ItemStack stack, final World world, final EntityPlayer player) {
|
||||
player.setItemInUse(stack, getMaxItemUseDuration(stack));
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUsingTick (ItemStack stack, EntityPlayer player, int i)
|
||||
{
|
||||
// Based off of hungry node
|
||||
public void onUsingTick (final ItemStack stack, final EntityPlayer player, final int i) {
|
||||
|
||||
List<Entity> ents = player.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB
|
||||
final List<Entity> ents = player.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB
|
||||
.getBoundingBox(player.posX, player.posY, player.posZ, player.posX + 1, player.posY + 1, player.posZ + 1)
|
||||
.expand(15.0D, 15.0D, 15.0D));
|
||||
|
||||
if (player.ticksExisted % 10 == 0) player.worldObj.playSoundAtEntity(player, "thaumcraft:brain", 0.05F, 0.5F);
|
||||
if (player.ticksExisted % 10 == 0) {
|
||||
player.worldObj.playSoundAtEntity(player, "thaumcraft:brain", 0.05F, 0.5F);
|
||||
}
|
||||
|
||||
if (ents != null && ents.size() > 0) for (Entity entity : ents)
|
||||
{
|
||||
if (entity != player)
|
||||
{
|
||||
if (entity.isEntityAlive() && !entity.isEntityInvulnerable())
|
||||
{
|
||||
double dist = TaintedMagicHelper.getDistanceTo(player, entity.posX, entity.posY, entity.posZ);
|
||||
if (dist < 2.0D) entity.attackEntityFrom(DamageSource.magic, 3.0F);
|
||||
}
|
||||
if (ents != null && ents.size() > 0) {
|
||||
for (final Entity entity : ents) {
|
||||
if (entity != player) {
|
||||
if (entity.isEntityAlive() && !entity.isEntityInvulnerable()) {
|
||||
final double dist = TaintedMagicHelper.getDistanceTo(player, entity.posX, entity.posY, entity.posZ);
|
||||
if (dist < 2.0D) {
|
||||
entity.attackEntityFrom(DamageSource.magic, 3.0F);
|
||||
}
|
||||
}
|
||||
|
||||
double x = (player.posX + 0.5D - entity.posX) / 20.0D;
|
||||
double y = (player.posY + 0.5D - entity.posY) / 20.0D;
|
||||
double z = (player.posZ + 0.5D - entity.posZ) / 20.0D;
|
||||
double vec = Math.sqrt(x * x + y * y + z * z);
|
||||
double vec2 = 1.0D - vec;
|
||||
final double x = (player.posX + 0.5D - entity.posX) / 20.0D;
|
||||
final double y = (player.posY + 0.5D - entity.posY) / 20.0D;
|
||||
final double z = (player.posZ + 0.5D - entity.posZ) / 20.0D;
|
||||
final double vec = Math.sqrt(x * x + y * y + z * z);
|
||||
double vec2 = 1.0D - vec;
|
||||
|
||||
if (vec2 > 0.0D)
|
||||
{
|
||||
vec2 *= vec2;
|
||||
entity.motionX += x / vec * vec2 * 0.20D;
|
||||
entity.motionY += y / vec * vec2 * 0.30D;
|
||||
entity.motionZ += z / vec * vec2 * 0.20D;
|
||||
if (vec2 > 0.0D) {
|
||||
vec2 *= vec2;
|
||||
entity.motionX += x / vec * vec2 * 0.20D;
|
||||
entity.motionY += y / vec * vec2 * 0.30D;
|
||||
entity.motionZ += z / vec * vec2 * 0.20D;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int i, boolean b)
|
||||
{
|
||||
if (!world.isRemote && stack.isItemDamaged() && entity.ticksExisted % 20 == 0)
|
||||
public void onUpdate (final ItemStack stack, final World world, final Entity entity, final int i, final boolean b) {
|
||||
if (!world.isRemote && stack.isItemDamaged() && entity.ticksExisted % 20 == 0) {
|
||||
stack.damageItem(-1, (EntityLivingBase) entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean b)
|
||||
{
|
||||
public void addInformation (final ItemStack stack, final EntityPlayer player, final List list, final boolean b) {
|
||||
list.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("text.sapprimal"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarp (ItemStack stack, EntityPlayer player)
|
||||
{
|
||||
public int getWarp (final ItemStack stack, final EntityPlayer player) {
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
@@ -7,25 +7,23 @@ import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.registry.ItemRegistry;
|
||||
import thaumcraft.api.IRepairable;
|
||||
|
||||
public class ItemShadowmetalAxe extends ItemAxe implements IRepairable
|
||||
{
|
||||
public ItemShadowmetalAxe (ToolMaterial material)
|
||||
{
|
||||
public class ItemShadowmetalAxe extends ItemAxe implements IRepairable {
|
||||
|
||||
public ItemShadowmetalAxe (final ToolMaterial material) {
|
||||
super(material);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setTextureName("taintedmagic:ItemShadowmetalAxe");
|
||||
this.setUnlocalizedName("ItemShadowmetalAxe");
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setTextureName("taintedmagic:ItemShadowmetalAxe");
|
||||
setUnlocalizedName("ItemShadowmetalAxe");
|
||||
}
|
||||
|
||||
public boolean getIsRepairable (ItemStack stack, ItemStack repairItem)
|
||||
{
|
||||
@Override
|
||||
public boolean getIsRepairable (final ItemStack stack, final ItemStack repairItem) {
|
||||
return repairItem.isItemEqual(new ItemStack(ItemRegistry.ItemMaterial, 1, 0)) ? true
|
||||
: super.getIsRepairable(stack, repairItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -15,67 +15,61 @@ import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.registry.ItemRegistry;
|
||||
import thaumcraft.api.IRepairable;
|
||||
|
||||
public class ItemShadowmetalHoe extends ItemHoe implements IRepairable
|
||||
{
|
||||
public ItemShadowmetalHoe (ToolMaterial material)
|
||||
{
|
||||
public class ItemShadowmetalHoe extends ItemHoe implements IRepairable {
|
||||
|
||||
public ItemShadowmetalHoe (final ToolMaterial material) {
|
||||
super(material);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setTextureName("taintedmagic:ItemShadowmetalHoe");
|
||||
this.setUnlocalizedName("ItemShadowmetalHoe");
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setTextureName("taintedmagic:ItemShadowmetalHoe");
|
||||
setUnlocalizedName("ItemShadowmetalHoe");
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
}
|
||||
|
||||
public boolean getIsRepairable (ItemStack stack, ItemStack repairItem)
|
||||
{
|
||||
@Override
|
||||
public boolean getIsRepairable (final ItemStack stack, final ItemStack repairItem) {
|
||||
return repairItem.isItemEqual(new ItemStack(ItemRegistry.ItemMaterial, 1, 0)) ? true
|
||||
: super.getIsRepairable(stack, repairItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int i, float f, float f1,
|
||||
float f2)
|
||||
{
|
||||
public boolean onItemUse (final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y,
|
||||
final int z, final int i, final float f, final float f1, final float f2) {
|
||||
super.onItemUse(stack, player, world, x, y, z, i, f, f1, f2);
|
||||
|
||||
if (!player.worldObj.isRemote)
|
||||
{
|
||||
Block dirt = Blocks.dirt;
|
||||
if (!player.worldObj.isRemote) {
|
||||
final Block dirt = Blocks.dirt;
|
||||
|
||||
if (player.worldObj.getBlock(x, y, z) == Blocks.farmland)
|
||||
{
|
||||
if (player.worldObj.getBlock(x, y, z) == Blocks.farmland) {
|
||||
player.worldObj.setBlock(x, y, z, Blocks.dirt);
|
||||
stack.damageItem(1, player);
|
||||
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F),
|
||||
dirt.stepSound.getStepResourcePath(), (dirt.stepSound.getVolume() + 1.0F) / 2.0F,
|
||||
dirt.stepSound.getPitch() * 0.8F);
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, dirt.stepSound.getStepResourcePath(),
|
||||
(dirt.stepSound.getVolume() + 1.0F) / 2.0F, dirt.stepSound.getPitch() * 0.8F);
|
||||
}
|
||||
else if (player.worldObj.getBlock(x, y, z) == Blocks.dirt || player.worldObj.getBlock(x, y, z) == Blocks.grass)
|
||||
{
|
||||
else if (player.worldObj.getBlock(x, y, z) == Blocks.dirt || player.worldObj.getBlock(x, y, z) == Blocks.grass) {
|
||||
player.worldObj.setBlock(x, y, z, Blocks.farmland);
|
||||
stack.damageItem(1, player);
|
||||
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F),
|
||||
dirt.stepSound.getStepResourcePath(), (dirt.stepSound.getVolume() + 1.0F) / 2.0F,
|
||||
dirt.stepSound.getPitch() * 0.8F);
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, dirt.stepSound.getStepResourcePath(),
|
||||
(dirt.stepSound.getVolume() + 1.0F) / 2.0F, dirt.stepSound.getPitch() * 0.8F);
|
||||
}
|
||||
}
|
||||
if (player.worldObj.getBlock(x, y, z) == Blocks.dirt || player.worldObj.getBlock(x, y, z) == Blocks.grass
|
||||
|| player.worldObj.getBlock(x, y, z) == Blocks.farmland)
|
||||
|| player.worldObj.getBlock(x, y, z) == Blocks.farmland) {
|
||||
player.swingItem();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void useHoe (UseHoeEvent event)
|
||||
{
|
||||
if (event.current.getItem() == ItemRegistry.ItemShadowmetalHoe) event.setCanceled(true);
|
||||
public void useHoe (final UseHoeEvent event) {
|
||||
if (event.current.getItem() == ItemRegistry.ItemShadowmetalHoe) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -7,25 +7,23 @@ import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.registry.ItemRegistry;
|
||||
import thaumcraft.api.IRepairable;
|
||||
|
||||
public class ItemShadowmetalPick extends ItemPickaxe implements IRepairable
|
||||
{
|
||||
public ItemShadowmetalPick (ToolMaterial material)
|
||||
{
|
||||
public class ItemShadowmetalPick extends ItemPickaxe implements IRepairable {
|
||||
|
||||
public ItemShadowmetalPick (final ToolMaterial material) {
|
||||
super(material);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setTextureName("taintedmagic:ItemShadowmetalPick");
|
||||
this.setUnlocalizedName("ItemShadowmetalPick");
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setTextureName("taintedmagic:ItemShadowmetalPick");
|
||||
setUnlocalizedName("ItemShadowmetalPick");
|
||||
}
|
||||
|
||||
public boolean getIsRepairable (ItemStack stack, ItemStack repairItem)
|
||||
{
|
||||
@Override
|
||||
public boolean getIsRepairable (final ItemStack stack, final ItemStack repairItem) {
|
||||
return repairItem.isItemEqual(new ItemStack(ItemRegistry.ItemMaterial, 1, 0)) ? true
|
||||
: super.getIsRepairable(stack, repairItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -7,25 +7,23 @@ import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.registry.ItemRegistry;
|
||||
import thaumcraft.api.IRepairable;
|
||||
|
||||
public class ItemShadowmetalSpade extends ItemSpade implements IRepairable
|
||||
{
|
||||
public ItemShadowmetalSpade (ToolMaterial material)
|
||||
{
|
||||
public class ItemShadowmetalSpade extends ItemSpade implements IRepairable {
|
||||
|
||||
public ItemShadowmetalSpade (final ToolMaterial material) {
|
||||
super(material);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setTextureName("taintedmagic:ItemShadowmetalSpade");
|
||||
this.setUnlocalizedName("ItemShadowmetalSpade");
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setTextureName("taintedmagic:ItemShadowmetalSpade");
|
||||
setUnlocalizedName("ItemShadowmetalSpade");
|
||||
}
|
||||
|
||||
public boolean getIsRepairable (ItemStack stack, ItemStack repairItem)
|
||||
{
|
||||
@Override
|
||||
public boolean getIsRepairable (final ItemStack stack, final ItemStack repairItem) {
|
||||
return repairItem.isItemEqual(new ItemStack(ItemRegistry.ItemMaterial, 1, 0)) ? true
|
||||
: super.getIsRepairable(stack, repairItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -7,25 +7,23 @@ import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.registry.ItemRegistry;
|
||||
import thaumcraft.api.IRepairable;
|
||||
|
||||
public class ItemShadowmetalSword extends ItemSword implements IRepairable
|
||||
{
|
||||
public ItemShadowmetalSword (ToolMaterial material)
|
||||
{
|
||||
public class ItemShadowmetalSword extends ItemSword implements IRepairable {
|
||||
|
||||
public ItemShadowmetalSword (final ToolMaterial material) {
|
||||
super(material);
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setTextureName("taintedmagic:ItemShadowmetalSword");
|
||||
this.setUnlocalizedName("ItemShadowmetalSword");
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setTextureName("taintedmagic:ItemShadowmetalSword");
|
||||
setUnlocalizedName("ItemShadowmetalSword");
|
||||
}
|
||||
|
||||
public boolean getIsRepairable (ItemStack stack, ItemStack repairItem)
|
||||
{
|
||||
@Override
|
||||
public boolean getIsRepairable (final ItemStack stack, final ItemStack repairItem) {
|
||||
return repairItem.isItemEqual(new ItemStack(ItemRegistry.ItemMaterial, 1, 0)) ? true
|
||||
: super.getIsRepairable(stack, repairItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -24,8 +24,8 @@ import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.common.items.wands.WandManager;
|
||||
|
||||
public class ItemThaumicDisassembler extends Item
|
||||
{
|
||||
public class ItemThaumicDisassembler extends Item {
|
||||
|
||||
public static final String TAG_MODE = "mode";
|
||||
public static final String TAG_CHARGE = "charge";
|
||||
public static final int MAX_CHARGE = 50000;
|
||||
@@ -33,33 +33,29 @@ public class ItemThaumicDisassembler extends Item
|
||||
public static final int ENTROPY_USAGE_HOE = ENTROPY_USAGE_BASE * 5;
|
||||
public static final int ENTROPY_USAGE_HIT = ENTROPY_USAGE_BASE * 10;
|
||||
|
||||
public ItemThaumicDisassembler ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setMaxStackSize(1);
|
||||
this.setUnlocalizedName("ItemThaumicDisassembler");
|
||||
this.setTextureName("taintedmagic:ItemThaumicDisassembler");
|
||||
public ItemThaumicDisassembler () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName("ItemThaumicDisassembler");
|
||||
setTextureName("taintedmagic:ItemThaumicDisassembler");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar (ItemStack stack)
|
||||
{
|
||||
public boolean showDurabilityBar (final ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay (ItemStack stack)
|
||||
{
|
||||
return 1d - ((double) getEntropyCharge(stack) / (double) MAX_CHARGE);
|
||||
public double getDurabilityForDisplay (final ItemStack stack) {
|
||||
return 1d - (double) getEntropyCharge(stack) / (double) MAX_CHARGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean b)
|
||||
{
|
||||
public void addInformation (final ItemStack stack, final EntityPlayer player, final List list, final boolean b) {
|
||||
super.addInformation(stack, player, list, b);
|
||||
|
||||
list.add(StatCollector.translateToLocal("text.disassembler.charge") + ": " + EnumChatFormatting.DARK_GRAY
|
||||
+ (getEntropyCharge(stack) / 100) + "/" + (MAX_CHARGE / 100));
|
||||
+ getEntropyCharge(stack) / 100 + "/" + MAX_CHARGE / 100);
|
||||
list.add(StatCollector.translateToLocal("text.disassembler.mode") + ": " + getModeName(stack));
|
||||
list.add(StatCollector.translateToLocal("text.disassembler.efficiency") + ": "
|
||||
+ (getMode(stack) == 3 ? EnumChatFormatting.RED : EnumChatFormatting.GREEN) + getEfficiency(stack));
|
||||
@@ -68,59 +64,56 @@ public class ItemThaumicDisassembler extends Item
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock (Block block, ItemStack stack)
|
||||
{
|
||||
public boolean canHarvestBlock (final Block block, final ItemStack stack) {
|
||||
return block != Blocks.bedrock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity (ItemStack stack, EntityLivingBase entity, EntityLivingBase player)
|
||||
{
|
||||
if (getEntropyCharge(stack) > 0)
|
||||
{
|
||||
public boolean hitEntity (final ItemStack stack, final EntityLivingBase entity, final EntityLivingBase player) {
|
||||
if (getEntropyCharge(stack) > 0) {
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) player), 20);
|
||||
consumeEntropy(stack, ENTROPY_USAGE_HIT);
|
||||
}
|
||||
else entity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) player), 4);
|
||||
else {
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) player), 4);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed (ItemStack stack, Block block, int meta)
|
||||
{
|
||||
public float getDigSpeed (final ItemStack stack, final Block block, final int meta) {
|
||||
return getEntropyCharge(stack) != 0 ? getEfficiency(stack) : 1f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed (ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entity)
|
||||
{
|
||||
if (block.getBlockHardness(world, x, y, z) != 0.0D)
|
||||
public boolean onBlockDestroyed (final ItemStack stack, final World world, final Block block, final int x, final int y,
|
||||
final int z, final EntityLivingBase entity) {
|
||||
if (block.getBlockHardness(world, x, y, z) != 0.0D) {
|
||||
consumeEntropy(stack, (int) ((double) ENTROPY_USAGE_BASE * (double) getEfficiency(stack) / 8d));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFull3D ()
|
||||
{
|
||||
public boolean isFull3D () {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (player.isSneaking())
|
||||
{
|
||||
if (stack.stackTagCompound == null) stack.setTagCompound(new NBTTagCompound());
|
||||
public ItemStack onItemRightClick (final ItemStack stack, final World world, final EntityPlayer player) {
|
||||
if (player.isSneaking()) {
|
||||
if (stack.stackTagCompound == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
stack.stackTagCompound.setInteger(TAG_MODE, getMode(stack) < 3 ? getMode(stack) + 1 : 0);
|
||||
|
||||
String str = EnumChatFormatting.GRAY + StatCollector.translateToLocal("text.disassembler.mode") + ": "
|
||||
final String str = EnumChatFormatting.GRAY + StatCollector.translateToLocal("text.disassembler.mode") + ": "
|
||||
+ getModeName(getMode(stack)) + (getMode(stack) == 3 ? EnumChatFormatting.RED : EnumChatFormatting.GREEN)
|
||||
+ " (" + getEfficiency(getMode(stack)) + ")";
|
||||
HUDHandler.displayString(str, 300, false);
|
||||
@@ -129,20 +122,18 @@ public class ItemThaumicDisassembler extends Item
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
if (!player.isSneaking() && getMode(stack) != 3)
|
||||
{
|
||||
if (!useHoe(stack, player, world, x, y, z, side) && world.getBlock(x, y, z) != Blocks.farmland) return false;
|
||||
public boolean onItemUse (final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y,
|
||||
final int z, final int side, final float hitX, final float hitY, final float hitZ) {
|
||||
if (!player.isSneaking() && getMode(stack) != 3) {
|
||||
if (!useHoe(stack, player, world, x, y, z, side) && world.getBlock(x, y, z) != Blocks.farmland)
|
||||
return false;
|
||||
|
||||
if (getMode(stack) == 1) return true;
|
||||
if (getMode(stack) == 1)
|
||||
return true;
|
||||
|
||||
int rad = getMode(stack) == 0 ? 1 : 2;
|
||||
for (int x1 = x - rad; x1 <= x + rad; x1++)
|
||||
{
|
||||
for (int z1 = z - rad; z1 <= z + rad; z1++)
|
||||
{
|
||||
final int rad = getMode(stack) == 0 ? 1 : 2;
|
||||
for (int x1 = x - rad; x1 <= x + rad; x1++) {
|
||||
for (int z1 = z - rad; z1 <= z + rad; z1++) {
|
||||
useHoe(stack, player, world, x1, y, z1, side);
|
||||
}
|
||||
}
|
||||
@@ -151,48 +142,42 @@ public class ItemThaumicDisassembler extends Item
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean useHoe (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side)
|
||||
{
|
||||
private boolean useHoe (final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y,
|
||||
final int z, final int side) {
|
||||
if (!player.canPlayerEdit(x, y, z, side, stack)
|
||||
|| (!player.capabilities.isCreativeMode && getEntropyCharge(stack) < ENTROPY_USAGE_HOE))
|
||||
|| !player.capabilities.isCreativeMode && getEntropyCharge(stack) < ENTROPY_USAGE_HOE)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
UseHoeEvent event = new UseHoeEvent(player, stack, world, x, y, z);
|
||||
if (MinecraftForge.EVENT_BUS.post(event)) return false;
|
||||
|
||||
if (event.getResult() == Result.ALLOW)
|
||||
{
|
||||
consumeEntropy(stack, ENTROPY_USAGE_HOE);
|
||||
return true;
|
||||
}
|
||||
final UseHoeEvent event = new UseHoeEvent(player, stack, world, x, y, z);
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
return false;
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
boolean air = world.isAirBlock(x, y + 1, z);
|
||||
|
||||
if (side != 0 && air && (block == Blocks.grass || block == Blocks.dirt))
|
||||
{
|
||||
Block farm = Blocks.farmland;
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, farm.stepSound.getStepResourcePath(),
|
||||
(farm.stepSound.getVolume() + 1.0F) / 2.0F, farm.stepSound.getPitch() * 0.8F);
|
||||
|
||||
if (world.isRemote) return true;
|
||||
else
|
||||
{
|
||||
world.setBlock(x, y, z, farm);
|
||||
if (!player.capabilities.isCreativeMode) consumeEntropy(stack, ENTROPY_USAGE_HOE);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else return false;
|
||||
if (event.getResult() == Result.ALLOW) {
|
||||
consumeEntropy(stack, ENTROPY_USAGE_HOE);
|
||||
return true;
|
||||
}
|
||||
|
||||
final Block block = world.getBlock(x, y, z);
|
||||
final boolean air = world.isAirBlock(x, y + 1, z);
|
||||
|
||||
if (side == 0 || !air || (block != Blocks.grass && block != Blocks.dirt))
|
||||
return false;
|
||||
|
||||
final Block farm = Blocks.farmland;
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, farm.stepSound.getStepResourcePath(),
|
||||
(farm.stepSound.getVolume() + 1.0F) / 2.0F, farm.stepSound.getPitch() * 0.8F);
|
||||
|
||||
if (!world.isRemote) {
|
||||
world.setBlock(x, y, z, farm);
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
consumeEntropy(stack, ENTROPY_USAGE_HOE);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static int getEfficiency (int mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
public static int getEfficiency (final int mode) {
|
||||
switch (mode) {
|
||||
case 0 :
|
||||
return 20;
|
||||
case 1 :
|
||||
@@ -205,21 +190,18 @@ public class ItemThaumicDisassembler extends Item
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int getEfficiency (ItemStack stack)
|
||||
{
|
||||
public static int getEfficiency (final ItemStack stack) {
|
||||
return getEfficiency(getMode(stack));
|
||||
}
|
||||
|
||||
public static int getMode (ItemStack stack)
|
||||
{
|
||||
if (stack.stackTagCompound == null) return 0;
|
||||
public static int getMode (final ItemStack stack) {
|
||||
if (stack.stackTagCompound == null)
|
||||
return 0;
|
||||
return stack.stackTagCompound.getInteger(TAG_MODE);
|
||||
}
|
||||
|
||||
public static String getModeName (int mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
public static String getModeName (final int mode) {
|
||||
switch (mode) {
|
||||
case 0 :
|
||||
return "\u00A7a" + StatCollector.translateToLocal("text.disassembler.normal");
|
||||
case 1 :
|
||||
@@ -232,43 +214,44 @@ public class ItemThaumicDisassembler extends Item
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getModeName (ItemStack stack)
|
||||
{
|
||||
public static String getModeName (final ItemStack stack) {
|
||||
return getModeName(getMode(stack));
|
||||
}
|
||||
|
||||
private void addEntropy (ItemStack stack, int amount)
|
||||
{
|
||||
if (stack.getTagCompound() == null) stack.stackTagCompound = new NBTTagCompound();
|
||||
private void addEntropy (final ItemStack stack, final int amount) {
|
||||
if (stack.getTagCompound() == null) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
stack.getTagCompound().setInteger(TAG_CHARGE, getEntropyCharge(stack) + amount);
|
||||
}
|
||||
|
||||
private void consumeEntropy (ItemStack stack, int amount)
|
||||
{
|
||||
if (stack.getTagCompound() == null) stack.stackTagCompound = new NBTTagCompound();
|
||||
private void consumeEntropy (final ItemStack stack, final int amount) {
|
||||
if (stack.getTagCompound() == null) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
stack.getTagCompound().setInteger(TAG_CHARGE, getEntropyCharge(stack) - amount);
|
||||
}
|
||||
|
||||
private int getEntropyCharge (ItemStack stack)
|
||||
{
|
||||
if (stack.getTagCompound() == null) return 0;
|
||||
private int getEntropyCharge (final ItemStack stack) {
|
||||
if (stack.getTagCompound() == null)
|
||||
return 0;
|
||||
return stack.getTagCompound().getInteger(TAG_CHARGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int i, boolean b)
|
||||
{
|
||||
public void onUpdate (final ItemStack stack, final World world, final Entity entity, final int i, final boolean b) {
|
||||
super.onUpdate(stack, world, entity, i, b);
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
if (!world.isRemote && getEntropyCharge(stack) < MAX_CHARGE && entity.ticksExisted % 20 == 0)
|
||||
{
|
||||
if (entity instanceof EntityPlayer) {
|
||||
final EntityPlayer player = (EntityPlayer) entity;
|
||||
if (!world.isRemote && getEntropyCharge(stack) < MAX_CHARGE && entity.ticksExisted % 20 == 0) {
|
||||
int amount = MAX_CHARGE - getEntropyCharge(stack);
|
||||
if (amount > 100) amount = 100;
|
||||
if (amount > 100) {
|
||||
amount = 100;
|
||||
}
|
||||
|
||||
if (WandManager.consumeVisFromInventory(player, new AspectList().add(Aspect.ENTROPY, amount)))
|
||||
if (WandManager.consumeVisFromInventory(player, new AspectList().add(Aspect.ENTROPY, amount))) {
|
||||
addEntropy(stack, amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,45 +12,46 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
|
||||
public class ItemWandCap extends Item
|
||||
{
|
||||
int SUBTYPES = 4;
|
||||
IIcon[] icons = new IIcon[SUBTYPES];
|
||||
public class ItemWandCap extends Item {
|
||||
|
||||
public ItemWandCap ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setUnlocalizedName("ItemWandCap");
|
||||
this.setHasSubtypes(true);
|
||||
private static final int SUBTYPES = 4;
|
||||
private IIcon[] icons = new IIcon[SUBTYPES];
|
||||
|
||||
public ItemWandCap () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setUnlocalizedName("ItemWandCap");
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
for (int i = 0; i < icons.length; i++)
|
||||
this.icons[i] = ir.registerIcon("taintedmagic:ItemWandCap" + i);
|
||||
public void registerIcons (final IIconRegister ir) {
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
icons[i] = ir.registerIcon("taintedmagic:ItemWandCap" + i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public IIcon getIconFromDamage (int i)
|
||||
{
|
||||
return this.icons[i];
|
||||
public IIcon getIconFromDamage (final int i) {
|
||||
return icons[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void getSubItems (Item item, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < SUBTYPES; i++)
|
||||
public void getSubItems (final Item item, final CreativeTabs tab, final List list) {
|
||||
for (int i = 0; i < SUBTYPES; i++) {
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public String getUnlocalizedName (final ItemStack stack) {
|
||||
return super.getUnlocalizedName() + "." + stack.getItemDamage();
|
||||
}
|
||||
}
|
||||
@@ -12,45 +12,46 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
|
||||
public class ItemWandRod extends Item
|
||||
{
|
||||
int SUBTYPES = 2;
|
||||
IIcon[] icons = new IIcon[SUBTYPES];
|
||||
public class ItemWandRod extends Item {
|
||||
|
||||
public ItemWandRod ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setUnlocalizedName("ItemWandRod");
|
||||
this.setHasSubtypes(true);
|
||||
private static final int SUBTYPES = 2;
|
||||
private IIcon[] icons = new IIcon[SUBTYPES];
|
||||
|
||||
public ItemWandRod () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setUnlocalizedName("ItemWandRod");
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public EnumRarity getRarity (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public EnumRarity getRarity (final ItemStack stack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
for (int i = 0; i < icons.length; i++)
|
||||
this.icons[i] = ir.registerIcon("taintedmagic:ItemWandRod" + i);
|
||||
public void registerIcons (final IIconRegister ir) {
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
icons[i] = ir.registerIcon("taintedmagic:ItemWandRod" + i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public IIcon getIconFromDamage (int i)
|
||||
{
|
||||
return this.icons[i];
|
||||
public IIcon getIconFromDamage (final int i) {
|
||||
return icons[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void getSubItems (Item item, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < SUBTYPES; i++)
|
||||
public void getSubItems (final Item item, final CreativeTabs tab, final List list) {
|
||||
for (int i = 0; i < SUBTYPES; i++) {
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public String getUnlocalizedName (final ItemStack stack) {
|
||||
return super.getUnlocalizedName() + "." + stack.getItemDamage();
|
||||
}
|
||||
}
|
||||
@@ -19,113 +19,114 @@ import thaumcraft.api.wands.ItemFocusBasic;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
public class ItemFocusDarkMatter extends ItemFocusBasic
|
||||
{
|
||||
private IIcon depthIcon, ornIcon;
|
||||
public class ItemFocusDarkMatter extends ItemFocusBasic {
|
||||
|
||||
private IIcon depthIcon;
|
||||
private IIcon ornIcon;
|
||||
private long soundDelay = 0L;
|
||||
|
||||
private static final AspectList COST = new AspectList().add(Aspect.ENTROPY, 150).add(Aspect.FIRE, 100);
|
||||
private static final AspectList COST_SANITY = COST.copy().add(Aspect.ORDER, 50);
|
||||
private static final AspectList COST_CORROSIVE = COST.copy().add(Aspect.WATER, 50);
|
||||
|
||||
public ItemFocusDarkMatter ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setUnlocalizedName("ItemFocusDarkMatter");
|
||||
public ItemFocusDarkMatter () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setUnlocalizedName("ItemFocusDarkMatter");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.icon = ir.registerIcon("taintedmagic:ItemFocusDarkMatter");
|
||||
this.depthIcon = ir.registerIcon("taintedmagic:ItemFocusDarkMatter_depth");
|
||||
this.ornIcon = ir.registerIcon("thaumcraft:focus_warding_orn");
|
||||
public void registerIcons (final IIconRegister ir) {
|
||||
icon = ir.registerIcon("taintedmagic:ItemFocusDarkMatter");
|
||||
depthIcon = ir.registerIcon("taintedmagic:ItemFocusDarkMatter_depth");
|
||||
ornIcon = ir.registerIcon("thaumcraft:focus_warding_orn");
|
||||
}
|
||||
|
||||
public IIcon getFocusDepthLayerIcon (ItemStack stack)
|
||||
{
|
||||
return this.depthIcon;
|
||||
@Override
|
||||
public IIcon getFocusDepthLayerIcon (final ItemStack stack) {
|
||||
return depthIcon;
|
||||
}
|
||||
|
||||
public IIcon getOrnament (ItemStack stack)
|
||||
{
|
||||
return this.ornIcon;
|
||||
@Override
|
||||
public IIcon getOrnament (final ItemStack stack) {
|
||||
return ornIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses ()
|
||||
{
|
||||
public boolean requiresMultipleRenderPasses () {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public int getRenderPasses (int meta)
|
||||
{
|
||||
public int getRenderPasses (final int meta) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public IIcon getIconFromDamageForRenderPass (int meta, int pass)
|
||||
{
|
||||
return (pass == 0) ? this.ornIcon : this.icon;
|
||||
public IIcon getIconFromDamageForRenderPass (final int meta, final int pass) {
|
||||
return pass == 0 ? ornIcon : icon;
|
||||
}
|
||||
|
||||
public String getSortingHelper (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public String getSortingHelper (final ItemStack stack) {
|
||||
return "ELDRITCH" + super.getSortingHelper(stack);
|
||||
}
|
||||
|
||||
public int getFocusColor (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public int getFocusColor (final ItemStack stack) {
|
||||
return 0x000018;
|
||||
}
|
||||
|
||||
public AspectList getVisCost (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public AspectList getVisCost (final ItemStack stack) {
|
||||
AspectList cost = isUpgradedWith(stack, TMFocusUpgrades.sanity) ? COST_SANITY
|
||||
: isUpgradedWith(stack, TMFocusUpgrades.corrosive) ? COST_CORROSIVE : COST;
|
||||
|
||||
if (isUpgradedWith(stack, TMFocusUpgrades.diffusion))
|
||||
{
|
||||
if (isUpgradedWith(stack, TMFocusUpgrades.diffusion)) {
|
||||
cost = cost.copy();
|
||||
for (Aspect aspect : cost.getAspects())
|
||||
for (final Aspect aspect : cost.getAspects()) {
|
||||
cost.reduce(aspect, (int) (cost.getAmount(aspect) * 0.9));
|
||||
}
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
|
||||
public int getActivationCooldown (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public int getActivationCooldown (final ItemStack stack) {
|
||||
return isUpgradedWith(stack, TMFocusUpgrades.diffusion) ? -1 : 1000;
|
||||
}
|
||||
|
||||
public boolean isVisCostPerTick (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean isVisCostPerTick (final ItemStack stack) {
|
||||
return isUpgradedWith(stack, TMFocusUpgrades.diffusion);
|
||||
}
|
||||
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (final ItemStack stack) {
|
||||
return isUpgradedWith(stack, TMFocusUpgrades.diffusion) ? ItemFocusBasic.WandFocusAnimation.CHARGE
|
||||
: ItemFocusBasic.WandFocusAnimation.WAVE;
|
||||
}
|
||||
|
||||
public ItemStack onFocusRightClick (ItemStack stack, World world, EntityPlayer player, MovingObjectPosition mop)
|
||||
{
|
||||
ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
@Override
|
||||
public ItemStack onFocusRightClick (final ItemStack stack, final World world, final EntityPlayer player,
|
||||
final MovingObjectPosition mop) {
|
||||
final ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
|
||||
if (isUpgradedWith(wand.getFocusItem(stack), TMFocusUpgrades.diffusion)) player.setItemInUse(stack, 2147483647);
|
||||
else
|
||||
{
|
||||
if (!world.isRemote && wand.consumeAllVis(stack, player, getVisCost(wand.getFocusItem(stack)), true, false))
|
||||
{
|
||||
EntityDarkMatter proj = new EntityDarkMatter(world, player, 16F + wand.getFocusPotency(stack),
|
||||
if (isUpgradedWith(wand.getFocusItem(stack), TMFocusUpgrades.diffusion)) {
|
||||
player.setItemInUse(stack, 2147483647);
|
||||
}
|
||||
else {
|
||||
if (!world.isRemote && wand.consumeAllVis(stack, player, getVisCost(wand.getFocusItem(stack)), true, false)) {
|
||||
final EntityDarkMatter proj = new EntityDarkMatter(world, player, 16F + wand.getFocusPotency(stack),
|
||||
wand.getFocusEnlarge(stack), isUpgradedWith(wand.getFocusItem(stack), TMFocusUpgrades.corrosive));
|
||||
world.spawnEntityInWorld(proj);
|
||||
|
||||
if (!isUpgradedWith(wand.getFocusItem(stack), TMFocusUpgrades.sanity) && world.rand.nextInt(20) == 0)
|
||||
if (!isUpgradedWith(wand.getFocusItem(stack), TMFocusUpgrades.sanity) && world.rand.nextInt(20) == 0) {
|
||||
Thaumcraft.addStickyWarpToPlayer(player, 1);
|
||||
}
|
||||
|
||||
world.playSoundAtEntity(player, "thaumcraft:egattack", 0.4F, 1.0F + world.rand.nextFloat() * 0.1F);
|
||||
}
|
||||
@@ -134,30 +135,26 @@ public class ItemFocusDarkMatter extends ItemFocusBasic
|
||||
return stack;
|
||||
}
|
||||
|
||||
public void onUsingFocusTick (ItemStack stack, EntityPlayer player, int i)
|
||||
{
|
||||
ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
@Override
|
||||
public void onUsingFocusTick (final ItemStack stack, final EntityPlayer player, final int i) {
|
||||
final ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
|
||||
if (!wand.consumeAllVis(stack, player, getVisCost(wand.getFocusItem(stack)), false, false))
|
||||
{
|
||||
if (!wand.consumeAllVis(stack, player, getVisCost(wand.getFocusItem(stack)), false, false)) {
|
||||
player.stopUsingItem();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.worldObj.isRemote && this.soundDelay < System.currentTimeMillis())
|
||||
{
|
||||
if (!player.worldObj.isRemote && soundDelay < System.currentTimeMillis()) {
|
||||
player.worldObj.playSoundAtEntity(player, "thaumcraft:wind", 0.3F + 0.2F * (float) Math.random(),
|
||||
0.75F + 0.25F * (float) Math.random());
|
||||
this.soundDelay = System.currentTimeMillis() + 750L;
|
||||
soundDelay = System.currentTimeMillis() + 750L;
|
||||
}
|
||||
|
||||
if (!player.worldObj.isRemote && wand.consumeAllVis(stack, player, getVisCost(wand.getFocusItem(stack)), true, false))
|
||||
{
|
||||
for (int a = 0; a < 2 + wand.getFocusPotency(stack); a++)
|
||||
{
|
||||
EntityDiffusion proj = new EntityDiffusion(player.worldObj, player,
|
||||
isUpgradedWith(wand.getFocusItem(stack), FocusUpgradeType.enlarge)
|
||||
? (12.0F + wand.getFocusEnlarge(stack)) : 9.0F,
|
||||
if (!player.worldObj.isRemote && wand.consumeAllVis(stack, player, getVisCost(wand.getFocusItem(stack)), true, false)) {
|
||||
for (int a = 0; a < 2 + wand.getFocusPotency(stack); a++) {
|
||||
final EntityDiffusion proj = new EntityDiffusion(player.worldObj, player,
|
||||
isUpgradedWith(wand.getFocusItem(stack), FocusUpgradeType.enlarge) ? 12.0F + wand.getFocusEnlarge(stack)
|
||||
: 9.0F,
|
||||
12F + wand.getFocusPotency(stack), isUpgradedWith(wand.getFocusItem(stack), TMFocusUpgrades.corrosive));
|
||||
|
||||
proj.posX += proj.motionX;
|
||||
@@ -167,15 +164,15 @@ public class ItemFocusDarkMatter extends ItemFocusBasic
|
||||
player.worldObj.spawnEntityInWorld(proj);
|
||||
}
|
||||
|
||||
if (!isUpgradedWith(wand.getFocusItem(stack), TMFocusUpgrades.sanity) && player.worldObj.rand.nextInt(1000) == 0)
|
||||
if (!isUpgradedWith(wand.getFocusItem(stack), TMFocusUpgrades.sanity) && player.worldObj.rand.nextInt(1000) == 0) {
|
||||
Thaumcraft.addStickyWarpToPlayer(player, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank (ItemStack stack, int rank)
|
||||
{
|
||||
switch (rank)
|
||||
{
|
||||
@Override
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank (final ItemStack stack, final int rank) {
|
||||
switch (rank) {
|
||||
case 1 :
|
||||
return new FocusUpgradeType[]{ FocusUpgradeType.frugal, FocusUpgradeType.potency, FocusUpgradeType.enlarge };
|
||||
case 2 :
|
||||
@@ -192,9 +189,10 @@ public class ItemFocusDarkMatter extends ItemFocusBasic
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean canApplyUpgrade (ItemStack stack, EntityPlayer player, FocusUpgradeType type, int rank)
|
||||
{
|
||||
return (!type.equals(TMFocusUpgrades.diffusion))
|
||||
|| (ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "DIFFUSIONUPGRADE"));
|
||||
@Override
|
||||
public boolean canApplyUpgrade (final ItemStack stack, final EntityPlayer player, final FocusUpgradeType type,
|
||||
final int rank) {
|
||||
return !type.equals(TMFocusUpgrades.diffusion)
|
||||
|| ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "DIFFUSIONUPGRADE");
|
||||
}
|
||||
}
|
||||
@@ -17,111 +17,110 @@ import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.fx.particles.FXSparkle;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
public class ItemFocusLumos extends ItemFocusBasic
|
||||
{
|
||||
public class ItemFocusLumos extends ItemFocusBasic {
|
||||
|
||||
private static final AspectList COST = new AspectList().add(Aspect.AIR, 10).add(Aspect.FIRE, 25);
|
||||
|
||||
public ItemFocusLumos ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setUnlocalizedName("ItemFocusLumos");
|
||||
public ItemFocusLumos () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setUnlocalizedName("ItemFocusLumos");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.icon = ir.registerIcon("taintedmagic:ItemFocusLumos");
|
||||
public void registerIcons (final IIconRegister ir) {
|
||||
icon = ir.registerIcon("taintedmagic:ItemFocusLumos");
|
||||
}
|
||||
|
||||
public String getSortingHelper (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public String getSortingHelper (final ItemStack stack) {
|
||||
return "LUMOS" + super.getSortingHelper(stack);
|
||||
}
|
||||
|
||||
public int getFocusColor (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public int getFocusColor (final ItemStack stack) {
|
||||
return 0xC9D2F8;
|
||||
}
|
||||
|
||||
public AspectList getVisCost (ItemStack stack)
|
||||
{
|
||||
return this.COST;
|
||||
@Override
|
||||
public AspectList getVisCost (final ItemStack stack) {
|
||||
return COST;
|
||||
}
|
||||
|
||||
public int getActivationCooldown (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public int getActivationCooldown (final ItemStack stack) {
|
||||
return 1000;
|
||||
}
|
||||
|
||||
public boolean isVisCostPerTick (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean isVisCostPerTick (final ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (final ItemStack stack) {
|
||||
return ItemFocusBasic.WandFocusAnimation.WAVE;
|
||||
}
|
||||
|
||||
public ItemStack onFocusRightClick (ItemStack stack, World world, EntityPlayer player, MovingObjectPosition mop)
|
||||
{
|
||||
ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
@Override
|
||||
public ItemStack onFocusRightClick (final ItemStack stack, final World world, final EntityPlayer player,
|
||||
final MovingObjectPosition mop) {
|
||||
final ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
|
||||
if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
int x = mop.blockX;
|
||||
int y = mop.blockY;
|
||||
int z = mop.blockZ;
|
||||
|
||||
if (!world.getBlock(x, y, z).getMaterial().isReplaceable()) switch (mop.sideHit)
|
||||
{
|
||||
case 0 :
|
||||
y--;
|
||||
break;
|
||||
case 1 :
|
||||
y++;
|
||||
break;
|
||||
case 2 :
|
||||
z--;
|
||||
break;
|
||||
case 3 :
|
||||
z++;
|
||||
break;
|
||||
case 4 :
|
||||
x--;
|
||||
break;
|
||||
case 5 :
|
||||
x++;
|
||||
}
|
||||
if (world.getBlock(x, y, z).isReplaceable(world, x, y, z))
|
||||
{
|
||||
if (wand.consumeAllVis(stack, player, getVisCost(stack), true, false))
|
||||
{
|
||||
if (!world.isRemote) world.setBlock(x, y, z, BlockRegistry.BlockLumos, 0, 3);
|
||||
world.playSoundAtEntity(player, "thaumcraft:ice", 0.3F, 1.1F + world.rand.nextFloat() * 0.1F);
|
||||
|
||||
for (int a = 0; a < 9; a++)
|
||||
if (world.isRemote) spawnLumosParticles(world, x, y, z);
|
||||
if (!world.getBlock(x, y, z).getMaterial().isReplaceable()) {
|
||||
switch (mop.sideHit) {
|
||||
case 0 :
|
||||
y--;
|
||||
break;
|
||||
case 1 :
|
||||
y++;
|
||||
break;
|
||||
case 2 :
|
||||
z--;
|
||||
break;
|
||||
case 3 :
|
||||
z++;
|
||||
break;
|
||||
case 4 :
|
||||
x--;
|
||||
break;
|
||||
case 5 :
|
||||
x++;
|
||||
}
|
||||
}
|
||||
if (world.getBlock(x, y, z).isReplaceable(world, x, y, z)
|
||||
&& wand.consumeAllVis(stack, player, getVisCost(stack), true, false)) {
|
||||
if (!world.isRemote) {
|
||||
world.setBlock(x, y, z, BlockRegistry.BlockLumos, 0, 3);
|
||||
}
|
||||
world.playSoundAtEntity(player, "thaumcraft:ice", 0.3F, 1.1F + world.rand.nextFloat() * 0.1F);
|
||||
|
||||
for (int a = 0; a < 9; a++)
|
||||
if (world.isRemote) {
|
||||
spawnLumosParticles(world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
player.swingItem();
|
||||
return stack;
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
void spawnLumosParticles (World world, double x, double y, double z)
|
||||
{
|
||||
FXSparkle fx = new FXSparkle(world, x + world.rand.nextFloat(), y + world.rand.nextFloat(), z + world.rand.nextFloat(),
|
||||
1.75F, 6, 3 + world.rand.nextInt(3));
|
||||
void spawnLumosParticles (final World world, final double x, final double y, final double z) {
|
||||
final FXSparkle fx = new FXSparkle(world, x + world.rand.nextFloat(), y + world.rand.nextFloat(),
|
||||
z + world.rand.nextFloat(), 1.75F, 6, 3 + world.rand.nextInt(3));
|
||||
fx.setGravity(0.1F);
|
||||
ParticleEngine.instance.addEffect(world, fx);
|
||||
}
|
||||
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank (ItemStack stack, int rank)
|
||||
{
|
||||
switch (rank)
|
||||
{
|
||||
@Override
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank (final ItemStack stack, final int rank) {
|
||||
switch (rank) {
|
||||
case 1 :
|
||||
return new FocusUpgradeType[]{ FocusUpgradeType.frugal };
|
||||
case 2 :
|
||||
|
||||
@@ -20,101 +20,98 @@ import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.wands.FocusUpgradeType;
|
||||
import thaumcraft.api.wands.ItemFocusBasic;
|
||||
|
||||
public class ItemFocusMageMace extends ItemFocusBasic
|
||||
{
|
||||
IIcon ornIcon = null;
|
||||
public class ItemFocusMageMace extends ItemFocusBasic {
|
||||
|
||||
private IIcon ornIcon;
|
||||
|
||||
private static final AspectList COST = new AspectList().add(Aspect.ENTROPY, 10);
|
||||
|
||||
public ItemFocusMageMace ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setUnlocalizedName("ItemFocusMageMace");
|
||||
public ItemFocusMageMace () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setUnlocalizedName("ItemFocusMageMace");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.icon = ir.registerIcon("taintedmagic:ItemFocusMageMace");
|
||||
this.ornIcon = ir.registerIcon("taintedmagic:ItemFocusMageMace_orn");
|
||||
public void registerIcons (final IIconRegister ir) {
|
||||
icon = ir.registerIcon("taintedmagic:ItemFocusMageMace");
|
||||
ornIcon = ir.registerIcon("taintedmagic:ItemFocusMageMace_orn");
|
||||
}
|
||||
|
||||
public IIcon getOrnament (ItemStack stack)
|
||||
{
|
||||
return this.ornIcon;
|
||||
@Override
|
||||
public IIcon getOrnament (final ItemStack stack) {
|
||||
return ornIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses ()
|
||||
{
|
||||
public boolean requiresMultipleRenderPasses () {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public int getRenderPasses (int meta)
|
||||
{
|
||||
public int getRenderPasses (final int meta) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public IIcon getIconFromDamageForRenderPass (int meta, int pass)
|
||||
{
|
||||
return (pass == 0) ? this.ornIcon : this.icon;
|
||||
public IIcon getIconFromDamageForRenderPass (final int meta, final int pass) {
|
||||
return pass == 0 ? ornIcon : icon;
|
||||
}
|
||||
|
||||
public String getSortingHelper (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public String getSortingHelper (final ItemStack stack) {
|
||||
return "MACE" + super.getSortingHelper(stack);
|
||||
}
|
||||
|
||||
public int getFocusColor (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public int getFocusColor (final ItemStack stack) {
|
||||
return 0xACA9B5;
|
||||
}
|
||||
|
||||
public AspectList getVisCost (ItemStack stack)
|
||||
{
|
||||
return this.COST;
|
||||
@Override
|
||||
public AspectList getVisCost (final ItemStack stack) {
|
||||
return COST;
|
||||
}
|
||||
|
||||
public int getActivationCooldown (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public int getActivationCooldown (final ItemStack stack) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean isVisCostPerTick (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean isVisCostPerTick (final ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (final ItemStack stack) {
|
||||
return WandFocusAnimation.WAVE;
|
||||
}
|
||||
|
||||
public ItemStack onFocusRightClick (ItemStack stack, World world, EntityPlayer player, MovingObjectPosition mop)
|
||||
{
|
||||
@Override
|
||||
public ItemStack onFocusRightClick (final ItemStack stack, final World world, final EntityPlayer player,
|
||||
final MovingObjectPosition mop) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean b)
|
||||
{
|
||||
public void addInformation (final ItemStack stack, final EntityPlayer player, final List list, final boolean b) {
|
||||
super.addInformation(stack, player, list, b);
|
||||
list.add(" ");
|
||||
|
||||
DecimalFormat df = new DecimalFormat("0.#");
|
||||
double dmg = ConfigHandler.MAGE_MACE_DMG_INC_BASE + (double) this.getUpgradeLevel(stack, FocusUpgradeType.potency);
|
||||
final DecimalFormat df = new DecimalFormat("0.#");
|
||||
final double dmg = ConfigHandler.MAGE_MACE_DMG_INC_BASE + getUpgradeLevel(stack, FocusUpgradeType.potency);
|
||||
|
||||
list.add(EnumChatFormatting.BLUE + "+" + df.format(dmg) + " "
|
||||
+ StatCollector.translateToLocal("text.attackdamageequipped"));
|
||||
}
|
||||
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank (ItemStack stack, int rank)
|
||||
{
|
||||
switch (rank)
|
||||
{
|
||||
@Override
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank (final ItemStack stack, final int rank) {
|
||||
switch (rank) {
|
||||
case 1 :
|
||||
return new FocusUpgradeType[]{ FocusUpgradeType.frugal, FocusUpgradeType.potency };
|
||||
case 2 :
|
||||
|
||||
@@ -28,98 +28,100 @@ import thaumcraft.codechicken.lib.vec.Vector3;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
public class ItemFocusShockwave extends ItemFocusBasic
|
||||
{
|
||||
public class ItemFocusShockwave extends ItemFocusBasic {
|
||||
|
||||
private static final AspectList COST = new AspectList().add(Aspect.AIR, 150).add(Aspect.ENTROPY, 100);
|
||||
|
||||
IIcon depthIcon;
|
||||
private IIcon depthIcon;
|
||||
|
||||
public ItemFocusShockwave ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setUnlocalizedName("ItemFocusShockwave");
|
||||
public ItemFocusShockwave () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setUnlocalizedName("ItemFocusShockwave");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.icon = ir.registerIcon("taintedmagic:ItemFocusShockwave");
|
||||
this.depthIcon = ir.registerIcon("taintedmagic:ItemFocusShockwave_depth");
|
||||
public void registerIcons (final IIconRegister ir) {
|
||||
icon = ir.registerIcon("taintedmagic:ItemFocusShockwave");
|
||||
depthIcon = ir.registerIcon("taintedmagic:ItemFocusShockwave_depth");
|
||||
}
|
||||
|
||||
public IIcon getFocusDepthLayerIcon (ItemStack stack)
|
||||
{
|
||||
return this.depthIcon;
|
||||
@Override
|
||||
public IIcon getFocusDepthLayerIcon (final ItemStack stack) {
|
||||
return depthIcon;
|
||||
}
|
||||
|
||||
public String getSortingHelper (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public String getSortingHelper (final ItemStack stack) {
|
||||
return "SHOCKWAVE" + super.getSortingHelper(stack);
|
||||
}
|
||||
|
||||
public int getFocusColor (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public int getFocusColor (final ItemStack stack) {
|
||||
return 0xB0B7C4;
|
||||
}
|
||||
|
||||
public AspectList getVisCost (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public AspectList getVisCost (final ItemStack stack) {
|
||||
return COST;
|
||||
}
|
||||
|
||||
public int getActivationCooldown (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public int getActivationCooldown (final ItemStack stack) {
|
||||
return 10000;
|
||||
}
|
||||
|
||||
public boolean isVisCostPerTick (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean isVisCostPerTick (final ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (final ItemStack stack) {
|
||||
return ItemFocusBasic.WandFocusAnimation.WAVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean b)
|
||||
{
|
||||
public void addInformation (final ItemStack stack, final EntityPlayer player, final List list, final boolean b) {
|
||||
super.addInformation(stack, player, list, b);
|
||||
list.add(" ");
|
||||
list.add(EnumChatFormatting.BLUE + "+"
|
||||
+ new String(this.isUpgradedWith(stack, FocusUpgradeType.enlarge)
|
||||
? Integer.toString(15 + this.getUpgradeLevel(stack, FocusUpgradeType.enlarge)) : "15")
|
||||
+ new String(isUpgradedWith(stack, FocusUpgradeType.enlarge)
|
||||
? Integer.toString(15 + getUpgradeLevel(stack, FocusUpgradeType.enlarge)) : "15")
|
||||
+ " " + StatCollector.translateToLocal("text.radius"));
|
||||
}
|
||||
|
||||
public ItemStack onFocusRightClick (ItemStack stack, World world, EntityPlayer player, MovingObjectPosition mop)
|
||||
{
|
||||
ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
@Override
|
||||
public ItemStack onFocusRightClick (final ItemStack stack, final World world, final EntityPlayer player,
|
||||
final MovingObjectPosition mop) {
|
||||
final ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
|
||||
int potency = wand.getFocusPotency(stack);
|
||||
int enlarge = wand.getFocusEnlarge(stack);
|
||||
final int potency = wand.getFocusPotency(stack);
|
||||
final int enlarge = wand.getFocusEnlarge(stack);
|
||||
|
||||
if (wand.consumeAllVis(stack, player, getVisCost(stack), true, false))
|
||||
{
|
||||
List<EntityLivingBase> ents =
|
||||
if (wand.consumeAllVis(stack, player, getVisCost(stack), true, false)) {
|
||||
final List<EntityLivingBase> ents =
|
||||
world.getEntitiesWithinAABB(EntityLivingBase.class,
|
||||
AxisAlignedBB.getBoundingBox(player.posX, player.posY, player.posZ, player.posX + 1,
|
||||
player.posY + 1, player.posZ + 1)
|
||||
.expand(15.0D + enlarge, 15.0D + enlarge, 15.0D + enlarge));
|
||||
|
||||
if (ents != null && ents.size() > 0) for (EntityLivingBase entity : ents)
|
||||
{
|
||||
if (entity != player && entity.isEntityAlive() && !entity.isEntityInvulnerable())
|
||||
{
|
||||
double dist = TaintedMagicHelper.getDistanceTo(player, entity.posX, entity.posY, entity.posZ);
|
||||
if (ents != null && ents.size() > 0) {
|
||||
for (final EntityLivingBase entity : ents) {
|
||||
if (entity != player && entity.isEntityAlive() && !entity.isEntityInvulnerable()) {
|
||||
final double dist = TaintedMagicHelper.getDistanceTo(player, entity.posX, entity.posY, entity.posZ);
|
||||
|
||||
if (dist < 7.0D) entity.attackEntityFrom(DamageSource.magic, 2.0F + potency);
|
||||
if (dist < 7.0D) {
|
||||
entity.attackEntityFrom(DamageSource.magic, 2.0F + potency);
|
||||
}
|
||||
|
||||
Vector3 vel = TaintedMagicHelper.getVectorBetweenEntities(entity, player);
|
||||
entity.addVelocity(vel.x * (5.0D + potency), 1.5D + (potency * 0.1D), vel.z * (5.0D + potency));
|
||||
final Vector3 vel = TaintedMagicHelper.getVectorBetweenEntities(entity, player);
|
||||
entity.addVelocity(vel.x * (5.0D + potency), 1.5D + potency * 0.1D, vel.z * (5.0D + potency));
|
||||
|
||||
if (world.isRemote) spawnParticles(world, player, entity);
|
||||
if (world.isRemote) {
|
||||
spawnParticles(world, player, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
world.playSoundAtEntity(player, "taintedmagic:shockwave", 5.0F, 1.5F * (float) Math.random());
|
||||
@@ -129,29 +131,26 @@ public class ItemFocusShockwave extends ItemFocusBasic
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public static void spawnParticles (World world, EntityPlayer player, Entity entity)
|
||||
{
|
||||
FXLightningBolt bolt = new FXLightningBolt(world, player, entity, world.rand.nextLong(), 4);
|
||||
public static void spawnParticles (final World world, final EntityPlayer player, final Entity entity) {
|
||||
final FXLightningBolt bolt = new FXLightningBolt(world, player, entity, world.rand.nextLong(), 4);
|
||||
|
||||
bolt.defaultFractal();
|
||||
bolt.setType(2);
|
||||
bolt.setWidth(0.125F);
|
||||
bolt.finalizeBolt();
|
||||
|
||||
for (int a = 0; a < 5; a++)
|
||||
{
|
||||
Random random = player.worldObj.rand;
|
||||
float x = (float) entity.posX + (random.nextFloat() - random.nextFloat()) * 0.6F;
|
||||
float y = (float) entity.posY + (random.nextFloat() - random.nextFloat()) * 0.6F;
|
||||
float z = (float) entity.posZ + (random.nextFloat() - random.nextFloat()) * 0.6F;
|
||||
for (int a = 0; a < 5; a++) {
|
||||
final Random random = player.worldObj.rand;
|
||||
final float x = (float) entity.posX + (random.nextFloat() - random.nextFloat()) * 0.6F;
|
||||
final float y = (float) entity.posY + (random.nextFloat() - random.nextFloat()) * 0.6F;
|
||||
final float z = (float) entity.posZ + (random.nextFloat() - random.nextFloat()) * 0.6F;
|
||||
Thaumcraft.proxy.sparkle(x, y, z, 2.0F + random.nextFloat(), 2, 0.05F + random.nextFloat() * 0.05F);
|
||||
}
|
||||
}
|
||||
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank (ItemStack stack, int rank)
|
||||
{
|
||||
switch (rank)
|
||||
{
|
||||
@Override
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank (final ItemStack stack, final int rank) {
|
||||
switch (rank) {
|
||||
case 1 :
|
||||
return new FocusUpgradeType[]{ FocusUpgradeType.frugal, FocusUpgradeType.enlarge, FocusUpgradeType.potency };
|
||||
case 2 :
|
||||
|
||||
@@ -23,100 +23,97 @@ import thaumcraft.common.entities.monster.EntityTaintSwarm;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import thaumcraft.common.lib.utils.EntityUtils;
|
||||
|
||||
public class ItemFocusTaintSwarm extends ItemFocusBasic
|
||||
{
|
||||
IIcon depthIcon = null;
|
||||
IIcon ornIcon = null;
|
||||
public class ItemFocusTaintSwarm extends ItemFocusBasic {
|
||||
|
||||
private IIcon depthIcon;
|
||||
private IIcon ornIcon;
|
||||
|
||||
private static final AspectList COST = new AspectList().add(Aspect.EARTH, 50).add(Aspect.WATER, 50);
|
||||
private static final AspectList COST_ANTIBODY = COST.copy().add(Aspect.ORDER, 10);
|
||||
|
||||
public ItemFocusTaintSwarm ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setUnlocalizedName("ItemFocusTaintSwarm");
|
||||
public ItemFocusTaintSwarm () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setUnlocalizedName("ItemFocusTaintSwarm");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.icon = ir.registerIcon("taintedmagic:ItemFocusTaintSwarm");
|
||||
this.depthIcon = ir.registerIcon("taintedmagic:ItemFocusTaintSwarm_depth");
|
||||
this.ornIcon = ir.registerIcon("thaumcraft:focus_whatever_orn");
|
||||
public void registerIcons (final IIconRegister ir) {
|
||||
icon = ir.registerIcon("taintedmagic:ItemFocusTaintSwarm");
|
||||
depthIcon = ir.registerIcon("taintedmagic:ItemFocusTaintSwarm_depth");
|
||||
ornIcon = ir.registerIcon("thaumcraft:focus_whatever_orn");
|
||||
}
|
||||
|
||||
public IIcon getFocusDepthLayerIcon (ItemStack stack)
|
||||
{
|
||||
return this.depthIcon;
|
||||
@Override
|
||||
public IIcon getFocusDepthLayerIcon (final ItemStack stack) {
|
||||
return depthIcon;
|
||||
}
|
||||
|
||||
public IIcon getOrnament (ItemStack stack)
|
||||
{
|
||||
return this.ornIcon;
|
||||
@Override
|
||||
public IIcon getOrnament (final ItemStack stack) {
|
||||
return ornIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses ()
|
||||
{
|
||||
public boolean requiresMultipleRenderPasses () {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public int getRenderPasses (int meta)
|
||||
{
|
||||
public int getRenderPasses (final int meta) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public IIcon getIconFromDamageForRenderPass (int meta, int pass)
|
||||
{
|
||||
return (pass == 0) ? this.ornIcon : this.icon;
|
||||
public IIcon getIconFromDamageForRenderPass (final int meta, final int pass) {
|
||||
return pass == 0 ? ornIcon : icon;
|
||||
}
|
||||
|
||||
public String getSortingHelper (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public String getSortingHelper (final ItemStack stack) {
|
||||
return "TAINT" + super.getSortingHelper(stack);
|
||||
}
|
||||
|
||||
public int getFocusColor (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public int getFocusColor (final ItemStack stack) {
|
||||
return 0x9929BD;
|
||||
}
|
||||
|
||||
public AspectList getVisCost (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public AspectList getVisCost (final ItemStack stack) {
|
||||
return isUpgradedWith(stack, TMFocusUpgrades.antibody) ? COST_ANTIBODY : COST;
|
||||
}
|
||||
|
||||
public int getActivationCooldown (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public int getActivationCooldown (final ItemStack stack) {
|
||||
return 3000;
|
||||
}
|
||||
|
||||
public boolean isVisCostPerTick (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean isVisCostPerTick (final ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (final ItemStack stack) {
|
||||
return ItemFocusBasic.WandFocusAnimation.WAVE;
|
||||
}
|
||||
|
||||
public ItemStack onFocusRightClick (ItemStack stack, World world, EntityPlayer player, MovingObjectPosition mop)
|
||||
{
|
||||
ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
@Override
|
||||
public ItemStack onFocusRightClick (final ItemStack stack, final World world, final EntityPlayer player,
|
||||
final MovingObjectPosition mop) {
|
||||
final ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
|
||||
Entity target = EntityUtils.getPointedEntity(world, player, 0.0D, 32.0D, 1.1F);
|
||||
final Entity target = EntityUtils.getPointedEntity(world, player, 0.0D, 32.0D, 1.1F);
|
||||
|
||||
if (target != null && target instanceof EntityLivingBase)
|
||||
{
|
||||
if (wand.consumeAllVis(stack, player, getVisCost(stack), true, false))
|
||||
{
|
||||
EntityTaintSwarm swarm = new EntityTaintSwarm(world);
|
||||
if (target != null && target instanceof EntityLivingBase) {
|
||||
if (wand.consumeAllVis(stack, player, getVisCost(stack), true, false)) {
|
||||
final EntityTaintSwarm swarm = new EntityTaintSwarm(world);
|
||||
|
||||
Vec3 look = player.getLookVec();
|
||||
final Vec3 look = player.getLookVec();
|
||||
swarm.setLocationAndAngles(player.posX + look.xCoord / 2.0D,
|
||||
player.posY + player.getEyeHeight() + look.yCoord / 2.0D, player.posZ + look.zCoord / 2.0D,
|
||||
player.rotationYaw, player.rotationPitch);
|
||||
@@ -125,17 +122,13 @@ public class ItemFocusTaintSwarm extends ItemFocusBasic
|
||||
swarm.setTarget(target);
|
||||
swarm.setIsSummoned(true);
|
||||
|
||||
if (!world.isRemote) world.spawnEntityInWorld(swarm);
|
||||
if (!world.isRemote) {
|
||||
world.spawnEntityInWorld(swarm);
|
||||
}
|
||||
|
||||
if (!isUpgradedWith(wand.getFocusItem(stack), TMFocusUpgrades.antibody) && player.worldObj.rand.nextInt(3) == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(Config.potionTaintPoisonID, 40, 2));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
if (!isUpgradedWith(wand.getFocusItem(stack), TMFocusUpgrades.antibody)
|
||||
&& player.worldObj.rand.nextInt(3) == 0) {
|
||||
player.addPotionEffect(new PotionEffect(Config.potionTaintPoisonID, 40, 2));
|
||||
}
|
||||
}
|
||||
player.swingItem();
|
||||
@@ -143,10 +136,9 @@ public class ItemFocusTaintSwarm extends ItemFocusBasic
|
||||
return stack;
|
||||
}
|
||||
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank (ItemStack stack, int rank)
|
||||
{
|
||||
switch (rank)
|
||||
{
|
||||
@Override
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank (final ItemStack stack, final int rank) {
|
||||
switch (rank) {
|
||||
case 1 :
|
||||
return new FocusUpgradeType[]{ FocusUpgradeType.frugal, FocusUpgradeType.potency };
|
||||
case 2 :
|
||||
|
||||
@@ -23,59 +23,61 @@ import thaumcraft.common.lib.utils.EntityUtils;
|
||||
/**
|
||||
* This class is based off of ItemFocusShard.class created by <Azanor> as part of Thaumcraft 5.
|
||||
*/
|
||||
public class ItemFocusVisShard extends ItemFocusBasic
|
||||
{
|
||||
public class ItemFocusVisShard extends ItemFocusBasic {
|
||||
|
||||
private static final AspectList COST = new AspectList().add(Aspect.FIRE, 10).add(Aspect.ENTROPY, 10).add(Aspect.AIR, 10);
|
||||
private static final AspectList COST_PERSISTENT = COST.copy().add(Aspect.WATER, 10);
|
||||
|
||||
public ItemFocusVisShard ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTM);
|
||||
this.setUnlocalizedName("ItemFocusVisShard");
|
||||
public ItemFocusVisShard () {
|
||||
setCreativeTab(TaintedMagic.tabTM);
|
||||
setUnlocalizedName("ItemFocusVisShard");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.icon = ir.registerIcon("taintedmagic:ItemFocusVisShard");
|
||||
public void registerIcons (final IIconRegister ir) {
|
||||
icon = ir.registerIcon("taintedmagic:ItemFocusVisShard");
|
||||
}
|
||||
|
||||
public String getSortingHelper (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public String getSortingHelper (final ItemStack stack) {
|
||||
return "SHARD" + super.getSortingHelper(stack);
|
||||
}
|
||||
|
||||
public int getFocusColor (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public int getFocusColor (final ItemStack stack) {
|
||||
return 0x9929BD;
|
||||
}
|
||||
|
||||
public int getActivationCooldown (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public int getActivationCooldown (final ItemStack stack) {
|
||||
return 300;
|
||||
}
|
||||
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (final ItemStack stack) {
|
||||
return ItemFocusBasic.WandFocusAnimation.WAVE;
|
||||
}
|
||||
|
||||
public ItemStack onFocusRightClick (ItemStack stack, World world, EntityPlayer player, MovingObjectPosition mop)
|
||||
{
|
||||
ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
Entity look = EntityUtils.getPointedEntity(player.worldObj, player, 0.0D, 32.0D, 1.1F);
|
||||
@Override
|
||||
public ItemStack onFocusRightClick (final ItemStack stack, final World world, final EntityPlayer player,
|
||||
final MovingObjectPosition mop) {
|
||||
final ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
final Entity look = EntityUtils.getPointedEntity(player.worldObj, player, 0.0D, 32.0D, 1.1F);
|
||||
|
||||
if (look != null && look instanceof EntityLivingBase)
|
||||
{
|
||||
if (wand.consumeAllVis(stack, player, getVisCost(stack), true, false))
|
||||
{
|
||||
EntityHomingShard shard = new EntityHomingShard(world, player, (EntityLivingBase) look,
|
||||
if (look != null && look instanceof EntityLivingBase) {
|
||||
if (wand.consumeAllVis(stack, player, getVisCost(stack), true, false)) {
|
||||
final EntityHomingShard shard = new EntityHomingShard(world, player, (EntityLivingBase) look,
|
||||
wand.getFocusPotency(stack), isUpgradedWith(wand.getFocusItem(stack), TMFocusUpgrades.persistent));
|
||||
if (!world.isRemote) world.spawnEntityInWorld(shard);
|
||||
if (!world.isRemote) {
|
||||
world.spawnEntityInWorld(shard);
|
||||
}
|
||||
|
||||
world.playSoundAtEntity(shard, "taintedmagic:shard", 0.3F, 1.1F + world.rand.nextFloat() * 0.1F);
|
||||
|
||||
if (world.isRemote) spawnParticles(world, shard.posX, shard.posY, shard.posZ);
|
||||
if (world.isRemote) {
|
||||
spawnParticles(world, shard.posX, shard.posY, shard.posZ);
|
||||
}
|
||||
}
|
||||
player.swingItem();
|
||||
}
|
||||
@@ -83,26 +85,23 @@ public class ItemFocusVisShard extends ItemFocusBasic
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
void spawnParticles (World world, double x, double y, double z)
|
||||
{
|
||||
for (int a = 0; a < 18; a++)
|
||||
{
|
||||
FXSparkle fx = new FXSparkle(world, x + world.rand.nextFloat(), y + world.rand.nextFloat(),
|
||||
void spawnParticles (final World world, final double x, final double y, final double z) {
|
||||
for (int a = 0; a < 18; a++) {
|
||||
final FXSparkle fx = new FXSparkle(world, x + world.rand.nextFloat(), y + world.rand.nextFloat(),
|
||||
z + world.rand.nextFloat(), 1.75F, 0, 3 + world.rand.nextInt(3));
|
||||
fx.setGravity(0.1F);
|
||||
ParticleEngine.instance.addEffect(world, fx);
|
||||
}
|
||||
}
|
||||
|
||||
public AspectList getVisCost (ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public AspectList getVisCost (final ItemStack stack) {
|
||||
return isUpgradedWith(stack, TMFocusUpgrades.persistent) ? COST_PERSISTENT : COST;
|
||||
}
|
||||
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank (ItemStack stack, int rank)
|
||||
{
|
||||
switch (rank)
|
||||
{
|
||||
@Override
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank (final ItemStack stack, final int rank) {
|
||||
switch (rank) {
|
||||
case 1 :
|
||||
return new FocusUpgradeType[]{ FocusUpgradeType.frugal, FocusUpgradeType.potency };
|
||||
case 2 :
|
||||
|
||||
@@ -6,16 +6,16 @@ import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.wands.FocusUpgradeType;
|
||||
|
||||
public class TMFocusUpgrades
|
||||
{
|
||||
public class TMFocusUpgrades {
|
||||
|
||||
public static FocusUpgradeType sanity;
|
||||
public static FocusUpgradeType antibody;
|
||||
public static FocusUpgradeType corrosive;
|
||||
public static FocusUpgradeType persistent;
|
||||
public static FocusUpgradeType diffusion;
|
||||
|
||||
public static void initFocusUpgrades ()
|
||||
{
|
||||
public static void initFocusUpgrades () {
|
||||
|
||||
sanity = new FocusUpgradeType(ConfigHandler.SANITY_UPGRADE_ID,
|
||||
new ResourceLocation("taintedmagic:textures/foci/IconSanity.png"), "focus.upgrade.sanity.name",
|
||||
"focus.upgrade.sanity.text", new AspectList().add(Aspect.MIND, 1).add(Aspect.HEAL, 1));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package taintedmagic.common.lib;
|
||||
|
||||
public class LibInfo
|
||||
{
|
||||
public class LibInfo {
|
||||
|
||||
public static final String MODID = "TaintedMagic";
|
||||
public static final String NAME = "Tainted Magic";
|
||||
public static final String VERSION = "r7.82";
|
||||
|
||||
@@ -4,8 +4,7 @@ import net.minecraft.item.Item.ToolMaterial;
|
||||
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
|
||||
public class LibMaterials
|
||||
{
|
||||
public class LibMaterials {
|
||||
// Tool materials
|
||||
public static ToolMaterial toolMatHollow = EnumHelper.addToolMaterial("HOLLOW", 1, 200, 4.0F, -0.5F, 5);
|
||||
public static ToolMaterial toolMatShadow = EnumHelper.addToolMaterial("SHADOW", 3, 2500, 17.0F, 6.0F, 30);
|
||||
|
||||
@@ -5,12 +5,11 @@ import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import taintedmagic.common.lib.LibInfo;
|
||||
|
||||
public class PacketHandler
|
||||
{
|
||||
public class PacketHandler {
|
||||
|
||||
public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(LibInfo.MODID.toLowerCase());
|
||||
|
||||
public static void initPackets ()
|
||||
{
|
||||
public static void initPackets () {
|
||||
INSTANCE.registerMessage(PacketKatanaAttack.class, PacketKatanaAttack.class, 0, Side.SERVER);
|
||||
}
|
||||
}
|
||||
@@ -11,55 +11,53 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
public class PacketKatanaAttack implements IMessage, IMessageHandler<PacketKatanaAttack, IMessage>
|
||||
{
|
||||
public class PacketKatanaAttack implements IMessage, IMessageHandler<PacketKatanaAttack, IMessage> {
|
||||
|
||||
private int entityID;
|
||||
private int playerID;
|
||||
private int dimensionID;
|
||||
private float dmg;
|
||||
|
||||
public PacketKatanaAttack ()
|
||||
{
|
||||
public PacketKatanaAttack () {
|
||||
}
|
||||
|
||||
public PacketKatanaAttack (Entity entity, EntityPlayer player, float dmg)
|
||||
{
|
||||
this.entityID = entity.getEntityId();
|
||||
this.playerID = player.getEntityId();
|
||||
this.dimensionID = entity.dimension;
|
||||
public PacketKatanaAttack (final Entity entity, final EntityPlayer player, final float dmg) {
|
||||
entityID = entity.getEntityId();
|
||||
playerID = player.getEntityId();
|
||||
dimensionID = entity.dimension;
|
||||
this.dmg = dmg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage (PacketKatanaAttack message, MessageContext ctx)
|
||||
{
|
||||
World world = DimensionManager.getWorld(message.dimensionID);
|
||||
if (world == null) return null;
|
||||
public IMessage onMessage (final PacketKatanaAttack message, final MessageContext ctx) {
|
||||
final World world = DimensionManager.getWorld(message.dimensionID);
|
||||
if (world == null)
|
||||
return null;
|
||||
|
||||
Entity entity = world.getEntityByID(message.entityID);
|
||||
Entity player = world.getEntityByID(message.playerID);
|
||||
final Entity entity = world.getEntityByID(message.entityID);
|
||||
final Entity player = world.getEntityByID(message.playerID);
|
||||
|
||||
if (entity != null && entity instanceof EntityLivingBase && player != null && player instanceof EntityPlayer) entity
|
||||
.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) player).setDamageBypassesArmor(), message.dmg);
|
||||
if (entity != null && entity instanceof EntityLivingBase && player != null && player instanceof EntityPlayer) {
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) player).setDamageBypassesArmor(),
|
||||
message.dmg);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes (ByteBuf buf)
|
||||
{
|
||||
this.entityID = buf.readInt();
|
||||
this.playerID = buf.readInt();
|
||||
this.dimensionID = buf.readInt();
|
||||
this.dmg = buf.readFloat();
|
||||
public void fromBytes (final ByteBuf buf) {
|
||||
entityID = buf.readInt();
|
||||
playerID = buf.readInt();
|
||||
dimensionID = buf.readInt();
|
||||
dmg = buf.readFloat();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes (ByteBuf buf)
|
||||
{
|
||||
buf.writeInt(this.entityID);
|
||||
buf.writeInt(this.playerID);
|
||||
buf.writeInt(this.dimensionID);
|
||||
buf.writeFloat(this.dmg);
|
||||
public void toBytes (final ByteBuf buf) {
|
||||
buf.writeInt(entityID);
|
||||
buf.writeInt(playerID);
|
||||
buf.writeInt(dimensionID);
|
||||
buf.writeFloat(dmg);
|
||||
}
|
||||
}
|
||||
@@ -10,18 +10,16 @@ import taintedmagic.common.blocks.BlockWarpwoodPlanks;
|
||||
import taintedmagic.common.blocks.BlockWarpwoodSapling;
|
||||
import taintedmagic.common.blocks.tile.TileLumos;
|
||||
|
||||
public class BlockRegistry
|
||||
{
|
||||
public class BlockRegistry {
|
||||
|
||||
public static Block BlockWarpwoodLog;
|
||||
public static Block BlockWarpwoodLeaves;
|
||||
public static Block BlockWarpwoodSapling;
|
||||
public static Block BlockWarpwoodPlanks;
|
||||
public static Block BlockNightshadeBush;
|
||||
|
||||
public static Block BlockLumos;
|
||||
|
||||
public static void initBlocks ()
|
||||
{
|
||||
public static void initBlocks () {
|
||||
BlockWarpwoodLog = new BlockWarpwoodLog();
|
||||
GameRegistry.registerBlock(BlockWarpwoodLog, "BlockWarpwoodLog");
|
||||
|
||||
@@ -41,8 +39,7 @@ public class BlockRegistry
|
||||
GameRegistry.registerBlock(BlockLumos, "BlockLumos");
|
||||
}
|
||||
|
||||
public static void initTiles ()
|
||||
{
|
||||
public static void initTiles () {
|
||||
GameRegistry.registerTileEntity(TileLumos.class, "TileLumos");
|
||||
}
|
||||
}
|
||||
@@ -49,8 +49,8 @@ import thaumcraft.api.wands.StaffRod;
|
||||
import thaumcraft.api.wands.WandCap;
|
||||
import thaumcraft.api.wands.WandRod;
|
||||
|
||||
public class ItemRegistry
|
||||
{
|
||||
public class ItemRegistry {
|
||||
|
||||
public static Item ItemMagicFunguar;
|
||||
public static Item ItemNightshadeBerries;
|
||||
public static Item ItemMaterial;
|
||||
@@ -113,8 +113,7 @@ public class ItemRegistry
|
||||
|
||||
public static Item ItemKatana;
|
||||
|
||||
public static void initItems ()
|
||||
{
|
||||
public static void initItems () {
|
||||
ItemMaterial = new ItemMaterial();
|
||||
GameRegistry.registerItem(ItemMaterial, "ItemMaterial");
|
||||
|
||||
|
||||
@@ -3,10 +3,9 @@ package taintedmagic.common.registry;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class OreDictRegistry
|
||||
{
|
||||
public static void initOreDict ()
|
||||
{
|
||||
public class OreDictRegistry {
|
||||
|
||||
public static void initOreDict () {
|
||||
OreDictionary.registerOre("logWood", new ItemStack(BlockRegistry.BlockWarpwoodLog));
|
||||
OreDictionary.registerOre("treeSapling", new ItemStack(BlockRegistry.BlockWarpwoodSapling));
|
||||
OreDictionary.registerOre("ingotShadow", new ItemStack(ItemRegistry.ItemMaterial));
|
||||
|
||||
@@ -15,10 +15,9 @@ import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
|
||||
public class RecipeRegistry
|
||||
{
|
||||
public static void initRecipes ()
|
||||
{
|
||||
public class RecipeRegistry {
|
||||
|
||||
public static void initRecipes () {
|
||||
initCrafting();
|
||||
initSmelting();
|
||||
initCrucible();
|
||||
@@ -29,8 +28,7 @@ public class RecipeRegistry
|
||||
/**
|
||||
* Vanilla crafting table recipes
|
||||
*/
|
||||
private static void initCrafting ()
|
||||
{
|
||||
private static void initCrafting () {
|
||||
// Shadow Metal Ingot from nuggets
|
||||
GameRegistry.addShapedRecipe(new ItemStack(ItemRegistry.ItemMaterial, 1, 0), "AAA", "AAA", "AAA", 'A',
|
||||
new ItemStack(ItemRegistry.ItemMaterial, 1, 8));
|
||||
@@ -72,15 +70,13 @@ public class RecipeRegistry
|
||||
/**
|
||||
* Furnace recipes
|
||||
*/
|
||||
private static void initSmelting ()
|
||||
{
|
||||
private static void initSmelting () {
|
||||
}
|
||||
|
||||
/**
|
||||
* Arcane Infusion recipes
|
||||
*/
|
||||
private static void initInfusion ()
|
||||
{
|
||||
private static void initInfusion () {
|
||||
// Shockwave Focus
|
||||
ResearchRegistry.recipes.put("ItemFocusShockwave",
|
||||
ThaumcraftApi.addInfusionCraftingRecipe("FOCUSSHOCKWAVE", new ItemStack(ItemRegistry.ItemFocusShockwave), 6,
|
||||
@@ -93,8 +89,8 @@ public class RecipeRegistry
|
||||
|
||||
// Primal Blade
|
||||
ResearchRegistry.recipes.put("ItemPrimalBlade", ThaumcraftApi.addInfusionCraftingRecipe("PRIMALBLADE",
|
||||
new ItemStack(ItemRegistry.ItemPrimalBlade), 8, new AspectList().add(Aspect.WEAPON, 65)
|
||||
.add(Aspect.ELDRITCH, 46).add(Aspect.DARKNESS, 16).add(Aspect.METAL, 60).add(Aspect.VOID, 56),
|
||||
new ItemStack(ItemRegistry.ItemPrimalBlade), 8, new AspectList().add(Aspect.WEAPON, 65).add(Aspect.ELDRITCH, 46)
|
||||
.add(Aspect.DARKNESS, 16).add(Aspect.METAL, 60).add(Aspect.VOID, 56),
|
||||
new ItemStack(ConfigItems.itemSwordVoid),
|
||||
new ItemStack[]{ new ItemStack(ItemRegistry.ItemMaterial, 1, 5), new ItemStack(ConfigItems.itemShard, 1, 0),
|
||||
new ItemStack(ConfigItems.itemShard, 1, 1), new ItemStack(ConfigItems.itemShard, 1, 2),
|
||||
@@ -503,8 +499,7 @@ public class RecipeRegistry
|
||||
/**
|
||||
* Arcane worktable recipes
|
||||
*/
|
||||
private static void initArcane ()
|
||||
{
|
||||
private static void initArcane () {
|
||||
// Crimson-stained Cloth
|
||||
ResearchRegistry.recipes.put("ItemMaterial:2",
|
||||
ThaumcraftApi.addShapelessArcaneCraftingRecipe("CRIMSONROBES", new ItemStack(ItemRegistry.ItemMaterial, 1, 2),
|
||||
@@ -680,8 +675,7 @@ public class RecipeRegistry
|
||||
/**
|
||||
* Crucible recipes
|
||||
*/
|
||||
private static void initCrucible ()
|
||||
{
|
||||
private static void initCrucible () {
|
||||
// Warped Unbalanced Shard
|
||||
ResearchRegistry.recipes.put("ItemMaterial:3",
|
||||
ThaumcraftApi.addCrucibleRecipe("UNBALANCEDSHARDS", new ItemStack(ItemRegistry.ItemMaterial, 1, 3),
|
||||
|
||||
@@ -21,13 +21,12 @@ import thaumcraft.api.research.ResearchPage;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
|
||||
public class ResearchRegistry
|
||||
{
|
||||
public static final String CATEGORY_TM = "TAINTEDMAGIC";
|
||||
public static HashMap<String, Object> recipes = new HashMap<String, Object>();
|
||||
public class ResearchRegistry {
|
||||
|
||||
public static void initResearch ()
|
||||
{
|
||||
public static final String CATEGORY_TM = "TAINTEDMAGIC";
|
||||
public static HashMap<String, Object> recipes = new HashMap<>();
|
||||
|
||||
public static void initResearch () {
|
||||
ResearchCategories.registerCategory(CATEGORY_TM, new ResourceLocation("taintedmagic:textures/misc/tab_tm.png"),
|
||||
ConfigHandler.CUSTOM_RESEARCH_TAB_BACK
|
||||
? new ResourceLocation("taintedmagic:textures/gui/gui_tm_researchback.png")
|
||||
@@ -341,23 +340,19 @@ public class ResearchRegistry
|
||||
* ResearchPage helpers
|
||||
*/
|
||||
|
||||
private static ResearchPage recipePage (String key)
|
||||
{
|
||||
private static ResearchPage recipePage (final String key) {
|
||||
return new ResearchPage((IRecipe) recipes.get(key));
|
||||
}
|
||||
|
||||
private static ResearchPage arcanePage (String key)
|
||||
{
|
||||
private static ResearchPage arcanePage (final String key) {
|
||||
return new ResearchPage((IArcaneRecipe) recipes.get(key));
|
||||
}
|
||||
|
||||
private static ResearchPage infusionPage (String key)
|
||||
{
|
||||
private static ResearchPage infusionPage (final String key) {
|
||||
return new ResearchPage((InfusionRecipe) recipes.get(key));
|
||||
}
|
||||
|
||||
private static ResearchPage cruciblePage (String key)
|
||||
{
|
||||
private static ResearchPage cruciblePage (final String key) {
|
||||
return new ResearchPage((CrucibleRecipe) recipes.get(key));
|
||||
}
|
||||
}
|
||||
@@ -6,14 +6,13 @@ import taintedmagic.common.entities.EntityDarkMatter;
|
||||
import taintedmagic.common.entities.EntityDiffusion;
|
||||
import taintedmagic.common.entities.EntityHomingShard;
|
||||
|
||||
public class TMEntityRegistry
|
||||
{
|
||||
public static void initEntities ()
|
||||
{
|
||||
int ID = 0;
|
||||
EntityRegistry.registerModEntity(EntityDarkMatter.class, "EntityDarkMatter", ID++, TaintedMagic.instance, 64, 21, true);
|
||||
EntityRegistry.registerModEntity(EntityHomingShard.class, "EntityHomingShard", ID++, TaintedMagic.instance, 64, 3,
|
||||
public class TMEntityRegistry {
|
||||
|
||||
public static void initEntities () {
|
||||
int id = 0;
|
||||
EntityRegistry.registerModEntity(EntityDarkMatter.class, "EntityDarkMatter", id++, TaintedMagic.instance, 64, 21, true);
|
||||
EntityRegistry.registerModEntity(EntityHomingShard.class, "EntityHomingShard", id++, TaintedMagic.instance, 64, 3,
|
||||
true);
|
||||
EntityRegistry.registerModEntity(EntityDiffusion.class, "EntityDiffusion", ID++, TaintedMagic.instance, 64, 20, true);
|
||||
EntityRegistry.registerModEntity(EntityDiffusion.class, "EntityDiffusion", id++, TaintedMagic.instance, 64, 20, true);
|
||||
}
|
||||
}
|
||||
@@ -12,69 +12,73 @@ import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchItem;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
|
||||
public class TMResearchItem extends ResearchItem
|
||||
{
|
||||
int warp = 0;
|
||||
public class TMResearchItem extends ResearchItem {
|
||||
|
||||
public TMResearchItem (String key, String category)
|
||||
{
|
||||
private int warp = 0;
|
||||
|
||||
public TMResearchItem (final String key, final String category) {
|
||||
super(key, category);
|
||||
}
|
||||
|
||||
public TMResearchItem (String key, AspectList tags, int col, int row, ItemStack icon, int complexity, int warp)
|
||||
{
|
||||
public TMResearchItem (final String key, final AspectList tags, final int col, final int row, final ItemStack icon,
|
||||
final int complexity, final int warp) {
|
||||
super(key, ResearchRegistry.CATEGORY_TM, tags, col, row, complexity, icon);
|
||||
this.warp = warp;
|
||||
}
|
||||
|
||||
public TMResearchItem (String key, AspectList tags, int col, int row, ResourceLocation icon, int complexity, int warp)
|
||||
{
|
||||
public TMResearchItem (final String key, final AspectList tags, final int col, final int row, final ResourceLocation icon,
|
||||
final int complexity, final int warp) {
|
||||
super(key, ResearchRegistry.CATEGORY_TM, tags, col, row, complexity, icon);
|
||||
this.warp = warp;
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public String getName ()
|
||||
{
|
||||
return StatCollector.translateToLocal("tm.name." + this.key);
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public String getText ()
|
||||
{
|
||||
return (ConfigHandler.RESEARCH_TAGS ? "[TM] " : "")
|
||||
+ StatCollector.translateToLocal(new StringBuilder("tm.tag.").append(this.key).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResearchItem setPages (ResearchPage... pages)
|
||||
{
|
||||
for (ResearchPage page : pages)
|
||||
{
|
||||
if (page.type == ResearchPage.PageType.TEXT) page.text = ("tm.text." + this.key + "." + page.text);
|
||||
@SideOnly (Side.CLIENT)
|
||||
public String getName () {
|
||||
return StatCollector.translateToLocal("tm.name." + key);
|
||||
}
|
||||
|
||||
if (page.type != ResearchPage.PageType.INFUSION_CRAFTING) continue;
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public String getText () {
|
||||
return (ConfigHandler.RESEARCH_TAGS ? "[TM] " : "")
|
||||
+ StatCollector.translateToLocal(new StringBuilder("tm.tag.").append(key).toString());
|
||||
}
|
||||
|
||||
if (this.parentsHidden == null || this.parentsHidden.length == 0) this.parentsHidden = new String[]{ "INFUSION" };
|
||||
else
|
||||
{
|
||||
String[] newParents = new String[this.parentsHidden.length + 1];
|
||||
@Override
|
||||
public ResearchItem setPages (final ResearchPage... pages) {
|
||||
for (final ResearchPage page : pages) {
|
||||
if (page.type == ResearchPage.PageType.TEXT) {
|
||||
page.text = "tm.text." + key + "." + page.text;
|
||||
}
|
||||
|
||||
if (page.type != ResearchPage.PageType.INFUSION_CRAFTING) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (parentsHidden == null || parentsHidden.length == 0) {
|
||||
parentsHidden = new String[]{ "INFUSION" };
|
||||
}
|
||||
else {
|
||||
final String[] newParents = new String[parentsHidden.length + 1];
|
||||
newParents[0] = "INFUSION";
|
||||
|
||||
for (int i = 0; i < this.parentsHidden.length; i++)
|
||||
newParents[ (i + 1)] = this.parentsHidden[i];
|
||||
for (int i = 0; i < parentsHidden.length; i++) {
|
||||
newParents[i + 1] = parentsHidden[i];
|
||||
}
|
||||
|
||||
this.parentsHidden = newParents;
|
||||
parentsHidden = newParents;
|
||||
}
|
||||
}
|
||||
return super.setPages(pages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResearchItem registerResearchItem ()
|
||||
{
|
||||
public ResearchItem registerResearchItem () {
|
||||
super.registerResearchItem();
|
||||
if (warp > 0) ThaumcraftApi.addWarpToResearch(key, warp);
|
||||
if (warp > 0) {
|
||||
ThaumcraftApi.addWarpToResearch(key, warp);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.util.ResourceLocation;
|
||||
import taintedmagic.common.registry.ResearchRegistry;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchCategories;
|
||||
import thaumcraft.api.research.ResearchCategoryList;
|
||||
import thaumcraft.api.research.ResearchItem;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
|
||||
@@ -15,77 +14,75 @@ import thaumcraft.api.research.ResearchPage;
|
||||
* This class was created by <flaxbeard> as part of Thaumic Exploration.
|
||||
* It is being distributed as part of Tainted Magic.
|
||||
*/
|
||||
public class ThaumcraftResearchItem extends ResearchItem
|
||||
{
|
||||
public ResearchItem original;
|
||||
public class ThaumcraftResearchItem extends ResearchItem {
|
||||
|
||||
public ThaumcraftResearchItem (String tag, String origin, String originCategory, int col, int row, ResourceLocation icon)
|
||||
{
|
||||
private ResearchItem original;
|
||||
|
||||
public ThaumcraftResearchItem (final String tag, final String origin, final String originCategory, final int col,
|
||||
final int row, final ResourceLocation icon) {
|
||||
super(tag, ResearchRegistry.CATEGORY_TM, new AspectList(), col, row, 1, icon);
|
||||
original = ((ResearchCategoryList) ResearchCategories.researchCategories.get(originCategory)).research.get(origin);
|
||||
original = ResearchCategories.researchCategories.get(originCategory).research.get(origin);
|
||||
bindToOriginal();
|
||||
setStub();
|
||||
setHidden();
|
||||
}
|
||||
|
||||
public ThaumcraftResearchItem (String tag, String origin, String originCategory, int col, int row, ItemStack icon)
|
||||
{
|
||||
public ThaumcraftResearchItem (final String tag, final String origin, final String originCategory, final int col,
|
||||
final int row, final ItemStack icon) {
|
||||
super(tag, ResearchRegistry.CATEGORY_TM, new AspectList(), col, row, 1, icon);
|
||||
original = ((ResearchCategoryList) ResearchCategories.researchCategories.get(originCategory)).research.get(origin);
|
||||
original = ResearchCategories.researchCategories.get(originCategory).research.get(origin);
|
||||
bindToOriginal();
|
||||
setStub();
|
||||
setHidden();
|
||||
}
|
||||
|
||||
private void bindToOriginal ()
|
||||
{
|
||||
if (original.siblings == null) original.setSiblings(new String[]{ key });
|
||||
else
|
||||
{
|
||||
String[] family = original.siblings;
|
||||
String[] newFamily = new String[family.length + 1];
|
||||
for (int x = 0; x < family.length; x++)
|
||||
{
|
||||
private void bindToOriginal () {
|
||||
if (original.siblings == null) {
|
||||
original.setSiblings(key);
|
||||
}
|
||||
else {
|
||||
final String[] family = original.siblings;
|
||||
final String[] newFamily = new String[family.length + 1];
|
||||
for (int x = 0; x < family.length; x++) {
|
||||
newFamily[x] = family[x];
|
||||
}
|
||||
newFamily[family.length] = key;
|
||||
original.setSiblings(newFamily);
|
||||
}
|
||||
if (original.isSecondary())
|
||||
{
|
||||
this.setSecondary();
|
||||
if (original.isSecondary()) {
|
||||
setSecondary();
|
||||
}
|
||||
}
|
||||
|
||||
public ResearchPage[] getPages ()
|
||||
{
|
||||
@Override
|
||||
public ResearchPage[] getPages () {
|
||||
return original.getPages();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public String getName ()
|
||||
{
|
||||
public String getName () {
|
||||
return original.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public String getText ()
|
||||
{
|
||||
public String getText () {
|
||||
return original.getText();
|
||||
}
|
||||
|
||||
public boolean isStub ()
|
||||
{
|
||||
@Override
|
||||
public boolean isStub () {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isHidden ()
|
||||
{
|
||||
@Override
|
||||
public boolean isHidden () {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getComplexity ()
|
||||
{
|
||||
@Override
|
||||
public int getComplexity () {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -16,185 +16,173 @@ import thaumcraft.common.lib.world.WorldGenCustomFlowers;
|
||||
/**
|
||||
* This class is based off of WorldGenSilverwoodTrees.class created by <Azanor> as part of Thaumcraft 4.
|
||||
*/
|
||||
public class WorldGenWarpwoodTree extends WorldGenAbstractTree
|
||||
{
|
||||
private Block trunk;
|
||||
private Block leaves;
|
||||
public class WorldGenWarpwoodTree extends WorldGenAbstractTree {
|
||||
|
||||
private final Block trunk;
|
||||
private final Block leaves;
|
||||
private final int minTreeHeight;
|
||||
private final int randomTreeHeight;
|
||||
boolean worldgen = false;
|
||||
|
||||
public WorldGenWarpwoodTree (boolean doBlockNotify, int minTreeHeight, int randomTreeHeight)
|
||||
{
|
||||
public WorldGenWarpwoodTree (final boolean doBlockNotify, final int minTreeHeight, final int randomTreeHeight) {
|
||||
super(doBlockNotify);
|
||||
this.worldgen = !doBlockNotify;
|
||||
worldgen = !doBlockNotify;
|
||||
this.minTreeHeight = minTreeHeight;
|
||||
this.randomTreeHeight = randomTreeHeight;
|
||||
this.trunk = BlockRegistry.BlockWarpwoodLog;
|
||||
this.leaves = BlockRegistry.BlockWarpwoodLeaves;
|
||||
trunk = BlockRegistry.BlockWarpwoodLog;
|
||||
leaves = BlockRegistry.BlockWarpwoodLeaves;
|
||||
}
|
||||
|
||||
public boolean generate (World world, Random random, int x, int y, int z)
|
||||
{
|
||||
int height = random.nextInt(this.randomTreeHeight) + this.minTreeHeight;
|
||||
@Override
|
||||
public boolean generate (final World world, final Random random, final int x, final int y, final int z) {
|
||||
final int height = random.nextInt(randomTreeHeight) + minTreeHeight;
|
||||
boolean flag = true;
|
||||
if (y >= 1 && y + height + 1 <= 256)
|
||||
{
|
||||
for (int i1 = y; i1 <= y + 1 + height; ++i1)
|
||||
{
|
||||
byte spread = 1;
|
||||
if (i1 == y)
|
||||
{
|
||||
spread = 0;
|
||||
}
|
||||
if (y < 1 || y + height + 1 > 256)
|
||||
return false;
|
||||
for (int i1 = y; i1 <= y + 1 + height; ++i1) {
|
||||
byte spread = 1;
|
||||
if (i1 == y) {
|
||||
spread = 0;
|
||||
}
|
||||
|
||||
if (i1 >= y + 1 + height - 2)
|
||||
{
|
||||
spread = 3;
|
||||
}
|
||||
if (i1 >= y + 1 + height - 2) {
|
||||
spread = 3;
|
||||
}
|
||||
|
||||
for (int j1 = x - spread; j1 <= x + spread && flag; ++j1)
|
||||
{
|
||||
for (int k1 = z - spread; k1 <= z + spread && flag; ++k1)
|
||||
{
|
||||
if (i1 >= 0 && i1 < 256)
|
||||
{
|
||||
Block block = world.getBlock(j1, i1, k1);
|
||||
if (!block.isAir(world, j1, i1, k1) && !block.isLeaves(world, j1, i1, k1)
|
||||
&& !block.isReplaceable(world, j1, i1, k1) && i1 > y)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j1 = x - spread; j1 <= x + spread && flag; ++j1) {
|
||||
for (int k1 = z - spread; k1 <= z + spread && flag; ++k1) {
|
||||
if (i1 >= 0 && i1 < 256) {
|
||||
final Block block = world.getBlock(j1, i1, k1);
|
||||
if (!block.isAir(world, j1, i1, k1) && !block.isLeaves(world, j1, i1, k1)
|
||||
&& !block.isReplaceable(world, j1, i1, k1) && i1 > y) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Block block1 = world.getBlock(x, y - 1, z);
|
||||
boolean isSoil = block1.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, (BlockSapling) Blocks.sapling);
|
||||
if (isSoil && y < 256 - height - 1)
|
||||
{
|
||||
block1.onPlantGrow(world, x, y - 1, z, x, y, z);
|
||||
int start = y + height - 5;
|
||||
int end = y + height + 3 + random.nextInt(3);
|
||||
if (!flag)
|
||||
return false;
|
||||
else {
|
||||
final Block block1 = world.getBlock(x, y - 1, z);
|
||||
final boolean isSoil = block1.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, (BlockSapling) Blocks.sapling);
|
||||
if (isSoil && y < 256 - height - 1) {
|
||||
block1.onPlantGrow(world, x, y - 1, z, x, y, z);
|
||||
final int start = y + height - 5;
|
||||
final int end = y + height + 3 + random.nextInt(3);
|
||||
|
||||
int k2;
|
||||
for (k2 = start; k2 <= end; ++k2)
|
||||
{
|
||||
int cty = MathHelper.clamp_int(k2, y + height - 3, y + height);
|
||||
int k2;
|
||||
for (k2 = start; k2 <= end; ++k2) {
|
||||
final int cty = MathHelper.clamp_int(k2, y + height - 3, y + height);
|
||||
|
||||
for (int xx = x - 5; xx <= x + 5; ++xx)
|
||||
{
|
||||
for (int zz = z - 5; zz <= z + 5; ++zz)
|
||||
{
|
||||
double d3 = (double) (xx - x);
|
||||
double d4 = (double) (k2 - cty);
|
||||
double d5 = (double) (zz - z);
|
||||
double dist = d3 * d3 + d4 * d4 + d5 * d5;
|
||||
for (int xx = x - 5; xx <= x + 5; ++xx) {
|
||||
for (int zz = z - 5; zz <= z + 5; ++zz) {
|
||||
final double d3 = xx - x;
|
||||
final double d4 = k2 - cty;
|
||||
final double d5 = zz - z;
|
||||
final double dist = d3 * d3 + d4 * d4 + d5 * d5;
|
||||
|
||||
if (dist < (double) (10 + random.nextInt(8))
|
||||
&& world.getBlock(xx, k2, zz).canBeReplacedByLeaves(world, xx, k2, zz))
|
||||
this.setBlockAndNotifyAdequately(world, xx, k2, zz, this.leaves, 1);
|
||||
if (dist < 10 + random.nextInt(8)
|
||||
&& world.getBlock(xx, k2, zz).canBeReplacedByLeaves(world, xx, k2, zz)) {
|
||||
setBlockAndNotifyAdequately(world, xx, k2, zz, leaves, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int chance = height;
|
||||
boolean lastblock = false;
|
||||
int chance = height;
|
||||
boolean lastblock = false;
|
||||
|
||||
for (k2 = 0; k2 < height; k2++)
|
||||
{
|
||||
Block block2 = world.getBlock(x, y + k2, z);
|
||||
for (k2 = 0; k2 < height; k2++) {
|
||||
final Block block2 = world.getBlock(x, y + k2, z);
|
||||
|
||||
if (!block2.isAir(world, x, y + k2, z) && !block2.isLeaves(world, x, y + k2, z)
|
||||
&& !block2.isReplaceable(world, x, y + k2, z))
|
||||
continue;
|
||||
|
||||
if (k2 > 0 && !lastblock && random.nextInt(chance) == 0)
|
||||
{
|
||||
setBlockAndNotifyAdequately(world, x, y + k2, z, this.trunk, 2);
|
||||
lastblock = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
setBlockAndNotifyAdequately(world, x, y + k2, z, this.trunk, 0);
|
||||
lastblock = false;
|
||||
chance--;
|
||||
}
|
||||
setBlockAndNotifyAdequately(world, x - 1, y + k2, z, this.trunk, 0);
|
||||
setBlockAndNotifyAdequately(world, x + 1, y + k2, z, this.trunk, 0);
|
||||
setBlockAndNotifyAdequately(world, x, y + k2, z - 1, this.trunk, 0);
|
||||
setBlockAndNotifyAdequately(world, x, y + k2, z + 1, this.trunk, 0);
|
||||
if (!block2.isAir(world, x, y + k2, z) && !block2.isLeaves(world, x, y + k2, z)
|
||||
&& !block2.isReplaceable(world, x, y + k2, z)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
this.setBlockAndNotifyAdequately(world, x, y + k2, z, this.trunk, 0);
|
||||
this.setBlockAndNotifyAdequately(world, x - 1, y, z - 1, this.trunk, 0);
|
||||
this.setBlockAndNotifyAdequately(world, x + 1, y, z + 1, this.trunk, 0);
|
||||
this.setBlockAndNotifyAdequately(world, x - 1, y, z + 1, this.trunk, 0);
|
||||
this.setBlockAndNotifyAdequately(world, x + 1, y, z - 1, this.trunk, 0);
|
||||
|
||||
if (random.nextInt(3) != 0) this.setBlockAndNotifyAdequately(world, x - 1, y + 1, z - 1, this.trunk, 0);
|
||||
|
||||
if (random.nextInt(3) != 0) this.setBlockAndNotifyAdequately(world, x + 1, y + 1, z + 1, this.trunk, 0);
|
||||
|
||||
if (random.nextInt(3) != 0) this.setBlockAndNotifyAdequately(world, x - 1, y + 1, z + 1, this.trunk, 0);
|
||||
|
||||
if (random.nextInt(3) != 0) this.setBlockAndNotifyAdequately(world, x + 1, y + 1, z - 1, this.trunk, 0);
|
||||
|
||||
this.setBlockAndNotifyAdequately(world, x - 2, y, z, this.trunk, 5);
|
||||
this.setBlockAndNotifyAdequately(world, x + 2, y, z, this.trunk, 5);
|
||||
this.setBlockAndNotifyAdequately(world, x, y, z - 2, this.trunk, 9);
|
||||
this.setBlockAndNotifyAdequately(world, x, y, z + 2, this.trunk, 9);
|
||||
this.setBlockAndNotifyAdequately(world, x - 2, y - 1, z, this.trunk, 0);
|
||||
this.setBlockAndNotifyAdequately(world, x + 2, y - 1, z, this.trunk, 0);
|
||||
this.setBlockAndNotifyAdequately(world, x, y - 1, z - 2, this.trunk, 0);
|
||||
this.setBlockAndNotifyAdequately(world, x, y - 1, z + 2, this.trunk, 0);
|
||||
this.setBlockAndNotifyAdequately(world, x - 1, y + (height - 4), z - 1, this.trunk, 0);
|
||||
this.setBlockAndNotifyAdequately(world, x + 1, y + (height - 4), z + 1, this.trunk, 0);
|
||||
this.setBlockAndNotifyAdequately(world, x - 1, y + (height - 4), z + 1, this.trunk, 0);
|
||||
this.setBlockAndNotifyAdequately(world, x + 1, y + (height - 4), z - 1, this.trunk, 0);
|
||||
|
||||
if (random.nextInt(3) == 0)
|
||||
this.setBlockAndNotifyAdequately(world, x - 1, y + (height - 5), z - 1, this.trunk, 0);
|
||||
|
||||
if (random.nextInt(3) == 0)
|
||||
this.setBlockAndNotifyAdequately(world, x + 1, y + (height - 5), z + 1, this.trunk, 0);
|
||||
|
||||
if (random.nextInt(3) == 0)
|
||||
this.setBlockAndNotifyAdequately(world, x - 1, y + (height - 5), z + 1, this.trunk, 0);
|
||||
|
||||
if (random.nextInt(3) == 0)
|
||||
this.setBlockAndNotifyAdequately(world, x + 1, y + (height - 5), z - 1, this.trunk, 0);
|
||||
|
||||
this.setBlockAndNotifyAdequately(world, x - 2, y + (height - 4), z, this.trunk, 5);
|
||||
this.setBlockAndNotifyAdequately(world, x + 2, y + (height - 4), z, this.trunk, 5);
|
||||
this.setBlockAndNotifyAdequately(world, x, y + (height - 4), z - 2, this.trunk, 9);
|
||||
this.setBlockAndNotifyAdequately(world, x, y + (height - 4), z + 2, this.trunk, 9);
|
||||
|
||||
WorldGenerator flowers = new WorldGenCustomFlowers(BlockRegistry.BlockNightshadeBush, 0);
|
||||
flowers.generate(world, random, x, y, z);
|
||||
|
||||
return true;
|
||||
if (k2 > 0 && !lastblock && random.nextInt(chance) == 0) {
|
||||
setBlockAndNotifyAdequately(world, x, y + k2, z, trunk, 2);
|
||||
lastblock = true;
|
||||
}
|
||||
else {
|
||||
setBlockAndNotifyAdequately(world, x, y + k2, z, trunk, 0);
|
||||
lastblock = false;
|
||||
chance--;
|
||||
}
|
||||
setBlockAndNotifyAdequately(world, x - 1, y + k2, z, trunk, 0);
|
||||
setBlockAndNotifyAdequately(world, x + 1, y + k2, z, trunk, 0);
|
||||
setBlockAndNotifyAdequately(world, x, y + k2, z - 1, trunk, 0);
|
||||
setBlockAndNotifyAdequately(world, x, y + k2, z + 1, trunk, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
||||
setBlockAndNotifyAdequately(world, x, y + k2, z, trunk, 0);
|
||||
setBlockAndNotifyAdequately(world, x - 1, y, z - 1, trunk, 0);
|
||||
setBlockAndNotifyAdequately(world, x + 1, y, z + 1, trunk, 0);
|
||||
setBlockAndNotifyAdequately(world, x - 1, y, z + 1, trunk, 0);
|
||||
setBlockAndNotifyAdequately(world, x + 1, y, z - 1, trunk, 0);
|
||||
|
||||
if (random.nextInt(3) != 0) {
|
||||
setBlockAndNotifyAdequately(world, x - 1, y + 1, z - 1, trunk, 0);
|
||||
}
|
||||
|
||||
if (random.nextInt(3) != 0) {
|
||||
setBlockAndNotifyAdequately(world, x + 1, y + 1, z + 1, trunk, 0);
|
||||
}
|
||||
|
||||
if (random.nextInt(3) != 0) {
|
||||
setBlockAndNotifyAdequately(world, x - 1, y + 1, z + 1, trunk, 0);
|
||||
}
|
||||
|
||||
if (random.nextInt(3) != 0) {
|
||||
setBlockAndNotifyAdequately(world, x + 1, y + 1, z - 1, trunk, 0);
|
||||
}
|
||||
|
||||
setBlockAndNotifyAdequately(world, x - 2, y, z, trunk, 5);
|
||||
setBlockAndNotifyAdequately(world, x + 2, y, z, trunk, 5);
|
||||
setBlockAndNotifyAdequately(world, x, y, z - 2, trunk, 9);
|
||||
setBlockAndNotifyAdequately(world, x, y, z + 2, trunk, 9);
|
||||
setBlockAndNotifyAdequately(world, x - 2, y - 1, z, trunk, 0);
|
||||
setBlockAndNotifyAdequately(world, x + 2, y - 1, z, trunk, 0);
|
||||
setBlockAndNotifyAdequately(world, x, y - 1, z - 2, trunk, 0);
|
||||
setBlockAndNotifyAdequately(world, x, y - 1, z + 2, trunk, 0);
|
||||
setBlockAndNotifyAdequately(world, x - 1, y + height - 4, z - 1, trunk, 0);
|
||||
setBlockAndNotifyAdequately(world, x + 1, y + height - 4, z + 1, trunk, 0);
|
||||
setBlockAndNotifyAdequately(world, x - 1, y + height - 4, z + 1, trunk, 0);
|
||||
setBlockAndNotifyAdequately(world, x + 1, y + height - 4, z - 1, trunk, 0);
|
||||
|
||||
if (random.nextInt(3) == 0) {
|
||||
setBlockAndNotifyAdequately(world, x - 1, y + height - 5, z - 1, trunk, 0);
|
||||
}
|
||||
|
||||
if (random.nextInt(3) == 0) {
|
||||
setBlockAndNotifyAdequately(world, x + 1, y + height - 5, z + 1, trunk, 0);
|
||||
}
|
||||
|
||||
if (random.nextInt(3) == 0) {
|
||||
setBlockAndNotifyAdequately(world, x - 1, y + height - 5, z + 1, trunk, 0);
|
||||
}
|
||||
|
||||
if (random.nextInt(3) == 0) {
|
||||
setBlockAndNotifyAdequately(world, x + 1, y + height - 5, z - 1, trunk, 0);
|
||||
}
|
||||
|
||||
setBlockAndNotifyAdequately(world, x - 2, y + height - 4, z, trunk, 5);
|
||||
setBlockAndNotifyAdequately(world, x + 2, y + height - 4, z, trunk, 5);
|
||||
setBlockAndNotifyAdequately(world, x, y + height - 4, z - 2, trunk, 9);
|
||||
setBlockAndNotifyAdequately(world, x, y + height - 4, z + 2, trunk, 9);
|
||||
|
||||
final WorldGenerator flowers = new WorldGenCustomFlowers(BlockRegistry.BlockNightshadeBush, 0);
|
||||
flowers.generate(world, random, x, y, z);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user