TurnBasedMinecraftMod/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/CommonProxy.java

169 lines
4 KiB
Java
Raw Normal View History

2019-11-25 06:29:25 +00:00
package com.burnedkirby.TurnBasedMinecraft.common;
2018-09-12 06:39:55 +00:00
import java.util.*;
2019-10-21 07:13:11 +00:00
import net.minecraft.entity.player.PlayerEntity;
2020-11-12 08:10:01 +00:00
import net.minecraft.util.RegistryKey;
import net.minecraft.util.text.ITextComponent;
2020-11-12 08:10:01 +00:00
import net.minecraft.world.DimensionType;
import net.minecraft.world.World;
import net.minecraftforge.fml.server.ServerLifecycleHooks;
import org.apache.logging.log4j.Logger;
import net.minecraft.entity.Entity;
2018-09-12 06:39:55 +00:00
public class CommonProxy
{
private Set<AttackerViaBow> attackerViaBow = null;
private BattleManager battleManager = null;
private Entity attackingEntity = null;
private int attackingDamage = 0;
private Config config = null;
protected Logger logger = null;
private Map<Integer, EditingInfo> editingPlayers;
public final void initialize()
{
attackerViaBow = new HashSet<AttackerViaBow>();
editingPlayers = new Hashtable<Integer, EditingInfo>();
initializeClient();
logger.debug("Init proxy for com_burnedkirby_turnbasedminecraft");
}
protected void initializeClient() {}
public final boolean initializeBattleManager()
{
if(battleManager == null)
{
battleManager = new BattleManager(TurnBasedMinecraftMod.logger);
return true;
}
return false;
}
public final boolean cleanupBattleManager ()
{
if(battleManager != null)
{
battleManager.cleanup();
battleManager = null;
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-18 07:58:01 +00:00
public void battleStarted() {}
public void battleEnded() {}
public final void postInit()
{
config = new Config(logger);
postInitClient();
logger.debug("postInit proxy for com_burnedkirby_turnbasedminecraft");
}
protected void postInitClient() {}
public final void setLogger(Logger logger)
{
this.logger = logger;
}
public void playBattleMusic() {}
public void playSillyMusic() {}
public void stopMusic(boolean resumeMCSounds) {}
public void typeEnteredBattle(String type) {}
public void typeLeftBattle(String type) {}
public void displayString(String message) {}
public void displayTextComponent(ITextComponent textComponent) {}
public final boolean isServerRunning()
{
return battleManager != null;
}
2018-09-28 03:13:07 +00:00
public Battle getLocalBattle()
{
return null;
}
public void createLocalBattle(int id) {}
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;
}
protected final EditingInfo getEditingInfo(int id)
{
return editingPlayers.get(id);
}
2019-10-21 07:13:11 +00:00
protected final EditingInfo setEditingPlayer(PlayerEntity player)
{
2021-05-21 05:44:31 +00:00
return editingPlayers.put(player.getId(), new EditingInfo(player));
}
protected final EditingInfo removeEditingInfo(int id)
{
return editingPlayers.remove(id);
}
2020-11-12 08:10:01 +00:00
public Entity getEntity(int id, RegistryKey<World> dim) {
2021-05-21 05:44:31 +00:00
return ServerLifecycleHooks.getCurrentServer().getLevel(dim).getEntity(id);
}
2018-09-12 06:39:55 +00:00
}