thaumcraft.common.Thaumcraft Java Examples

The following examples show how to use thaumcraft.common.Thaumcraft. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ItemCrystalwell.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 6 votes vote down vote up
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean isSelected) {

    if(world.isRemote)
        return;
    if(Config.researchDifficulty == -1 && entity.ticksExisted % 200 == 0 && (entity instanceof EntityPlayer)){
        EntityPlayer player = (EntityPlayer)entity;
        Aspect aspect = (Aspect)Aspect.getPrimalAspects().get(world.rand.nextInt(6));
        short amount = (short)(world.rand.nextInt(4) + 1);
        Thaumcraft.proxy.playerKnowledge.addAspectPool(player.getCommandSenderName(), aspect, amount);
        PacketHandler.INSTANCE.sendTo(new PacketAspectPool(aspect.getTag(), amount, Short.valueOf(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(player.getCommandSenderName(), aspect))), (EntityPlayerMP) player);
        ResearchManager.scheduleSave(player);
        stack.setItemDamage(stack.getItemDamage() + 1);
        if(stack.getItemDamage() >= stack.getMaxDamage())
            ((EntityPlayer)entity).inventory.setInventorySlotContents(slot, null);
    }
}
 
Example #2
Source File: SubTileEuclidaisy.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 6 votes vote down vote up
@Override
public void onUpdate(){
    super.onUpdate();

    if(redstoneSignal > 0)
        return;

    if(mana >= cost && !supertile.getWorldObj().isRemote && this.ticksExisted % 400 == 0) {
        Thaumcraft.proxy.burst(supertile.getWorldObj(), (double)supertile.xCoord + 0.5D, (double)supertile.yCoord + 0.5D, (double)supertile.zCoord + 0.5D, 1.0F);
        AspectList aspect;
        if(supertile.getWorldObj().rand.nextInt(10) < 4)
            aspect = (new AspectList()).add(Aspect.AURA, 2);
        else {
            Aspect[] aspects = Aspect.aspects.values().toArray(new Aspect[0]);
            aspect = (new AspectList()).add(aspects[supertile.getWorldObj().rand.nextInt(aspects.length)], 2);
        }
        ItemStack ess = new ItemStack(ConfigItems.itemWispEssence);
        ((ItemWispEssence)ess.getItem()).setAspects(ess, aspect);
        dropItem(supertile.getWorldObj(), supertile.xCoord, supertile.yCoord, supertile.zCoord, ess);
        mana -= cost;
        sync();
    }
}
 
Example #3
Source File: MultiTickEffectDispatcher.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
private static void handleVortexDiggingEffects(World currentRenderWorld) {
    Iterator<VortexDigInfo> it = vortexDigInfos.iterator();
    while(it.hasNext()) {
        VortexDigInfo info = it.next();
        if(info.dimId != currentRenderWorld.provider.dimensionId) {
            it.remove();
            continue;
        }
        info.renderTicks++;
        if(info.renderTicks > info.tickCap) {
            it.remove();
            continue;
        }

        Thaumcraft.proxy.boreDigFx(currentRenderWorld, info.tX, info.tY, info.tZ, info.oX, info.oY, info.oZ, info.blockInstance, info.meta);
    }
}
 
Example #4
Source File: ItemExtendedNodeJar.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
    String desc = "ยง9" + StatCollector.translateToLocal("nodetype." + getNodeType(stack) + ".name");
    if(getExtendedNodeType(stack) != null) {
        desc = desc + ", " + StatCollector.translateToLocal("gadomancy.nodes." + getExtendedNodeType(stack));
    }
    if (getNodeModifier(stack) != null) {
        desc = desc + ", " + StatCollector.translateToLocal("nodemod." + getNodeModifier(stack) + ".name");
    }
    list.add(desc);
    AspectList aspects = getAspects(stack);
    if ((aspects != null) && (aspects.size() > 0)) {
        for (Aspect tag : aspects.getAspectsSorted()) {
            if (Thaumcraft.proxy.playerKnowledge.hasDiscoveredAspect(player.getCommandSenderName(), tag)) {
                list.add(tag.getName() + " x " + aspects.getAmount(tag));
            } else {
                list.add(StatCollector.translateToLocal("tc.aspect.unknown"));
            }
        }
    }
    super.addInformation(stack, player, list, par4);
}
 
