mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-21 23:13:28 +01:00
parent
584f6bc034
commit
add64ce9ea
8 changed files with 160 additions and 68 deletions
|
@ -19,3 +19,4 @@ minetechniker=actuallyadditions:itemCrystalEmpowered@2
|
|||
3pixel=actuallyadditions:itemMoreDamageLens
|
||||
kirindave=actuallyadditions:itemCrystalEmpowered@3
|
||||
theonewhohunts=actuallyadditions:itemCrystalEmpowered@4
|
||||
garantiertnicht=actuallyadditions:itemFillingWand
|
|
@ -193,7 +193,6 @@ public final class InitBooklet{
|
|||
new BookletChapter("canola", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockFermentingBarrel), new PageTextOnly(1).setStacks(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal()), new ItemStack(InitItems.itemCanolaSeed)).addFluidToPage(InitFluids.fluidCanolaOil), new PageTextOnly(2).addFluidToPage(InitFluids.fluidOil).addFluidToPage(InitFluids.fluidCrystalOil).addFluidToPage(InitFluids.fluidEmpoweredOil), new PageCrafting(3, BlockCrafting.recipeCanolaPress).setNoText(), new PageCrafting(4, BlockCrafting.recipeFermentingBarrel).setNoText(), new PageCrafting(5, BlockCrafting.recipeOilGen), new PageReconstructor(6, LensRecipeHandler.recipeCrystallizedCanolaSeed).setNoText(), new PageEmpowerer(7, EmpowererHandler.recipeEmpoweredCanolaSeed).setNoText());
|
||||
new BookletChapter("leafGen", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockLeafGenerator), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityLeafGenerator.ENERGY_PRODUCED).addTextReplacement("<range>", TileEntityLeafGenerator.RANGE), new PageCrafting(2, BlockCrafting.recipeLeafGen)).setImportant();
|
||||
new BookletChapter("bioReactor", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockBioReactor), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBioReactor).setNoText()).setSpecial();
|
||||
;
|
||||
|
||||
//No RF Using Items
|
||||
new BookletChapter("bags", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemBag), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeBag), new PageCrafting(3, ItemCrafting.recipeVoidBag).setNoText()).setImportant();
|
||||
|
@ -221,6 +220,7 @@ public final class InitBooklet{
|
|||
|
||||
//RF Using Items
|
||||
new BookletChapter("drill", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemDrill, 1, TheColoredLampColors.LIGHT_BLUE.ordinal()), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeDrill).setNoText(), new PageCrafting(4, ItemCrafting.RECIPES_DRILL_COLORING), new PageCrafting(4, ItemCrafting.recipeDrillCore).setNoText(), new PageCrafting(5, ItemCrafting.recipeDrillSpeedI).setNoText(), new PageCrafting(6, ItemCrafting.recipeDrillSpeedII).setNoText(), new PageCrafting(7, ItemCrafting.recipeDrillSpeedIII).setNoText(), new PageCrafting(8, ItemCrafting.recipeDrillFortuneI).setNoText(), new PageCrafting(9, ItemCrafting.recipeDrillFortuneII).setNoText(), new PageCrafting(10, ItemCrafting.recipeDrillSilk).setNoText(), new PageCrafting(11, ItemCrafting.recipeDrillThree).setNoText(), new PageCrafting(12, ItemCrafting.recipeDrillFive).setNoText(), new PageCrafting(13, ItemCrafting.recipeDrillPlacing).setNoText()).setSpecial();
|
||||
new BookletChapter("fillingWand", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemFillingWand), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeFillingWand).setNoText()).setSpecial();
|
||||
new BookletChapter("staff", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemTeleStaff), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeStaff).setNoText()).setImportant();
|
||||
new BookletChapter("magnetRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemMagnetRing), new PageCrafting(1, ItemCrafting.recipeMagnetRing));
|
||||
new BookletChapter("growthRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemGrowthRing), new PageCrafting(1, ItemCrafting.recipeGrowthRing));
|
||||
|
|
|
@ -154,6 +154,7 @@ public enum ConfigCrafting{
|
|||
CHARCOAL_BLOCK("Charcoal Block", ConfigCategories.BLOCKS_CRAFTING),
|
||||
TINY_COAL("Tiny Coal", ConfigCategories.ITEMS_CRAFTING),
|
||||
BAG("Bag", ConfigCategories.ITEMS_CRAFTING),
|
||||
FILLING_WAND("Handheld Filler", ConfigCategories.ITEMS_CRAFTING),
|
||||
VOID_BAG("Void Bag", ConfigCategories.ITEMS_CRAFTING),
|
||||
EMPOWERER("Empowerer", ConfigCategories.BLOCKS_CRAFTING),
|
||||
DISTRIBUTOR_ITEM("Item Distributor", ConfigCategories.BLOCKS_CRAFTING),
|
||||
|
|
|
@ -94,9 +94,22 @@ public final class ItemCrafting{
|
|||
public static IRecipe recipeBag;
|
||||
public static IRecipe recipeVoidBag;
|
||||
public static IRecipe recipeLensMoreDeath;
|
||||
public static IRecipe recipeFillingWand;
|
||||
|
||||
public static void init(){
|
||||
|
||||
//Filling Wand
|
||||
if(ConfigCrafting.FILLING_WAND.isEnabled()){
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFillingWand),
|
||||
"IPI", "DCD", " B ",
|
||||
'I', new ItemStack(InitItems.itemCrystalEmpowered, 1, TheCrystals.IRON.ordinal()),
|
||||
'P', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()),
|
||||
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()),
|
||||
'D', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()),
|
||||
'B', new ItemStack(InitItems.itemBatteryTriple)));
|
||||
recipeFillingWand = RecipeUtil.lastIRecipe();
|
||||
}
|
||||
|
||||
//Bag
|
||||
if(ConfigCrafting.BAG.isEnabled()){
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemBag),
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
|
@ -29,15 +30,17 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemFillingWand extends ItemEnergy{
|
||||
|
||||
public ItemFillingWand(String name){
|
||||
super(500000, 1000, name);
|
||||
super(800000, 2000, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ){
|
||||
if(player.getItemInUseCount() <= 0){
|
||||
if(!world.isRemote && player.getItemInUseCount() <= 0){
|
||||
if(player.isSneaking()){
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
saveBlock(state, stack);
|
||||
|
@ -64,6 +67,7 @@ public class ItemFillingWand extends ItemEnergy{
|
|||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase entity, int timeLeft){
|
||||
if(!world.isRemote){
|
||||
boolean clear = true;
|
||||
if(entity instanceof EntityPlayer){
|
||||
RayTraceResult result = WorldUtil.getNearestBlockWithDefaultReachDistance(world, (EntityPlayer)entity);
|
||||
|
@ -85,6 +89,7 @@ public class ItemFillingWand extends ItemEnergy{
|
|||
if(clear){
|
||||
ItemPhantomConnector.clearStorage(stack, "FirstX", "FirstY", "FirstZ");
|
||||
}
|
||||
}
|
||||
|
||||
super.onPlayerStoppedUsing(stack, world, entity, timeLeft);
|
||||
}
|
||||
|
@ -93,18 +98,24 @@ public class ItemFillingWand extends ItemEnergy{
|
|||
public void onUpdate(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected){
|
||||
super.onUpdate(stack, world, entity, itemSlot, isSelected);
|
||||
|
||||
if(!world.isRemote){
|
||||
boolean shouldClear = false;
|
||||
|
||||
if(isSelected){
|
||||
if(entity instanceof EntityPlayer && stack.hasTagCompound()){
|
||||
EntityPlayer player = (EntityPlayer)entity;
|
||||
boolean creative = player.capabilities.isCreativeMode;
|
||||
|
||||
NBTTagCompound compound = stack.getTagCompound();
|
||||
|
||||
BlockPos firstPos = new BlockPos(compound.getInteger("FirstX"), compound.getInteger("FirstY"), compound.getInteger("FirstZ"));
|
||||
BlockPos secondPos = new BlockPos(compound.getInteger("SecondX"), compound.getInteger("SecondY"), compound.getInteger("SecondZ"));
|
||||
|
||||
if(!BlockPos.ORIGIN.equals(firstPos) && !BlockPos.ORIGIN.equals(secondPos)){
|
||||
int energyUse = 1500;
|
||||
|
||||
IBlockState replaceState = loadBlock(stack);
|
||||
if(replaceState != null){
|
||||
if(replaceState != null && (creative || this.getEnergyStored(stack) >= energyUse)){
|
||||
int lowestX = Math.min(firstPos.getX(), secondPos.getX());
|
||||
int lowestY = Math.min(firstPos.getY(), secondPos.getY());
|
||||
int lowestZ = Math.min(firstPos.getZ(), secondPos.getZ());
|
||||
|
@ -117,12 +128,21 @@ public class ItemFillingWand extends ItemEnergy{
|
|||
IBlockState state = world.getBlockState(pos);
|
||||
|
||||
if(state.getBlock().isReplaceable(world, pos) && replaceState.getBlock().canPlaceBlockAt(world, pos)){
|
||||
if(creative || removeFittingItem(replaceState, player)){
|
||||
world.setBlockState(pos, replaceState, 2);
|
||||
|
||||
if(!ConfigBoolValues.LESS_SOUND.isEnabled()){
|
||||
SoundType sound = replaceState.getBlock().getSoundType(replaceState, world, pos, entity);
|
||||
SoundType sound = replaceState.getBlock().getSoundType(replaceState, world, pos, player);
|
||||
world.playSound(null, pos, sound.getPlaceSound(), SoundCategory.BLOCKS, (sound.getVolume()+1.0F)/2.0F, sound.getPitch()*0.8F);
|
||||
}
|
||||
|
||||
if(!creative){
|
||||
this.extractEnergy(stack, energyUse, false);
|
||||
}
|
||||
}
|
||||
else{
|
||||
shouldClear = true;
|
||||
}
|
||||
}
|
||||
|
||||
int distX = Math.abs(secondPos.getX()-firstPos.getX());
|
||||
|
@ -142,10 +162,12 @@ public class ItemFillingWand extends ItemEnergy{
|
|||
}
|
||||
}
|
||||
|
||||
if(!shouldClear){
|
||||
compound.setInteger("CurrX", currX);
|
||||
compound.setInteger("CurrY", currY);
|
||||
compound.setInteger("CurrZ", currZ);
|
||||
}
|
||||
}
|
||||
else{
|
||||
shouldClear = true;
|
||||
}
|
||||
|
@ -160,6 +182,46 @@ public class ItemFillingWand extends ItemEnergy{
|
|||
ItemPhantomConnector.clearStorage(stack, "FirstX", "FirstY", "FirstZ", "SecondX", "SecondY", "SecondZ", "CurrX", "CurrY", "CurrZ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){
|
||||
super.addInformation(stack, player, list, bool);
|
||||
|
||||
String display = "None";
|
||||
|
||||
IBlockState state = loadBlock(stack);
|
||||
if(state != null){
|
||||
Block block = state.getBlock();
|
||||
ItemStack blockStack = new ItemStack(block, 1, block.getMetaFromState(state));
|
||||
if(blockStack.getItem() != null){
|
||||
display = blockStack.getDisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
list.add("Selected Block: "+display);
|
||||
}
|
||||
|
||||
private static boolean removeFittingItem(IBlockState state, EntityPlayer player){
|
||||
Block block = state.getBlock();
|
||||
ItemStack stack = new ItemStack(block, 1, block.getMetaFromState(state));
|
||||
|
||||
if(stack != null && stack.getItem() != null){
|
||||
for(int i = 0; i < player.inventory.getSizeInventory(); i++){
|
||||
ItemStack slot = player.inventory.getStackInSlot(i);
|
||||
if(slot != null && slot.isItemEqual(stack) && slot.stackSize > 0){
|
||||
slot.stackSize--;
|
||||
if(slot.stackSize <= 0){
|
||||
player.inventory.setInventorySlotContents(i, null);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void saveBlock(IBlockState state, ItemStack stack){
|
||||
if(!stack.hasTagCompound()){
|
||||
|
@ -190,4 +252,9 @@ public class ItemFillingWand extends ItemEnergy{
|
|||
public int getMaxItemUseDuration(ItemStack stack){
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -513,6 +513,7 @@ item.actuallyadditions.itemMiscCrystallizedCanolaSeed.name=Crystallized Canola S
|
|||
item.actuallyadditions.itemMiscEmpoweredCanolaSeed.name=Empowered Canola Seed
|
||||
item.actuallyadditions.itemMiningLens.name=Lens of the Miner
|
||||
item.actuallyadditions.itemMoreDamageLens.name=Lens of the Killer
|
||||
item.actuallyadditions.itemFillingWand.name=Handheld Filler
|
||||
|
||||
#Tooltips
|
||||
tooltip.actuallyadditions.onSuffix.desc=On
|
||||
|
@ -1054,3 +1055,6 @@ booklet.actuallyadditions.chapter.reviews.text.1="Actually Additions, to me, is
|
|||
|
||||
booklet.actuallyadditions.chapter.lensMoreDeath.name=Lens of the Killer
|
||||
booklet.actuallyadditions.chapter.lensMoreDeath.text.1=The <item>Lens of the Killer<r> works much like the <item>Lens of Certain Death<r>, however it will also <imp>drop experience<r> and <imp>player-kill loot<r>. <n>This means, however, that it will use <imp>a lot more power<r>. <n><n>To pick up the experience it drops, you might want to try an <item>Experience Solidifier<r>.
|
||||
|
||||
booklet.actuallyadditions.chapter.fillingWand.name=Handheld Filler
|
||||
booklet.actuallyadditions.chapter.fillingWand.text.1=The <item>Handheld Filler<r> is a great way to <imp>fill any area<r> with blocks. <n>To do this, first <imp>sneak-right-click<r> a block in the world that you want to <imp>fill an area with<r>. <n><n>To actually fill an area, look at the <imp>first corner<r> and <imp>hold right-click<r>. Let go of right-click at the <imp>second corner<r>. The area you mark can be a flat plane or a cube. <n>This process requires <imp>some RF<r> for placing the blocks and you need to <imp>have the blocks<r> in your inventory.
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "actuallyadditions:item/standardItem",
|
||||
"textures": {
|
||||
"layer0": "actuallyadditions:items/itemFillingWand"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 556 B |
Loading…
Reference in a new issue