use of net.minecraft.client.MinecraftClient in project Biome-Makeover by Lemonszz.
the class ItemGroupTabWidget method renderButton.
public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float delta) {
MinecraftClient minecraftClient = MinecraftClient.getInstance();
minecraftClient.getTextureManager().bindTexture(TEXTURE);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, this.alpha);
int i = this.getYImage(this.isHovered());
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
this.drawTexture(matrixStack, this.x, this.y, 0, i * height, this.width, this.height);
this.renderBg(matrixStack, minecraftClient, mouseX, mouseY);
minecraftClient.getItemRenderer().renderInGui(tab.getIcon(), this.x + 3, this.y + 3);
}
use of net.minecraft.client.MinecraftClient in project EarthMCEssentials by EarthMC-Stats.
the class EarthMCAPI method getNearby.
public static CompletableFuture<JsonArray> getNearby(int xBlocks, int zBlocks) {
return CompletableFuture.supplyAsync(() -> {
try {
MinecraftClient client = MinecraftClient.getInstance();
ClientPlayerEntity player = client.player;
if (player != null) {
if (!player.getEntityWorld().getDimension().isBedWorking())
return new JsonArray();
JsonArray array = (JsonArray) new JsonParser().parse(getURL(config.api.main.domain() + config.api.routes.nearby + (int) player.getX() + "/" + (int) player.getZ() + "/" + xBlocks + "/" + zBlocks));
for (int i = 0; i < array.size(); i++) {
JsonObject currentObj = (JsonObject) array.get(i);
if (currentObj.get("name").getAsString().equals(client.player.getName().asString()))
array.remove(i);
}
return array;
} else
return EarthMCEssentials.instance().getNearbyPlayers();
} catch (APIException e) {
MsgUtils.sendDebugMessage(e.getMessage(), e);
return EarthMCEssentials.instance().getNearbyPlayers();
}
});
}
use of net.minecraft.client.MinecraftClient in project isometric-renders by gliscowo.
the class IsometricRenderPresets method setupBlockEntityRender.
public static void setupBlockEntityRender(IsometricRenderScreen screen, @NotNull BlockEntity entity) {
final MinecraftClient client = MinecraftClient.getInstance();
final Identifier blockId = Registry.BLOCK.getId(entity.getCachedState().getBlock());
screen.setup((matrices, vertexConsumerProvider, tickDelta) -> {
matrices.push();
matrices.translate(-0.5, 0, -0.5);
client.getBlockRenderManager().renderBlockAsEntity(entity.getCachedState(), matrices, vertexConsumerProvider, 15728880, OverlayTexture.DEFAULT_UV);
if (BlockEntityRenderDispatcher.INSTANCE.get(entity) != null) {
BlockEntityRenderDispatcher.INSTANCE.get(entity).render(entity, tickDelta, matrices, vertexConsumerProvider, 15728880, OverlayTexture.DEFAULT_UV);
}
double xOffset = client.player.getX() % 1d;
double zOffset = client.player.getZ() % 1d;
if (xOffset < 0)
xOffset += 1;
if (zOffset < 0)
zOffset += 1;
matrices.translate(xOffset, 1.65 + client.player.getY() % 1d, zOffset);
client.particleManager.renderParticles(matrices, (VertexConsumerProvider.Immediate) vertexConsumerProvider, client.gameRenderer.getLightmapTextureManager(), getParticleCamera(), tickDelta);
matrices.pop();
}, blockId.getNamespace() + "/blocks/" + blockId.getPath());
screen.setTickCallback(() -> {
if (entity instanceof Tickable) {
((Tickable) entity).tick();
}
if (client.world.random.nextDouble() < 0.150) {
entity.getCachedState().getBlock().randomDisplayTick(entity.getCachedState(), client.world, client.player.getBlockPos(), client.world.random);
}
});
}
use of net.minecraft.client.MinecraftClient in project isometric-renders by gliscowo.
the class IsoRenderCommand method executeEntity.
private static int executeEntity(FabricClientCommandSource source, Identifier entityType, CompoundTag entityTag) {
final MinecraftClient client = MinecraftClient.getInstance();
IsometricRenderScreen screen = new IsometricRenderScreen();
entityTag.putString("id", entityType.toString());
Entity entity = EntityType.loadEntityWithPassengers(entityTag, client.world, Function.identity());
entity.updatePosition(client.player.getX(), client.player.getY(), client.player.getZ());
entity.setWorld(client.world);
if (entity instanceof MobEntity) {
((MobEntity) entity).setPersistent();
}
IsometricRenderPresets.setupEntityRender(screen, entity);
IsometricRenderHelper.scheduleScreen(screen);
return 0;
}
use of net.minecraft.client.MinecraftClient in project isometric-renders by gliscowo.
the class IsoRenderCommand method executeItem.
private static int executeItem(FabricClientCommandSource source, ItemStack stack) {
MinecraftClient client = MinecraftClient.getInstance();
IsometricRenderScreen screen = new IsometricRenderScreen();
IsometricRenderPresets.setupItemStackRender(screen, stack);
IsometricRenderHelper.scheduleScreen(screen);
return 0;
}
Aggregations