mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Changed the Phantomfaces' Description up, added TeleStaffs and made them work
This commit is contained in:
parent
963feee3e9
commit
8b72bbf79e
9 changed files with 182 additions and 77 deletions
|
@ -19,6 +19,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ChatComponentText;
|
import net.minecraft.util.ChatComponentText;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -58,28 +59,36 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
if(tile != null){
|
if(tile != null){
|
||||||
if(tile instanceof TileEntityPhantomface){
|
if(tile instanceof TileEntityPhantomface){
|
||||||
|
player.addChatComponentMessage(new ChatComponentText(""));
|
||||||
TileEntityPhantomface phantom = (TileEntityPhantomface)tile;
|
TileEntityPhantomface phantom = (TileEntityPhantomface)tile;
|
||||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc") + ": " + phantom.range));
|
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc") + ": " + phantom.range));
|
||||||
if(phantom.hasBoundTile()){
|
if(phantom.hasBoundTile()){
|
||||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.blockInfo.desc", phantom.boundPosition.getBlock().getLocalizedName(), phantom.boundPosition.getX()-phantom.xCoord, phantom.boundPosition.getY()-phantom.yCoord, phantom.boundPosition.getZ()-phantom.zCoord)));
|
int distance = (int)Vec3.createVectorHelper(x, y, z).distanceTo(Vec3.createVectorHelper(phantom.boundPosition.getX(), phantom.boundPosition.getY(), phantom.boundPosition.getZ()));
|
||||||
if(phantom.isBoundTileInRage()) player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedBlock.desc", phantom.boundPosition.getX(), phantom.boundPosition.getY(), phantom.boundPosition.getZ())));
|
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.blockInfo.desc", phantom.boundPosition.getBlock().getLocalizedName(), phantom.boundPosition.getX(), phantom.boundPosition.getY(), phantom.boundPosition.getZ(), distance)));
|
||||||
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc", phantom.boundPosition.getX(), phantom.boundPosition.getY(), phantom.boundPosition.getZ())));
|
|
||||||
|
if(phantom.isBoundTileInRage()) player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedRange.desc")));
|
||||||
|
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc")));
|
||||||
}
|
}
|
||||||
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc")));
|
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc")));
|
||||||
|
player.addChatComponentMessage(new ChatComponentText(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(tile instanceof TileEntityPhantomPlacer){
|
else if(tile instanceof TileEntityPhantomPlacer){
|
||||||
if(player.isSneaking()){
|
if(player.isSneaking()){
|
||||||
|
player.addChatComponentMessage(new ChatComponentText(""));
|
||||||
TileEntityPhantomPlacer phantom = (TileEntityPhantomPlacer)tile;
|
TileEntityPhantomPlacer phantom = (TileEntityPhantomPlacer)tile;
|
||||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc") + ": " + phantom.range));
|
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc") + ": " + phantom.range));
|
||||||
if(phantom.hasBoundPosition()){
|
if(phantom.hasBoundPosition()){
|
||||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.blockInfo.desc", phantom.boundPosition.getBlock().getLocalizedName(), phantom.boundPosition.getX()-phantom.xCoord, phantom.boundPosition.getY()-phantom.yCoord, phantom.boundPosition.getZ()-phantom.zCoord)));
|
int distance = (int)Vec3.createVectorHelper(x, y, z).distanceTo(Vec3.createVectorHelper(phantom.boundPosition.getX(), phantom.boundPosition.getY(), phantom.boundPosition.getZ()));
|
||||||
if(phantom.isBoundPositionInRange()) player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedBlock.desc", phantom.boundPosition.getX(), phantom.boundPosition.getY(), phantom.boundPosition.getZ())));
|
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.blockInfo.desc", phantom.boundPosition.getBlock().getLocalizedName(), phantom.boundPosition.getX(), phantom.boundPosition.getY(), phantom.boundPosition.getZ(), distance)));
|
||||||
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc", phantom.boundPosition.getX(), phantom.boundPosition.getY(), phantom.boundPosition.getZ())));
|
|
||||||
|
if(phantom.isBoundPositionInRange()) player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedRange.desc")));
|
||||||
|
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc")));
|
||||||
}
|
}
|
||||||
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc")));
|
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc")));
|
||||||
}
|
}
|
||||||
else player.openGui(ActuallyAdditions.instance, GuiHandler.PHANTOM_PLACER_ID, world, x, y, z);
|
else player.openGui(ActuallyAdditions.instance, GuiHandler.PHANTOM_PLACER_ID, world, x, y, z);
|
||||||
|
player.addChatComponentMessage(new ChatComponentText(""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@ public class CreativeTab extends CreativeTabs{
|
||||||
add(InitItems.itemDrillUpgradeFiveByFive);
|
add(InitItems.itemDrillUpgradeFiveByFive);
|
||||||
add(InitItems.itemDrillUpgradeBlockPlacing);
|
add(InitItems.itemDrillUpgradeBlockPlacing);
|
||||||
add(InitItems.itemBattery);
|
add(InitItems.itemBattery);
|
||||||
|
add(InitItems.itemTeleStaff);
|
||||||
|
|
||||||
add(InitItems.itemPhantomConnector);
|
add(InitItems.itemPhantomConnector);
|
||||||
add(InitItems.itemBucketCanolaOil);
|
add(InitItems.itemBucketCanolaOil);
|
||||||
|
|
|
@ -80,9 +80,14 @@ public class InitItems{
|
||||||
|
|
||||||
public static Item itemBattery;
|
public static Item itemBattery;
|
||||||
|
|
||||||
|
public static Item itemTeleStaff;
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
ModUtil.LOGGER.info("Initializing Items...");
|
ModUtil.LOGGER.info("Initializing Items...");
|
||||||
|
|
||||||
|
itemTeleStaff = new ItemTeleStaff();
|
||||||
|
ItemUtil.register(itemTeleStaff);
|
||||||
|
|
||||||
itemDrill = new ItemDrill();
|
itemDrill = new ItemDrill();
|
||||||
ItemUtil.register(itemDrill);
|
ItemUtil.register(itemDrill);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package ellpeck.actuallyadditions.items;
|
package ellpeck.actuallyadditions.items;
|
||||||
|
|
||||||
import cofh.api.energy.ItemEnergyContainer;
|
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
@ -11,22 +10,20 @@ import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||||
import ellpeck.actuallyadditions.inventory.GuiHandler;
|
import ellpeck.actuallyadditions.inventory.GuiHandler;
|
||||||
import ellpeck.actuallyadditions.items.tools.ItemAllToolAA;
|
import ellpeck.actuallyadditions.items.tools.ItemAllToolAA;
|
||||||
import ellpeck.actuallyadditions.util.INameableItem;
|
import ellpeck.actuallyadditions.util.INameableItem;
|
||||||
import ellpeck.actuallyadditions.util.ItemUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.KeyUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
|
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.enchantment.Enchantment;
|
import net.minecraft.enchantment.Enchantment;
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
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;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
@ -37,11 +34,10 @@ import net.minecraft.world.World;
|
||||||
import org.apache.logging.log4j.Level;
|
import org.apache.logging.log4j.Level;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class ItemDrill extends ItemEnergyContainer implements INameableItem{
|
public class ItemDrill extends ItemEnergy implements INameableItem{
|
||||||
|
|
||||||
private static final Set allSet = Sets.newHashSet();
|
private static final Set allSet = Sets.newHashSet();
|
||||||
static{
|
static{
|
||||||
|
@ -50,21 +46,12 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemDrill(){
|
public ItemDrill(){
|
||||||
super(500000, 5000);
|
super(500000, 5000, 3);
|
||||||
this.setMaxStackSize(1);
|
|
||||||
this.setHasSubtypes(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float defaultEfficiency = ConfigFloatValues.DRILL_DAMAGE.getValue();
|
public static float defaultEfficiency = ConfigFloatValues.DRILL_DAMAGE.getValue();
|
||||||
public static int energyUsePerBlockOrHit = ConfigIntValues.DRILL_ENERGY_USE.getValue();
|
public static int energyUsePerBlockOrHit = ConfigIntValues.DRILL_ENERGY_USE.getValue();
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getDurabilityForDisplay(ItemStack stack){
|
|
||||||
double energyDif = getMaxEnergyStored(stack)-getEnergyStored(stack);
|
|
||||||
double maxAmount = getMaxEnergyStored(stack);
|
|
||||||
return energyDif/maxAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int hitSide, float hitX, float hitY, float hitZ){
|
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int hitSide, float hitX, float hitY, float hitZ){
|
||||||
ItemStack upgrade = this.getHasUpgradeAsStack(stack, ItemDrillUpgrade.UpgradeType.PLACER);
|
ItemStack upgrade = this.getHasUpgradeAsStack(stack, ItemDrillUpgrade.UpgradeType.PLACER);
|
||||||
|
@ -94,16 +81,6 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean showDurabilityBar(ItemStack itemStack){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreated(ItemStack stack, World world, EntityPlayer player){
|
|
||||||
this.setEnergy(stack, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
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)){
|
||||||
|
@ -142,12 +119,6 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{
|
||||||
return use;
|
return use;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public boolean hasEffect(ItemStack stack, int pass){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack){
|
||||||
return EnumRarity.epic;
|
return EnumRarity.epic;
|
||||||
|
@ -183,13 +154,6 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{
|
||||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
|
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnergy(ItemStack stack, int energy){
|
|
||||||
NBTTagCompound compound = stack.getTagCompound();
|
|
||||||
if(compound == null) compound = new NBTTagCompound();
|
|
||||||
compound.setInteger("Energy", energy);
|
|
||||||
stack.setTagCompound(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void writeSlotsToNBT(ItemStack[] slots, ItemStack stack){
|
public void writeSlotsToNBT(ItemStack[] slots, ItemStack stack){
|
||||||
NBTTagCompound compound = stack.getTagCompound();
|
NBTTagCompound compound = stack.getTagCompound();
|
||||||
if(compound == null) compound = new NBTTagCompound();
|
if(compound == null) compound = new NBTTagCompound();
|
||||||
|
@ -210,18 +174,6 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{
|
||||||
stack.setTagCompound(compound);
|
stack.setTagCompound(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void getSubItems(Item item, CreativeTabs tabs, List list){
|
|
||||||
ItemStack stackFull = new ItemStack(this);
|
|
||||||
this.setEnergy(stackFull, this.getMaxEnergyStored(stackFull));
|
|
||||||
list.add(stackFull);
|
|
||||||
|
|
||||||
ItemStack stackEmpty = new ItemStack(this);
|
|
||||||
this.setEnergy(stackEmpty, 0);
|
|
||||||
list.add(stackEmpty);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack[] getSlotsFromNBT(ItemStack stack){
|
public ItemStack[] getSlotsFromNBT(ItemStack stack){
|
||||||
NBTTagCompound compound = stack.getTagCompound();
|
NBTTagCompound compound = stack.getTagCompound();
|
||||||
if(compound == null) return null;
|
if(compound == null) return null;
|
||||||
|
@ -247,7 +199,8 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{
|
||||||
int yRange = radius;
|
int yRange = radius;
|
||||||
int zRange = 0;
|
int zRange = 0;
|
||||||
|
|
||||||
MovingObjectPosition pos = this.getMovingObjectPositionFromPlayer(world, player, false);
|
MovingObjectPosition pos = WorldUtil.getMovingObjectPosWithReachDistance(world, player, ((EntityPlayerMP)player).theItemInWorldManager.getBlockReachDistance());
|
||||||
|
|
||||||
if(pos != null){
|
if(pos != null){
|
||||||
int side = pos.sideHit;
|
int side = pos.sideHit;
|
||||||
if(side == 0 || side == 1){
|
if(side == 0 || side == 1){
|
||||||
|
@ -375,24 +328,10 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{
|
||||||
return this.func_150893_a(stack, block);
|
return this.func_150893_a(stack, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
|
|
||||||
ItemUtil.addInformation(this, list, 3, "");
|
|
||||||
if(KeyUtil.isShiftPressed()){
|
|
||||||
list.add(this.getEnergyStored(stack) + "/" + this.getMaxEnergyStored(stack) + " RF");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Multimap getAttributeModifiers(ItemStack stack){
|
public Multimap getAttributeModifiers(ItemStack stack){
|
||||||
Multimap map = super.getAttributeModifiers(stack);
|
Multimap map = super.getAttributeModifiers(stack);
|
||||||
map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", this.getEnergyStored(stack) >= energyUsePerBlockOrHit ? 8.0F : 0.0F, 0));
|
map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", this.getEnergyStored(stack) >= energyUsePerBlockOrHit ? 8.0F : 0.0F, 0));
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getShareTag(){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
package ellpeck.actuallyadditions.items;
|
||||||
|
|
||||||
|
import cofh.api.energy.ItemEnergyContainer;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import ellpeck.actuallyadditions.util.ItemUtil;
|
||||||
|
import ellpeck.actuallyadditions.util.KeyUtil;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public abstract class ItemEnergy extends ItemEnergyContainer{
|
||||||
|
|
||||||
|
private int infoLines;
|
||||||
|
|
||||||
|
public ItemEnergy(int maxPower, int transfer, int infoLines){
|
||||||
|
super(maxPower, transfer);
|
||||||
|
this.setHasSubtypes(true);
|
||||||
|
this.setMaxStackSize(1);
|
||||||
|
this.infoLines = infoLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getDurabilityForDisplay(ItemStack stack){
|
||||||
|
double energyDif = getMaxEnergyStored(stack)-getEnergyStored(stack);
|
||||||
|
double maxAmount = getMaxEnergyStored(stack);
|
||||||
|
return energyDif/maxAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean showDurabilityBar(ItemStack itemStack){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreated(ItemStack stack, World world, EntityPlayer player){
|
||||||
|
this.setEnergy(stack, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public boolean hasEffect(ItemStack stack, int pass){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getShareTag(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void getSubItems(Item item, CreativeTabs tabs, List list){
|
||||||
|
ItemStack stackFull = new ItemStack(this);
|
||||||
|
this.setEnergy(stackFull, this.getMaxEnergyStored(stackFull));
|
||||||
|
list.add(stackFull);
|
||||||
|
|
||||||
|
ItemStack stackEmpty = new ItemStack(this);
|
||||||
|
this.setEnergy(stackEmpty, 0);
|
||||||
|
list.add(stackEmpty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnergy(ItemStack stack, int energy){
|
||||||
|
NBTTagCompound compound = stack.getTagCompound();
|
||||||
|
if(compound == null) compound = new NBTTagCompound();
|
||||||
|
compound.setInteger("Energy", energy);
|
||||||
|
stack.setTagCompound(compound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
|
||||||
|
ItemUtil.addInformation(this, list, this.infoLines, "");
|
||||||
|
if(KeyUtil.isShiftPressed()){
|
||||||
|
list.add(this.getEnergyStored(stack) + "/" + this.getMaxEnergyStored(stack) + " RF");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package ellpeck.actuallyadditions.items;
|
||||||
|
|
||||||
|
import ellpeck.actuallyadditions.util.INameableItem;
|
||||||
|
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
public class ItemTeleStaff extends ItemEnergy implements INameableItem{
|
||||||
|
|
||||||
|
private static final double reach = 250D;
|
||||||
|
private static final int energyUsedPerBlock = 250;
|
||||||
|
|
||||||
|
public ItemTeleStaff(){
|
||||||
|
super(1000000, 12000, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(){
|
||||||
|
return "itemTeleStaff";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
|
||||||
|
MovingObjectPosition pos = WorldUtil.getMovingObjectPosWithReachDistance(world, player, reach, false, true, false);
|
||||||
|
if(pos != null){
|
||||||
|
int side = pos.sideHit;
|
||||||
|
if(side != -1){
|
||||||
|
ForgeDirection forgeSide = ForgeDirection.getOrientation(side);
|
||||||
|
if(forgeSide != ForgeDirection.UNKNOWN){
|
||||||
|
double x = pos.hitVec.xCoord-(side == 4 ? 0.5 : 0)+(side == 5 ? 0.5 : 0);
|
||||||
|
double y = pos.hitVec.yCoord-(side == 0 ? 2.0 : 0)+(side == 1 ? 0.5 : 0);
|
||||||
|
double z = pos.hitVec.zCoord-(side == 2 ? 0.5 : 0)+(side == 3 ? 0.5 : 0);
|
||||||
|
int use = energyUsedPerBlock+(int)(energyUsedPerBlock*pos.hitVec.distanceTo(player.getPosition(1.0F)));
|
||||||
|
if(this.getEnergyStored(stack) >= use){
|
||||||
|
player.swingItem();
|
||||||
|
if(!world.isRemote){
|
||||||
|
((EntityPlayerMP)player).playerNetServerHandler.setPlayerLocation(x, y, z, player.rotationYaw, player.rotationPitch);
|
||||||
|
this.extractEnergy(stack, use, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,7 +5,7 @@ import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
public class ModUtil{
|
public class ModUtil{
|
||||||
|
|
||||||
public static final String VERSION = "1.7.10-0.0.6.5";
|
public static final String VERSION = "1.7.10-0.0.6.4";
|
||||||
|
|
||||||
public static final String MOD_ID = "ActuallyAdditions";
|
public static final String MOD_ID = "ActuallyAdditions";
|
||||||
public static final String NAME = "Actually Additions";
|
public static final String NAME = "Actually Additions";
|
||||||
|
|
|
@ -5,9 +5,13 @@ import cofh.api.energy.IEnergyReceiver;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.WorldServer;
|
||||||
import net.minecraftforge.common.IPlantable;
|
import net.minecraftforge.common.IPlantable;
|
||||||
|
@ -208,4 +212,16 @@ public class WorldUtil{
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MovingObjectPosition getMovingObjectPosWithReachDistance(World world, EntityPlayer player, double distance){
|
||||||
|
return getMovingObjectPosWithReachDistance(world, player, distance, false, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MovingObjectPosition getMovingObjectPosWithReachDistance(World world, EntityPlayer player, double distance, boolean arg1, boolean arg2, boolean arg3){
|
||||||
|
float f1 = player.prevRotationPitch+(player.rotationPitch-player.prevRotationPitch)*1.0F;
|
||||||
|
float f2 = player.prevRotationYaw+(player.rotationYaw-player.prevRotationYaw)*1.0F;
|
||||||
|
Vec3 vec = Vec3.createVectorHelper(player.prevPosX+(player.posX-player.prevPosX)*(double)1.0F, player.prevPosY+(player.posY-player.prevPosY)*(double)1.0F+(double)(world.isRemote ? player.getEyeHeight()-player.getDefaultEyeHeight() : player.getEyeHeight()), player.prevPosZ+(player.posZ-player.prevPosZ)*(double)1.0F);
|
||||||
|
Vec3 vec1 = vec.addVector((double)MathHelper.sin(-f2*0.017453292F-(float)Math.PI)*-MathHelper.cos(-f1*0.017453292F)*distance, (double)MathHelper.sin(-f1*0.017453292F)*distance, (double)MathHelper.cos(-f2*0.017453292F-(float)Math.PI)*-MathHelper.cos(-f1*0.017453292F)*distance);
|
||||||
|
return world.func_147447_a(vec, vec1, arg1, arg2, arg3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,10 +264,10 @@ tooltip.actuallyadditions.phantom.stored.desc=<Block stored to this Connector!>
|
||||||
tooltip.actuallyadditions.phantom.unbound.desc=The Connection was cleared!
|
tooltip.actuallyadditions.phantom.unbound.desc=The Connection was cleared!
|
||||||
tooltip.actuallyadditions.phantom.inWorld.desc=In World
|
tooltip.actuallyadditions.phantom.inWorld.desc=In World
|
||||||
tooltip.actuallyadditions.phantom.boundTo.desc=Bound to
|
tooltip.actuallyadditions.phantom.boundTo.desc=Bound to
|
||||||
tooltip.actuallyadditions.phantom.connectedBlock.desc=Connected to Block at %s, %s, %s
|
tooltip.actuallyadditions.phantom.connectedRange.desc=The Connection is fine and working.
|
||||||
tooltip.actuallyadditions.phantom.connectedNoRange.desc=Connected to Block at %s, %s, %s but it is not in Range, not loaded or not the right type of Inventory!
|
tooltip.actuallyadditions.phantom.connectedNoRange.desc=The Connection is obstructed: It is either not in Range, not in loaded Chunks or not the right type of Block for this Phantom Device.
|
||||||
tooltip.actuallyadditions.phantom.notConnected.desc=This isn't connected to anything!
|
tooltip.actuallyadditions.phantom.notConnected.desc=This isn't connected to anything!
|
||||||
tooltip.actuallyadditions.phantom.blockInfo.desc=The connected Block is a %s that is %s, %s, %s Blocks away.
|
tooltip.actuallyadditions.phantom.blockInfo.desc=The connected Block is a %s at %s, %s, %s that is %s Blocks away.
|
||||||
|
|
||||||
tooltip.actuallyadditions.factory.notPart.desc=The Controller isn't part of the right Multi-Block! Look at the Controller's Description!
|
tooltip.actuallyadditions.factory.notPart.desc=The Controller isn't part of the right Multi-Block! Look at the Controller's Description!
|
||||||
tooltip.actuallyadditions.factory.works.desc=This Lava Factory is complete and can produce Lava!
|
tooltip.actuallyadditions.factory.works.desc=This Lava Factory is complete and can produce Lava!
|
||||||
|
|
Loading…
Reference in a new issue