Skip to content

Commit

Permalink
Infinite staff (#83)
Browse files Browse the repository at this point in the history
* fix readme

* added a creative staff of travelling

* spotless

* add back tooltip

* adress reviews
  • Loading branch information
boubou19 authored Sep 20, 2022
1 parent 52b0cab commit fd85b9a
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ Issues can be reported to the [GTNH tracker](https://github.com/GTNewHorizons/GT
All code (excluding the bundled APIs from other mods, which are covered by their respective licenses) were released without restriction into the public domain under the CC0 1.0 license (http://creativecommons.org/publicdomain/zero/1.0/legalcode) FAQ (https://wiki.creativecommons.org/CC0_FAQ).
Do what you want with it, as long as you smile while doing so.

###GTNH Modifications:
### GTNH Modifications:

LGPL v3.0 or later. Feel free to use our changes, just give back any changes you make to the community as well!

###Sound Credits
### Sound Credits

Most sound attributed under Creative Commons Attribution 3.0 Unported (CC BY 3.0)

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/crazypants/enderio/EnderIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
import crazypants.enderio.material.endergy.ItemGrindingBallEndergy;
import crazypants.enderio.network.PacketHandler;
import crazypants.enderio.rail.BlockEnderRail;
import crazypants.enderio.teleport.ItemInfiniteTravelStaff;
import crazypants.enderio.teleport.ItemTravelStaff;
import crazypants.enderio.teleport.TeleportRecipes;
import crazypants.enderio.teleport.TravelController;
Expand Down Expand Up @@ -228,6 +229,7 @@ public class EnderIO {
public static BlockTelePad blockTelePad;
public static ItemCoordSelector itemCoordSelector;
public static ItemTravelStaff itemTravelStaff;
public static ItemInfiniteTravelStaff itemInfiniteTravelStaff;

// Painter
public static BlockPainter blockPainter;
Expand Down Expand Up @@ -479,6 +481,7 @@ public void preInit(FMLPreInitializationEvent event) {
itemYetaWench = ItemYetaWrench.create();
itemEnderface = ItemEnderface.create();
itemTravelStaff = ItemTravelStaff.create();
itemInfiniteTravelStaff = ItemInfiniteTravelStaff.create();
itemConduitProbe = ItemConduitProbe.create();

itemXpTransfer = ItemXpTransfer.create();
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/crazypants/enderio/ModObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ public enum ModObject {

blockEnderRail,

itemEnderFood;
itemEnderFood,

itemInfiniteTravelStaff;

public final String unlocalisedName;

Expand Down
1 change: 1 addition & 0 deletions src/main/java/crazypants/enderio/nei/NEIEnderIOConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public void loadConfig() {
}
if (!Config.travelAnchorEnabled) {
API.hideItem(new ItemStack(EnderIO.itemTravelStaff));
API.hideItem(new ItemStack(EnderIO.itemInfiniteTravelStaff));
}
if (!Config.reinforcedObsidianEnabled) {
API.hideItem(new ItemStack(EnderIO.blockReinforcedObsidian));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package crazypants.enderio.teleport;

import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.EnderIO;
import crazypants.enderio.ModObject;
import crazypants.enderio.machine.power.PowerDisplayUtil;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class ItemInfiniteTravelStaff extends ItemTravelStaff {

protected ItemInfiniteTravelStaff() {
super();
setUnlocalizedName(ModObject.itemInfiniteTravelStaff.name());
}

public static ItemInfiniteTravelStaff create() {
ItemInfiniteTravelStaff result = new ItemInfiniteTravelStaff();
result.init();
return result;
}

public static boolean isEquipped(EntityPlayer ep) {
if (ep == null || ep.getCurrentEquippedItem() == null) {
return false;
}
return ep.getCurrentEquippedItem().getItem() == EnderIO.itemInfiniteTravelStaff;
}

@Override
protected void init() {
GameRegistry.registerItem(this, ModObject.itemInfiniteTravelStaff.unlocalisedName);
}

@Override
public void onCreated(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
setFull(itemStack);
}

@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister IIconRegister) {
itemIcon = IIconRegister.registerIcon("enderio:itemInfiniteTravelStaff");
}

@Override
public void extractInternal(ItemStack item, int powerUse) {
return;
}

@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List par3List) {
ItemStack is = new ItemStack(this);
setFull(is);
par3List.add(is);
}

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemStack, EntityPlayer par2EntityPlayer, List list, boolean par4) {
super.addInformation(itemStack, par2EntityPlayer, list, par4);
String str = "Infinite " + PowerDisplayUtil.abrevation();
list.set(list.size() - 1, str); // Changing charge indicator to infinite RF
}

@Override
public String getUnlocalizedNameForTooltip(ItemStack stack) {
return getUnlocalizedName();
}

@Override
public boolean isActive(EntityPlayer ep, ItemStack equipped) {
return isEquipped(ep);
}

@Override
@SideOnly(Side.CLIENT)
public boolean isFull3D() {
return true;
}
}
6 changes: 6 additions & 0 deletions src/main/resources/assets/enderio/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,12 @@ item.itemTravelStaff.tooltip.detailed.line4=Shift-R-Click will teleport the
item.itemTravelStaff.tooltip.detailed.line5=player a short distance
enderio.itemTravelStaff.notEnoughPower=Not enough power

item.itemInfiniteTravelStaff.name=Creative Staff of Traveling
item.itemInfiniteTravelStaff.tooltip.detailed.line1=When held Travel Anchors and EnderIO
item.itemInfiniteTravelStaff.tooltip.detailed.line2=blocks become visible and can be
item.itemInfiniteTravelStaff.tooltip.detailed.line3=activated by R-Click
item.itemInfiniteTravelStaff.tooltip.detailed.line4=Shift-R-Click will teleport the
item.itemInfiniteTravelStaff.tooltip.detailed.line5=player a short distance
item.itemCoordSelector.name=Coordinate Selector
item.itemCoordSelector.tooltip.detailed.line1=Stores coordinates of a block.
item.itemCoordSelector.tooltip.detailed.line2=Right click at block to select
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fd85b9a

Please sign in to comment.