Example #5
Source File: RegisteredItems.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
private static void registerItems() {
    itemTransformationFocus = registerItem(new ItemTransformationFocus());
    itemGolemCoreBreak = registerItem(new ItemGolemCoreBreak());
    itemFamiliar_old = registerItem(new ItemFamiliar_Old(), "ItemFamiliar");
    itemEtherealFamiliar = registerItem(new ItemEtherealFamiliar());
    itemAuraCore = registerItem(new ItemAuraCore());
    itemElement = registerItem(new ItemElement());

    itemCreativeNode = registerItem(new ItemCreativeNode());
    itemPackage = registerItem(new ItemArcanePackage());
    itemFakeLootbag = registerItem(Thaumcraft.MODID, new ItemFakeLootbag());
    itemFakeGolemPlacer = registerItem(new ItemFakeGolemPlacer());
    itemFakeGolemShield = registerItem(new ItemFakeGolemShield());
    itemExtendedNodeJar = registerItem(new ItemExtendedNodeJar());
    itemFakeModIcon = registerItem(new ItemFakeModIcon());
}
 
Example #6
Source File: TileExtendedNodeJar.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
public boolean receiveClientEvent(int i, int j) {
    if (i == 9) {
        if (this.worldObj.isRemote) {
            for (int yy = -1; yy < 3; yy++) {
                for (int xx = -1; xx < 2; xx++) {
                    for (int zz = -1; zz < 2; zz++) {
                        Thaumcraft.proxy.blockSparkle(this.worldObj, this.xCoord + xx, this.yCoord + yy, this.zCoord + zz, -9999, 5);
                    }
                }
            }
            this.animate = (System.currentTimeMillis() + 1000L);
        }
        return true;
    }
    return super.receiveClientEvent(i, j);
}
 
Example #7
Source File: TileEssentiaCompressor.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void playVortexEffects() {
    for (int a = 0; a < Thaumcraft.proxy.particleCount(1); a++) {
        int tx = this.xCoord + this.worldObj.rand.nextInt(4) - this.worldObj.rand.nextInt(4);
        int ty = this.yCoord + 1 + this.worldObj.rand.nextInt(4) - this.worldObj.rand.nextInt(4);
        int tz = this.zCoord + this.worldObj.rand.nextInt(4) - this.worldObj.rand.nextInt(4);
        if (ty > this.worldObj.getHeightValue(tx, tz)) {
            ty = this.worldObj.getHeightValue(tx, tz);
        }
        Vec3 v1 = Vec3.createVectorHelper(this.xCoord + 0.5D, this.yCoord + 1.5D, this.zCoord + 0.5D);
        Vec3 v2 = Vec3.createVectorHelper(tx + 0.5D, ty + 0.5D, tz + 0.5D);

        MovingObjectPosition mop = ThaumcraftApiHelper.rayTraceIgnoringSource(this.worldObj, v1, v2, true, false, false);
        if ((mop != null) && (getDistanceFrom(mop.blockX, mop.blockY, mop.blockZ) < 16.0D)) {
            tx = mop.blockX;
            ty = mop.blockY;
            tz = mop.blockZ;
            Block bi = this.worldObj.getBlock(tx, ty, tz);
            int md = this.worldObj.getBlockMetadata(tx, ty, tz);
            if (!bi.isAir(this.worldObj, tx, ty, tz)) {
                Thaumcraft.proxy.hungryNodeFX(this.worldObj, tx, ty, tz, this.xCoord, this.yCoord + 1, this.zCoord, bi, md);
            }
        }
    }
}
 
