2018-09-12 06:39:55 +00:00
|
|
|
package com.seodisparate.TurnBasedMinecraft.common;
|
|
|
|
|
2018-10-24 08:20:04 +00:00
|
|
|
import java.util.*;
|
2018-09-28 08:45:32 +00:00
|
|
|
|
2019-10-21 07:13:11 +00:00
|
|
|
import net.minecraft.entity.player.PlayerEntity;
|
2018-10-24 08:20:04 +00:00
|
|
|
import net.minecraft.util.text.ITextComponent;
|
2018-09-14 05:14:10 +00:00
|
|
|
import org.apache.logging.log4j.Logger;
|
|
|
|
|
2019-10-21 07:13:11 +00:00
|
|
|
import net.minecraft.client.Minecraft;
|
2018-09-17 04:27:13 +00:00
|
|
|
import net.minecraft.entity.Entity;
|
|
|
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
|
|
|
|
2018-09-12 06:39:55 +00:00
|
|
|
public class CommonProxy
|
|
|
|
{
|
2018-09-28 08:45:32 +00:00
|
|
|
private Set<AttackerViaBow> attackerViaBow = null;
|
|
|
|
private BattleManager battleManager = null;
|
|
|
|
private Entity attackingEntity = null;
|
|
|
|
private int attackingDamage = 0;
|
|
|
|
private Config config = null;
|
|
|
|
private Logger logger = null;
|
2018-10-24 08:20:04 +00:00
|
|
|
private Map<Integer, EditingInfo> editingPlayers;
|
2018-09-28 08:45:32 +00:00
|
|
|
|
2018-10-04 03:07:26 +00:00
|
|
|
public final void initialize()
|
2018-09-28 08:45:32 +00:00
|
|
|
{
|
|
|
|
attackerViaBow = new HashSet<AttackerViaBow>();
|
2018-10-24 08:20:04 +00:00
|
|
|
editingPlayers = new Hashtable<Integer, EditingInfo>();
|
2018-10-04 03:07:26 +00:00
|
|
|
initializeClient();
|
2018-09-28 08:45:32 +00:00
|
|
|
}
|
2018-09-20 06:15:34 +00:00
|
|
|
|
2018-10-04 03:07:26 +00:00
|
|
|
protected void initializeClient() {}
|
|
|
|
|
2018-09-28 08:45:32 +00:00
|
|
|
public final boolean initializeBattleManager()
|
2018-09-20 06:15:34 +00:00
|
|
|
{
|
2018-09-28 08:45:32 +00:00
|
|
|
if(battleManager == null)
|
2018-09-20 06:15:34 +00:00
|
|
|
{
|
2018-09-28 08:45:32 +00:00
|
|
|
battleManager = new BattleManager(TurnBasedMinecraftMod.logger);
|
2018-09-20 06:15:34 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-09-28 08:45:32 +00:00
|
|
|
public final boolean cleanupBattleManager ()
|
2018-09-20 06:15:34 +00:00
|
|
|
{
|
2018-09-28 08:45:32 +00:00
|
|
|
if(battleManager != null)
|
2018-09-20 06:15:34 +00:00
|
|
|
{
|
2018-09-28 08:45:32 +00:00
|
|
|
battleManager.cleanup();
|
|
|
|
battleManager = null;
|
2018-09-20 06:15:34 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-09-12 06:39:55 +00:00
|
|
|
public void setBattleGuiTime(int timeRemaining) {}
|
|
|
|
|
|
|
|
public void setBattleGuiBattleChanged() {}
|
|
|
|
|
|
|
|
public void setBattleGuiAsGui() {}
|
|
|
|
|
|
|
|
public void battleGuiTurnBegin() {}
|
|
|
|
|
|
|
|
public void battleGuiTurnEnd() {}
|
2018-09-14 03:44:45 +00:00
|
|
|
|
2018-09-18 07:58:01 +00:00
|
|
|
public void battleStarted() {}
|
|
|
|
|
2018-09-14 03:44:45 +00:00
|
|
|
public void battleEnded() {}
|
2018-09-14 05:14:10 +00:00
|
|
|
|
2018-10-04 03:07:26 +00:00
|
|
|
public final void postInit()
|
2018-09-28 08:45:32 +00:00
|
|
|
{
|
|
|
|
config = new Config(logger);
|
2018-10-04 03:07:26 +00:00
|
|
|
postInitClient();
|
2018-09-28 08:45:32 +00:00
|
|
|
}
|
2018-09-14 05:14:10 +00:00
|
|
|
|
2018-10-04 03:07:26 +00:00
|
|
|
protected void postInitClient() {}
|
|
|
|
|
2018-09-28 08:45:32 +00:00
|
|
|
public final void setLogger(Logger logger)
|
|
|
|
{
|
|
|
|
this.logger = logger;
|
|
|
|
}
|
2018-09-14 05:14:10 +00:00
|
|
|
|
|
|
|
public void playBattleMusic() {}
|
|
|
|
|
|
|
|
public void playSillyMusic() {}
|
|
|
|
|
2018-09-27 07:44:28 +00:00
|
|
|
public void stopMusic(boolean resumeMCSounds) {}
|
2018-09-14 05:14:10 +00:00
|
|
|
|
|
|
|
public void typeEnteredBattle(String type) {}
|
|
|
|
|
2018-09-27 09:09:40 +00:00
|
|
|
public void typeLeftBattle(String type) {}
|
|
|
|
|
2018-09-17 04:27:13 +00:00
|
|
|
public void displayString(String message) {}
|
2018-10-24 08:20:04 +00:00
|
|
|
|
|
|
|
public void displayTextComponent(ITextComponent textComponent) {}
|
2018-09-17 04:27:13 +00:00
|
|
|
|
|
|
|
public Entity getEntityByID(int id)
|
|
|
|
{
|
|
|
|
return FMLCommonHandler.instance().getMinecraftServerInstance().getEntityWorld().getEntityByID(id);
|
|
|
|
}
|
2018-09-25 05:55:24 +00:00
|
|
|
|
2018-09-28 08:45:32 +00:00
|
|
|
public final boolean isServerRunning()
|
2018-09-25 05:55:24 +00:00
|
|
|
{
|
2018-09-28 08:45:32 +00:00
|
|
|
return battleManager != null;
|
2018-09-25 05:55:24 +00:00
|
|
|
}
|
2018-09-28 03:13:07 +00:00
|
|
|
|
|
|
|
public Battle getLocalBattle()
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void createLocalBattle(int id) {}
|
2018-09-28 08:45:32 +00:00
|
|
|
|
|
|
|
public final Set<AttackerViaBow> getAttackerViaBowSet()
|
|
|
|
{
|
|
|
|
return attackerViaBow;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final BattleManager getBattleManager()
|
|
|
|
{
|
|
|
|
return battleManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected final void setAttackingEntity(Entity entity)
|
|
|
|
{
|
|
|
|
attackingEntity = entity;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected final Entity getAttackingEntity()
|
|
|
|
{
|
|
|
|
return attackingEntity;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected final void setAttackingDamage(int damage)
|
|
|
|
{
|
|
|
|
attackingDamage = damage;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected final int getAttackingDamage()
|
|
|
|
{
|
|
|
|
return attackingDamage;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected final Logger getLogger()
|
|
|
|
{
|
|
|
|
return logger;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Config getConfig()
|
|
|
|
{
|
|
|
|
return config;
|
|
|
|
}
|
2018-10-24 08:20:04 +00:00
|
|
|
|
|
|
|
protected final EditingInfo getEditingInfo(int id)
|
|
|
|
{
|
|
|
|
return editingPlayers.get(id);
|
|
|
|
}
|
|
|
|
|
2019-10-21 07:13:11 +00:00
|
|
|
protected final EditingInfo setEditingPlayer(PlayerEntity player)
|
2018-10-24 08:20:04 +00:00
|
|
|
{
|
|
|
|
return editingPlayers.put(player.getEntityId(), new EditingInfo(player));
|
|
|
|
}
|
|
|
|
|
|
|
|
protected final EditingInfo removeEditingInfo(int id)
|
|
|
|
{
|
|
|
|
return editingPlayers.remove(id);
|
|
|
|
}
|
2018-09-12 06:39:55 +00:00
|
|
|
}
|