From ebdfbc00787ee0f31095598f6ef535270deb4201 Mon Sep 17 00:00:00 2001 From: spikespaz Date: Fri, 24 Mar 2017 05:10:12 -0700 Subject: [PATCH] Fix all errors and method calls --- .../forgecreeperheal/commands/ConfigCommand.java | 15 ++++++++++++--- .../commands/ForgeCreeperHealCommands.java | 9 +++------ .../forgecreeperheal/commands/HealCommand.java | 13 +++++++++++-- .../forgecreeperheal/commands/HelpCommand.java | 10 ++++++++++ .../forgecreeperheal/commands/VersionCommand.java | 11 ++++++++++- .../handler/ChunkEventHandler.java | 8 ++++---- .../forgecreeperheal/healer/HealerManager.java | 12 ++++++------ .../reflection/transform/ChunkTransform.java | 2 +- .../scheduler/TickTimelineFactory.java | 2 +- .../eyzox/minecraft/util/ChunkDataProvider.java | 8 ++++---- 10 files changed, 62 insertions(+), 28 deletions(-) diff --git a/src/main/java/fr/eyzox/forgecreeperheal/commands/ConfigCommand.java b/src/main/java/fr/eyzox/forgecreeperheal/commands/ConfigCommand.java index 7d119cf..95d3d53 100644 --- a/src/main/java/fr/eyzox/forgecreeperheal/commands/ConfigCommand.java +++ b/src/main/java/fr/eyzox/forgecreeperheal/commands/ConfigCommand.java @@ -50,20 +50,29 @@ protected void _execute(MinecraftServer server, ICommandSender sender, String[] if(reload) { ForgeCreeperHeal.getProxy().loadConfig(); final ITextComponent reloadMsg = buildChatMessage(sender, buildTranslationMessage(sender, "fch.command.config.action.reload"), MessageType.SUCCESS); - sender.addChatMessage(reloadMsg); + sender.sendMessage(reloadMsg); } if(shift < args.length) { final ITextComponent sorry = buildChatMessage(sender, buildTranslationMessage(sender, "fch.command.config.action.edit")); sorry.getStyle().setColor(TextFormatting.DARK_RED); - sender.addChatMessage(sorry); + sender.sendMessage(sorry); } if(save) { final ITextComponent saveMsg = buildChatMessage(sender, buildTranslationMessage(sender, "fch.command.config.action.save")); saveMsg.getStyle().setColor(TextFormatting.DARK_RED); - sender.addChatMessage(saveMsg); + sender.sendMessage(saveMsg); } } + @Override + public String getName() { + return null; + } + + @Override + public String getUsage(ICommandSender sender) { + return null; + } } diff --git a/src/main/java/fr/eyzox/forgecreeperheal/commands/ForgeCreeperHealCommands.java b/src/main/java/fr/eyzox/forgecreeperheal/commands/ForgeCreeperHealCommands.java index 865068d..5b33726 100644 --- a/src/main/java/fr/eyzox/forgecreeperheal/commands/ForgeCreeperHealCommands.java +++ b/src/main/java/fr/eyzox/forgecreeperheal/commands/ForgeCreeperHealCommands.java @@ -28,17 +28,14 @@ public abstract class ForgeCreeperHealCommands extends CommandBase { new HelpCommand() }; - @Override public final String getCommandUsage(ICommandSender sender) { return '/'+buildCommandName(BASE_ALIAS)+" [?] "+getFCHUsage(); } - @Override public final String getCommandName() { return buildCommandName(ForgeCreeperHeal.MODID); } - @Override public final List getCommandAliases() { final List aliases = new LinkedList(); aliases.add(buildCommandName(BASE_ALIAS)); @@ -63,16 +60,16 @@ public final void execute(MinecraftServer server, ICommandSender sender, String[ final ITextComponent head = buildChatMessage(sender, buildTranslationMessage(sender, "fch.command.generic.help.head", new Object[]{buildCommandName(BASE_ALIAS)})); head.getStyle().setColor(TextFormatting.DARK_GREEN); - sender.addChatMessage(head); + sender.sendMessage(head); final ITextComponent usage = buildTranslationMessage(sender, "fch.command.generic.help.usage",new Object[]{getCommandUsage(sender)}); usage.getStyle().setColor(TextFormatting.GRAY); - sender.addChatMessage(usage); + sender.sendMessage(usage); final String rawHelp = buildTranslationMessage(sender, getHelp()).getFormattedText(); final String[] helps = rawHelp.split("\\\\n"); for(int i=0; i 0 ? args[0] : null; @@ -57,9 +57,18 @@ protected void _execute(MinecraftServer server, ICommandSender sender, String[] }else { ForgeCreeperHeal.getHealerManager(world).heal(); final ITextComponent healedMsg = buildChatMessage(sender, buildTranslationMessage(sender, "fch.command.heal.action.world", new Object[]{world.getWorldInfo().getWorldName(), world.provider.getDimension()}), MessageType.SUCCESS); - sender.addChatMessage(healedMsg); + sender.sendMessage(healedMsg); } } } + @Override + public String getName() { + return null; + } + + @Override + public String getUsage(ICommandSender sender) { + return null; + } } diff --git a/src/main/java/fr/eyzox/forgecreeperheal/commands/HelpCommand.java b/src/main/java/fr/eyzox/forgecreeperheal/commands/HelpCommand.java index b00ed11..5f95e4c 100644 --- a/src/main/java/fr/eyzox/forgecreeperheal/commands/HelpCommand.java +++ b/src/main/java/fr/eyzox/forgecreeperheal/commands/HelpCommand.java @@ -12,6 +12,16 @@ public class HelpCommand extends ForgeCreeperHealCommands { + @Override + public String getName() { + return null; + } + + @Override + public String getUsage(ICommandSender sender) { + return null; + } + private static final class WrappedVanillaHelpCommand extends CommandHelp { @Override protected List getSortedPossibleCommands(ICommandSender sender, MinecraftServer server) { diff --git a/src/main/java/fr/eyzox/forgecreeperheal/commands/VersionCommand.java b/src/main/java/fr/eyzox/forgecreeperheal/commands/VersionCommand.java index b176fe9..3f19a9b 100644 --- a/src/main/java/fr/eyzox/forgecreeperheal/commands/VersionCommand.java +++ b/src/main/java/fr/eyzox/forgecreeperheal/commands/VersionCommand.java @@ -9,7 +9,7 @@ public class VersionCommand extends ForgeCreeperHealCommands { @Override public void _execute(MinecraftServer server, ICommandSender sender, String[] args) { - sender.addChatMessage(new TextComponentString(ForgeCreeperHeal.MODNAME)); + sender.sendMessage(new TextComponentString(ForgeCreeperHeal.MODNAME)); } @Override @@ -27,4 +27,13 @@ protected String getFCHUsage() { return ""; } + @Override + public String getName() { + return null; + } + + @Override + public String getUsage(ICommandSender sender) { + return null; + } } diff --git a/src/main/java/fr/eyzox/forgecreeperheal/handler/ChunkEventHandler.java b/src/main/java/fr/eyzox/forgecreeperheal/handler/ChunkEventHandler.java index e3f404e..ef1efce 100644 --- a/src/main/java/fr/eyzox/forgecreeperheal/handler/ChunkEventHandler.java +++ b/src/main/java/fr/eyzox/forgecreeperheal/handler/ChunkEventHandler.java @@ -30,7 +30,7 @@ public void onChunkDataLoad(final ChunkDataEvent.Load event) { healer.setLoaded(true); - ForgeCreeperHeal.getHealerManager((WorldServer) event.getWorld()).getLoadedHealers().put(ChunkPos.chunkXZ2Int(event.getChunk().xPosition, event.getChunk().zPosition), healer); + ForgeCreeperHeal.getHealerManager((WorldServer) event.getWorld()).getLoadedHealers().put(ChunkPos.asLong(event.getChunk().xPosition, event.getChunk().zPosition), healer); } } } @@ -42,7 +42,7 @@ public void onChunkDataSave(final ChunkDataEvent.Save event) { final HealerManager manager = ForgeCreeperHeal.getHealerManager((WorldServer) event.getWorld()); - final Healer healer = manager.getLoadedHealers().get(ChunkPos.chunkXZ2Int(event.getChunk().xPosition, event.getChunk().zPosition)); + final Healer healer = manager.getLoadedHealers().get(ChunkPos.asLong(event.getChunk().xPosition, event.getChunk().zPosition)); if(healer != null) { @@ -54,7 +54,7 @@ public void onChunkDataSave(final ChunkDataEvent.Save event) { //If chunk is unloaded, unhandle its healer if(!healer.isLoaded()) { - manager.getLoadedHealers().remove(ChunkPos.chunkXZ2Int(event.getChunk().xPosition, event.getChunk().zPosition)); + manager.getLoadedHealers().remove(ChunkPos.asLong(event.getChunk().xPosition, event.getChunk().zPosition)); } } } @@ -64,7 +64,7 @@ public void onChunkUnload(ChunkEvent.Unload event) { if(event.getWorld().isRemote) return; final HealerManager manager = ForgeCreeperHeal.getHealerManager((WorldServer)event.getWorld()); - final Healer healer = manager.getLoadedHealers().get(ChunkPos.chunkXZ2Int(event.getChunk().xPosition, event.getChunk().zPosition)); + final Healer healer = manager.getLoadedHealers().get(ChunkPos.asLong(event.getChunk().xPosition, event.getChunk().zPosition)); if(healer != null) { healer.setLoaded(false); } diff --git a/src/main/java/fr/eyzox/forgecreeperheal/healer/HealerManager.java b/src/main/java/fr/eyzox/forgecreeperheal/healer/HealerManager.java index c185008..c816057 100644 --- a/src/main/java/fr/eyzox/forgecreeperheal/healer/HealerManager.java +++ b/src/main/java/fr/eyzox/forgecreeperheal/healer/HealerManager.java @@ -31,11 +31,11 @@ public HealerManager(final WorldServer world) { */ public void hook(final Healer healer) { final Chunk chunk = world.getChunkFromChunkCoords(healer.getChunk().xPosition, healer.getChunk().zPosition); - final ChunkPos chunkKey = chunk.getChunkCoordIntPair(); + final ChunkPos chunkKey = chunk.getPos(); // UNSURE healer.setLoaded(true); - this.loadedHealers.put(ChunkPos.chunkXZ2Int(chunkKey.chunkXPos, chunkKey.chunkZPos), healer); + this.loadedHealers.put(ChunkPos.asLong(chunkKey.chunkXPos, chunkKey.chunkZPos), healer); chunk.setChunkModified(); this.worldHealerData.handleChunk(chunkKey); } @@ -46,7 +46,7 @@ public void hook(final Healer healer) { */ public void unhook(final ChunkPos chunkKey) { final Chunk chunk = world.getChunkFromChunkCoords(chunkKey.chunkXPos, chunkKey.chunkZPos); - this.loadedHealers.remove(ChunkPos.chunkXZ2Int(chunk.xPosition, chunk.zPosition)); + this.loadedHealers.remove(ChunkPos.asLong(chunk.xPosition, chunk.zPosition)); chunk.setChunkModified(); this.worldHealerData.unhandleChunk(chunkKey); } @@ -58,7 +58,7 @@ public void unhook(final ChunkPos chunkKey) { */ public Healer load(final ChunkPos chunkKey) { final Chunk chunk = world.getChunkFromChunkCoords(chunkKey.chunkXPos, chunkKey.chunkZPos); - return loadedHealers.get(ChunkPos.chunkXZ2Int(chunk.xPosition, chunk.zPosition)); + return loadedHealers.get(ChunkPos.asLong(chunk.xPosition, chunk.zPosition)); } /** @@ -103,7 +103,7 @@ public void tick() { if(!emptyHealers.isEmpty()) { for(final Healer emptyHealer : emptyHealers) { - this.unhook(emptyHealer.getChunk().getChunkCoordIntPair()); + this.unhook(emptyHealer.getChunk().getPos()); // UNSURE } } } @@ -119,7 +119,7 @@ private void healLoaded() { data.heal(worldHealer); } } - this.worldHealerData.unhandleChunk(healer.getChunk().getChunkCoordIntPair()); + this.worldHealerData.unhandleChunk(healer.getChunk().getPos()); // UNSURE } worldHealer.update(3); } diff --git a/src/main/java/fr/eyzox/forgecreeperheal/reflection/transform/ChunkTransform.java b/src/main/java/fr/eyzox/forgecreeperheal/reflection/transform/ChunkTransform.java index dd66f62..0c4e6c9 100644 --- a/src/main/java/fr/eyzox/forgecreeperheal/reflection/transform/ChunkTransform.java +++ b/src/main/java/fr/eyzox/forgecreeperheal/reflection/transform/ChunkTransform.java @@ -110,7 +110,7 @@ public IBlockState setBlockState(BlockPos pos, IBlockState state) { return null; } - extendedblockstorage = this.storageArrays[j >> 4] = new ExtendedBlockStorage(j >> 4 << 4, !this.worldObj.provider.getHasNoSky()); + extendedblockstorage = this.storageArrays[j >> 4] = new ExtendedBlockStorage(j >> 4 << 4, !this.worldObj.provider.hasNoSky()); flag = j >= i1; } diff --git a/src/main/java/fr/eyzox/forgecreeperheal/scheduler/TickTimelineFactory.java b/src/main/java/fr/eyzox/forgecreeperheal/scheduler/TickTimelineFactory.java index 0963eef..f78eea0 100644 --- a/src/main/java/fr/eyzox/forgecreeperheal/scheduler/TickTimelineFactory.java +++ b/src/main/java/fr/eyzox/forgecreeperheal/scheduler/TickTimelineFactory.java @@ -53,7 +53,7 @@ private > ChunkDataProvider getLong2ObjectMap() { } private long getMapKey(final ChunkPos chunk) { - return ChunkPos.chunkXZ2Int(chunk.chunkXPos, chunk.chunkZPos); + return ChunkPos.asLong(chunk.chunkXPos, chunk.chunkZPos); } private long getMapKey(final Chunk chunk) { - return ChunkPos.chunkXZ2Int(chunk.xPosition, chunk.zPosition); + return ChunkPos.asLong(chunk.xPosition, chunk.zPosition); } }