thaumcraft.common.config.Config Java Examples

The following examples show how to use thaumcraft.common.config.Config. 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: ExplosionHelper.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void taintplosion(World world, int x, int y, int z, boolean taintBiome, int chanceToTaint, float str, int size, int blocksAffected) {
    if(chanceToTaint < 1) chanceToTaint = 1;
    world.createExplosion(null, x + 0.5D, y + 0.5D, z + 0.5D, str, false);
    for (int a = 0; a < blocksAffected; a++) {
        int xx = x + world.rand.nextInt(size) - world.rand.nextInt(size);
        int yy = y + world.rand.nextInt(size) - world.rand.nextInt(size);
        int zz = z + world.rand.nextInt(size) - world.rand.nextInt(size);
        if (world.isAirBlock(xx, yy, zz)) {
            if (yy < y) {
                world.setBlock(xx, yy, zz, ConfigBlocks.blockFluxGoo, 8, 3);
            } else {
                world.setBlock(xx, yy, zz, ConfigBlocks.blockFluxGas, 8, 3);
            }
        }
        if(!Config.genTaint) continue;

        if(taintBiome && world.rand.nextInt(chanceToTaint) == 0) {
            Utils.setBiomeAt(world, xx, zz, ThaumcraftWorldGenerator.biomeTaint);
        }
    }
}
 
Example #3
Source File: AIBreakBlock.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean shouldExecute() {
    if (golem.ticksExisted % Config.golemDelay > 0) {
        return false;
    }

    currentMarker = getNextMarker();

    if(!hasValidTool()) {
        if(isInHomeRange()) {
            return true;
        }
        return false;
    }

    return currentMarker != null;
}
 
Example #4
Source File: RegisteredResearches.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void postInit() {
    ResearchItem researchJar = PseudoResearchItem.create("JARLABEL", -3, -7).registerResearchItem();

    RecipeVisualStickyJar visualRecipe = new RecipeVisualStickyJar();
    ResearchPage page = new ResearchPage(visualRecipe);

    researchStickyJar = new StickyJarResearchItem("STICKYJAR", -5, -5, 2,
            new AspectList().add(Aspect.SLIME, 8).add(Aspect.EARTH, 8))
            .setParents(researchJar.key).setConcealed()
            .setPages(new ResearchPage("gadomancy.research_page.STICKYJAR.1"), page).registerResearchItem();

    if(researchBlockProtector != null) {
        researchBlockProtector.setParents(researchStickyJar.key);
    }

    String[] parents = Config.allowMirrors ? new String[] { researchJar.key, "MIRRORESSENTIA" } : new String[] { researchJar.key };
    researchRemoteJar = new SimpleResearchItem("REMOTEJAR", -4, -3, 3,
            RegisteredRecipes.recipeRemoteJar.getRecipeOutput(),
            new AspectList().add(Aspect.WATER, 4).add(Aspect.MECHANISM, 8).add(Aspect.EARTH, 4).add(Aspect.ORDER, 8))
            .setParents(parents).setConcealed()
            .setPages(new ResearchPage("gadomancy.research_page.REMOTEJAR.1"), new ResearchPage(RegisteredRecipes.recipeRemoteJar), new ResearchPage("gadomancy.research_page.REMOTEJAR.2")).registerResearchItem();

    //Aura researches
    AuraResearchManager.registerAuraResearches();
}
 
Example #5
Source File: RenderTileCapEldritch.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
    if(te.getWorldObj().provider.dimensionId == ModConfig.dimOuterId) {
        int old = Config.dimensionOuterId;
        Config.dimensionOuterId = ModConfig.dimOuterId;
        super.renderTileEntityAt(te, x, y, z, f);
        Config.dimensionOuterId = old;
    } else {
        super.renderTileEntityAt(te, x, y, z, f);
    }
}
 
Example #6
Source File: ItemCrystalwell.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public ItemCrystalwell() {
    maxStackSize = 1;
    canRepair = false;
    if(Config.researchDifficulty == -1)
        setMaxDamage(50);
    else
        setMaxDamage(100);
    setCreativeTab(Forbidden.tab);
    setHasSubtypes(false);

}
 
Example #7
Source File: BlockPlanksTainted.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public BlockPlanksTainted(){
    super(Config.taintMaterial);
    setCreativeTab(Forbidden.tab);
    setStepSound(Block.soundTypeWood);
    setHardness(2.0F);
    setResistance(5.0F);
    setBlockTextureName("forbidden:taint_planks");
    this.setHarvestLevel("axe", 0);
}
 
Example #8
Source File: BlockSaplingTainted.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public BlockSaplingTainted()
{
    super();
    setCreativeTab(Forbidden.tab);
    setStepSound(ConfigBlocks.blockTaint.stepSound);
    try {
        Field mat = ReflectionHelper.findField(Block.class, "blockMaterial", "field_149764_J");
        mat.set(this, Config.taintMaterial);
    } catch (Exception e){
        e.printStackTrace();
    }
}
 
Example #9
Source File: BlockLeavesTainted.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public BlockLeavesTainted()
{
    super();
    setCreativeTab(Forbidden.tab);
    setLightOpacity(0);
    setHardness(0.2F);
    setStepSound(ConfigBlocks.blockTaint.stepSound);
    try {
        Field mat = ReflectionHelper.findField(Block.class, "blockMaterial", "field_149764_J");
        mat.set(this, Config.taintMaterial);
    } catch (Exception e){
        e.printStackTrace();
    }
}
 
