use of net.minecraft.client.multiplayer.WorldClient in project Hyperium by HyperiumClient.
the class YeetHandler method yeet.
public void yeet(UUID uuid) {
WorldClient theWorld = Minecraft.getMinecraft().theWorld;
if (theWorld == null)
return;
EntityPlayer player = theWorld.getPlayerEntityByUUID(uuid);
if (player != null)
yeets.add(new Yeet(player));
}
use of net.minecraft.client.multiplayer.WorldClient in project minecolonies by Minecolonies.
the class ClientEventHandler method renderWorldLastEvent.
/**
* Used to catch the renderWorldLastEvent in order to draw the debug nodes for pathfinding.
*
* @param event the catched event.
*/
@SubscribeEvent
public void renderWorldLastEvent(@NotNull final RenderWorldLastEvent event) {
Pathfinding.debugDraw(event.getPartialTicks());
final Structure structure = Settings.instance.getActiveStructure();
final WorldClient world = Minecraft.getMinecraft().world;
final EntityPlayer player = Minecraft.getMinecraft().player;
if (structure != null) {
final BlockPos position = Settings.instance.getPosition();
if (Settings.instance.getStructureName().contains(AbstractEntityAIStructure.WAYPOINT_STRING)) {
RenderUtils.renderWayPoints(position, world, event.getPartialTicks());
} else {
RenderUtils.renderColonyBorder(position, world, event.getPartialTicks(), player, colonyBorder);
}
return;
} else {
if (citizen != null) {
final Entity entityCitizen = world.getEntityByID(citizen.getEntityId());
if (entityCitizen instanceof EntityCitizen) {
RenderUtils.renderSigns(world, event.getPartialTicks(), citizen, player, entityCitizen.getPosition());
ticksPassed += event.getPartialTicks();
if (ticksPassed > Constants.TICKS_SECOND * SECONDS_TO_SHOW) {
ticksPassed = 0;
citizen = null;
}
} else {
citizen = null;
ticksPassed = 0;
}
return;
}
final ColonyView colony = ColonyManager.getClosestColonyView(world, player.getPosition());
if (colony != null && player != null && colony.getPermissions().hasPermission(player, Action.ACCESS_HUTS)) {
for (final CitizenDataView citizenDataView : new ArrayList<CitizenDataView>(colony.getCitizens().values())) {
final Entity entityCitizen = world.getEntityByID(citizenDataView.getEntityId());
if (entityCitizen instanceof EntityCitizen && entityCitizen.getPosition().distanceSq(player.getPosition()) <= 2) {
RenderUtils.renderSigns(world, event.getPartialTicks(), citizenDataView, player, entityCitizen.getPosition());
citizen = citizenDataView;
return;
}
}
}
}
colonyBorder.clear();
}
use of net.minecraft.client.multiplayer.WorldClient in project XNet by McJty.
the class RenderWorldLastEventHandler method renderCablesInt.
private static void renderCablesInt(RenderWorldLastEvent evt, Minecraft mc) {
EntityPlayerSP p = mc.player;
WorldClient world = mc.world;
double doubleX = p.lastTickPosX + (p.posX - p.lastTickPosX) * evt.getPartialTicks();
double doubleY = p.lastTickPosY + (p.posY - p.lastTickPosY) * evt.getPartialTicks();
double doubleZ = p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * evt.getPartialTicks();
GlStateManager.pushMatrix();
GlStateManager.color(1.0f, 0, 0);
GlStateManager.glLineWidth(2);
GlStateManager.translate(-doubleX, -doubleY, -doubleZ);
GlStateManager.disableDepth();
GlStateManager.disableTexture2D();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
for (int dx = -20; dx <= 20; dx++) {
for (int dy = -20; dy <= 20; dy++) {
for (int dz = -20; dz <= 20; dz++) {
BlockPos c = p.getPosition().add(dx, dy, dz);
IBlockState state = world.getBlockState(c);
Block block = state.getBlock();
if (block instanceof FacadeBlock || block instanceof ConnectorBlock || block instanceof GenericCableBlock) {
IExtendedBlockState extendedBlockState;
if (state.getBlock() instanceof FacadeBlock) {
extendedBlockState = (IExtendedBlockState) ((FacadeBlock) state.getBlock()).getStateInternal(state, world, c);
} else {
extendedBlockState = (IExtendedBlockState) state.getBlock().getExtendedState(state, world, c);
}
FacadeBlockId facadeId = extendedBlockState.getValue(GenericCableBlock.FACADEID);
if (((!GeneralConfiguration.showNonFacadedCablesWhileSneaking) || (!p.isSneaking())) && facadeId == null && !(block instanceof FacadeBlock)) {
continue;
}
CableColor color = extendedBlockState.getValue(GenericCableBlock.COLOR);
float r = 0;
float g = 0;
float b = 0;
switch(color) {
case BLUE:
r = .4f;
g = .4f;
b = 1f;
break;
case RED:
r = 1f;
g = .4f;
b = .4f;
break;
case YELLOW:
r = 1f;
g = 1f;
b = .4f;
break;
case GREEN:
r = .4f;
g = 1f;
b = .4f;
break;
case ROUTING:
r = .7f;
g = .7f;
b = .7f;
break;
}
List<Rect> quads = getQuads(extendedBlockState);
for (Rect quad : quads) {
renderRect(buffer, quad, c, r, g, b, 0.5f);
}
}
}
}
}
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.popMatrix();
}
use of net.minecraft.client.multiplayer.WorldClient in project BetterRain by OreCruncher.
the class StormSplashRenderer method addRainParticles.
public void addRainParticles(final EntityRenderer theThis) {
if (theThis.mc.gameSettings.particleSetting == 2)
return;
if (!DimensionRegistry.hasWeather(EnvironState.getWorld()))
return;
float rainStrengthFactor = theThis.mc.theWorld.getRainStrength(1.0F);
if (!theThis.mc.gameSettings.fancyGraphics)
rainStrengthFactor /= 2.0F;
if (rainStrengthFactor <= 0.0F)
return;
RANDOM.setSeed((long) theThis.rendererUpdateCount * 312987231L);
final Entity entity = theThis.mc.getRenderViewEntity();
final WorldClient worldclient = theThis.mc.theWorld;
final int playerX = MathHelper.floor_double(entity.posX);
final int playerY = MathHelper.floor_double(entity.posY);
final int playerZ = MathHelper.floor_double(entity.posZ);
double spawnX = 0.0D;
double spawnY = 0.0D;
double spawnZ = 0.0D;
int particlesSpawned = 0;
int particleCount = (int) (ModOptions.particleCountBase * rainStrengthFactor * rainStrengthFactor);
if (theThis.mc.gameSettings.particleSetting == 1)
particleCount >>= 1;
BlockPos.MutableBlockPos posXZ = new BlockPos.MutableBlockPos();
for (int j1 = 0; j1 < particleCount; ++j1) {
final int locX = playerX + RANDOM.nextInt(RANGE) - RANDOM.nextInt(RANGE);
final int locZ = playerZ + RANDOM.nextInt(RANGE) - RANDOM.nextInt(RANGE);
posXZ.set(locX, 0, locZ);
final BlockPos precipHeight = getPrecipitationHeight(worldclient, RANGE / 2, posXZ);
final BiomeGenBase biome = worldclient.getBiomeGenForCoords(posXZ);
final boolean hasDust = WeatherUtils.biomeHasDust(biome);
if (precipHeight.getY() <= playerY + RANGE && precipHeight.getY() >= playerY - RANGE && (hasDust || (BiomeRegistry.hasPrecipitation(biome) && biome.getFloatTemperature(precipHeight) >= 0.15F))) {
final Block block = worldclient.getBlockState(precipHeight.down()).getBlock();
final double posX = locX + RANDOM.nextFloat();
final double posY = precipHeight.getY() + 0.1F - block.getBlockBoundsMinY();
final double posZ = locZ + RANDOM.nextFloat();
final EntityFX particle = getBlockParticleFX(block, hasDust, worldclient, posX, posY, posZ);
if (particle != null)
theThis.mc.effectRenderer.addEffect(particle);
if (RANDOM.nextInt(++particlesSpawned) == 0) {
spawnX = posX;
spawnY = posY;
spawnZ = posZ;
}
}
}
if (particlesSpawned > 0 && RANDOM.nextInt(PARTICLE_SOUND_CHANCE) < theThis.rainSoundCounter++) {
theThis.rainSoundCounter = 0;
playSplashSound(theThis, worldclient, entity, spawnX, spawnY, spawnZ);
}
}
Aggregations