Example #8
Source File: TileBlockProtector.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void spawnEntityParticles(EntityLivingBase entity) {
    AxisAlignedBB cube = entity.boundingBox;
    if(cube != null && worldObj.rand.nextInt(20) == 0) {
        double posX = worldObj.rand.nextDouble() * (cube.maxX - cube.minX) + cube.minX;
        double posY = worldObj.rand.nextDouble() * (cube.maxX - cube.minX) + cube.minY;
        double posZ = worldObj.rand.nextDouble() * (cube.maxX - cube.minX) + cube.minZ;

        switch (worldObj.rand.nextInt(5)) {
            case 0: posX = cube.maxX; break;
            case 1: posY = cube.maxY; break;
            case 2: posZ = cube.maxZ; break;
            case 3: posX = cube.minX; break;
            case 4: posZ = cube.minZ; break;
        }

        Thaumcraft.proxy.wispFX3(this.worldObj, posX, posY, posZ, posX + this.worldObj.rand.nextFloat() * 0.2F, posY, posZ + this.worldObj.rand.nextFloat() * 0.2F, 0.2F, 6, true, -0.02F);
    }
}
 
Example #9
Source File: ItemTaintShovel.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
@Override
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float par8, float par9, float par10) {
    int purified = 0;
    for(int ex = x - 5;ex < x + 6;ex++){
        for(int wy = y - 4;wy < y + 5;wy++){
            for(int zee = z - 5;zee < z + 6;zee++){
                Block target = world.getBlock(ex, wy, zee);
                if(target != null && (target == ConfigBlocks.blockFluxGoo || target == ConfigBlocks.blockFluxGas)){
                    purified++;
                    world.setBlockToAir(ex, wy, zee);
                    float d1 = ((float) ex + world.rand.nextFloat());
                    float d2 = ((float) wy + world.rand.nextFloat());
                    float d0 = ((float) zee + world.rand.nextFloat());
                    Thaumcraft.proxy.nodeBolt(world, (float)player.posX, (float)player.posY, (float)player.posZ, d1, d2, d0);
                }
            }
        }
    }
    if(purified > 0){
        itemstack.damageItem(Math.min(purified, 15), player);
        player.swingItem();
        world.playSoundEffect((double)x + 0.5D, (double)y + 0.5D, (double)z + 0.5D, "thaumcraft:wandfail", 0.2F, 0.2F + world.rand.nextFloat() * 0.2F);
        return true;
    }
    else
        return super.onItemUse(itemstack, player, world, x, y, z, side, par8, par9, par10);
}
 
Example #10
Source File: ItemFruitTainted.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) {
    if(!world.isRemote && player instanceof EntityPlayerMP) {
        Thaumcraft.addStickyWarpToPlayer(player, 1);
        player.addPotionEffect(getEffect(PotionFluxTaint.instance.id, 600, false));
        player.addPotionEffect(getEffect(Potion.hunger.id, 600, false));
        if(world.rand.nextFloat() < 0.4F){
            player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("warp.text.15")));
            player.addPotionEffect(getEffect(PotionThaumarhia.instance.id, 600, true));
        }
    }
    return super.onEaten(stack, world, player);
}
 
Example #11
Source File: ItemElectricBootsTraveller.java    From Electro-Magic-Tools with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
    if ((!player.capabilities.isFlying) && (player.moveForward > 0.0F)) {
        if ((player.worldObj.isRemote) && (!player.isSneaking())) {
            if (!Thaumcraft.instance.entityEventHandler.prevStep.containsKey(Integer.valueOf(player.getEntityId()))) {
                Thaumcraft.instance.entityEventHandler.prevStep.put(Integer.valueOf(player.getEntityId()), Float.valueOf(player.stepHeight));
            }
            player.stepHeight = 1.0F;
        }
        if ((player.onGround || player.capabilities.isFlying) && player.moveForward > 0F) {
            player.moveFlying(0F, 1F, speedBonus);
            player.jumpMovementFactor = jumpBonus;
        }
    }
}
 
Example #12
Source File: AuraEffects.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void doEntityEffect(ChunkCoordinates originTile, Entity e) {
    EntityPlayer player = (EntityPlayer) e;

    for(Aspect a : Aspect.getPrimalAspects()) {
        if(a != null && e.worldObj.rand.nextInt(40) == 0) {
            if(e.worldObj.rand.nextInt(20) == 0) {
                //1 temp warp.
                Thaumcraft.addWarpToPlayer(player, 1, true);
            }
            ScanManager.checkAndSyncAspectKnowledge(player, a, 1);
        }
    }
}
 
