Silk Touch Upgrade for the Destructor (#471)
* Silk Touch Upgrade for the Destructor * Removed unused imports * Naming Convention * Get enchant by string id * Moved if * Forgot to add the renamed files and fix some coding style * Unused statement * Remove unused var
This commit is contained in:
@@ -70,6 +70,7 @@ public final class RSConfig {
|
||||
public int craftingUpgradeUsage;
|
||||
public int stackUpgradeUsage;
|
||||
public int interdimensionalUpgradeUsage;
|
||||
public int silkTouchUpgradeUsage;
|
||||
//endregion
|
||||
|
||||
//region Categories
|
||||
@@ -157,6 +158,7 @@ public final class RSConfig {
|
||||
craftingUpgradeUsage = config.getInt("crafting", UPGRADES, 5, 0, Integer.MAX_VALUE, "The additional energy used per Crafting Upgrade");
|
||||
stackUpgradeUsage = config.getInt("stack", UPGRADES, 12, 0, Integer.MAX_VALUE, "The additional energy used per Stack Upgrade");
|
||||
interdimensionalUpgradeUsage = config.getInt("interdimensional", UPGRADES, 1000, 0, Integer.MAX_VALUE, "The additional energy used by the Interdimensional Upgrade");
|
||||
silkTouchUpgradeUsage = config.getInt("silkTouch", UPGRADES, 15, 0, Integer.MAX_VALUE, "The additional energy used by the Silk Touch Upgrade");
|
||||
//endregion
|
||||
|
||||
if (config.hasChanged()) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package refinedstorage.item;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentData;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -15,6 +17,7 @@ public class ItemUpgrade extends ItemBase {
|
||||
public static final int TYPE_CRAFTING = 3;
|
||||
public static final int TYPE_STACK = 4;
|
||||
public static final int TYPE_INTERDIMENSIONAL = 5;
|
||||
public static final int TYPE_SILK_TOUCH = 6;
|
||||
|
||||
public ItemUpgrade() {
|
||||
super("upgrade");
|
||||
@@ -26,7 +29,7 @@ public class ItemUpgrade extends ItemBase {
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for (int i = 0; i <= 5; ++i) {
|
||||
for (int i = 0; i <= 6; ++i) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
@@ -43,6 +46,8 @@ public class ItemUpgrade extends ItemBase {
|
||||
return RS.INSTANCE.config.stackUpgradeUsage;
|
||||
case TYPE_INTERDIMENSIONAL:
|
||||
return RS.INSTANCE.config.interdimensionalUpgradeUsage;
|
||||
case TYPE_SILK_TOUCH:
|
||||
return RS.INSTANCE.config.silkTouchUpgradeUsage;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@@ -58,6 +63,8 @@ public class ItemUpgrade extends ItemBase {
|
||||
return new ItemStack(Blocks.CRAFTING_TABLE);
|
||||
case ItemUpgrade.TYPE_INTERDIMENSIONAL:
|
||||
return new ItemStack(Items.NETHER_STAR);
|
||||
case ItemUpgrade.TYPE_SILK_TOUCH:
|
||||
return Items.ENCHANTED_BOOK.getEnchantedItemStack(new EnchantmentData(Enchantment.getEnchantmentByLocation("silk_touch"), 1));
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -197,7 +197,8 @@ public class ClientProxy extends CommonProxy {
|
||||
new ResourceLocation("refinedstorage:range_upgrade"),
|
||||
new ResourceLocation("refinedstorage:speed_upgrade"),
|
||||
new ResourceLocation("refinedstorage:stack_upgrade"),
|
||||
new ResourceLocation("refinedstorage:interdimensional_upgrade")
|
||||
new ResourceLocation("refinedstorage:interdimensional_upgrade"),
|
||||
new ResourceLocation("refinedstorage:silk_touch_upgrade")
|
||||
);
|
||||
|
||||
// Items
|
||||
@@ -249,6 +250,7 @@ public class ClientProxy extends CommonProxy {
|
||||
ModelLoader.setCustomModelResourceLocation(RSItems.UPGRADE, ItemUpgrade.TYPE_CRAFTING, new ModelResourceLocation("refinedstorage:crafting_upgrade", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(RSItems.UPGRADE, ItemUpgrade.TYPE_STACK, new ModelResourceLocation("refinedstorage:stack_upgrade", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(RSItems.UPGRADE, ItemUpgrade.TYPE_INTERDIMENSIONAL, new ModelResourceLocation("refinedstorage:interdimensional_upgrade", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(RSItems.UPGRADE, ItemUpgrade.TYPE_SILK_TOUCH, new ModelResourceLocation("refinedstorage:silk_touch_upgrade", "inventory"));
|
||||
|
||||
// Blocks
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.CABLE), 0, new ModelResourceLocation("refinedstorage:cable", "inventory"));
|
||||
|
||||
@@ -540,6 +540,7 @@ public class CommonProxy {
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_RANGE));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_SPEED));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_INTERDIMENSIONAL));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_SILK_TOUCH));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_CRAFTING));
|
||||
|
||||
GameRegistry.addShapedRecipe(new ItemStack(RSItems.UPGRADE, 1, ItemUpgrade.TYPE_STACK),
|
||||
|
||||
@@ -38,6 +38,7 @@ import refinedstorage.tile.data.ITileDataProducer;
|
||||
import refinedstorage.tile.data.TileDataParameter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class TileDestructor extends TileMultipartNode implements IComparable, IFilterable, IType {
|
||||
@@ -68,7 +69,7 @@ public class TileDestructor extends TileMultipartNode implements IComparable, IF
|
||||
private ItemHandlerBasic itemFilters = new ItemHandlerBasic(9, this);
|
||||
private ItemHandlerFluid fluidFilters = new ItemHandlerFluid(9, this);
|
||||
|
||||
private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, this, ItemUpgrade.TYPE_SPEED);
|
||||
private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, this, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_SILK_TOUCH);
|
||||
|
||||
private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
|
||||
private int mode = IFilterable.WHITELIST;
|
||||
@@ -125,7 +126,18 @@ public class TileDestructor extends TileMultipartNode implements IComparable, IF
|
||||
|
||||
if (frontStack != null) {
|
||||
if (IFilterable.canTake(itemFilters, mode, compare, frontStack)) {
|
||||
List<ItemStack> drops = frontBlockState.getBlock().getDrops(worldObj, front, frontBlockState, 0);
|
||||
List<ItemStack> drops;
|
||||
if (!upgrades.hasUpgrade(ItemUpgrade.TYPE_SILK_TOUCH)) {
|
||||
drops = frontBlockState.getBlock().getDrops(worldObj, front, frontBlockState, 0);
|
||||
} else {
|
||||
drops = Collections.singletonList(frontStack);
|
||||
}
|
||||
|
||||
for (ItemStack drop : drops) {
|
||||
if (network.insertItem(drop, drop.stackSize, true) != null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
worldObj.playEvent(null, 2001, front, Block.getStateId(frontBlockState));
|
||||
worldObj.setBlockToAir(front);
|
||||
@@ -136,11 +148,7 @@ public class TileDestructor extends TileMultipartNode implements IComparable, IF
|
||||
if (network == null) {
|
||||
InventoryHelper.spawnItemStack(worldObj, front.getX(), front.getY(), front.getZ(), drop);
|
||||
} else {
|
||||
ItemStack remainder = network.insertItem(drop, drop.stackSize, false);
|
||||
|
||||
if (remainder != null) {
|
||||
InventoryHelper.spawnItemStack(worldObj, front.getX(), front.getY(), front.getZ(), remainder);
|
||||
}
|
||||
network.insertItem(drop, drop.stackSize, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,6 +212,7 @@ item.refinedstorage:upgrade.2.name=Speed Upgrade
|
||||
item.refinedstorage:upgrade.3.name=Crafting Upgrade
|
||||
item.refinedstorage:upgrade.4.name=Stack Upgrade
|
||||
item.refinedstorage:upgrade.5.name=Interdimensional Upgrade
|
||||
item.refinedstorage:upgrade.6.name=Silk Touch Upgrade
|
||||
item.refinedstorage:storage_housing.name=Storage Housing
|
||||
item.refinedstorage:grid_filter.name=Grid Filter
|
||||
item.refinedstorage:network_card.name=Network Card
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "refinedstorage:items/silk_touch_upgrade" // Place Holder
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
Reference in New Issue
Block a user