Command rework (#1434)

* Network part finished.

* Should be more reasonable now

* This should be good enough.

* Orb finished, needs strings

* Bind finished. Needs strings.

* Reformat & Help subcommand

* Cleanup, strings, no negative amounts

* Removed TODOs

* Added missing MaxTier check for Blood Orbs.
Added TODO: Test with custom Blood Orbs.

* Ritual commands finished.
Check for valid placement might be optimized. (TODO)

* Access modifiers, moved TODO

* Added TODOs for localized strings

* DrainUtils postponed until the necessary functionality is available with SoulTickets (telling SoulTicket network from soul ticket, a list of all registered soul tickets per network)

* Replaced all occurrences of TextHelper with TextComponentTranslation in the commands section

* - Moved Teleports.java to teleport package
- added teleposer command
- added missing strings
- cleanup

* Fixed spelling of "Successful(ly)"

* getUsage() now returns translation keys.
getInfo() is now an explicit String

ritual creation command now has proper tab completions

help is an additional argument with "-h" or "?"

cleanup

* teleposerSet final
cleanup.

* Removed ritual removal command

Signed-off-by: tobias <angryaeon@icloud.com>

* Check if the tile has a ritual first

Signed-off-by: tobias <angryaeon@icloud.com>

* A bit more optimisation

Signed-off-by: tobias <angryaeon@icloud.com>

* Cleanup part 1

Signed-off-by: tobias <angryaeon@icloud.com>

* Cleanup part 2

Signed-off-by: tobias <angryaeon@icloud.com>

* Part 3

Signed-off-by: tobias <angryaeon@icloud.com>

* Part 4

Signed-off-by: tobias <angryaeon@icloud.com>

* Updated language file to reflect cleanup & continuity changes.

Signed-off-by: tobias <angryaeon@icloud.com>

* Change to use an abstract class that gets called instead of calling super on overriden execute() for commands

Signed-off-by: tobias <angryaeon@icloud.com>

* Use player facing for ritual creation.

Signed-off-by: tobias <angryaeon@icloud.com>
This commit is contained in:
Tobias Gremeyer 2019-02-01 01:46:02 +01:00 committed by Nick Ignoffo
parent 2a8e1f1271
commit 95d99c0a01
13 changed files with 990 additions and 323 deletions

View file

@ -1,12 +1,13 @@
package WayofTime.bloodmagic.tile;
import WayofTime.bloodmagic.block.BlockTeleposer;
import WayofTime.bloodmagic.command.sub.SubCommandTeleposer;
import WayofTime.bloodmagic.core.data.Binding;
import WayofTime.bloodmagic.core.data.SoulTicket;
import WayofTime.bloodmagic.event.TeleposeEvent;
import WayofTime.bloodmagic.item.ItemTelepositionFocus;
import WayofTime.bloodmagic.ritual.portal.Teleports;
import WayofTime.bloodmagic.teleport.TeleportQueue;
import WayofTime.bloodmagic.teleport.Teleports;
import WayofTime.bloodmagic.util.Constants;
import WayofTime.bloodmagic.util.Utils;
import WayofTime.bloodmagic.util.helper.NetworkHelper;
@ -56,6 +57,17 @@ public class TileTeleposer extends TileInventory implements ITickable {
}
previousInput = currentInput;
if (world.getTotalWorldTime() % 100 == 0) {
ItemStack focusStack = getStackInSlot(0);
if (!focusStack.isEmpty()) {
if (((ItemTelepositionFocus) focusStack.getItem()).getBinding(focusStack) != null)
SubCommandTeleposer.teleposerSet.add(this);
else
SubCommandTeleposer.teleposerSet.remove(this);
} else
SubCommandTeleposer.teleposerSet.remove(this);
}
}
}
@ -66,14 +78,14 @@ public class TileTeleposer extends TileInventory implements ITickable {
Binding binding = focus.getBinding(focusStack);
if (binding == null)
return;
BlockPos focusPos = focus.getBlockPos(getStackInSlot(0));
World focusWorld = focus.getWorld(getStackInSlot(0));
BlockPos focusPos = focus.getBlockPos(focusStack);
World focusWorld = focus.getWorld(focusStack);
if (focusWorld == null)
return;
TileEntity boundTile = focusWorld.getTileEntity(focusPos);
if (boundTile instanceof TileTeleposer && boundTile != this) {
final int focusLevel = (getStackInSlot(0).getItemDamage() + 1);
final int focusLevel = (focusStack.getItemDamage() + 1);
final int lpToBeDrained = (int) (0.5F * Math.sqrt((pos.getX() - focusPos.getX()) * (pos.getX() - focusPos.getX()) + (pos.getY() - focusPos.getY() + 1) * (pos.getY() - focusPos.getY() + 1) + (pos.getZ() - focusPos.getZ()) * (pos.getZ() - focusPos.getZ())));
if (NetworkHelper.syphonFromContainer(focusStack, SoulTicket.block(world, pos, lpToBeDrained * (focusLevel * 2 - 1) * (focusLevel * 2 - 1) * (focusLevel * 2 - 1)))) {