Example #13
Source File: AuraResearchManager.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void tryUnlockAuraEffect(EntityPlayer player, Aspect aspect) {
    if(!AuraEffectHandler.registeredEffects.containsKey(aspect)) return;
    if(isBlacklisted(aspect)) return;

    if(!ResearchManager.isResearchComplete(player.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS")) return;
    if(!Thaumcraft.proxy.getPlayerKnowledge().hasDiscoveredAspect(player.getCommandSenderName(), aspect)) return;

    String res = String.format(TC_AURA_RESEARCH_STR, aspect.getTag());
    if(ResearchManager.isResearchComplete(player.getCommandSenderName(), res)) return;
    Thaumcraft.proxy.getResearchManager().completeResearch(player, res);

    PacketTCNotificationText text = new PacketTCNotificationText("gadomancy.aura.research.unlock", aspect.getTag());
    PacketHandler.INSTANCE.sendTo(text, (EntityPlayerMP) player);
}
 
Example #14
Source File: TileInfusionClaw.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void loadResearch(EntityPlayer fakePlayer) {
    boolean online = false;
    for(String username : MinecraftServer.getServer().getAllUsernames()) {
        if(username.equals(player)) {
            online = true;
            break;
        }
    }

    if(online) {
        this.research = ResearchManager.getResearchForPlayer(player);
    } else {
        if(research == null) {
            Thaumcraft.proxy.getCompletedResearch().put(fakePlayer.getCommandSenderName(), new ArrayList<String>());

            IPlayerFileData playerNBTManagerObj = MinecraftServer.getServer().worldServerForDimension(0).getSaveHandler().getSaveHandler();
            SaveHandler sh = (SaveHandler)playerNBTManagerObj;
            File dir = ObfuscationReflectionHelper.getPrivateValue(SaveHandler.class, sh, "playersDirectory", "field_75771_c");
            File file1 = new File(dir, player + ".thaum");
            File file2 = new File(dir, player + ".thaumbak");
            ResearchManager.loadPlayerData(fakePlayer, file1, file2, false);

            this.research = ResearchManager.getResearchForPlayerSafe(fakePlayer.getCommandSenderName());
        }
    }

    Thaumcraft.proxy.getCompletedResearch().put(fakePlayer.getCommandSenderName(), research == null ? new ArrayList<String>() : research);
}
 
Example #15
Source File: ResearchHelper.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void distributeResearch(String research, World world, double x, double y, double z, double radius) {
    List players = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(radius, radius, radius));
    for(Object pl : players) {
        EntityPlayer player = (EntityPlayer) pl;
        if(!ResearchManager.isResearchComplete(player.getCommandSenderName(), research) && ResearchManager.doesPlayerHaveRequisites(player.getCommandSenderName(), research)) {
            thaumcraft.common.lib.network.PacketHandler.INSTANCE.sendTo(new PacketResearchComplete(research), (EntityPlayerMP)player);
            Thaumcraft.proxy.getResearchManager().completeResearch(player, research);
        }
    }
}
 
Example #16
Source File: ExplosionHelper.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void vortexLightning(TileExtendedNode te) {
    World world = te.getWorldObj();
    int x = te.xCoord;
    int y = te.yCoord;
    int z = te.zCoord;
    float xx = x + world.rand.nextInt(3) - world.rand.nextInt(3);
    float yy = y + world.rand.nextInt(3) - world.rand.nextInt(3);
    float zz = z + world.rand.nextInt(3) - world.rand.nextInt(3);
    xx += world.rand.nextFloat() * (world.rand.nextBoolean() ? 1 : -1);
    yy += world.rand.nextFloat() * (world.rand.nextBoolean() ? 1 : -1);
    zz += world.rand.nextFloat() * (world.rand.nextBoolean() ? 1 : -1);
    Thaumcraft.proxy.nodeBolt(world, x + 0.5F, y + 0.5F, z + 0.5F, xx, yy, zz);
}
 
Example #17
Source File: ProfaneWandUpdate.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public void onUpdate(ItemStack itemstack, EntityPlayer player) {

        if(player.ticksExisted % 20 == 0){

            NBTTagCompound tag = itemstack.getTagCompound();
            if(!tag.hasKey("contract")){
                Thaumcraft.proxy.getResearchManager().completeResearch(player, "ROD_profane");
                tag.setInteger("contract", 25000);
            }
            else if(tag.getInteger("contract") <= 0)
                return;

            for(int x = 0;x < primals.length && tag.getInteger("contract") > 0;x++){
                int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]);
                if(deficit > 0) {
                    int restore = Math.min(tag.getInteger("contract"), deficit);
                    ((ItemWandCasting)itemstack.getItem()).addRealVis(itemstack, primals[x], restore, true);
                    tag.setInteger("contract", tag.getInteger("contract") - restore);
                    if(player.worldObj.rand.nextInt(2501) < restore)
                        Thaumcraft.addStickyWarpToPlayer(player, 1);
                }
            }

            if(tag.getInteger("contract") <= 0) {
                ((ItemWandCasting)itemstack.getItem()).setRod(itemstack, WandRod.rods.get("profaned"));
                Thaumcraft.addStickyWarpToPlayer(player, 1);
                player.worldObj.spawnParticle("largeexplode", player.posX, player.posY + (double)(player.height / 2.0F), player.posZ, 0.0D, 0.0D, 0.0D);
            }
            itemstack.setTagCompound(tag);
        }

    }
 
