This commit is contained in:
Flanks255 2021-11-21 14:05:27 -06:00
parent b3a00f8d4e
commit eb3072bcbe
8 changed files with 38 additions and 59 deletions

View file

@ -10,20 +10,21 @@
package de.ellpeck.actuallyadditions.mod.items;
import com.google.common.collect.Sets;
import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.material.Material;
import net.minecraft.item.IItemTier;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tags.ITag;
import java.util.Collections;
import java.util.Set;
public class ItemAxeAA extends ItemToolAA {
public ItemAxeAA(float p_i48512_1_, float p_i48512_2_, IItemTier p_i48512_3_, Set<Block> p_i48512_4_, Properties p_i48512_5_, String name, ItemStack repairItem, ITag<Item> repairTag) {
super(p_i48512_1_, p_i48512_2_, p_i48512_3_, p_i48512_4_, p_i48512_5_, name, repairItem, repairTag);
}
/*
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE);
public ItemAxeAA(IItemTier material) {
@ -42,5 +43,5 @@ public class ItemAxeAA extends ItemToolAA {
@Override
public Set<String> getToolClasses(ItemStack stack) {
return Collections.singleton("axe");
}
}*/
}

View file

@ -16,6 +16,6 @@ public class ItemCoffeeBean extends ItemFoodBase {
public ItemCoffeeBean() {
super(1, 1F, false);
this.setMaxDamage(0);
//this.setMaxDamage(0);
}
}

View file

@ -10,20 +10,21 @@
package de.ellpeck.actuallyadditions.mod.items;
import com.google.common.collect.Sets;
import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.material.Material;
import net.minecraft.item.IItemTier;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tags.ITag;
import java.util.Collections;
import java.util.Set;
public class ItemPickaxeAA extends ItemToolAA {
public ItemPickaxeAA(float p_i48512_1_, float p_i48512_2_, IItemTier p_i48512_3_, Set<Block> p_i48512_4_, Properties p_i48512_5_, String name, ItemStack repairItem, ITag<Item> repairTag) {
super(p_i48512_1_, p_i48512_2_, p_i48512_3_, p_i48512_4_, p_i48512_5_, name, repairItem, repairTag);
}
/*
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.DOUBLE_STONE_SLAB, Blocks.GOLDEN_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.LIT_REDSTONE_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.STONE_SLAB, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE);
public ItemPickaxeAA(IItemTier material) {
@ -76,5 +77,5 @@ public class ItemPickaxeAA extends ItemToolAA {
@Override
public Set<String> getToolClasses(ItemStack stack) {
return Collections.singleton("pickaxe");
}
}*/
}

View file

