Added Explosion Lens

This commit is contained in:
Ellpeck 2015-11-27 15:57:38 +01:00
parent 117fc49a15
commit 7cb73187c4
7 changed files with 117 additions and 68 deletions

View file

@ -56,12 +56,12 @@ public class InitBooklet{
//Getting Started
chapterIntro = new BookletChapter("intro", entryGettingStarted, new ItemStack(InitItems.itemLexicon), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3));
new BookletChapter("bookTutorial", entryGettingStarted, new ItemStack(InitItems.itemLexicon), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeBook));
new BookletChapterReconstructor("crystals", entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.RECONSTRUCTOR_BASE_ENERGY_USE.getValue()), new PageTextOnly(2), new PagePicture(3, "pageAtomicReconstructor", 0).setNoText(), new PageTextOnly(4), new PageCrafting(5, BlockCrafting.recipeAtomicReconstructor).setNoText(), new PageCrafting(6, ItemCrafting.recipeLens).setNoText(), new PageReconstructor(7, ReconstructorRecipeHandler.recipeColorLens).setNoText()).setSpecial();
new BookletChapterReconstructor("crystals", entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.RECONSTRUCTOR_BASE_ENERGY_USE.getValue()), new PageTextOnly(2), new PagePicture(3, "pageAtomicReconstructor", 0).setNoText(), new PageTextOnly(4), new PageCrafting(5, BlockCrafting.recipeAtomicReconstructor).setNoText(), new PageCrafting(6, ItemCrafting.recipeLens).setNoText()).setSpecial();
new BookletChapter("coalGen", entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageCrafting(1, BlockCrafting.recipeCoalGen).addTextReplacement("<rf>", ConfigIntValues.COAL_GEN_ENERGY_PRODUCED.getValue()));
new BookletChapter("craftingIngs", entryGettingStarted, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeCoil).setNoText(), new PageCrafting(3, ItemCrafting.recipeCoilAdvanced).setNoText(), new PageCrafting(4, BlockCrafting.recipeCase).setNoText(), new PageCrafting(5, BlockCrafting.recipeStoneCase).setNoText(), new PageCrafting(6, BlockCrafting.recipeEnderPearlBlock).setNoText(), new PageCrafting(7, BlockCrafting.recipeEnderCase).setNoText(), new PageCrafting(8, ItemCrafting.recipeRing).setNoText(), new PageCrafting(9, ItemCrafting.recipeKnifeHandle).setNoText(), new PageCrafting(10, ItemCrafting.recipeKnifeBlade).setNoText(), new PageCrafting(11, ItemCrafting.recipeKnife).setNoText(), new PageCrafting(12, ItemCrafting.recipeDough).setNoText(), new PageCrafting(13, ItemCrafting.recipeRiceDough).setNoText(), new PageCrafting(14, BlockCrafting.recipeIronCase).setNoText()).setImportant();
//Miscellaneous
new BookletChapter("miscReconstructor", entryMisc, new ItemStack(InitBlocks.blockTestifiBucksWhiteWall), new PageTextOnly(1), new PageReconstructor(2, ReconstructorRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(3, ReconstructorRecipeHandler.recipeWhiteWall), new PageReconstructor(4, ReconstructorRecipeHandler.recipeGreenWall).setNoText(), new PageReconstructor(5, ReconstructorRecipeHandler.colorConversionRecipes)).setImportant();
new BookletChapter("miscReconstructor", entryMisc, new ItemStack(InitBlocks.blockTestifiBucksWhiteWall), new PageTextOnly(1), new PageReconstructor(2, ReconstructorRecipeHandler.recipeExplosionLens), new PageReconstructor(3, ReconstructorRecipeHandler.recipeColorLens).setNoText(), new PageReconstructor(4, ReconstructorRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(5, ReconstructorRecipeHandler.recipeWhiteWall), new PageReconstructor(6, ReconstructorRecipeHandler.recipeGreenWall).setNoText(), new PageReconstructor(7, ReconstructorRecipeHandler.colorConversionRecipes)).setImportant();
new BookletChapter("bookStand", entryMisc, new ItemStack(InitBlocks.blockBookletStand), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBookStand));
new BookletChapter("quartz", entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), new PageTextOnly(1).setStack(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())).addTextReplacement("<lowest>", ConfigIntValues.BLACK_QUARTZ_MIN_HEIGHT.getValue()).addTextReplacement("<highest>", ConfigIntValues.BLACK_QUARTZ_MAX_HEIGHT.getValue()), new PageTextOnly(2).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())), new PageCrafting(3, BlockCrafting.recipeQuartzBlock).setNoText(), new PageCrafting(4, BlockCrafting.recipeQuartzPillar).setNoText(), new PageCrafting(5, BlockCrafting.recipeQuartzChiseled).setNoText());
new BookletChapter("cloud", entryMisc, new ItemStack(InitBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setNoText()).setSpecial();

View file

@ -111,8 +111,14 @@ public class InterModCommunications{
int lensType = compound.getInteger("lensType");
if(ReconstructorRecipeHandler.LensType.values().length > lensType && input != null && output != null){
ReconstructorRecipeHandler.addRecipe(input, output, energyUse, ReconstructorRecipeHandler.LensType.values()[lensType]);
ModUtil.LOGGER.info("Reconstructor Recipe that was sent from Mod "+message.getSender()+" has been registered successfully: "+input+" -> "+output+" @ "+energyUse+" with LensType "+lensType);
ReconstructorRecipeHandler.LensType type = ReconstructorRecipeHandler.LensType.values()[lensType];
if(type.canAddRecipesFor){
ReconstructorRecipeHandler.addRecipe(input, output, energyUse, type);
ModUtil.LOGGER.info("Reconstructor Recipe that was sent from Mod "+message.getSender()+" has been registered successfully: "+input+" -> "+output+" @ "+energyUse+" with LensType "+lensType);
}
else{
ModUtil.LOGGER.error("Reconstructor Recipe that was sent from Mod "+message.getSender()+" could not be registered: It's trying to register for a Lens Type ("+lensType+") that can't have recipes added!");
}
}
else{
ModUtil.LOGGER.error("Reconstructor Recipe that was sent from Mod "+message.getSender()+" could not be registered: It's missing an Output, an Input or a LensType!");

View file

@ -131,6 +131,7 @@ public class InitItems{
public static Item itemLaserWrench;
public static Item itemCrystal;
public static Item itemColorLens;
public static Item itemExplosionLens;
public static void init(){
ModUtil.LOGGER.info("Initializing Items...");
@ -138,6 +139,9 @@ public class InitItems{
itemColorLens = new ItemLens("itemColorLens", ReconstructorRecipeHandler.LensType.COLOR);
ItemUtil.register(itemColorLens);
itemExplosionLens = new ItemLens("itemExplosionLens", ReconstructorRecipeHandler.LensType.DETONATION);
ItemUtil.register(itemExplosionLens);
itemCrystal = new ItemCrystal();
ItemUtil.register(itemCrystal);

View file

@ -117,6 +117,7 @@ public class InitOreDict{
addOre(InitBlocks.blockTestifiBucksGreenWall, "blockGreenBrick");
addOre(InitItems.itemColorLens, "itemColorLens");
addOre(InitItems.itemExplosionLens, "itemExplosionLens");
addOre(InitItems.itemMisc, TheMiscItems.LENS.ordinal(), "itemLens");
}

View file

@ -12,6 +12,7 @@ package ellpeck.actuallyadditions.recipe;
import ellpeck.actuallyadditions.blocks.metalists.TheColoredLampColors;
import ellpeck.actuallyadditions.config.values.ConfigCrafting;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.util.AssetUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.item.Item;
@ -31,6 +32,7 @@ public class ReconstructorRecipeHandler{
public static Recipe recipeSoulSand;
public static Recipe recipeGreenWall;
public static Recipe recipeWhiteWall;
public static Recipe recipeExplosionLens;
public static ArrayList<Recipe> colorConversionRecipes = new ArrayList<Recipe>();
public static void init(){
@ -64,8 +66,10 @@ public class ReconstructorRecipeHandler{
//Lenses
addRecipe("itemLens", "itemColorLens", 5000);
addRecipe("itemColorLens", "itemLens", 5000);
recipeColorLens = Util.GetRecipes.lastReconstructorRecipe();
addRecipe("itemColorLens", "itemExplosionLens", 5000);
recipeExplosionLens = Util.GetRecipes.lastReconstructorRecipe();
addRecipe("itemExplosionLens", "itemLens", 5000);
//Misc
if(ConfigCrafting.RECONSTRUCTOR_MISC.isEnabled()){
@ -103,7 +107,9 @@ public class ReconstructorRecipeHandler{
}
public static void addRecipe(String input, String output, int energyUse, LensType type){
recipes.add(new Recipe(input, output, energyUse, type));
if(type.canAddRecipesFor){
recipes.add(new Recipe(input, output, energyUse, type));
}
}
public static ArrayList<Recipe> getRecipes(ItemStack input){
@ -146,22 +152,35 @@ public class ReconstructorRecipeHandler{
public enum LensType{
NONE,
COLOR;
NONE(true),
COLOR(true),
DETONATION(false);
public ItemStack lens;
public boolean canAddRecipesFor;
LensType(boolean canAddRecipesFor){
this.canAddRecipesFor = canAddRecipesFor;
}
public float[] getColor(){
if(this == COLOR){
float[] colors = AssetUtil.RGB_WOOL_COLORS[Util.RANDOM.nextInt(AssetUtil.RGB_WOOL_COLORS.length)];
return new float[]{colors[0]/255F, colors[1]/255F, colors[2]/255F};
}
return new float[]{27F/255F, 109F/255F, 1F};
else if(this == DETONATION){
return new float[]{158F/255F, 43F/255F, 39F/255F};
}
else return new float[]{27F/255F, 109F/255F, 1F};
}
public void setLens(Item lens){
this.lens = new ItemStack(lens);
}
public int getDistance(){
return ConfigIntValues.RECONSTRUCTOR_DISTANCE.getValue()*(this == DETONATION ? 3 : 1);
}
}
}

View file

@ -55,76 +55,89 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
ForgeDirection sideToManipulate = ForgeDirection.getOrientation(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
//Extract energy for shooting the laser itself too!
this.storage.extractEnergy(baseUse, false);
if(this.storage.getEnergyStored() >= baseUse){
//The Lens the Reconstructor currently has installed
ReconstructorRecipeHandler.LensType currentLens = this.getCurrentLens();
int distance = ConfigIntValues.RECONSTRUCTOR_DISTANCE.getValue();
for(int i = 0; i < distance; i++){
WorldPos coordsBlock = WorldUtil.getCoordsFromSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, i);
this.damagePlayer(coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ());
//The Lens the Reconstructor currently has installed
ReconstructorRecipeHandler.LensType currentLens = this.getCurrentLens();
int distance = currentLens.getDistance();
for(int i = 0; i < distance; i++){
WorldPos hitBlock = WorldUtil.getCoordsFromSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, i);
this.damagePlayer(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ());
if(coordsBlock != null){
if(!coordsBlock.getBlock().isAir(coordsBlock.getWorld(), coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ())){
PacketHandler.theNetwork.sendToAllAround(new PacketAtomicReconstructor(xCoord, yCoord, zCoord, coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ(), currentLens), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64));
if(hitBlock != null){
if(!hitBlock.getBlock().isAir(hitBlock.getWorld(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ())){
this.shootLaser(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), currentLens);
int range = ConfigIntValues.RECONSTRCUTOR_RANGE.getValue();
//Detonation
if(currentLens == ReconstructorRecipeHandler.LensType.DETONATION){
int use = baseUse+800000;
if(this.storage.getEnergyStored() >= use){
this.worldObj.newExplosion(null, hitBlock.getX()+0.5, hitBlock.getY()+0.5, hitBlock.getZ()+0.5, 8F, true, true);
this.storage.extractEnergy(use, false);
}
}
//Conversion Recipes
else{
int range = ConfigIntValues.RECONSTRCUTOR_RANGE.getValue();
//Converting the Blocks
for(int reachX = -range; reachX < range+1; reachX++){
for(int reachZ = -range; reachZ < range+1; reachZ++){
for(int reachY = -range; reachY < range+1; reachY++){
//Converting the Blocks
for(int reachX = -range; reachX < range+1; reachX++){
for(int reachZ = -range; reachZ < range+1; reachZ++){
for(int reachY = -range; reachY < range+1; reachY++){
if(this.storage.getEnergyStored() >= baseUse){
WorldPos pos = new WorldPos(worldObj, hitBlock.getX()+reachX, hitBlock.getY()+reachY, hitBlock.getZ()+reachZ);
ArrayList<ReconstructorRecipeHandler.Recipe> recipes = ReconstructorRecipeHandler.getRecipes(new ItemStack(pos.getBlock(), 1, pos.getMetadata()));
for(ReconstructorRecipeHandler.Recipe recipe : recipes){
if(recipe != null && this.storage.getEnergyStored() >= baseUse+recipe.energyUse && recipe.type == currentLens){
ItemStack output = recipe.getFirstOutput();
if(output != null){
if(output.getItem() instanceof ItemBlock){
this.worldObj.playAuxSFX(2001, pos.getX(), pos.getY(), pos.getZ(), Block.getIdFromBlock(pos.getBlock())+(pos.getMetadata() << 12));
pos.setBlock(Block.getBlockFromItem(output.getItem()), output.getItemDamage(), 2);
}
else{
EntityItem item = new EntityItem(worldObj, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, output.copy());
worldObj.spawnEntityInWorld(item);
}
this.storage.extractEnergy(baseUse+recipe.energyUse, false);
break;
}
}
}
}
}
}
}
//Converting the Items
ArrayList<EntityItem> items = (ArrayList<EntityItem>)worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(hitBlock.getX()-range, hitBlock.getY()-range, hitBlock.getZ()-range, hitBlock.getX()+range, hitBlock.getY()+range, hitBlock.getZ()+range));
for(EntityItem item : items){
if(this.storage.getEnergyStored() >= baseUse){
WorldPos pos = new WorldPos(worldObj, coordsBlock.getX()+reachX, coordsBlock.getY()+reachY, coordsBlock.getZ()+reachZ);
ArrayList<ReconstructorRecipeHandler.Recipe> recipes = ReconstructorRecipeHandler.getRecipes(new ItemStack(pos.getBlock(), 1, pos.getMetadata()));
for(ReconstructorRecipeHandler.Recipe recipe : recipes){
if(recipe != null && this.storage.getEnergyStored() >= baseUse+recipe.energyUse && recipe.type == currentLens){
ItemStack output = recipe.getFirstOutput();
if(output != null){
if(output.getItem() instanceof ItemBlock){
this.worldObj.playAuxSFX(2001, pos.getX(), pos.getY(), pos.getZ(), Block.getIdFromBlock(pos.getBlock())+(pos.getMetadata() << 12));
pos.setBlock(Block.getBlockFromItem(output.getItem()), output.getItemDamage(), 2);
ItemStack stack = item.getEntityItem();
if(stack != null){
ArrayList<ReconstructorRecipeHandler.Recipe> recipes = ReconstructorRecipeHandler.getRecipes(stack);
for(ReconstructorRecipeHandler.Recipe recipe : recipes){
if(recipe != null && this.storage.getEnergyStored() >= baseUse+recipe.energyUse && recipe.type == currentLens){
ItemStack output = recipe.getFirstOutput();
if(output != null){
ItemStack outputCopy = output.copy();
outputCopy.stackSize = stack.stackSize;
item.setEntityItemStack(outputCopy);
this.storage.extractEnergy(baseUse+recipe.energyUse, false);
break;
}
else{
EntityItem item = new EntityItem(worldObj, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, output.copy());
worldObj.spawnEntityInWorld(item);
}
this.storage.extractEnergy(baseUse+recipe.energyUse, false);
break;
}
}
}
}
}
}
break;
}
//Converting the Items
ArrayList<EntityItem> items = (ArrayList<EntityItem>)worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(coordsBlock.getX()-range, coordsBlock.getY()-range, coordsBlock.getZ()-range, coordsBlock.getX()+range, coordsBlock.getY()+range, coordsBlock.getZ()+range));
for(EntityItem item : items){
if(this.storage.getEnergyStored() >= baseUse){
ItemStack stack = item.getEntityItem();
if(stack != null){
ArrayList<ReconstructorRecipeHandler.Recipe> recipes = ReconstructorRecipeHandler.getRecipes(stack);
for(ReconstructorRecipeHandler.Recipe recipe : recipes){
if(recipe != null && this.storage.getEnergyStored() >= baseUse+recipe.energyUse && recipe.type == currentLens){
ItemStack output = recipe.getFirstOutput();
if(output != null){
ItemStack outputCopy = output.copy();
outputCopy.stackSize = stack.stackSize;
item.setEntityItemStack(outputCopy);
this.storage.extractEnergy(baseUse+recipe.energyUse, false);
break;
}
}
}
}
}
else if(i >= distance-1){
this.shootLaser(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), currentLens);
}
break;
}
if(i >= distance-1){
PacketHandler.theNetwork.sendToAllAround(new PacketAtomicReconstructor(xCoord, yCoord, zCoord, coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ(), currentLens), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64));
}
}
}
@ -137,6 +150,10 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
}
}
private void shootLaser(int endX, int endY, int endZ, ReconstructorRecipeHandler.LensType currentLens){
PacketHandler.theNetwork.sendToAllAround(new PacketAtomicReconstructor(xCoord, yCoord, zCoord, endX, endY, endZ, currentLens), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64));
}
public ReconstructorRecipeHandler.LensType getCurrentLens(){
if(this.slots[0] != null){
if(this.slots[0].getItem() instanceof IReconstructorLens){

View file

@ -308,7 +308,8 @@ item.actuallyadditions.itemCrystalGreen.name=Emeradic Crystal
item.actuallyadditions.itemCrystalBlack.name=Void Crystal
item.actuallyadditions.itemCrystalWhite.name=Enori Crystal
item.actuallyadditions.itemMiscLens.name=Lens
item.actuallyadditions.itemColorLens.name=Lens: Color
item.actuallyadditions.itemColorLens.name=Lens of Color
item.actuallyadditions.itemExplosionLens.name=Lens of Detonation
#Tooltips
tooltip.actuallyadditions.onSuffix.desc=On
@ -612,8 +613,9 @@ booklet.actuallyadditions.chapter.bookTutorial.text.3=If you, for some reason, w
booklet.actuallyadditions.chapter.miscReconstructor.name=Useful Reconstructor Recipes
booklet.actuallyadditions.chapter.miscReconstructor.text.1=There are some additional recipes for the <item>Atomic Reconstructor<r> that could be very useful to you. <n>These include <imp>decor blocks and items<r> as well as some <imp>useful conversions<r>. Flip through the following pages to see them all.
booklet.actuallyadditions.chapter.miscReconstructor.text.3=The <item>Ethetic Quartz Blocks<r> are Quartz Blocks spruced up. <n>They can be crafted into <imp>stairs<r>, <imp>slabs<r> and <imp>walls<r> with the same recipes as cobblestone has. <n><n><i>No, not misspelled
booklet.actuallyadditions.chapter.miscReconstructor.text.5=By firing at <imp>Wool, Stained Clay, Stained Glass and Dye<r> with a <item>Lens: Color<r> multiple times, you can <imp>cycle through<r> all of their colors.
booklet.actuallyadditions.chapter.miscReconstructor.text.2=The <item>Lens of Detonation<r>, when put into the Reconstructor, will fire out a red laser that will <imp>cause a firey explosion<r> around the block it hits, using a lot of power in the process. <n><i>Be careful. <imp>Seriously.
booklet.actuallyadditions.chapter.miscReconstructor.text.5=The <item>Ethetic Quartz Blocks<r> are Quartz Blocks spruced up. <n>They can be crafted into <imp>stairs<r>, <imp>slabs<r> and <imp>walls<r> with the same recipes as cobblestone has. <n><n><i>No, not misspelled
booklet.actuallyadditions.chapter.miscReconstructor.text.7=By firing at <imp>Wool, Stained Clay, Stained Glass and Dye<r> with a <item>Lens of Color<r> multiple times, you can <imp>cycle through<r> all of their colors.
booklet.actuallyadditions.chapter.bookStand.name=Manual Stand
booklet.actuallyadditions.chapter.bookStand.text.1=The <item>Manual Stand<r> is a block that is supposed to mainly be used on <imp>Servers<r>. <n>You can, provided you are the person who <imp>placed it down<r>, set a page in the GUI that will <imp>open when someone else accesses it<r> by pressing the "Set Page"-button while being on the desired page. <n>The Manual Stand <imp>does not save<r> pages another player navigated to, meaing re-accessing the Stand will cause it to always <imp>end up on the page speficied<r> by the placer.