Example #18
Source File: GuiResearchRecipeAuraEffects.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public GuiResearchRecipeAuraEffects(ResearchItem research, int page, double x, double y) {
    super(research, page, x, y);

    Injector inj = new Injector(this, GuiResearchRecipe.class);

    ResearchPage[] additionalPages = ResearchPageAuraAspects.createAllAuraPagesFor(Minecraft.getMinecraft().thePlayer);
    ResearchPage[] pages = inj.getField("pages");
    ResearchPage[] newPages = new ResearchPage[pages.length + additionalPages.length];
    System.arraycopy(pages, 0, newPages, 0, pages.length);
    System.arraycopy(additionalPages, 0, newPages, pages.length, additionalPages.length);
    inj.setField("pages", newPages);
    inj.setField("maxPages", newPages.length);

    List<String> list = Thaumcraft.proxy.getScannedObjects().get(Minecraft.getMinecraft().thePlayer.getCommandSenderName());
    if ((list != null) && (list.size() > 0)) {
        for (String s : list) {
            try {
                String s2 = s.substring(1);
                ItemStack is = getFromCache(Integer.parseInt(s2));
                if (is != null) {
                    AspectList tags = ThaumcraftCraftingManager.getObjectTags(is);
                    tags = ThaumcraftCraftingManager.getBonusTags(is, tags);
                    if ((tags != null) && (tags.size() > 0)) {
                        for (Aspect a : tags.getAspects()) {
                            ArrayList<ItemStack> items = itemMap.get(a.getTag());
                            if (items == null) {
                                items = new ArrayList<ItemStack>();
                            }
                            ItemStack is2 = is.copy();
                            is2.stackSize = tags.getAmount(a);
                            items.add(is2);
                            itemMap.put(a.getTag(), items);
                        }
                    }
                }
            } catch (NumberFormatException e) {}
        }
    }
}
 
Example #19
Source File: UtilsFX.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void doRuneEffects(World world, int x, int y, int z, int colorFlag) {
    if(world.isRemote) {
        int cnt = 20;
        while(cnt > 0) {
            cnt--;
            Color rand = evaluateRandomColor(world.rand, colorFlag);
            Thaumcraft.proxy.blockRunes(world, x + randomOffset(world), y + randomOffset(world), z + randomOffset(world),
                    rand.getRed() / 255F, rand.getGreen() / 255F, rand.getBlue() / 255F, world.rand.nextInt(10) + 30, -0.01F - (world.rand.nextBoolean() ? world.rand.nextBoolean() ? 0.02F : 0.01F : 0F));
        }
    }
}
 
Example #20
Source File: SubTileTainthistle.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 4 votes vote down vote up
public void doBurnParticles() {
    Thaumcraft.proxy.reservoirBubble(supertile.getWorldObj(), supertile.xCoord, supertile.yCoord, supertile.zCoord, 0x4D00FF);
}
 
