mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 16:58:34 +01:00
Changed how lenses work.
Better to see now. Still needs documentation however.
This commit is contained in:
parent
d5462f693f
commit
2a4b3a8a4f
22 changed files with 414 additions and 285 deletions
|
@ -41,10 +41,9 @@ The two Brackets will have to get replaced with one of the parts of Information
|
||||||
- To the Compound, add an int with the name "maxAmount" that contains the maximum size of the ItemStack
|
- To the Compound, add an int with the name "maxAmount" that contains the maximum size of the ItemStack
|
||||||
- Send the Message with "registerTreasureChestRecipe" as the [X] Argument, the Compound as the [Y] Argument.
|
- Send the Message with "registerTreasureChestRecipe" as the [X] Argument, the Compound as the [Y] Argument.
|
||||||
|
|
||||||
##### Reconstructor Recipes
|
##### Reconstructor Recipes (For Recipes without a Lens)
|
||||||
- Create an NBTTagCompound
|
- Create an NBTTagCompound
|
||||||
- To the Compound, add a String with the name "input" that is the Input's OreDictionary Name
|
- To the Compound, add a String with the name "input" that is the Input's OreDictionary Name
|
||||||
- To the Compound, add a String with the name "output" that is the Output's OreDictionary Name
|
- To the Compound, add a String with the name "output" that is the Output's OreDictionary Name
|
||||||
- To the Compound, add an int with the name "energyUse" that is the amount of RF used
|
- To the Compound, add an int with the name "energyUse" that is the amount of RF used
|
||||||
- To the Compound, add an int with the name "lensType" that contains the LensType's ID (found in LensType in ReconstructorRecipeHandler, the ID is the ordinal)
|
|
||||||
- Send the Message with "registerReconstructorRecipe" as the [X] Argument, the Compound as the [Y] Argument.
|
- Send the Message with "registerReconstructorRecipe" as the [X] Argument, the Compound as the [Y] Argument.
|
||||||
|
|
|
@ -30,6 +30,7 @@ import ellpeck.actuallyadditions.inventory.GuiHandler;
|
||||||
import ellpeck.actuallyadditions.items.InitForeignPaxels;
|
import ellpeck.actuallyadditions.items.InitForeignPaxels;
|
||||||
import ellpeck.actuallyadditions.items.InitItems;
|
import ellpeck.actuallyadditions.items.InitItems;
|
||||||
import ellpeck.actuallyadditions.items.ItemCoffee;
|
import ellpeck.actuallyadditions.items.ItemCoffee;
|
||||||
|
import ellpeck.actuallyadditions.items.lens.LensNoneRecipeHandler;
|
||||||
import ellpeck.actuallyadditions.material.InitArmorMaterials;
|
import ellpeck.actuallyadditions.material.InitArmorMaterials;
|
||||||
import ellpeck.actuallyadditions.material.InitToolMaterials;
|
import ellpeck.actuallyadditions.material.InitToolMaterials;
|
||||||
import ellpeck.actuallyadditions.misc.*;
|
import ellpeck.actuallyadditions.misc.*;
|
||||||
|
@ -38,7 +39,6 @@ import ellpeck.actuallyadditions.ore.InitOreDict;
|
||||||
import ellpeck.actuallyadditions.proxy.IProxy;
|
import ellpeck.actuallyadditions.proxy.IProxy;
|
||||||
import ellpeck.actuallyadditions.recipe.FuelHandler;
|
import ellpeck.actuallyadditions.recipe.FuelHandler;
|
||||||
import ellpeck.actuallyadditions.recipe.HairyBallHandler;
|
import ellpeck.actuallyadditions.recipe.HairyBallHandler;
|
||||||
import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler;
|
|
||||||
import ellpeck.actuallyadditions.recipe.TreasureChestHandler;
|
import ellpeck.actuallyadditions.recipe.TreasureChestHandler;
|
||||||
import ellpeck.actuallyadditions.tile.TileEntityBase;
|
import ellpeck.actuallyadditions.tile.TileEntityBase;
|
||||||
import ellpeck.actuallyadditions.update.UpdateChecker;
|
import ellpeck.actuallyadditions.update.UpdateChecker;
|
||||||
|
@ -102,7 +102,7 @@ public class ActuallyAdditions{
|
||||||
ItemCrafting.initMashedFoodRecipes();
|
ItemCrafting.initMashedFoodRecipes();
|
||||||
HairyBallHandler.init();
|
HairyBallHandler.init();
|
||||||
TreasureChestHandler.init();
|
TreasureChestHandler.init();
|
||||||
ReconstructorRecipeHandler.init();
|
LensNoneRecipeHandler.init();
|
||||||
InitForeignPaxels.init();
|
InitForeignPaxels.init();
|
||||||
|
|
||||||
InitBooklet.init();
|
InitBooklet.init();
|
||||||
|
|
|
@ -13,7 +13,7 @@ package ellpeck.actuallyadditions.blocks;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import ellpeck.actuallyadditions.blocks.base.BlockContainerBase;
|
import ellpeck.actuallyadditions.blocks.base.BlockContainerBase;
|
||||||
import ellpeck.actuallyadditions.items.IReconstructorLens;
|
import ellpeck.actuallyadditions.items.lens.ItemLens;
|
||||||
import ellpeck.actuallyadditions.tile.TileEntityAtomicReconstructor;
|
import ellpeck.actuallyadditions.tile.TileEntityAtomicReconstructor;
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -82,7 +82,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase{
|
||||||
if(!player.isSneaking()){
|
if(!player.isSneaking()){
|
||||||
ItemStack heldItem = player.getCurrentEquippedItem();
|
ItemStack heldItem = player.getCurrentEquippedItem();
|
||||||
if(heldItem != null){
|
if(heldItem != null){
|
||||||
if(heldItem.getItem() instanceof IReconstructorLens && reconstructor.getStackInSlot(0) == null){
|
if(heldItem.getItem() instanceof ItemLens && reconstructor.getStackInSlot(0) == null){
|
||||||
ItemStack toPut = heldItem.copy();
|
ItemStack toPut = heldItem.copy();
|
||||||
toPut.stackSize = 1;
|
toPut.stackSize = 1;
|
||||||
reconstructor.setInventorySlotContents(0, toPut);
|
reconstructor.setInventorySlotContents(0, toPut);
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.blocks.render;
|
package ellpeck.actuallyadditions.blocks.render;
|
||||||
|
|
||||||
import ellpeck.actuallyadditions.items.IReconstructorLens;
|
import ellpeck.actuallyadditions.items.lens.ItemLens;
|
||||||
import ellpeck.actuallyadditions.tile.TileEntityAtomicReconstructor;
|
import ellpeck.actuallyadditions.tile.TileEntityAtomicReconstructor;
|
||||||
import ellpeck.actuallyadditions.util.AssetUtil;
|
import ellpeck.actuallyadditions.util.AssetUtil;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
|
@ -27,7 +27,7 @@ public class RenderReconstructorLens extends TileEntitySpecialRenderer{
|
||||||
}
|
}
|
||||||
ItemStack stack = ((TileEntityAtomicReconstructor)tile).getStackInSlot(0);
|
ItemStack stack = ((TileEntityAtomicReconstructor)tile).getStackInSlot(0);
|
||||||
|
|
||||||
if(stack != null && stack.getItem() instanceof IReconstructorLens){
|
if(stack != null && stack.getItem() instanceof ItemLens){
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glTranslatef((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
GL11.glTranslatef((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
||||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||||
|
|
|
@ -23,10 +23,10 @@ import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||||
import ellpeck.actuallyadditions.crafting.*;
|
import ellpeck.actuallyadditions.crafting.*;
|
||||||
import ellpeck.actuallyadditions.gen.OreGen;
|
import ellpeck.actuallyadditions.gen.OreGen;
|
||||||
import ellpeck.actuallyadditions.items.InitItems;
|
import ellpeck.actuallyadditions.items.InitItems;
|
||||||
|
import ellpeck.actuallyadditions.items.lens.LensNoneRecipeHandler;
|
||||||
import ellpeck.actuallyadditions.items.metalists.TheFoods;
|
import ellpeck.actuallyadditions.items.metalists.TheFoods;
|
||||||
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
||||||
import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops;
|
import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops;
|
||||||
import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler;
|
|
||||||
import ellpeck.actuallyadditions.tile.*;
|
import ellpeck.actuallyadditions.tile.*;
|
||||||
import ellpeck.actuallyadditions.util.Util;
|
import ellpeck.actuallyadditions.util.Util;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -62,13 +62,13 @@ public class InitBooklet{
|
||||||
//Getting Started
|
//Getting Started
|
||||||
chapterIntro = new BookletChapter("intro", entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3));
|
chapterIntro = new BookletChapter("intro", entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3));
|
||||||
new BookletChapter("bookTutorial", entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeBook));
|
new BookletChapter("bookTutorial", entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeBook));
|
||||||
new BookletChapter("crystals", entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityAtomicReconstructor.ENERGY_USE), new PageTextOnly(2), new PagePicture(3, "pageAtomicReconstructor", 0).setNoText(), new PageTextOnly(4), new PageCrafting(5, BlockCrafting.recipeAtomicReconstructor).setNoText(), new PageCrafting(6, MiscCrafting.recipesCrystals).setNoText(), new PageCrafting(7, MiscCrafting.recipesCrystalBlocks).setNoText(), new PageReconstructor(8, ReconstructorRecipeHandler.mainPageRecipes).setNoText()).setSpecial();
|
new BookletChapter("crystals", entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityAtomicReconstructor.ENERGY_USE), new PageTextOnly(2), new PagePicture(3, "pageAtomicReconstructor", 0).setNoText(), new PageTextOnly(4), new PageCrafting(5, BlockCrafting.recipeAtomicReconstructor).setNoText(), new PageCrafting(6, MiscCrafting.recipesCrystals).setNoText(), new PageCrafting(7, MiscCrafting.recipesCrystalBlocks).setNoText(), new PageReconstructor(8, LensNoneRecipeHandler.mainPageRecipes).setNoText()).setSpecial();
|
||||||
new BookletChapter("coalGen", entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageCrafting(1, BlockCrafting.recipeCoalGen).addTextReplacement("<rf>", TileEntityCoalGenerator.PRODUCE));
|
new BookletChapter("coalGen", entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageCrafting(1, BlockCrafting.recipeCoalGen).addTextReplacement("<rf>", TileEntityCoalGenerator.PRODUCE));
|
||||||
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();
|
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
|
//Miscellaneous
|
||||||
new BookletChapter("reconstructorLenses", entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLens).setNoText(), new PageReconstructor(3, ReconstructorRecipeHandler.recipeColorLens), new PageReconstructor(4, ReconstructorRecipeHandler.colorConversionRecipes).setNoText(), new PageReconstructor(5, ReconstructorRecipeHandler.recipeExplosionLens), new PageReconstructor(6, ReconstructorRecipeHandler.recipeDamageLens), new PageReconstructor(7, ReconstructorRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(8, ReconstructorRecipeHandler.recipeLeather).setNoText()).setImportant();
|
new BookletChapter("reconstructorLenses", entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLens).setNoText(), new PageReconstructor(3, LensNoneRecipeHandler.recipeColorLens), new PageReconstructor(4, LensNoneRecipeHandler.recipeExplosionLens), new PageReconstructor(5, LensNoneRecipeHandler.recipeDamageLens), new PageReconstructor(6, LensNoneRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(7, LensNoneRecipeHandler.recipeLeather).setNoText()).setImportant();
|
||||||
new BookletChapter("miscDecorStuffsAndThings", entryMisc, new ItemStack(InitBlocks.blockTestifiBucksGreenWall), new PageTextOnly(1), new PageReconstructor(2, ReconstructorRecipeHandler.recipeWhiteWall).setNoText(), new PageReconstructor(3, ReconstructorRecipeHandler.recipeGreenWall).setNoText());
|
new BookletChapter("miscDecorStuffsAndThings", entryMisc, new ItemStack(InitBlocks.blockTestifiBucksGreenWall), new PageTextOnly(1), new PageReconstructor(2, LensNoneRecipeHandler.recipeWhiteWall).setNoText(), new PageReconstructor(3, LensNoneRecipeHandler.recipeGreenWall).setNoText());
|
||||||
new BookletChapter("bookStand", entryMisc, new ItemStack(InitBlocks.blockBookletStand), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBookStand));
|
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>", OreGen.QUARTZ_MIN).addTextReplacement("<highest>", OreGen.QUARTZ_MAX), 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("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>", OreGen.QUARTZ_MIN).addTextReplacement("<highest>", OreGen.QUARTZ_MAX), 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();
|
new BookletChapter("cloud", entryMisc, new ItemStack(InitBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setNoText()).setSpecial();
|
||||||
|
|
|
@ -14,8 +14,8 @@ import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||||
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
||||||
|
import ellpeck.actuallyadditions.items.lens.LensNoneRecipeHandler;
|
||||||
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
||||||
import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler;
|
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
import ellpeck.actuallyadditions.util.StringUtil;
|
import ellpeck.actuallyadditions.util.StringUtil;
|
||||||
import ellpeck.actuallyadditions.util.Util;
|
import ellpeck.actuallyadditions.util.Util;
|
||||||
|
@ -27,14 +27,14 @@ import java.util.List;
|
||||||
|
|
||||||
public class PageReconstructor extends BookletPage{
|
public class PageReconstructor extends BookletPage{
|
||||||
|
|
||||||
private ReconstructorRecipeHandler.Recipe[] recipes;
|
private LensNoneRecipeHandler.Recipe[] recipes;
|
||||||
private int recipePos;
|
private int recipePos;
|
||||||
|
|
||||||
public PageReconstructor(int id, ArrayList<ReconstructorRecipeHandler.Recipe> recipes){
|
public PageReconstructor(int id, ArrayList<LensNoneRecipeHandler.Recipe> recipes){
|
||||||
this(id, recipes.toArray(new ReconstructorRecipeHandler.Recipe[recipes.size()]));
|
this(id, recipes.toArray(new LensNoneRecipeHandler.Recipe[recipes.size()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public PageReconstructor(int id, ReconstructorRecipeHandler.Recipe... recipes){
|
public PageReconstructor(int id, LensNoneRecipeHandler.Recipe... recipes){
|
||||||
super(id);
|
super(id);
|
||||||
this.recipes = recipes;
|
this.recipes = recipes;
|
||||||
this.addToPagesWithItemStackData();
|
this.addToPagesWithItemStackData();
|
||||||
|
@ -44,7 +44,7 @@ public class PageReconstructor extends BookletPage{
|
||||||
public ItemStack[] getItemStacksForPage(){
|
public ItemStack[] getItemStacksForPage(){
|
||||||
if(this.recipes != null){
|
if(this.recipes != null){
|
||||||
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
|
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||||
for(ReconstructorRecipeHandler.Recipe recipe : this.recipes){
|
for(LensNoneRecipeHandler.Recipe recipe : this.recipes){
|
||||||
if(recipe != null){
|
if(recipe != null){
|
||||||
stacks.addAll(recipe.getOutputs());
|
stacks.addAll(recipe.getOutputs());
|
||||||
}
|
}
|
||||||
|
@ -67,18 +67,13 @@ public class PageReconstructor extends BookletPage{
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
ReconstructorRecipeHandler.Recipe recipe = this.recipes[this.recipePos];
|
LensNoneRecipeHandler.Recipe recipe = this.recipes[this.recipePos];
|
||||||
if(recipe == null){
|
if(recipe == null){
|
||||||
gui.mc.fontRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
|
gui.mc.fontRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
String strg = "Atomic Reconstructor";
|
String strg = "Atomic Reconstructor";
|
||||||
gui.mc.fontRenderer.drawString(strg, gui.guiLeft+gui.xSize/2-gui.mc.fontRenderer.getStringWidth(strg)/2, gui.guiTop+10, 0);
|
gui.mc.fontRenderer.drawString(strg, gui.guiLeft+gui.xSize/2-gui.mc.fontRenderer.getStringWidth(strg)/2, gui.guiTop+10, 0);
|
||||||
|
|
||||||
//Lens
|
|
||||||
ItemStack lens = recipe.type.lens;
|
|
||||||
strg = lens == null ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".noLens") : lens.getItem().getItemStackDisplayName(lens);
|
|
||||||
gui.mc.fontRenderer.drawString(strg, gui.guiLeft+gui.xSize/2-gui.mc.fontRenderer.getStringWidth(strg)/2, gui.guiTop+75, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String text = gui.currentPage.getText();
|
String text = gui.currentPage.getText();
|
||||||
|
|
|
@ -12,9 +12,9 @@ package ellpeck.actuallyadditions.communication;
|
||||||
|
|
||||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||||
import ellpeck.actuallyadditions.items.ItemCoffee;
|
import ellpeck.actuallyadditions.items.ItemCoffee;
|
||||||
|
import ellpeck.actuallyadditions.items.lens.LensNoneRecipeHandler;
|
||||||
import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry;
|
import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry;
|
||||||
import ellpeck.actuallyadditions.recipe.HairyBallHandler;
|
import ellpeck.actuallyadditions.recipe.HairyBallHandler;
|
||||||
import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler;
|
|
||||||
import ellpeck.actuallyadditions.recipe.TreasureChestHandler;
|
import ellpeck.actuallyadditions.recipe.TreasureChestHandler;
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -108,20 +108,13 @@ public class InterModCommunications{
|
||||||
String input = compound.getString("input");
|
String input = compound.getString("input");
|
||||||
String output = compound.getString("output");
|
String output = compound.getString("output");
|
||||||
int energyUse = compound.getInteger("energyUse");
|
int energyUse = compound.getInteger("energyUse");
|
||||||
int lensType = compound.getInteger("lensType");
|
|
||||||
|
|
||||||
if(ReconstructorRecipeHandler.LensType.values().length > lensType && input != null && output != null){
|
if(input != null && output != null){
|
||||||
ReconstructorRecipeHandler.LensType type = ReconstructorRecipeHandler.LensType.values()[lensType];
|
LensNoneRecipeHandler.addRecipe(input, output, energyUse);
|
||||||
if(type.hasRecipes){
|
ModUtil.LOGGER.info("Reconstructor Recipe that was sent from Mod "+message.getSender()+" has been registered successfully: "+input+" -> "+output+" @ "+energyUse+".");
|
||||||
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{
|
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!");
|
ModUtil.LOGGER.error("Reconstructor Recipe that was sent from Mod "+message.getSender()+" could not be registered: It's missing an Input or an Output!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("ILens.java") is part of the Actually Additions Mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.items;
|
|
||||||
|
|
||||||
import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler;
|
|
||||||
|
|
||||||
public interface IReconstructorLens{
|
|
||||||
|
|
||||||
ReconstructorRecipeHandler.LensType getLensType();
|
|
||||||
}
|
|
|
@ -12,11 +12,12 @@ package ellpeck.actuallyadditions.items;
|
||||||
|
|
||||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||||
import ellpeck.actuallyadditions.items.base.*;
|
import ellpeck.actuallyadditions.items.base.*;
|
||||||
|
import ellpeck.actuallyadditions.items.lens.ItemLens;
|
||||||
|
import ellpeck.actuallyadditions.items.lens.Lenses;
|
||||||
import ellpeck.actuallyadditions.items.metalists.TheFoods;
|
import ellpeck.actuallyadditions.items.metalists.TheFoods;
|
||||||
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
||||||
import ellpeck.actuallyadditions.material.InitArmorMaterials;
|
import ellpeck.actuallyadditions.material.InitArmorMaterials;
|
||||||
import ellpeck.actuallyadditions.material.InitToolMaterials;
|
import ellpeck.actuallyadditions.material.InitToolMaterials;
|
||||||
import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler;
|
|
||||||
import ellpeck.actuallyadditions.util.CompatUtil;
|
import ellpeck.actuallyadditions.util.CompatUtil;
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
|
@ -136,9 +137,9 @@ public class InitItems{
|
||||||
public static void init(){
|
public static void init(){
|
||||||
ModUtil.LOGGER.info("Initializing Items...");
|
ModUtil.LOGGER.info("Initializing Items...");
|
||||||
|
|
||||||
itemColorLens = new ItemLens("itemColorLens", ReconstructorRecipeHandler.LensType.COLOR);
|
itemColorLens = new ItemLens("itemColorLens", Lenses.LENS_COLOR);
|
||||||
itemExplosionLens = new ItemLens("itemExplosionLens", ReconstructorRecipeHandler.LensType.DETONATION);
|
itemExplosionLens = new ItemLens("itemExplosionLens", Lenses.LENS_DETONATION);
|
||||||
itemDamageLens = new ItemLens("itemDamageLens", ReconstructorRecipeHandler.LensType.JUST_DAMAGE);
|
itemDamageLens = new ItemLens("itemDamageLens", Lenses.LENS_DEATH);
|
||||||
itemCrystal = new ItemCrystal("itemCrystal");
|
itemCrystal = new ItemCrystal("itemCrystal");
|
||||||
itemLaserWrench = new ItemLaserWrench("itemLaserWrench");
|
itemLaserWrench = new ItemLaserWrench("itemLaserWrench");
|
||||||
itemChestToCrateUpgrade = new ItemChestToCrateUpgrade("itemChestToCrateUpgrade");
|
itemChestToCrateUpgrade = new ItemChestToCrateUpgrade("itemChestToCrateUpgrade");
|
||||||
|
|
|
@ -8,26 +8,25 @@
|
||||||
* © 2015 Ellpeck
|
* © 2015 Ellpeck
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.items;
|
package ellpeck.actuallyadditions.items.lens;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import ellpeck.actuallyadditions.items.base.ItemBase;
|
import ellpeck.actuallyadditions.items.base.ItemBase;
|
||||||
import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler;
|
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
public class ItemLens extends ItemBase implements IReconstructorLens{
|
public class ItemLens extends ItemBase{
|
||||||
|
|
||||||
private ReconstructorRecipeHandler.LensType type;
|
private Lens type;
|
||||||
|
|
||||||
public ItemLens(String name, ReconstructorRecipeHandler.LensType type){
|
public ItemLens(String name, Lens type){
|
||||||
super(name);
|
super(name);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.type.setLens(this);
|
this.type.setLensItem(this);
|
||||||
this.setMaxStackSize(1);
|
this.setMaxStackSize(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,8 +47,7 @@ public class ItemLens extends ItemBase implements IReconstructorLens{
|
||||||
return this.itemIcon;
|
return this.itemIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public Lens getLensType(){
|
||||||
public ReconstructorRecipeHandler.LensType getLensType(){
|
|
||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
}
|
}
|
35
src/main/java/ellpeck/actuallyadditions/items/lens/Lens.java
Normal file
35
src/main/java/ellpeck/actuallyadditions/items/lens/Lens.java
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* This file ("Lens.java") is part of the Actually Additions Mod for Minecraft.
|
||||||
|
* It is created and owned by Ellpeck and distributed
|
||||||
|
* under the Actually Additions License to be found at
|
||||||
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
||||||
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
|
*
|
||||||
|
* © 2015 Ellpeck
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ellpeck.actuallyadditions.items.lens;
|
||||||
|
|
||||||
|
import ellpeck.actuallyadditions.tile.TileEntityAtomicReconstructor;
|
||||||
|
import ellpeck.actuallyadditions.util.WorldPos;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
|
||||||
|
public abstract class Lens{
|
||||||
|
|
||||||
|
protected Item lensItem;
|
||||||
|
|
||||||
|
public abstract boolean invoke(WorldPos hitBlock, TileEntityAtomicReconstructor tile);
|
||||||
|
|
||||||
|
public abstract float[] getColor();
|
||||||
|
|
||||||
|
public abstract int getDistance();
|
||||||
|
|
||||||
|
public Lens register(){
|
||||||
|
Lenses.allLenses.add(this);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLensItem(Item item){
|
||||||
|
this.lensItem = item;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
/*
|
||||||
|
* This file ("LensColor.java") is part of the Actually Additions Mod for Minecraft.
|
||||||
|
* It is created and owned by Ellpeck and distributed
|
||||||
|
* under the Actually Additions License to be found at
|
||||||
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
||||||
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
|
*
|
||||||
|
* © 2015 Ellpeck
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ellpeck.actuallyadditions.items.lens;
|
||||||
|
|
||||||
|
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||||
|
import ellpeck.actuallyadditions.tile.TileEntityAtomicReconstructor;
|
||||||
|
import ellpeck.actuallyadditions.util.Util;
|
||||||
|
import ellpeck.actuallyadditions.util.WorldPos;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class LensColor extends Lens{
|
||||||
|
|
||||||
|
//Thanks to xdjackiexd for this, as I couldn't be bothered
|
||||||
|
private static final float[][] possibleColorLensColors = {
|
||||||
|
{158F, 43F, 39F}, //Red
|
||||||
|
{234F, 126F, 53F}, //Orange
|
||||||
|
{194F, 181F, 28F}, //Yellow
|
||||||
|
{57F, 186F, 46F}, //Lime Green
|
||||||
|
{54F, 75F, 24F}, //Green
|
||||||
|
{99F, 135F, 210F}, //Light Blue
|
||||||
|
{38F, 113F, 145F}, //Cyan
|
||||||
|
{37F, 49F, 147F}, //Blue
|
||||||
|
{126F, 52F, 191F}, //Purple
|
||||||
|
{190F, 73F, 201F}, //Magenta
|
||||||
|
{217F, 129F, 153F}, //Pink
|
||||||
|
{86F, 51F, 28F}, //Brown
|
||||||
|
};
|
||||||
|
|
||||||
|
private static final Object[] CONVERTABLE_BLOCKS = new Object[]{
|
||||||
|
Items.dye,
|
||||||
|
Blocks.wool,
|
||||||
|
Blocks.stained_glass,
|
||||||
|
Blocks.stained_glass_pane,
|
||||||
|
Blocks.stained_hardened_clay,
|
||||||
|
InitBlocks.blockColoredLamp,
|
||||||
|
InitBlocks.blockColoredLampOn
|
||||||
|
};
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public boolean invoke(WorldPos hitBlock, TileEntityAtomicReconstructor tile){
|
||||||
|
if(hitBlock != null){
|
||||||
|
if(Util.arrayContains(CONVERTABLE_BLOCKS, hitBlock.getBlock()) >= 0){
|
||||||
|
int meta = hitBlock.getMetadata();
|
||||||
|
if(meta >= 15){
|
||||||
|
hitBlock.setMetadata(0, 2);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
hitBlock.setMetadata(meta+1, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<EntityItem> items = (ArrayList<EntityItem>)tile.getWorldObj().getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX()+1, hitBlock.getY()+1, hitBlock.getZ()+1));
|
||||||
|
for(EntityItem item : items){
|
||||||
|
if(item.getEntityItem() != null){
|
||||||
|
if(Util.arrayContains(CONVERTABLE_BLOCKS, item.getEntityItem().getItem()) >= 0 || Util.arrayContains(CONVERTABLE_BLOCKS, Block.getBlockFromItem(item.getEntityItem().getItem())) >= 0){
|
||||||
|
int meta = item.getEntityItem().getItemDamage();
|
||||||
|
if(meta >= 15){
|
||||||
|
item.getEntityItem().setItemDamage(0);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
item.getEntityItem().setItemDamage(meta+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float[] getColor(){
|
||||||
|
float[] colors = possibleColorLensColors[Util.RANDOM.nextInt(possibleColorLensColors.length)];
|
||||||
|
return new float[]{colors[0]/255F, colors[1]/255F, colors[2]/255F};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getDistance(){
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
* This file ("LensDeath.java") is part of the Actually Additions Mod for Minecraft.
|
||||||
|
* It is created and owned by Ellpeck and distributed
|
||||||
|
* under the Actually Additions License to be found at
|
||||||
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
||||||
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
|
*
|
||||||
|
* © 2015 Ellpeck
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ellpeck.actuallyadditions.items.lens;
|
||||||
|
|
||||||
|
import ellpeck.actuallyadditions.misc.DamageSources;
|
||||||
|
import ellpeck.actuallyadditions.tile.TileEntityAtomicReconstructor;
|
||||||
|
import ellpeck.actuallyadditions.util.WorldPos;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class LensDeath extends Lens{
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public boolean invoke(WorldPos hitBlock, TileEntityAtomicReconstructor tile){
|
||||||
|
int use = 150; //Per Block (because it doesn't only activate when something is hit like the other lenses!)
|
||||||
|
if(tile.storage.getEnergyStored() >= use){
|
||||||
|
tile.storage.extractEnergy(use, false);
|
||||||
|
|
||||||
|
ArrayList<EntityLivingBase> entities = (ArrayList<EntityLivingBase>)tile.getWorldObj().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX()+1, hitBlock.getY()+1, hitBlock.getZ()+1));
|
||||||
|
for(EntityLivingBase entity : entities){
|
||||||
|
entity.attackEntityFrom(DamageSources.DAMAGE_ATOMIC_RECONSTRUCTOR, 20F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hitBlock != null && !hitBlock.getBlock().isAir(hitBlock.getWorld(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float[] getColor(){
|
||||||
|
return new float[]{188F/255F, 222F/255F, 1F};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getDistance(){
|
||||||
|
return 15;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* This file ("LensDetonation.java") is part of the Actually Additions Mod for Minecraft.
|
||||||
|
* It is created and owned by Ellpeck and distributed
|
||||||
|
* under the Actually Additions License to be found at
|
||||||
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
||||||
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
|
*
|
||||||
|
* © 2015 Ellpeck
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ellpeck.actuallyadditions.items.lens;
|
||||||
|
|
||||||
|
import ellpeck.actuallyadditions.tile.TileEntityAtomicReconstructor;
|
||||||
|
import ellpeck.actuallyadditions.util.WorldPos;
|
||||||
|
|
||||||
|
public class LensDetonation extends Lens{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean invoke(WorldPos hitBlock, TileEntityAtomicReconstructor tile){
|
||||||
|
if(hitBlock != null && !hitBlock.getBlock().isAir(hitBlock.getWorld(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ())){
|
||||||
|
int use = 500000;
|
||||||
|
if(tile.storage.getEnergyStored() >= use){
|
||||||
|
tile.getWorldObj().newExplosion(null, hitBlock.getX()+0.5, hitBlock.getY()+0.5, hitBlock.getZ()+0.5, 10F, true, true);
|
||||||
|
tile.storage.extractEnergy(use, false);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float[] getColor(){
|
||||||
|
return new float[]{158F/255F, 43F/255F, 39F/255F};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getDistance(){
|
||||||
|
return 30;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
* This file ("LensNone.java") is part of the Actually Additions Mod for Minecraft.
|
||||||
|
* It is created and owned by Ellpeck and distributed
|
||||||
|
* under the Actually Additions License to be found at
|
||||||
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
||||||
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
|
*
|
||||||
|
* © 2015 Ellpeck
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ellpeck.actuallyadditions.items.lens;
|
||||||
|
|
||||||
|
import ellpeck.actuallyadditions.tile.TileEntityAtomicReconstructor;
|
||||||
|
import ellpeck.actuallyadditions.util.WorldPos;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class LensNone extends Lens{
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public boolean invoke(WorldPos hitBlock, TileEntityAtomicReconstructor tile){
|
||||||
|
if(hitBlock != null && !hitBlock.getBlock().isAir(hitBlock.getWorld(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ())){
|
||||||
|
int range = 2;
|
||||||
|
|
||||||
|
//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++){
|
||||||
|
WorldPos pos = new WorldPos(tile.getWorldObj(), hitBlock.getX()+reachX, hitBlock.getY()+reachY, hitBlock.getZ()+reachZ);
|
||||||
|
ArrayList<LensNoneRecipeHandler.Recipe> recipes = LensNoneRecipeHandler.getRecipesFor(new ItemStack(pos.getBlock(), 1, pos.getMetadata()));
|
||||||
|
for(LensNoneRecipeHandler.Recipe recipe : recipes){
|
||||||
|
if(recipe != null && tile.storage.getEnergyStored() >= recipe.energyUse){
|
||||||
|
List<ItemStack> outputs = recipe.getOutputs();
|
||||||
|
if(outputs != null && !outputs.isEmpty()){
|
||||||
|
ItemStack output = outputs.get(0);
|
||||||
|
if(output.getItem() instanceof ItemBlock){
|
||||||
|
tile.getWorldObj().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(tile.getWorldObj(), pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, output.copy());
|
||||||
|
tile.getWorldObj().spawnEntityInWorld(item);
|
||||||
|
}
|
||||||
|
tile.storage.extractEnergy(recipe.energyUse, false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Converting the Items
|
||||||
|
ArrayList<EntityItem> items = (ArrayList<EntityItem>)tile.getWorldObj().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){
|
||||||
|
ItemStack stack = item.getEntityItem();
|
||||||
|
if(stack != null){
|
||||||
|
ArrayList<LensNoneRecipeHandler.Recipe> recipes = LensNoneRecipeHandler.getRecipesFor(stack);
|
||||||
|
for(LensNoneRecipeHandler.Recipe recipe : recipes){
|
||||||
|
if(recipe != null && tile.storage.getEnergyStored() >= recipe.energyUse){
|
||||||
|
List<ItemStack> outputs = recipe.getOutputs();
|
||||||
|
if(outputs != null && !outputs.isEmpty()){
|
||||||
|
ItemStack outputCopy = outputs.get(0).copy();
|
||||||
|
outputCopy.stackSize = stack.stackSize;
|
||||||
|
item.setEntityItemStack(outputCopy);
|
||||||
|
|
||||||
|
tile.storage.extractEnergy(recipe.energyUse, false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float[] getColor(){
|
||||||
|
return new float[]{27F/255F, 109F/255F, 1F};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getDistance(){
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* This file ("AtomicReconstructorRecipeHandler.java") is part of the Actually Additions Mod for Minecraft.
|
* This file ("LensNoneRecipeHandler.java") is part of the Actually Additions Mod for Minecraft.
|
||||||
* It is created and owned by Ellpeck and distributed
|
* It is created and owned by Ellpeck and distributed
|
||||||
* under the Actually Additions License to be found at
|
* under the Actually Additions License to be found at
|
||||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
||||||
|
@ -8,10 +8,9 @@
|
||||||
* © 2015 Ellpeck
|
* © 2015 Ellpeck
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.recipe;
|
package ellpeck.actuallyadditions.items.lens;
|
||||||
|
|
||||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||||
import ellpeck.actuallyadditions.blocks.metalists.TheColoredLampColors;
|
|
||||||
import ellpeck.actuallyadditions.config.values.ConfigCrafting;
|
import ellpeck.actuallyadditions.config.values.ConfigCrafting;
|
||||||
import ellpeck.actuallyadditions.items.InitItems;
|
import ellpeck.actuallyadditions.items.InitItems;
|
||||||
import ellpeck.actuallyadditions.items.metalists.TheCrystals;
|
import ellpeck.actuallyadditions.items.metalists.TheCrystals;
|
||||||
|
@ -20,7 +19,6 @@ import ellpeck.actuallyadditions.util.ItemUtil;
|
||||||
import ellpeck.actuallyadditions.util.Util;
|
import ellpeck.actuallyadditions.util.Util;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
|
@ -28,7 +26,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ReconstructorRecipeHandler{
|
public class LensNoneRecipeHandler{
|
||||||
|
|
||||||
public static ArrayList<Recipe> recipes = new ArrayList<Recipe>();
|
public static ArrayList<Recipe> recipes = new ArrayList<Recipe>();
|
||||||
|
|
||||||
|
@ -40,7 +38,6 @@ public class ReconstructorRecipeHandler{
|
||||||
public static Recipe recipeExplosionLens;
|
public static Recipe recipeExplosionLens;
|
||||||
public static Recipe recipeDamageLens;
|
public static Recipe recipeDamageLens;
|
||||||
public static Recipe recipeLeather;
|
public static Recipe recipeLeather;
|
||||||
public static ArrayList<Recipe> colorConversionRecipes = new ArrayList<Recipe>();
|
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
//Crystal Blocks
|
//Crystal Blocks
|
||||||
|
@ -94,48 +91,20 @@ public class ReconstructorRecipeHandler{
|
||||||
recipeLeather = Util.GetRecipes.lastReconstructorRecipe();
|
recipeLeather = Util.GetRecipes.lastReconstructorRecipe();
|
||||||
addRecipe(new ItemStack(Blocks.quartz_block), new ItemStack(InitBlocks.blockTestifiBucksWhiteWall), 10);
|
addRecipe(new ItemStack(Blocks.quartz_block), new ItemStack(InitBlocks.blockTestifiBucksWhiteWall), 10);
|
||||||
recipeWhiteWall = Util.GetRecipes.lastReconstructorRecipe();
|
recipeWhiteWall = Util.GetRecipes.lastReconstructorRecipe();
|
||||||
addRecipe(new ItemStack(Blocks.quartz_block), new ItemStack(InitBlocks.blockTestifiBucksGreenWall), 10, LensType.COLOR);
|
addRecipe(new ItemStack(Blocks.quartz_block, 1, 1), new ItemStack(InitBlocks.blockTestifiBucksGreenWall), 10);
|
||||||
recipeGreenWall = Util.GetRecipes.lastReconstructorRecipe();
|
recipeGreenWall = Util.GetRecipes.lastReconstructorRecipe();
|
||||||
|
|
||||||
//Colors
|
|
||||||
for(int i = 0; i < TheColoredLampColors.values().length-1; i++){
|
|
||||||
addRecipe("dye"+TheColoredLampColors.values()[i].name, "dye"+TheColoredLampColors.values()[i+1].name, 2000, LensType.COLOR);
|
|
||||||
colorConversionRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
|
||||||
addRecipe(new ItemStack(Blocks.wool, 1, i), new ItemStack(Blocks.wool, 1, i+1), 2000, LensType.COLOR);
|
|
||||||
colorConversionRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
|
||||||
addRecipe(new ItemStack(Blocks.stained_hardened_clay, 1, i), new ItemStack(Blocks.stained_hardened_clay, 1, i+1), 2000, LensType.COLOR);
|
|
||||||
colorConversionRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
|
||||||
addRecipe("blockGlass"+TheColoredLampColors.values()[i].name, "blockGlass"+TheColoredLampColors.values()[i+1].name, 2000, LensType.COLOR);
|
|
||||||
colorConversionRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
|
||||||
}
|
|
||||||
addRecipe("dye"+TheColoredLampColors.values()[15].name, "dye"+TheColoredLampColors.values()[0].name, 2000, LensType.COLOR);
|
|
||||||
colorConversionRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
|
||||||
addRecipe(new ItemStack(Blocks.wool, 1, 15), new ItemStack(Blocks.wool, 1, 0), 2000, LensType.COLOR);
|
|
||||||
colorConversionRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
|
||||||
addRecipe(new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stained_hardened_clay, 1, 0), 2000, LensType.COLOR);
|
|
||||||
colorConversionRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
|
||||||
addRecipe("blockGlass"+TheColoredLampColors.values()[15].name, "blockGlass"+TheColoredLampColors.values()[0].name, 2000, LensType.COLOR);
|
|
||||||
colorConversionRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addRecipe(ItemStack input, ItemStack output, int energyUse){
|
public static void addRecipe(ItemStack input, ItemStack output, int energyUse){
|
||||||
addRecipe(input, output, energyUse, LensType.NONE);
|
recipes.add(new Recipe(input, output, energyUse));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addRecipe(ItemStack input, ItemStack output, int energyUse, LensType type){
|
public static void addRecipe(String input, String output, int energyUse){
|
||||||
if(type.hasRecipes){
|
recipes.add(new Recipe(input, output, energyUse));
|
||||||
recipes.add(new Recipe(input, output, energyUse, type));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addRecipe(String input, String output, int energyUse, LensType type){
|
public static ArrayList<Recipe> getRecipesFor(ItemStack input){
|
||||||
if(type.hasRecipes){
|
|
||||||
recipes.add(new Recipe(input, output, energyUse, type));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArrayList<Recipe> getRecipes(ItemStack input){
|
|
||||||
ArrayList<Recipe> possibleRecipes = new ArrayList<Recipe>();
|
ArrayList<Recipe> possibleRecipes = new ArrayList<Recipe>();
|
||||||
for(Recipe recipe : recipes){
|
for(Recipe recipe : recipes){
|
||||||
if(ItemUtil.contains(recipe.getInputs(), input, true)){
|
if(ItemUtil.contains(recipe.getInputs(), input, true)){
|
||||||
|
@ -145,82 +114,25 @@ public class ReconstructorRecipeHandler{
|
||||||
return possibleRecipes;
|
return possibleRecipes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum LensType{
|
|
||||||
|
|
||||||
NONE(true),
|
|
||||||
COLOR(true),
|
|
||||||
DETONATION(false),
|
|
||||||
JUST_DAMAGE(false);
|
|
||||||
|
|
||||||
//Thanks to xdjackiexd for this, as I couldn't be bothered
|
|
||||||
private static final float[][] possibleColorLensColors = {
|
|
||||||
{158F, 43F, 39F}, //Red
|
|
||||||
{234F, 126F, 53F}, //Orange
|
|
||||||
{194F, 181F, 28F}, //Yellow
|
|
||||||
{57F, 186F, 46F}, //Lime Green
|
|
||||||
{54F, 75F, 24F}, //Green
|
|
||||||
{99F, 135F, 210F}, //Light Blue
|
|
||||||
{38F, 113F, 145F}, //Cyan
|
|
||||||
{37F, 49F, 147F}, //Blue
|
|
||||||
{126F, 52F, 191F}, //Purple
|
|
||||||
{190F, 73F, 201F}, //Magenta
|
|
||||||
{217F, 129F, 153F}, //Pink
|
|
||||||
{86F, 51F, 28F}, //Brown
|
|
||||||
};
|
|
||||||
public ItemStack lens;
|
|
||||||
public boolean hasRecipes;
|
|
||||||
|
|
||||||
LensType(boolean hasRecipes){
|
|
||||||
this.hasRecipes = hasRecipes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float[] getColor(){
|
|
||||||
if(this == COLOR){
|
|
||||||
float[] colors = possibleColorLensColors[Util.RANDOM.nextInt(possibleColorLensColors.length)];
|
|
||||||
return new float[]{colors[0]/255F, colors[1]/255F, colors[2]/255F};
|
|
||||||
}
|
|
||||||
else if(this == DETONATION){
|
|
||||||
return new float[]{158F/255F, 43F/255F, 39F/255F};
|
|
||||||
}
|
|
||||||
else if(this == JUST_DAMAGE){
|
|
||||||
return new float[]{188F/255F, 222F/255F, 1F};
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
return new float[]{27F/255F, 109F/255F, 1F};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLens(Item lens){
|
|
||||||
this.lens = new ItemStack(lens);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDistance(){
|
|
||||||
return this == DETONATION ? 30 : (this == JUST_DAMAGE ? 15 : 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Recipe{
|
public static class Recipe{
|
||||||
|
|
||||||
private String input;
|
private String input;
|
||||||
private String output;
|
private String output;
|
||||||
public int energyUse;
|
public int energyUse;
|
||||||
public LensType type;
|
|
||||||
|
|
||||||
private ItemStack inputStack;
|
private ItemStack inputStack;
|
||||||
private ItemStack outputStack;
|
private ItemStack outputStack;
|
||||||
|
|
||||||
public Recipe(ItemStack input, ItemStack output, int energyUse, LensType type){
|
public Recipe(ItemStack input, ItemStack output, int energyUse){
|
||||||
this.inputStack = input;
|
this.inputStack = input;
|
||||||
this.outputStack = output;
|
this.outputStack = output;
|
||||||
this.energyUse = energyUse;
|
this.energyUse = energyUse;
|
||||||
this.type = type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Recipe(String input, String output, int energyUse, LensType type){
|
public Recipe(String input, String output, int energyUse){
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.output = output;
|
this.output = output;
|
||||||
this.energyUse = energyUse;
|
this.energyUse = energyUse;
|
||||||
this.type = type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ItemStack> getOutputs(){
|
public List<ItemStack> getOutputs(){
|
||||||
|
@ -255,5 +167,4 @@ public class ReconstructorRecipeHandler{
|
||||||
return stacks;
|
return stacks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* This file ("Lenses.java") is part of the Actually Additions Mod for Minecraft.
|
||||||
|
* It is created and owned by Ellpeck and distributed
|
||||||
|
* under the Actually Additions License to be found at
|
||||||
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
||||||
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
|
*
|
||||||
|
* © 2015 Ellpeck
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ellpeck.actuallyadditions.items.lens;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Lenses{
|
||||||
|
|
||||||
|
public static ArrayList<Lens> allLenses = new ArrayList<Lens>();
|
||||||
|
|
||||||
|
public static final Lens LENS_NONE = new LensNone().register();
|
||||||
|
public static final Lens LENS_DETONATION = new LensDetonation().register();
|
||||||
|
public static final Lens LENS_DEATH = new LensDeath().register();
|
||||||
|
public static final Lens LENS_COLOR = new LensColor().register();
|
||||||
|
}
|
|
@ -17,7 +17,7 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||||
import ellpeck.actuallyadditions.booklet.BookletUtils;
|
import ellpeck.actuallyadditions.booklet.BookletUtils;
|
||||||
import ellpeck.actuallyadditions.booklet.page.BookletPage;
|
import ellpeck.actuallyadditions.booklet.page.BookletPage;
|
||||||
import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler;
|
import ellpeck.actuallyadditions.items.lens.LensNoneRecipeHandler;
|
||||||
import ellpeck.actuallyadditions.util.ItemUtil;
|
import ellpeck.actuallyadditions.util.ItemUtil;
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
import ellpeck.actuallyadditions.util.StringUtil;
|
import ellpeck.actuallyadditions.util.StringUtil;
|
||||||
|
@ -58,8 +58,8 @@ public class NEIReconstructorRecipe extends TemplateRecipeHandler implements INE
|
||||||
@Override
|
@Override
|
||||||
public void loadCraftingRecipes(String outputId, Object... results){
|
public void loadCraftingRecipes(String outputId, Object... results){
|
||||||
if(outputId.equals(NAME) && getClass() == NEIReconstructorRecipe.class){
|
if(outputId.equals(NAME) && getClass() == NEIReconstructorRecipe.class){
|
||||||
ArrayList<ReconstructorRecipeHandler.Recipe> recipes = ReconstructorRecipeHandler.recipes;
|
ArrayList<LensNoneRecipeHandler.Recipe> recipes = LensNoneRecipeHandler.recipes;
|
||||||
for(ReconstructorRecipeHandler.Recipe recipe : recipes){
|
for(LensNoneRecipeHandler.Recipe recipe : recipes){
|
||||||
arecipes.add(new CachedReconstructorRecipe(recipe));
|
arecipes.add(new CachedReconstructorRecipe(recipe));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,8 +70,8 @@ public class NEIReconstructorRecipe extends TemplateRecipeHandler implements INE
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadCraftingRecipes(ItemStack result){
|
public void loadCraftingRecipes(ItemStack result){
|
||||||
ArrayList<ReconstructorRecipeHandler.Recipe> recipes = ReconstructorRecipeHandler.recipes;
|
ArrayList<LensNoneRecipeHandler.Recipe> recipes = LensNoneRecipeHandler.recipes;
|
||||||
for(ReconstructorRecipeHandler.Recipe recipe : recipes){
|
for(LensNoneRecipeHandler.Recipe recipe : recipes){
|
||||||
if(ItemUtil.contains(recipe.getOutputs(), result, true)){
|
if(ItemUtil.contains(recipe.getOutputs(), result, true)){
|
||||||
arecipes.add(new CachedReconstructorRecipe(recipe));
|
arecipes.add(new CachedReconstructorRecipe(recipe));
|
||||||
}
|
}
|
||||||
|
@ -80,8 +80,8 @@ public class NEIReconstructorRecipe extends TemplateRecipeHandler implements INE
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadUsageRecipes(ItemStack ingredient){
|
public void loadUsageRecipes(ItemStack ingredient){
|
||||||
ArrayList<ReconstructorRecipeHandler.Recipe> recipes = ReconstructorRecipeHandler.recipes;
|
ArrayList<LensNoneRecipeHandler.Recipe> recipes = LensNoneRecipeHandler.recipes;
|
||||||
for(ReconstructorRecipeHandler.Recipe recipe : recipes){
|
for(LensNoneRecipeHandler.Recipe recipe : recipes){
|
||||||
if(ItemUtil.contains(recipe.getInputs(), ingredient, true)){
|
if(ItemUtil.contains(recipe.getInputs(), ingredient, true)){
|
||||||
CachedReconstructorRecipe theRecipe = new CachedReconstructorRecipe(recipe);
|
CachedReconstructorRecipe theRecipe = new CachedReconstructorRecipe(recipe);
|
||||||
theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.input), ingredient);
|
theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.input), ingredient);
|
||||||
|
@ -117,9 +117,6 @@ public class NEIReconstructorRecipe extends TemplateRecipeHandler implements INE
|
||||||
if(Minecraft.getMinecraft().currentScreen != null){
|
if(Minecraft.getMinecraft().currentScreen != null){
|
||||||
BookletPage.renderItem(Minecraft.getMinecraft().currentScreen, new ItemStack(InitBlocks.blockAtomicReconstructor), 32+34, 19, 1.0F);
|
BookletPage.renderItem(Minecraft.getMinecraft().currentScreen, new ItemStack(InitBlocks.blockAtomicReconstructor), 32+34, 19, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
CachedReconstructorRecipe cache = (CachedReconstructorRecipe)this.arecipes.get(recipe);
|
|
||||||
GuiDraw.drawString(cache.lens == null ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".noLens") : cache.lens.getItem().getItemStackDisplayName(cache.lens), 10, 45, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -131,12 +128,10 @@ public class NEIReconstructorRecipe extends TemplateRecipeHandler implements INE
|
||||||
|
|
||||||
public PositionedStack result;
|
public PositionedStack result;
|
||||||
public PositionedStack input;
|
public PositionedStack input;
|
||||||
public ItemStack lens;
|
|
||||||
|
|
||||||
public CachedReconstructorRecipe(ReconstructorRecipeHandler.Recipe recipe){
|
public CachedReconstructorRecipe(LensNoneRecipeHandler.Recipe recipe){
|
||||||
this.result = new PositionedStack(recipe.getOutputs(), 67+32, 19);
|
this.result = new PositionedStack(recipe.getOutputs(), 67+32, 19);
|
||||||
this.input = new PositionedStack(recipe.getInputs(), 5+32, 19);
|
this.input = new PositionedStack(recipe.getInputs(), 5+32, 19);
|
||||||
this.lens = recipe.type.lens;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,7 +15,8 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler;
|
import ellpeck.actuallyadditions.items.lens.Lens;
|
||||||
|
import ellpeck.actuallyadditions.items.lens.Lenses;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.particle.EntityReddustFX;
|
import net.minecraft.client.particle.EntityReddustFX;
|
||||||
|
@ -37,14 +38,14 @@ public class PacketAtomicReconstructor implements IMessage{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PacketAtomicReconstructor(int startX, int startY, int startZ, int endX, int endY, int endZ, ReconstructorRecipeHandler.LensType type){
|
public PacketAtomicReconstructor(int startX, int startY, int startZ, int endX, int endY, int endZ, Lens type){
|
||||||
this.startX = startX;
|
this.startX = startX;
|
||||||
this.startY = startY;
|
this.startY = startY;
|
||||||
this.startZ = startZ;
|
this.startZ = startZ;
|
||||||
this.endX = endX;
|
this.endX = endX;
|
||||||
this.endY = endY;
|
this.endY = endY;
|
||||||
this.endZ = endZ;
|
this.endZ = endZ;
|
||||||
this.lensTypeOrdinal = type.ordinal();
|
this.lensTypeOrdinal = Lenses.allLenses.indexOf(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -84,7 +85,7 @@ public class PacketAtomicReconstructor implements IMessage{
|
||||||
|
|
||||||
for(int times = 0; times < 5; times++){
|
for(int times = 0; times < 5; times++){
|
||||||
for(double i = 0; i <= 1; i += 1/(distance*8)){
|
for(double i = 0; i <= 1; i += 1/(distance*8)){
|
||||||
ReconstructorRecipeHandler.LensType type = ReconstructorRecipeHandler.LensType.values()[message.lensTypeOrdinal];
|
Lens type = Lenses.allLenses.get(message.lensTypeOrdinal);
|
||||||
float[] color = type.getColor();
|
float[] color = type.getColor();
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityReddustFX(world, (difX*i)+message.endX+0.5, (difY*i)+message.endY+0.5, (difZ*i)+message.endZ+0.5, 2F, color[0], color[1], color[2]));
|
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityReddustFX(world, (difX*i)+message.endX+0.5, (difY*i)+message.endY+0.5, (difZ*i)+message.endZ+0.5, 2F, color[0], color[1], color[2]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,25 +13,17 @@ package ellpeck.actuallyadditions.tile;
|
||||||
import cofh.api.energy.EnergyStorage;
|
import cofh.api.energy.EnergyStorage;
|
||||||
import cofh.api.energy.IEnergyReceiver;
|
import cofh.api.energy.IEnergyReceiver;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
import ellpeck.actuallyadditions.items.IReconstructorLens;
|
import ellpeck.actuallyadditions.items.lens.ItemLens;
|
||||||
import ellpeck.actuallyadditions.misc.DamageSources;
|
import ellpeck.actuallyadditions.items.lens.Lens;
|
||||||
|
import ellpeck.actuallyadditions.items.lens.Lenses;
|
||||||
import ellpeck.actuallyadditions.network.PacketAtomicReconstructor;
|
import ellpeck.actuallyadditions.network.PacketAtomicReconstructor;
|
||||||
import ellpeck.actuallyadditions.network.PacketHandler;
|
import ellpeck.actuallyadditions.network.PacketHandler;
|
||||||
import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler;
|
|
||||||
import ellpeck.actuallyadditions.util.WorldPos;
|
import ellpeck.actuallyadditions.util.WorldPos;
|
||||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.item.EntityItem;
|
|
||||||
import net.minecraft.item.ItemBlock;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class TileEntityAtomicReconstructor extends TileEntityInventoryBase implements IEnergyReceiver{
|
public class TileEntityAtomicReconstructor extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||||
|
|
||||||
public static final int ENERGY_USE = 200;
|
public static final int ENERGY_USE = 200;
|
||||||
|
@ -56,86 +48,13 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
this.storage.extractEnergy(ENERGY_USE, false);
|
this.storage.extractEnergy(ENERGY_USE, false);
|
||||||
|
|
||||||
//The Lens the Reconstructor currently has installed
|
//The Lens the Reconstructor currently has installed
|
||||||
ReconstructorRecipeHandler.LensType currentLens = this.getCurrentLens();
|
Lens currentLens = this.getCurrentLens();
|
||||||
int distance = currentLens.getDistance();
|
int distance = currentLens.getDistance();
|
||||||
for(int i = 0; i < distance; i++){
|
for(int i = 0; i < distance; i++){
|
||||||
WorldPos hitBlock = WorldUtil.getCoordsFromSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, i);
|
WorldPos hitBlock = WorldUtil.getCoordsFromSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, i);
|
||||||
|
|
||||||
float damage = 5F;
|
if(currentLens.invoke(hitBlock, this)){
|
||||||
if(currentLens == ReconstructorRecipeHandler.LensType.JUST_DAMAGE){
|
|
||||||
int use = 150; //Per Block (because it doesn't only activate when something is hit like the other lenses!)
|
|
||||||
if(this.storage.getEnergyStored() >= use){
|
|
||||||
damage = 20F;
|
|
||||||
this.storage.extractEnergy(use, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.damagePlayer(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), damage);
|
|
||||||
|
|
||||||
if(hitBlock != null && !hitBlock.getBlock().isAir(hitBlock.getWorld(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ())){
|
|
||||||
this.shootLaser(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), currentLens);
|
this.shootLaser(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), currentLens);
|
||||||
|
|
||||||
//Detonation
|
|
||||||
if(currentLens == ReconstructorRecipeHandler.LensType.DETONATION){
|
|
||||||
int use = 500000;
|
|
||||||
if(this.storage.getEnergyStored() >= use){
|
|
||||||
this.worldObj.newExplosion(null, hitBlock.getX()+0.5, hitBlock.getY()+0.5, hitBlock.getZ()+0.5, 10F, true, true);
|
|
||||||
this.storage.extractEnergy(use, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Conversion Recipes
|
|
||||||
else if(currentLens.hasRecipes){
|
|
||||||
int range = 2;
|
|
||||||
|
|
||||||
//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++){
|
|
||||||
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() >= recipe.energyUse && recipe.type == currentLens){
|
|
||||||
List<ItemStack> outputs = recipe.getOutputs();
|
|
||||||
if(outputs != null && !outputs.isEmpty()){
|
|
||||||
ItemStack output = outputs.get(0);
|
|
||||||
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(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){
|
|
||||||
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() >= recipe.energyUse && recipe.type == currentLens){
|
|
||||||
List<ItemStack> outputs = recipe.getOutputs();
|
|
||||||
if(outputs != null && !outputs.isEmpty()){
|
|
||||||
ItemStack outputCopy = outputs.get(0).copy();
|
|
||||||
outputCopy.stackSize = stack.stackSize;
|
|
||||||
item.setEntityItemStack(outputCopy);
|
|
||||||
|
|
||||||
this.storage.extractEnergy(recipe.energyUse, false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(i >= distance-1){
|
else if(i >= distance-1){
|
||||||
|
@ -152,24 +71,16 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReconstructorRecipeHandler.LensType getCurrentLens(){
|
public Lens getCurrentLens(){
|
||||||
if(this.slots[0] != null){
|
if(this.slots[0] != null){
|
||||||
if(this.slots[0].getItem() instanceof IReconstructorLens){
|
if(this.slots[0].getItem() instanceof ItemLens){
|
||||||
return ((IReconstructorLens)this.slots[0].getItem()).getLensType();
|
return ((ItemLens)this.slots[0].getItem()).getLensType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ReconstructorRecipeHandler.LensType.NONE;
|
return Lenses.LENS_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
private void shootLaser(int endX, int endY, int endZ, Lens currentLens){
|
||||||
public void damagePlayer(int x, int y, int z, float damage){
|
|
||||||
ArrayList<EntityLivingBase> entities = (ArrayList<EntityLivingBase>)worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(x, y, z, x+1, y+1, z+1));
|
|
||||||
for(EntityLivingBase entity : entities){
|
|
||||||
entity.attackEntityFrom(DamageSources.DAMAGE_ATOMIC_RECONSTRUCTOR, damage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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));
|
PacketHandler.theNetwork.sendToAllAround(new PacketAtomicReconstructor(xCoord, yCoord, zCoord, endX, endY, endZ, currentLens), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +105,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return stack != null && stack.getItem() instanceof IReconstructorLens;
|
return stack != null && stack.getItem() instanceof ItemLens;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
package ellpeck.actuallyadditions.util;
|
package ellpeck.actuallyadditions.util;
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import ellpeck.actuallyadditions.items.lens.LensNoneRecipeHandler;
|
||||||
import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry;
|
import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry;
|
||||||
import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler;
|
|
||||||
import net.minecraft.block.BlockDispenser;
|
import net.minecraft.block.BlockDispenser;
|
||||||
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
|
@ -66,8 +66,8 @@ public class Util{
|
||||||
|
|
||||||
public static class GetRecipes{
|
public static class GetRecipes{
|
||||||
|
|
||||||
public static ReconstructorRecipeHandler.Recipe lastReconstructorRecipe(){
|
public static LensNoneRecipeHandler.Recipe lastReconstructorRecipe(){
|
||||||
ArrayList<ReconstructorRecipeHandler.Recipe> list = ReconstructorRecipeHandler.recipes;
|
ArrayList<LensNoneRecipeHandler.Recipe> list = LensNoneRecipeHandler.recipes;
|
||||||
return list.get(list.size()-1);
|
return list.get(list.size()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,12 @@ public class WorldPos{
|
||||||
return this.getWorld() != null ? this.getWorld().getBlockMetadata(this.x, this.y, this.z) : 0;
|
return this.getWorld() != null ? this.getWorld().getBlockMetadata(this.x, this.y, this.z) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMetadata(int meta, int flag){
|
||||||
|
if(this.getWorld() != null){
|
||||||
|
this.getWorld().setBlockMetadataWithNotify(this.x, this.y, this.z, meta, flag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isEqual(WorldPos pos){
|
public boolean isEqual(WorldPos pos){
|
||||||
return pos != null && this.x == pos.getX() && this.y == pos.getY() && this.z == pos.getZ() && this.getWorld() == pos.getWorld();
|
return pos != null && this.x == pos.getX() && this.y == pos.getY() && this.z == pos.getZ() && this.getWorld() == pos.getWorld();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue