Skip to content

Commit

Permalink
Add Iridium-Plated Bore Lens
Browse files Browse the repository at this point in the history
  • Loading branch information
codewarrior0 committed Jul 13, 2018
1 parent 4e14fc4 commit 04bf3f4
Show file tree
Hide file tree
Showing 8 changed files with 250 additions and 1 deletion.
126 changes: 126 additions & 0 deletions src/main/java/com/gmail/pharaun/gregtania/botania/GTItemLens.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 31, 2014, 3:02:58 PM (GMT)]
* Modified by Codewarrior0
*/
package com.gmail.pharaun.gregtania.botania;

import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.mana.BurstProperties;
import vazkii.botania.api.mana.ILensControl;
import vazkii.botania.api.mana.IManaSpreader;
import vazkii.botania.api.mana.ITinyPlanetExcempt;

public class GTItemLens extends Item implements ILensControl, ITinyPlanetExcempt {

private final LensIridiumBore BORE_LENS;
static IIcon iconIridiumBoreGlass;

public GTItemLens() {
super();
setUnlocalizedName("lensIridiumBore");
GameRegistry.registerItem(this, "lensIridiumBore");
setMaxStackSize(1);
setHasSubtypes(true);
BORE_LENS = new LensIridiumBore();
}

@Override
public void registerIcons(IIconRegister par1IconRegister) {
iconIridiumBoreGlass = par1IconRegister.registerIcon("gregtania:lensIridiumBoreGlass");
this.itemIcon = par1IconRegister.registerIcon("gregtania:lensIridiumBore");
}

@Override
public void apply(ItemStack stack, BurstProperties props) {
BORE_LENS.apply(stack, props);
}

@Override
public boolean collideBurst(IManaBurst burst, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
EntityThrowable entity = (EntityThrowable) burst;
return BORE_LENS.collideBurst(burst, entity, pos, isManaBlock, dead, stack);
}

@Override
public void updateBurst(IManaBurst burst, ItemStack stack) {
EntityThrowable entity = (EntityThrowable) burst;
BORE_LENS.updateBurst(burst, entity, stack);

}



@Override
public int getLensColor(ItemStack stack) {
return 0xFFFFFF;
}

@Override
public boolean requiresMultipleRenderPasses() {
return true;
}

@Override
public IIcon getIconFromDamageForRenderPass(int par1, int par2) {
return par2 == 1 ? itemIcon : iconIridiumBoreGlass;
}

@Override
public boolean doParticles(IManaBurst burst, ItemStack stack) {
return true;
}

@Override
public boolean canCombineLenses(ItemStack itemStack, ItemStack itemStack1) {
return false;
}

@Override
public ItemStack getCompositeLens(ItemStack stack) {
return null;
}

@Override
public ItemStack setCompositeLens(ItemStack sourceLens, ItemStack compositeLens) {
return sourceLens;
}

@Override
public boolean shouldPull(ItemStack stack) {
return true;
}

@Override
public boolean isControlLens(ItemStack stack) {
return false;
}

@Override
public boolean allowBurstShooting(ItemStack stack, IManaSpreader spreader, boolean redstone) {
return BORE_LENS.allowBurstShooting(stack, spreader, redstone);
}

@Override
public void onControlledSpreaderTick(ItemStack stack, IManaSpreader spreader, boolean redstone) {
BORE_LENS.onControlledSpreaderTick(stack, spreader, redstone);
}

@Override
public void onControlledSpreaderPulse(ItemStack stack, IManaSpreader spreader, boolean redstone) {
BORE_LENS.onControlledSpreaderPulse(stack, spreader, redstone);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package com.gmail.pharaun.gregtania.botania;

/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 24, 2015, 4:36:20 PM (GMT)]
* Modified by Codewarrior0
*/

import java.util.ArrayList;
import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.mana.IManaBlock;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.lens.ItemLens;
import vazkii.botania.common.item.lens.Lens;

public class LensIridiumBore extends Lens {

@Override
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
World world = entity.worldObj;
int x = pos.blockX;
int y = pos.blockY;
int z = pos.blockZ;
Block block = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
ItemStack composite = ((ItemLens) ModItems.lens).getCompositeLens(stack);
boolean warp = composite != null && composite.getItem() == ModItems.lens && composite.getItemDamage() == ItemLens.WARP;

if(warp && (block == ModBlocks.pistonRelay || block == Blocks.piston || block == Blocks.piston_extension || block == Blocks.piston_head))
return false;

int harvestLevel = 999;

TileEntity tile = world.getTileEntity(x, y, z);

float hardness = block.getBlockHardness(world, x, y, z);
int neededHarvestLevel = block.getHarvestLevel(meta);
int mana = burst.getMana();

ChunkCoordinates coords = burst.getBurstSourceChunkCoordinates();
if((coords.posX != x || coords.posY != y || coords.posZ != z) && !(tile instanceof IManaBlock) && neededHarvestLevel <= harvestLevel && hardness != -1 && (burst.isFake() || mana >= 24)) {
List<ItemStack> items = new ArrayList();

items.addAll(block.getDrops(world, x, y, z, meta, 0));

if(!burst.hasAlreadyCollidedAt(x, y, z)) {
if(!burst.isFake() && !entity.worldObj.isRemote) {
world.setBlockToAir(x, y, z);
if(ConfigHandler.blockBreakParticles)
entity.worldObj.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));

boolean offBounds = coords.posY < 0;
boolean doWarp = warp && !offBounds;
int dropX = doWarp ? coords.posX : x;
int dropY = doWarp ? coords.posY : y;
int dropZ = doWarp ? coords.posZ : z;

for(ItemStack stack_ : items)
world.spawnEntityInWorld(new EntityItem(world, dropX + 0.5, dropY + 0.5, dropZ + 0.5, stack_));

burst.setMana(mana - 24);
}
}

dead = false;
}