Example #21
Source File: WrathSpawnerLogic.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 4 votes vote down vote up
public void updateSpawner() {
    if (!mobSet)
        return;

    double d0;

    if (this.getSpawnerWorld().isRemote && (fuel > 0 || Config.wrathCost <= 0)) {
        double d1 = (double) ((float) this.getSpawnerX() + this.getSpawnerWorld().rand.nextFloat());
        double d2 = (double) ((float) this.getSpawnerY() + this.getSpawnerWorld().rand.nextFloat());
        d0 = (double) ((float) this.getSpawnerZ() + this.getSpawnerWorld().rand.nextFloat());
        // this.getSpawnerWorld().spawnParticle("smoke", d1, d2, d0, 0.0D,
        // 0.0D, 0.0D);
        // this.getSpawnerWorld().spawnParticle("flame", d1, d2, d0, 0.0D,
        // 0.0D, 0.0D);
        Thaumcraft.proxy.sparkle((float) d1, (float) d2, (float) d0, 0x870404);

        if (this.spawnDelay > 0) {
            --this.spawnDelay;
        }

        this.field_98284_d = this.field_98287_c;
        this.field_98287_c = (this.field_98287_c + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D;
    } else if (Config.wrathCage) {
        if (Config.wrathCost > 0 && fuel <= 0) {
            if (mobSpawnerEntity.special >= Config.wrathCost) {
                mobSpawnerEntity.special -= Config.wrathCost;
                slothful = false;
                fuel = Config.wrathEff;
                mobSpawnerEntity.getWorldObj().markBlockForUpdate(getSpawnerX(), getSpawnerY(), getSpawnerZ());
            } else if (mobSpawnerEntity.wrath >= Config.wrathCost) {
                mobSpawnerEntity.wrath -= Config.wrathCost;
                slothful = false;
                fuel = Config.wrathEff;
                mobSpawnerEntity.getWorldObj().markBlockForUpdate(getSpawnerX(), getSpawnerY(), getSpawnerZ());
            } else if (mobSpawnerEntity.sloth >= Config.wrathCost) {
                mobSpawnerEntity.sloth -= Config.wrathCost;
                slothful = true;
                fuel = Config.wrathEff;
                mobSpawnerEntity.getWorldObj().markBlockForUpdate(getSpawnerX(), getSpawnerY(), getSpawnerZ());
            }
        }

        if (this.spawnDelay == -1) {
            this.updateDelay();
        }

        if (fuel <= 0 && Config.wrathCost > 0)
            return;

        if (this.spawnDelay > 0) {
            --this.spawnDelay;
            return;
        }

        for (int i = 0; i < this.spawnCount && (fuel > 0 || Config.wrathCost <= 0); ++i) {
            Entity entity = EntityList.createEntityByName(this.getEntityNameToSpawn(), this.getSpawnerWorld());

            if (entity == null) {
                return;
            }

            //int j = this.getSpawnerWorld().getEntitiesWithinAABB(entity.getClass(), AxisAlignedBB.getAABBPool().getAABB((double) this.getSpawnerX(), (double) this.getSpawnerY(), (double) this.getSpawnerZ(), (double) (this.getSpawnerX() + 1), (double) (this.getSpawnerY() + 1), (double) (this.getSpawnerZ() + 1)).expand((double) (this.spawnRange * 2), 4.0D, (double) (this.spawnRange * 2))).size();
            int j = this.getSpawnerWorld().getEntitiesWithinAABB(entity.getClass(), AxisAlignedBB.getBoundingBox((double)this.getSpawnerX(), (double)this.getSpawnerY(), (double)this.getSpawnerZ(), (double)(this.getSpawnerX() + 1), (double)(this.getSpawnerY() + 1), (double)(this.getSpawnerZ() + 1)).expand((double)(this.spawnRange * 2), 4.0D, (double)(this.spawnRange * 2))).size();

            if (j >= this.maxNearbyEntities) {
                this.updateDelay();
                return;
            }

            d0 = (double) this.getSpawnerX() + (this.getSpawnerWorld().rand.nextDouble() - this.getSpawnerWorld().rand.nextDouble()) * (double) this.spawnRange;
            double d3 = (double) (this.getSpawnerY() + this.getSpawnerWorld().rand.nextInt(3) - 1);
            double d4 = (double) this.getSpawnerZ() + (this.getSpawnerWorld().rand.nextDouble() - this.getSpawnerWorld().rand.nextDouble()) * (double) this.spawnRange;
            EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving) entity : null;
            entity.setLocationAndAngles(d0, d3, d4, this.getSpawnerWorld().rand.nextFloat() * 360.0F, 0.0F);

            if (
            // entityliving == null ||
            entityCanSpawn(entityliving))
            // entityliving.getCanSpawnHere())
            {
                this.spawnMob(entity);
                this.getSpawnerWorld().playAuxSFX(2004, this.getSpawnerX(), this.getSpawnerY(), this.getSpawnerZ(), 0);

                if (entityliving != null) {
                    entityliving.spawnExplosionParticle();
                    fuel--;
                }

                this.updateDelay();
            } else if (entityliving != null)
                entityliving.isDead = true;
        }

    }
}
 