Example #10
Source File: BlockLogTainted.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public BlockLogTainted()
{
    super();
    setCreativeTab(Forbidden.tab);
    setStepSound(ConfigBlocks.blockTaint.stepSound);
    try {
        Field mat = ReflectionHelper.findField(Block.class, "blockMaterial", "field_149764_J");
        mat.set(this, Config.taintMaterial);
    } catch (Exception e){
        e.printStackTrace();
    }
    this.setHarvestLevel("axe", 0);
}
 
Example #11
Source File: BlockStoneTainted.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public BlockStoneTainted(){
    super(Config.taintMaterial);
    setHardness(2.0F);
    setResistance(10.0F);
    setStepSound(Block.soundTypeStone);
    setCreativeTab(Forbidden.tab);
    this.setHarvestLevel("pickaxe", 0);
}
 
Example #12
Source File: ItemMaterials.java    From Electro-Magic-Tools with GNU General Public License v3.0 5 votes vote down vote up
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {
    super.onUpdate(stack, world, entity, par4, par5);
    if ((!entity.worldObj.isRemote) && ((stack.getItemDamage() == 14)) && ((entity instanceof EntityLivingBase)) && (!((EntityLivingBase) entity).isEntityUndead()) && (!((EntityLivingBase) entity).isPotionActive(Config.potionTaintPoisonID)) && (world.rand.nextInt(4321) <= stack.stackSize)) {
        ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Config.potionTaintPoisonID, 120, 0, false));
        if ((entity instanceof EntityPlayer)) {
            InventoryUtils.consumeInventoryItem((EntityPlayer) entity, stack.getItem(), stack.getItemDamage());
        }
    }
}
 
Example #13
Source File: AuraEffects.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void doBlockEffect(ChunkCoordinates originTile, ChunkCoordinates selectedBlock, World world) {
    if(!Config.genTaint) return;
    int x = selectedBlock.posX;
    int y = selectedBlock.posY;
    int z = selectedBlock.posZ;
    BlockTaintFibres.spreadFibres(world, x, y, z);
    if(world.rand.nextInt(12) == 0) {
        Utils.setBiomeAt(world, x, z, ThaumcraftWorldGenerator.biomeTaint);
        world.addBlockEvent(x, y, z, world.getBlock(x, y, z), 1, 0);
    }
}
 
Example #14
Source File: RenderTileObelisk.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
    if(te.getWorldObj().provider.dimensionId == ModConfig.dimOuterId) {
        int old = Config.dimensionOuterId;
        Config.dimensionOuterId = ModConfig.dimOuterId;
        super.renderTileEntityAt(te, x, y, z, f);
        Config.dimensionOuterId = old;
    } else {
        super.renderTileEntityAt(te, x, y, z, f);
    }
}
 
Example #15
Source File: AuraEffects.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void doEntityEffect(ChunkCoordinates originTile, Entity e) {
    if(e.worldObj.rand.nextInt(20) == 0 && !((EntityLivingBase) e).isPotionActive(Config.potionTaintPoisonID)) {
        ((EntityLivingBase) e).addPotionEffect(new PotionEffect(Config.potionTaintPoisonID, ticksForSeconds(20), 0, true));
    }
}
 
Example #16
Source File: AIBreakBlock.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean continueExecuting() {
    if(hasValidTool) {
        if(!hasBlock(currentMarker)) {
            return false;
        }

        if(distanceSquaredToGolem(currentMarker) < 1) {
            if(golem.getCarried() == null) {
                golem.startActionTimer();
            } else {
                golem.startRightArmTimer();
            }

            if(clickCount % (7 - Math.min(6, golem.getGolemStrength())) == 0) {
                doLeftClick();
            }
            clickCount++;


            golem.getLookHelper().setLookPosition(currentMarker.x + 0.5D, currentMarker.y + 0.5D, currentMarker.z + 0.5D, 30.0F, 30.0F);

            count = 0;
        } else {
            if(count == 20) {
                count = 0;

                ForgeDirection dir = ForgeDirection.getOrientation(currentMarker.side);
                boolean path = golem.getNavigator().tryMoveToXYZ(currentMarker.x + 0.5D + dir.offsetX, currentMarker.y + 0.5D + dir.offsetY, currentMarker.z + 0.5D + dir.offsetZ, golem.getAIMoveSpeed());
                if(!path) {
                    if (blacklistCount > 10) {
                        blacklist.put(currentMarker, golem.ticksExisted);
                        return false;
                    }
                    blacklistCount++;
                }
            }
            count++;
            clickCount = 0;
        }
    } else {
        if(golem.ticksExisted % Config.golemDelay > 0) {
            if(isInHomeRange()) {
                IInventory homeChest = getHomeChest();
                if(homeChest != null) {
                    trySwitchTool(homeChest);
                }
            } else {
                return false;
            }
        }
    }

    return true;
}
 
Example #17
Source File: ItemCrystalwell.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 4 votes vote down vote up
/**
 * Render Pass sensitive version of hasEffect()
 */
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack, int pass) {
    return Config.researchDifficulty != -1 && stack.getItemDamage() >= 100;
}