use of net.minecraft.stats.StatisticsManager in project upgrade-aquatic by team-abnormals.
the class RestfulnessEffect method performEffect.
@Override
public void performEffect(LivingEntity entity, int amplifier) {
if (entity instanceof ServerPlayerEntity) {
ServerPlayerEntity playerMP = (ServerPlayerEntity) entity;
StatisticsManager statisticsManager = playerMP.getStats();
statisticsManager.increment(playerMP, Stats.CUSTOM.get(Stats.TIME_SINCE_REST), -(24000 * (amplifier + 1)));
} else if (entity instanceof PhantomEntity) {
entity.attackEntityFrom(DamageSource.MAGIC, Float.MAX_VALUE);
} else if (entity instanceof FlareEntity) {
PhantomEntity phantom = EntityType.PHANTOM.create(entity.world);
phantom.setLocationAndAngles(entity.getPosX(), entity.getPosY(), entity.getPosZ(), entity.rotationYaw, entity.rotationPitch);
phantom.setNoAI(((MobEntity) entity).isAIDisabled());
if (entity.hasCustomName()) {
phantom.setCustomName(entity.getCustomName());
phantom.setCustomNameVisible(entity.isCustomNameVisible());
}
phantom.setHealth(entity.getHealth());
if (phantom.getHealth() > 0) {
entity.world.addEntity(phantom);
entity.remove(true);
}
entity.remove(true);
}
}
use of net.minecraft.stats.StatisticsManager in project upgrade-aquatic by team-abnormals.
the class RenderOverlays method renderOverlays.
@SuppressWarnings("deprecation")
@SubscribeEvent
public static void renderOverlays(RenderGameOverlayEvent event) {
if (event.getType() == RenderGameOverlayEvent.ElementType.VIGNETTE) {
int scaledWidth = MC.getMainWindow().getScaledWidth();
int scaledHeight = MC.getMainWindow().getScaledHeight();
ClientPlayerEntity player = MC.player;
StatisticsManager statisticsManager = player.getStats();
int sleepTime = statisticsManager.getValue(Stats.CUSTOM.get(Stats.TIME_SINCE_REST));
int configuredTime = Config.CLIENT.daysTillRenderInsomniaOverlay.get();
float opacity = 0;
if (sleepTime == 24000 * configuredTime) {
opacity = 0.25F;
} else if (sleepTime == 24000 * configuredTime + 100) {
opacity = 0.45F;
} else if (sleepTime == 24000 * configuredTime + 200) {
opacity = 0.65F;
} else if (sleepTime == 24000 * configuredTime + 300) {
opacity = 0.85F;
} else if (sleepTime == 24000 * configuredTime + 400) {
opacity = 0.90F;
} else if (sleepTime >= 24000 * configuredTime + 500) {
opacity = 1F;
} else if (sleepTime < 24000 * configuredTime) {
opacity = 0F;
}
if (MC.gameSettings.thirdPersonView == 0 && Config.CLIENT.daysTillRenderInsomniaOverlay.get() != 0 && MC.player.getEntityWorld().func_234922_V_() == DimensionType.OVERWORLD) {
MatrixStack stack = event.getMatrixStack();
stack.push();
MC.textureManager.bindTexture(new ResourceLocation(UpgradeAquatic.MODID, "textures/gui/overlay/insomnia.png"));
RenderSystem.enableBlend();
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
RenderSystem.color3f(1.0F, 1.0F, 1.0F);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, opacity);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX);
bufferbuilder.pos(0.0D, (double) scaledHeight, -90.0D).tex(0.0F, 1.0F).endVertex();
bufferbuilder.pos((double) scaledWidth, (double) scaledHeight, -90.0D).tex(1.0F, 1.0F).endVertex();
bufferbuilder.pos((double) scaledWidth, 0.0D, -90.0D).tex(1.0F, 0.0F).endVertex();
bufferbuilder.pos(0.0D, 0.0D, -90.0D).tex(0.0F, 0.0F).endVertex();
tessellator.draw();
stack.pop();
}
}
}
use of net.minecraft.stats.StatisticsManager in project CumServerPro by MCUmbrella.
the class Minecraft method loadWorld.
public void loadWorld(@Nullable WorldClient worldClientIn, String loadingMessage) {
if (world != null)
net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(world));
if (worldClientIn == null) {
NetHandlerPlayClient nethandlerplayclient = this.getConnection();
if (nethandlerplayclient != null) {
nethandlerplayclient.cleanup();
}
if (this.integratedServer != null && this.integratedServer.isAnvilFileSet()) {
this.integratedServer.initiateShutdown();
if (loadingScreen != null && this.running) {
this.loadingScreen.displayLoadingString(I18n.format("forge.client.shutdown.internal"));
}
while (!integratedServer.isServerStopped()) {
try {
Thread.sleep(10);
} catch (InterruptedException ie) {
}
}
}
this.integratedServer = null;
this.entityRenderer.resetData();
this.playerController = null;
NarratorChatListener.INSTANCE.clear();
}
this.renderViewEntity = null;
this.myNetworkManager = null;
if (this.loadingScreen != null) {
this.loadingScreen.resetProgressAndMessage(loadingMessage);
this.loadingScreen.displayLoadingString("");
}
if (worldClientIn == null && this.world != null) {
this.mcResourcePackRepository.clearResourcePack();
this.ingameGUI.resetPlayersOverlayFooterHeader();
this.setServerData((ServerData) null);
this.integratedServerIsRunning = false;
net.minecraftforge.fml.client.FMLClientHandler.instance().handleClientWorldClosing(this.world);
}
this.mcSoundHandler.stopSounds();
this.world = worldClientIn;
if (this.renderGlobal != null) {
this.renderGlobal.setWorldAndLoadRenderers(worldClientIn);
}
if (this.effectRenderer != null) {
this.effectRenderer.clearEffects(worldClientIn);
}
TileEntityRendererDispatcher.instance.setWorld(worldClientIn);
net.minecraftforge.client.MinecraftForgeClient.clearRenderCache();
if (worldClientIn != null) {
if (!this.integratedServerIsRunning) {
AuthenticationService authenticationservice = new YggdrasilAuthenticationService(this.proxy, UUID.randomUUID().toString());
MinecraftSessionService minecraftsessionservice = authenticationservice.createMinecraftSessionService();
GameProfileRepository gameprofilerepository = authenticationservice.createProfileRepository();
PlayerProfileCache playerprofilecache = new PlayerProfileCache(gameprofilerepository, new File(this.mcDataDir, MinecraftServer.USER_CACHE_FILE.getName()));
TileEntitySkull.setProfileCache(playerprofilecache);
TileEntitySkull.setSessionService(minecraftsessionservice);
PlayerProfileCache.setOnlineMode(false);
}
if (this.player == null) {
this.player = this.playerController.createPlayer(worldClientIn, new StatisticsManager(), new RecipeBookClient());
this.playerController.flipPlayer(this.player);
}
this.player.preparePlayerToSpawn();
worldClientIn.spawnEntity(this.player);
this.player.movementInput = new MovementInputFromOptions(this.gameSettings);
this.playerController.setPlayerCapabilities(this.player);
this.renderViewEntity = this.player;
} else {
this.saveLoader.flushCache();
this.player = null;
}
System.gc();
this.systemTime = 0L;
}
use of net.minecraft.stats.StatisticsManager in project Minecraft-SlientClient-Hack by YouNeverKnow00.
the class Minecraft method loadWorld.
/**
* par2Str is displayed on the loading screen to the user unloads the current world first
*/
public void loadWorld(@Nullable WorldClient worldClientIn, String loadingMessage) {
if (worldClientIn == null) {
NetHandlerPlayClient nethandlerplayclient = this.getConnection();
if (nethandlerplayclient != null) {
nethandlerplayclient.cleanup();
}
if (this.theIntegratedServer != null && this.theIntegratedServer.isAnvilFileSet()) {
this.theIntegratedServer.initiateShutdown();
}
this.theIntegratedServer = null;
this.entityRenderer.func_190564_k();
this.playerController = null;
NarratorChatListener.field_193643_a.func_193642_b();
}
this.renderViewEntity = null;
this.myNetworkManager = null;
if (this.loadingScreen != null) {
this.loadingScreen.resetProgressAndMessage(loadingMessage);
this.loadingScreen.displayLoadingString("");
}
if (worldClientIn == null && this.world != null) {
this.mcResourcePackRepository.clearResourcePack();
this.ingameGUI.resetPlayersOverlayFooterHeader();
this.setServerData((ServerData) null);
this.integratedServerIsRunning = false;
}
this.mcSoundHandler.stopSounds();
this.world = worldClientIn;
if (this.renderGlobal != null) {
this.renderGlobal.setWorldAndLoadRenderers(worldClientIn);
}
if (this.effectRenderer != null) {
this.effectRenderer.clearEffects(worldClientIn);
}
TileEntityRendererDispatcher.instance.setWorld(worldClientIn);
if (worldClientIn != null) {
if (!this.integratedServerIsRunning) {
AuthenticationService authenticationservice = new YggdrasilAuthenticationService(this.proxy, UUID.randomUUID().toString());
MinecraftSessionService minecraftsessionservice = authenticationservice.createMinecraftSessionService();
GameProfileRepository gameprofilerepository = authenticationservice.createProfileRepository();
PlayerProfileCache playerprofilecache = new PlayerProfileCache(gameprofilerepository, new File(this.mcDataDir, MinecraftServer.USER_CACHE_FILE.getName()));
TileEntitySkull.setProfileCache(playerprofilecache);
TileEntitySkull.setSessionService(minecraftsessionservice);
PlayerProfileCache.setOnlineMode(false);
}
if (this.player == null) {
this.player = this.playerController.func_192830_a(worldClientIn, new StatisticsManager(), new RecipeBookClient());
this.playerController.flipPlayer(this.player);
}
this.player.preparePlayerToSpawn();
worldClientIn.spawnEntityInWorld(this.player);
this.player.movementInput = new MovementInputFromOptions(this.gameSettings);
this.playerController.setPlayerCapabilities(this.player);
this.renderViewEntity = this.player;
} else {
this.saveLoader.flushCache();
this.player = null;
}
System.gc();
this.systemTime = 0L;
}
use of net.minecraft.stats.StatisticsManager in project Minecraft-SlientClient-Hack by YouNeverKnow00.
the class Minecraft method setDimensionAndSpawnPlayer.
public void setDimensionAndSpawnPlayer(int dimension) {
this.world.setInitialSpawnLocation();
this.world.removeAllEntities();
int i = 0;
String s = null;
if (this.player != null) {
i = this.player.getEntityId();
this.world.removeEntity(this.player);
s = this.player.getServerBrand();
}
this.renderViewEntity = null;
EntityPlayerSP entityplayersp = this.player;
this.player = this.playerController.func_192830_a(this.world, this.player == null ? new StatisticsManager() : this.player.getStatFileWriter(), this.player == null ? new RecipeBook() : this.player.func_192035_E());
this.player.getDataManager().setEntryValues(entityplayersp.getDataManager().getAll());
this.player.dimension = dimension;
this.renderViewEntity = this.player;
this.player.preparePlayerToSpawn();
this.player.setServerBrand(s);
this.world.spawnEntityInWorld(this.player);
this.playerController.flipPlayer(this.player);
this.player.movementInput = new MovementInputFromOptions(this.gameSettings);
this.player.setEntityId(i);
this.playerController.setPlayerCapabilities(this.player);
this.player.setReducedDebug(entityplayersp.hasReducedDebug());
if (this.currentScreen instanceof GuiGameOver) {
this.displayGuiScreen((GuiScreen) null);
}
}
Aggregations