Example #22
Source File: RenderTileInfusionClaw.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void createZap(TileEntity tile, float startX, float startY, float startZ, float endX, float endY, float endZ) {
    Thaumcraft.proxy.nodeBolt(Thaumcraft.proxy.getClientWorld(), tile.xCoord + startX, tile.yCoord + startY, tile.zCoord + startZ,
            tile.xCoord + endX, tile.yCoord + endY, tile.zCoord + endZ);
}
 
Example #23
Source File: ItemRockbreakerDrill.java    From Electro-Magic-Tools with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("unused")
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
    if (!player.isSneaking()) {
        for (int i = 0; i < player.inventory.mainInventory.length; i++) {
            ItemStack torchStack = player.inventory.mainInventory[i];
            if (torchStack == null || !torchStack.getUnlocalizedName().toLowerCase().contains("torch")) {
                continue;
            }
            Item item = torchStack.getItem();
            if (!(item instanceof ItemBlock)) {
                continue;
            }
            int oldMeta = torchStack.getItemDamage();
            int oldSize = torchStack.stackSize;
            boolean result = torchStack.tryPlaceItemIntoWorld(player, world, x, y, z, side, xOffset, yOffset, zOffset);
            if (player.capabilities.isCreativeMode) {
                torchStack.setItemDamage(oldMeta);
                torchStack.stackSize = oldSize;
            } else if (torchStack.stackSize <= 0) {
                ForgeEventFactory.onPlayerDestroyItem(player, torchStack);
                player.inventory.mainInventory[i] = null;
            }
            if (result) {
                return true;
            }
        }
    } else {
        ElectricItem.manager.use(stack, searchCost, player);
        if (!world.isRemote) {
            world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "thaumcraft:wandfail", 0.2F, 0.2F + world.rand.nextFloat() * 0.2F);
            return super.onItemUse(stack, player, world, x, y, z, side, xOffset, xOffset, zOffset);
        }
        Minecraft mc = Minecraft.getMinecraft();
        Thaumcraft.instance.renderEventHandler.startScan(player, x, y, z, System.currentTimeMillis() + 5000L);
        player.swingItem();
        return super.onItemUse(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset);
    }

    return super.onItemUse(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset);
}
 
Example #24
Source File: TileBlockProtector.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void updateEntity() {
    if (!protectors.contains(this)) {
        protectors.add(this);
    }

    if (!worldObj.isRemote) {
        if (++count % 5 == 0 && amount < maxAmount) {
            fillJar();
        }

        if (count % UPDATE_TICKS == 0) {
            if(range == 0) {
                saturation = 0;
            }

            if (saturation > 0) {
                saturation--;
                return;
            }

            int powerLevel = getPowerLevel();
            boolean executeDecrease = range > powerLevel;

            if(range <= powerLevel && powerLevel > 0) {
                executeDecrease = true;
                if (takeFromContainer(ASPECT, 1)) {

                    if (range < powerLevel) {
                        range++;
                        markDirty();
                        worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);

                        saturation = 16 - range;
                    }
                    executeDecrease = false;
                }
            }

            if (executeDecrease && range > 0) {
                range--;

                markDirty();
                worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
            }
        }
    } else if(range > 0) {
        float sizeMod = 1 - (range / 15f);
        if (this.worldObj.rand.nextInt(9 - Thaumcraft.proxy.particleCount(2)) == 0) {
            Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.68F, this.zCoord + 0.5F, this.xCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, this.yCoord + 0.68F, this.zCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, 0.3F - (0.15f*sizeMod), 6, true, -0.025F);
        }
        if (this.worldObj.rand.nextInt(15 - Thaumcraft.proxy.particleCount(4)) == 0) {
            Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.68F, this.zCoord + 0.5F, this.xCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, this.yCoord + 0.68F, this.zCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, 0.2F - (0.15f*sizeMod), 6, true, -0.02F);
        }
    }

    if(range > 0) {
        for(EntityLivingBase entity : (List<EntityCreeper>)worldObj.getEntitiesWithinAABB(EntityLivingBase.class, getProtectedAABB())) {
            if(entity instanceof EntityCreeper) {
                ((EntityCreeper) entity).timeSinceIgnited = 0;
            }

            if(worldObj.isRemote && !(entity instanceof EntityPlayer)) {
                spawnEntityParticles(entity);
            }
        }
    }
}
 
