mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Made the Drill recharge if you put Batteries into the Upgrade Slots.
This commit is contained in:
parent
1465fab3d0
commit
996de5673f
8 changed files with 44 additions and 9 deletions
|
@ -77,7 +77,7 @@
|
||||||
-Ring of Aquadive: Fast underwater movement
|
-Ring of Aquadive: Fast underwater movement
|
||||||
-Ring of Suction: Sucks up Items in the area
|
-Ring of Suction: Sucks up Items in the area
|
||||||
-Ring of Water Absorption: Removes Water around
|
-Ring of Water Absorption: Removes Water around
|
||||||
-Ring of Striptease (Or something like that): Attacker lose parts of their Armor
|
-Ring of Unarmoring: Attacker lose parts of their Armor
|
||||||
|
|
||||||
-Food Cannon
|
-Food Cannon
|
||||||
-Shoots Food Items
|
-Shoots Food Items
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package ellpeck.actuallyadditions.inventory;
|
package ellpeck.actuallyadditions.inventory;
|
||||||
|
|
||||||
|
import cofh.api.energy.IEnergyContainerItem;
|
||||||
import ellpeck.actuallyadditions.inventory.slot.SlotImmovable;
|
import ellpeck.actuallyadditions.inventory.slot.SlotImmovable;
|
||||||
import ellpeck.actuallyadditions.items.ItemDrill;
|
import ellpeck.actuallyadditions.items.ItemDrill;
|
||||||
import ellpeck.actuallyadditions.items.ItemDrillUpgrade;
|
import ellpeck.actuallyadditions.items.ItemDrillUpgrade;
|
||||||
|
@ -26,7 +27,7 @@ public class ContainerDrill extends Container{
|
||||||
this.addSlotToContainer(new Slot(drillInventory, i, 44+i*18, 19){
|
this.addSlotToContainer(new Slot(drillInventory, i, 44+i*18, 19){
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValid(ItemStack stack){
|
public boolean isItemValid(ItemStack stack){
|
||||||
return stack.getItem() instanceof ItemDrillUpgrade;
|
return stack.getItem() instanceof ItemDrillUpgrade || stack.getItem() instanceof IEnergyContainerItem;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -86,7 +87,7 @@ public class ContainerDrill extends Container{
|
||||||
//Other Slots in Inventory excluded
|
//Other Slots in Inventory excluded
|
||||||
if(slot >= inventoryStart){
|
if(slot >= inventoryStart){
|
||||||
//Shift from Inventory
|
//Shift from Inventory
|
||||||
if(newStack.getItem() instanceof ItemDrillUpgrade){
|
if(newStack.getItem() instanceof ItemDrillUpgrade || newStack.getItem() instanceof IEnergyContainerItem){
|
||||||
if(!this.mergeItemStack(newStack, 0, 5, false)) return null;
|
if(!this.mergeItemStack(newStack, 0, 5, false)) return null;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
|
@ -90,6 +90,10 @@ public class InitItems{
|
||||||
public static Item itemDrillUpgradeBlockPlacing;
|
public static Item itemDrillUpgradeBlockPlacing;
|
||||||
|
|
||||||
public static Item itemBattery;
|
public static Item itemBattery;
|
||||||
|
public static Item itemBatteryDouble;
|
||||||
|
public static Item itemBatteryTriple;
|
||||||
|
public static Item itemBatteryQuadruple;
|
||||||
|
public static Item itemBatteryQuintuple;
|
||||||
|
|
||||||
public static Item itemTeleStaff;
|
public static Item itemTeleStaff;
|
||||||
|
|
||||||
|
@ -114,8 +118,12 @@ public class InitItems{
|
||||||
itemDrill = new ItemDrill();
|
itemDrill = new ItemDrill();
|
||||||
ItemUtil.register(itemDrill);
|
ItemUtil.register(itemDrill);
|
||||||
|
|
||||||
itemBattery = new ItemBattery();
|
itemBattery = new ItemBattery("itemBattery", 1000000, 5000);
|
||||||
ItemUtil.register(itemBattery);
|
itemBatteryDouble = new ItemBattery("itemBatteryDouble", 2000000, 10000);
|
||||||
|
itemBatteryTriple = new ItemBattery("itemBatteryTriple", 3000000, 15000);
|
||||||
|
itemBatteryQuadruple = new ItemBattery("itemBatteryQuadruple", 4000000, 20000);
|
||||||
|
itemBatteryQuintuple = new ItemBattery("itemBatteryQuintuple", 5000000, 25000);
|
||||||
|
ItemUtil.registerItems(new Item[]{itemBattery, itemBatteryDouble, itemBatteryTriple, itemBatteryQuadruple, itemBatteryQuintuple});
|
||||||
|
|
||||||
itemDrillUpgradeSpeed = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED, "itemDrillUpgradeSpeed");
|
itemDrillUpgradeSpeed = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED, "itemDrillUpgradeSpeed");
|
||||||
itemDrillUpgradeSpeedII = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED_II, "itemDrillUpgradeSpeedII");
|
itemDrillUpgradeSpeedII = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED_II, "itemDrillUpgradeSpeedII");
|
||||||
|
|
|
@ -11,9 +11,12 @@ import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
public class ItemBattery extends ItemEnergy implements INameableItem{
|
public class ItemBattery extends ItemEnergy implements INameableItem{
|
||||||
|
|
||||||
public ItemBattery(){
|
private String name;
|
||||||
super(1000000, 10000, 1);
|
|
||||||
|
public ItemBattery(String name, int capacity, int transfer){
|
||||||
|
super(capacity, transfer, 1);
|
||||||
this.setMaxStackSize(1);
|
this.setMaxStackSize(1);
|
||||||
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -34,6 +37,6 @@ public class ItemBattery extends ItemEnergy implements INameableItem{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName(){
|
public String getName(){
|
||||||
return "itemBattery";
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package ellpeck.actuallyadditions.items;
|
package ellpeck.actuallyadditions.items;
|
||||||
|
|
||||||
|
import cofh.api.energy.IEnergyContainerItem;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
@ -15,6 +16,7 @@ import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.enchantment.Enchantment;
|
import net.minecraft.enchantment.Enchantment;
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.SharedMonsterAttributes;
|
import net.minecraft.entity.SharedMonsterAttributes;
|
||||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||||
|
@ -38,7 +40,7 @@ import java.util.Set;
|
||||||
public class ItemDrill extends ItemEnergy implements INameableItem{
|
public class ItemDrill extends ItemEnergy implements INameableItem{
|
||||||
|
|
||||||
public ItemDrill(){
|
public ItemDrill(){
|
||||||
super(500000, 5000, 3);
|
super(500000, 5000, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float defaultEfficiency = ConfigFloatValues.DRILL_DAMAGE.getValue();
|
public static float defaultEfficiency = ConfigFloatValues.DRILL_DAMAGE.getValue();
|
||||||
|
@ -73,6 +75,26 @@ public class ItemDrill extends ItemEnergy implements INameableItem{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){
|
||||||
|
NBTTagCompound compound = stack.getTagCompound();
|
||||||
|
if(compound == null) return;
|
||||||
|
|
||||||
|
ItemStack[] slots = this.getSlotsFromNBT(stack);
|
||||||
|
if(slots != null && slots.length > 0){
|
||||||
|
for(ItemStack slotStack : slots){
|
||||||
|
if(slotStack != null && slotStack.getItem() instanceof IEnergyContainerItem){
|
||||||
|
if(this.getEnergyStored(stack) < this.getMaxEnergyStored(stack)){
|
||||||
|
int energy = ((IEnergyContainerItem)slotStack.getItem()).getEnergyStored(slotStack);
|
||||||
|
if(energy > 0){
|
||||||
|
int received = ((IEnergyContainerItem)stack.getItem()).receiveEnergy(stack, energy, false);
|
||||||
|
((IEnergyContainerItem)slotStack.getItem()).extractEnergy(slotStack, received, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public float getEfficiencyFromUpgrade(ItemStack stack){
|
public float getEfficiencyFromUpgrade(ItemStack stack){
|
||||||
float efficiency = defaultEfficiency;
|
float efficiency = defaultEfficiency;
|
||||||
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED)){
|
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED)){
|
||||||
|
|
|
@ -23,6 +23,7 @@ item.actuallyadditions.itemDrill.name=Drill
|
||||||
tooltip.actuallyadditions.itemDrill.desc.1=Mines all the Blocks!
|
tooltip.actuallyadditions.itemDrill.desc.1=Mines all the Blocks!
|
||||||
tooltip.actuallyadditions.itemDrill.desc.2=Powered by RF! Charge in an Energizer! Discharge in an Enervator!
|
tooltip.actuallyadditions.itemDrill.desc.2=Powered by RF! Charge in an Energizer! Discharge in an Enervator!
|
||||||
tooltip.actuallyadditions.itemDrill.desc.3=Drill Upgrades can be applied through Sneak-Right-Clicking!
|
tooltip.actuallyadditions.itemDrill.desc.3=Drill Upgrades can be applied through Sneak-Right-Clicking!
|
||||||
|
tooltip.actuallyadditions.itemDrill.desc.4=Put in a filled Battery to make me recharge automatically!
|
||||||
|
|
||||||
tile.actuallyadditions.blockMiscWoodCasing.name=Wood Casing
|
tile.actuallyadditions.blockMiscWoodCasing.name=Wood Casing
|
||||||
tile.actuallyadditions.blockMiscStoneCasing.name=Stone Casing
|
tile.actuallyadditions.blockMiscStoneCasing.name=Stone Casing
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 484 B After Width: | Height: | Size: 470 B |
Binary file not shown.
Before Width: | Height: | Size: 567 B After Width: | Height: | Size: 514 B |
Loading…
Reference in a new issue