@ -10,17 +10,15 @@
package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.item.HoeItem;
import net.minecraft.item.IItemTier;
import net.minecraft.item.ItemStack;
public class ItemHoeAA extends HoeItem implements IDisableableItem {
public class ItemHoeAA extends HoeItem {
public ItemHoeAA(IItemTier p_i231595_1_, int p_i231595_2_, float p_i231595_3_, Properties p_i231595_4_) {
super(p_i231595_1_, p_i231595_2_, p_i231595_3_, p_i231595_4_);
}
private final ItemStack repairItem;
/* private final ItemStack repairItem;
private final boolean disabled;
public ItemHoeAA(IItemTier toolMat) {
@ -43,5 +41,5 @@ public class ItemHoeAA extends HoeItem implements IDisableableItem {
@Override
public boolean isDisabled() {
return this.disabled;
}
}*/
}

View file

@ -28,7 +28,7 @@ public class ItemSeed /* extends ItemSeeds*/ {
this.plant = plant;
if (plant instanceof BlockPlant) {
((BlockPlant) plant).doStuff(this, returnItem, returnMeta);
//((BlockPlant) plant).doStuff(this, returnItem, returnMeta); //TODO
}
}

View file

@ -10,18 +10,15 @@
package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.item.IItemTier;
import net.minecraft.item.ItemStack;
import net.minecraft.item.SwordItem;
public class ItemSwordAA extends SwordItem implements IDisableableItem {
public class ItemSwordAA extends SwordItem {
public ItemSwordAA(IItemTier p_i48460_1_, int p_i48460_2_, float p_i48460_3_, Properties p_i48460_4_) {
super(p_i48460_1_, p_i48460_2_, p_i48460_3_, p_i48460_4_);
}
private final boolean disabled;
/* private final boolean disabled;
public ItemSwordAA(IItemTier toolMat) {
super(toolMat);
@ -48,5 +45,5 @@ public class ItemSwordAA extends SwordItem implements IDisableableItem {
@Override
public boolean isDisabled() {
return this.disabled;
}
}*/
}

View file

@ -22,11 +22,8 @@ import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.util.FakePlayerFactory;
import java.util.List;
import java.util.Map;
@ -61,7 +58,7 @@ public class LensColor extends Lens {
ItemStack returnStack = this.tryConvert(new ItemStack(block), hitState, hitBlock, tile);
if (returnStack != null && returnStack.getItem() instanceof BlockItem) {
Block toPlace = Block.byItem(returnStack.getItem());
BlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), hitBlock, Direction.UP, 0, 0, 0, FakePlayerFactory.getMinecraft((ServerWorld) tile.getWorldObject()), Hand.MAIN_HAND);
BlockState state2Place = toPlace.defaultBlockState(); //getStateForPlacement(tile.getWorldObject(), hitBlock, Direction.UP, 0, 0, 0, FakePlayerFactory.getMinecraft((ServerWorld) tile.getWorldObject()), Hand.MAIN_HAND); //TODO
tile.getWorldObject().setBlock(hitBlock, state2Place, 2);
tile.extractEnergy(ENERGY_USE);
}

View file

@ -10,33 +10,18 @@
package de.ellpeck.actuallyadditions.mod.misc.apiimpl;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
import de.ellpeck.actuallyadditions.api.internal.IMethodHandler;
import de.ellpeck.actuallyadditions.api.lens.Lens;
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
import de.ellpeck.actuallyadditions.mod.blocks.BlockLaserRelay;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3i;
import net.minecraftforge.common.util.FakePlayerFactory;
import java.util.ArrayList;
import java.util.List;
@ -132,7 +117,7 @@ public class MethodHandler implements IMethodHandler {
@Override
public boolean invokeConversionLens(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) {
if (hitBlock != null) {
/* if (hitBlock != null) {
int range = 1;
int rangeX = 0;
int rangeY = 0;
@ -170,7 +155,7 @@ public class MethodHandler implements IMethodHandler {
recipe.transformHook(ItemStack.EMPTY, state, pos, tile);
if (output.getItem() instanceof BlockItem) {
Block toPlace = Block.byItem(output.getItem());
BlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), pos, facing, 0, 0, 0, output.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND);
BlockState state2Place = toPlace.defaultBlockState(); //.getStateForPlacement(tile.getWorldObject(), pos, facing, 0, 0, 0, output.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND); //TODO
tile.getWorldObject().setBlock(pos, state2Place, 2);
} else {
ItemEntity item = new ItemEntity(tile.getWorldObject(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output.copy());
@ -194,7 +179,7 @@ public class MethodHandler implements IMethodHandler {
List<ItemEntity> items = tile.getWorldObject().getEntitiesOfClass(ItemEntity.class, aabb);
for (ItemEntity item : items) {
ItemStack stack = item.getItem();
if (item.isAlive() && StackUtil.isValid(stack) && !item.getEntityData().getBoolean("aa_cnv")) {
if (item.isAlive() && StackUtil.isValid(stack) && !item.getPersistentData().getBoolean("aa_cnv")) {
LensConversionRecipe recipe = LensRecipeHandler.findMatchingRecipe(stack, tile.getLens());
if (recipe != null) {
int itemsPossible = Math.min(tile.getEnergy() / recipe.getEnergyUsed(), stack.getCount());
@ -215,7 +200,7 @@ public class MethodHandler implements IMethodHandler {
outputCopy.setCount(itemsPossible);
ItemEntity newItem = new ItemEntity(tile.getWorldObject(), item.getX(), item.getY(), item.getZ(), outputCopy);
newItem.getEntityData().putBoolean("aa_cnv", true);
newItem.getPersistentData().putBoolean("aa_cnv", true);
tile.getWorldObject().addFreshEntity(newItem);
tile.extractEnergy(recipe.getEnergyUsed() * itemsPossible);
@ -225,7 +210,7 @@ public class MethodHandler implements IMethodHandler {
}
}
return !hitState.getBlock().isAir(hitState, tile.getWorldObject(), hitBlock);
}
}*/
return false;
}
@ -256,7 +241,7 @@ public class MethodHandler implements IMethodHandler {
@Override
public boolean addCrusherRecipes(List<ItemStack> inputs, List<ItemStack> outputOnes, int outputOneAmounts, List<ItemStack> outputTwos, int outputTwoAmounts, int outputTwoChance) {
boolean hasWorkedOnce = false;
for (ItemStack input : inputs) {
/* for (ItemStack input : inputs) {
if (StackUtil.isValid(input) && CrusherRecipeRegistry.getRecipeFromInput(input) == null) {
for (ItemStack outputOne : outputOnes) {
if (StackUtil.isValid(outputOne) && !CrusherRecipeRegistry.hasBlacklistedOutput(outputOne, ConfigStringListValues.CRUSHER_OUTPUT_BLACKLIST.getValue())) {
@ -280,14 +265,14 @@ public class MethodHandler implements IMethodHandler {
}
}
}
}
}*/ //TODO
return hasWorkedOnce;
}
@Override
public boolean addCrusherRecipes(List<ItemStack> inputs, ItemStack outputOne, int outputOneAmount, ItemStack outputTwo, int outputTwoAmount, int outputTwoChance) {
boolean hasWorkedOnce = false;
for (ItemStack input : inputs) {
/* for (ItemStack input : inputs) {
if (StackUtil.isValid(input) && CrusherRecipeRegistry.getRecipeFromInput(input) == null) {
if (StackUtil.isValid(outputOne) && !CrusherRecipeRegistry.hasBlacklistedOutput(outputOne, ConfigStringListValues.CRUSHER_OUTPUT_BLACKLIST.getValue())) {
ItemStack outputOneCopy = outputOne.copy();
@ -305,7 +290,7 @@ public class MethodHandler implements IMethodHandler {
}
}
}
}
}*/
return hasWorkedOnce;
}