Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

Commit

Permalink
Fix all errors and method calls
Browse files Browse the repository at this point in the history
  • Loading branch information
spikespaz committed Mar 24, 2017
1 parent 1a9c2c1 commit ebdfbc0
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> getCommandAliases() {
final List<String> aliases = new LinkedList<String>();
aliases.add(buildCommandName(BASE_ALIAS));
Expand All @@ -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<helps.length; i++) {
sender.addChatMessage(new TextComponentString(helps[i]));
sender.sendMessage(new TextComponentString(helps[i]));
}
}else {
_execute(server, sender, args);
Expand Down
13 changes: 11 additions & 2 deletions src/main/java/fr/eyzox/forgecreeperheal/commands/HealCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected void _execute(MinecraftServer server, ICommandSender sender, String[]
}

final ITextComponent healAllMsg = buildChatMessage(sender, buildTranslationMessage(sender, "fch.command.heal.action.allworld"), MessageType.SUCCESS);
sender.addChatMessage(healAllMsg);
sender.sendMessage(healAllMsg);
}else {
WorldServer world = null;
final String rawDimId = args.length > 0 ? args[0] : null;
Expand All @@ -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;
}
}
10 changes: 10 additions & 0 deletions src/main/java/fr/eyzox/forgecreeperheal/commands/HelpCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<ICommand> getSortedPossibleCommands(ICommandSender sender, MinecraftServer server) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,4 +27,13 @@ protected String getFCHUsage() {
return "";
}

@Override
public String getName() {
return null;
}

@Override
public String getUsage(ICommandSender sender) {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand All @@ -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) {

Expand All @@ -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));
}
}
}
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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));
}

/**
Expand Down Expand Up @@ -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
}
}
}
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private <T extends IHealable & IChunked & IData<?>> ChunkDataProvider<Dispatched
final int chunkZ = healable.getChunkZ();

//Retrieve or create DispatchedTimeline for a chunk
DispatchedTimeline dispatchedTimeline = dispatchedTimelines.get(ChunkPos.chunkXZ2Int(chunkX, chunkZ));
DispatchedTimeline dispatchedTimeline = dispatchedTimelines.get(ChunkPos.asLong(chunkX, chunkZ));
if(dispatchedTimeline == null) {
dispatchedTimeline = new DispatchedTimeline();
dispatchedTimelines.put(new ChunkPos(chunkX, chunkZ), dispatchedTimeline);
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/fr/eyzox/minecraft/util/ChunkDataProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public E put(Chunk chunk, E value) {
if(chunk == null) {
throw new NullPointerException(NULL_KEY);
}
return this.put(chunk.getChunkCoordIntPair(), value);
return this.put(chunk.getPos(), value);
}

@Override
Expand Down Expand Up @@ -81,7 +81,7 @@ public E remove(Chunk chunk) {
}

if(map.remove(this.getMapKey(chunk)) != null) {
return super.remove(chunk.getChunkCoordIntPair());
return super.remove(chunk.getPos());
}else {
return null;
}
Expand All @@ -108,10 +108,10 @@ public Long2ObjectMap<E> 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);
}
}

0 comments on commit ebdfbc0

Please sign in to comment.