Example #25
Source File: Gadomancy.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
    proxy.initalize();

    FMLInterModComms.sendMessage(Thaumcraft.MODID, "dimensionBlacklist", ModConfig.dimOuterId + ":0");
}
 
Example #26
Source File: PacketStartAnimation.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public IMessage onMessage(PacketStartAnimation message, MessageContext ctx) {
    switch (message.annimationId) {
        case ID_INFUSIONCLAW:
            TileInfusionClaw tile = (TileInfusionClaw) Minecraft.getMinecraft().theWorld.getTileEntity(message.x, message.y, message.z);
            if(tile != null) {
                tile.animationStates[8] = 1;
            }
            break;
        case ID_EX_VORTEX:
            TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(message.x, message.y, message.z);
            if(te == null || !(te instanceof TileExtendedNode)) return null;
            ExplosionHelper.VortexExplosion.vortexLightning((TileExtendedNode) te);
            break;
        case ID_BURST:
            Thaumcraft.proxy.burst(Minecraft.getMinecraft().theWorld, message.x + 0.5F, message.y + 0.5F, message.z + 0.5F, Minecraft.getMinecraft().theWorld.rand.nextInt(3) + 1);
            break;
        case ID_RUNES:
            UtilsFX.doRuneEffects(Minecraft.getMinecraft().theWorld, message.x, message.y, message.z, message.additionalData);
            break;
        case ID_SPARKLE_SPREAD:
            UtilsFX.doSparkleEffectsAround(Minecraft.getMinecraft().theWorld, message.x, message.y, message.z);
            break;
        case ID_SPARKLE:
            UtilsFX.doSparkleEffects(Minecraft.getMinecraft().theWorld, message.x, message.y, message.z);
            break;
        case ID_SMOKE:
            UtilsFX.doSmokeEffects(Minecraft.getMinecraft().theWorld, message.x, message.y, message.z, Float.intBitsToFloat(message.additionalData));
            break;
        case ID_SMOKE_SPREAD:
            UtilsFX.doSmokeEffectsAround(Minecraft.getMinecraft().theWorld, message.x, message.y, message.z, Float.intBitsToFloat(message.additionalData));
            break;
        case ID_BUBBLES:
            MultiTickEffectDispatcher.BubbleFXInfo bubbles =
                    new MultiTickEffectDispatcher.BubbleFXInfo(Minecraft.getMinecraft().theWorld.provider.dimensionId,
                            Float.intBitsToFloat(message.x), Float.intBitsToFloat(message.y), Float.intBitsToFloat(message.z),
                            10, Float.intBitsToFloat(message.additionalData));
            MultiTickEffectDispatcher.registerBubbles(bubbles);
            break;
    }
    return null;
}
 
Example #27
Source File: UtilsFX.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static void doSparkleEffects(World world, int x, int y, int z) {
    Thaumcraft.proxy.blockSparkle(world, x, y, z, -9999, 10);
}
 
Example #28
Source File: RenderTileInfusionClaw.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void playZapSound(float x, float y, float z) {
    Thaumcraft.proxy.getClientWorld().playSound(x, y, z, "thaumcraft:zap", 0.1F, 1.0F + Thaumcraft.proxy.getClientWorld().rand.nextFloat() * 0.2F, false);
}