return dead;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconPage;
import vazkii.botania.common.lexicon.page.PageCraftingRecipe;
import vazkii.botania.common.lexicon.page.PagePetalRecipe;
import vazkii.botania.common.lexicon.page.PageRuneRecipe;
import vazkii.botania.common.lexicon.page.PageText;
Expand All @@ -24,6 +25,7 @@ public class GTLexiconData {
public static LexiconEntry entryEvolvedOrechidIgnem;
public static LexiconEntry entryEvolvedOrechidEndium;
public static LexiconEntry entryStratodendron;
private static GTLexiconEntry entryIridiumBore;

public static void init() {
BotaniaAPI.addCategory(gtLexiconCategory = new GTLexiconCategory("gregtania.category.gregtania"));
Expand Down Expand Up @@ -59,7 +61,12 @@ public static void init() {

entryStratodendron = new GTLexiconEntry(SUBTILE_STRATODENDRON, gtLexiconCategory);

entryIridiumBore = new GTLexiconEntry("lensIridiumBore", gtLexiconCategory);

entryIridiumBore.setLexiconPages(
new PageText("0"),
new PageCraftingRecipe("1", recipeIridiumBoreLens)
);
}

public static void postInit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@

import com.gmail.pharaun.gregtania.botania.SubTileClayconiaAlluvia;
import com.gmail.pharaun.gregtania.botania.Util;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.api.recipe.RecipeRuneAltar;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import vazkii.botania.common.item.lens.ItemLens;

import static com.gmail.pharaun.gregtania.misc.ModFlowers.*;
import static com.gmail.pharaun.gregtania.proxies.CommonProxy.iridiumBoreLens;

/**
* Created by Rio on 7/12/2018.
Expand All @@ -37,6 +42,8 @@ public class ModCraftingRecipes {
public static RecipePetals recipeBumbleiscus;
public static RecipePetals recipeClayconiaAlluvia;

public static ShapedOreRecipe recipeIridiumBoreLens;

private static final int costTier1 = 5200;
private static final int costTier2 = 8000;
private static final int costTier3 = 12000;
Expand Down Expand Up @@ -145,5 +152,13 @@ public static void init() {
"petalGray", "petalLightGray", "petalLightGray", "petalCyan"
);
}

recipeIridiumBoreLens = new ShapedOreRecipe(iridiumBoreLens,
"SPS", "PBP", "SPS",
'P', "plateIridium",
'S', "screwIridium",
'B', new ItemStack(ModItems.lens, 1, ItemLens.MINE)
);
GameRegistry.addRecipe(recipeIridiumBoreLens);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gmail.pharaun.gregtania.proxies;

import com.gmail.pharaun.gregtania.botania.GTItemLens;
import com.gmail.pharaun.gregtania.botania.Util;
import com.gmail.pharaun.gregtania.lexicon.GTLexiconData;
import com.gmail.pharaun.gregtania.misc.BotaniaHelper;
Expand Down Expand Up @@ -33,8 +34,11 @@

public class CommonProxy {

public static GTItemLens iridiumBoreLens;

public void preInit(FMLPreInitializationEvent event) {
CS.GT.mAfterPostInit.add(this::afterGregPostInit);
iridiumBoreLens = new GTItemLens();
}

public void init(FMLInitializationEvent event) {
Expand Down
9 changes: 8 additions & 1 deletion src/main/resources/assets/gregtania/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,11 @@ tile.botania:flower.gregtania.bumblebiscus.reference=What little bumbles are mad
gregtania.entry.bumblebiscus=Bumblebiscus
gregtania.tagline.bumblebiscus=Bumble Hives from Silage
gregtania.page.bumblebiscus0=Can't find any bumblebee hives? No problem! The &1Bumblebiscus&0 will turn any nearby &4Dry Grass Bales&0 into random &4Bumble Hives&0, at a hefty mana cost.
gregtania.page.bumblebiscus1=&oMade by breeding HTNYCAEVIH with SUCSEEBIH&r.
gregtania.page.bumblebiscus1=&oMade by breeding HTNYCAEVIH with SUCSEEBIH&r.

item.lensIridiumBore.name=Iridium-Plated Bore Lens

gregtania.entry.lensIridiumBore=Iridium-Plated Bore Lens
gregtania.tagline.lensIridiumBore=Improved Bore Lens
gregtania.page.lensIridiumBore0=Some rare materials are simply too robust for an ordinary &1Bore Lens&0 to break. To that end, a more powerful Bore can be made by reinforcing it with Iridium. The &1Iridium-Plated Bore Lens&0 is mighty enough to break through almost any block, including Obsidian. However, it cannot be combined with any other lenses.
gregtania.page.lensIridiumBore1=Iridium-Plated Bore Lens
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 04bf3f4

Please sign in to comment.