mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
58 lines
1.5 KiB
Java
58 lines
1.5 KiB
Java
package com.hbm.saveddata.satellites;
|
|
|
|
import com.hbm.entity.projectile.EntityTom;
|
|
import com.hbm.main.MainRegistry;
|
|
import com.hbm.saveddata.SatelliteSavedData;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
import net.minecraft.server.MinecraftServer;
|
|
import net.minecraft.util.ChatComponentText;
|
|
import net.minecraft.util.EnumChatFormatting;
|
|
import net.minecraft.world.World;
|
|
|
|
public class SatelliteHorizons extends Satellite {
|
|
|
|
boolean used = false;
|
|
|
|
public SatelliteHorizons() {
|
|
this.satIface = Interfaces.SAT_COORD;
|
|
}
|
|
|
|
public void onOrbit(World world, double x, double y, double z) {
|
|
|
|
for(Object p : world.playerEntities)
|
|
((EntityPlayer)p).triggerAchievement(MainRegistry.horizonsStart);
|
|
}
|
|
|
|
public void writeToNBT(NBTTagCompound nbt) {
|
|
nbt.setBoolean("used", used);
|
|
}
|
|
|
|
public void readFromNBT(NBTTagCompound nbt) {
|
|
used = nbt.getBoolean("used");
|
|
}
|
|
|
|
public void onCoordAction(World world, EntityPlayer player, int x, int y, int z) {
|
|
|
|
if(used)
|
|
return;
|
|
|
|
used = true;
|
|
SatelliteSavedData.getData(world).markDirty();
|
|
|
|
EntityTom tom = new EntityTom(world);
|
|
tom.setPosition(x + 0.5, 600, z + 0.5);
|
|
world.spawnEntityInWorld(tom);
|
|
|
|
for(Object p : world.playerEntities)
|
|
((EntityPlayer)p).triggerAchievement(MainRegistry.horizonsEnd);
|
|
|
|
//not necessary but JUST to make sure
|
|
if(!world.isRemote) {
|
|
|
|
MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText(EnumChatFormatting.RED + "Horizons has been activated."));
|
|
}
|
|
}
|
|
}
|