Skip to content

Instantly share code, notes, and snippets.

View isXander's full-sized avatar

Xander isXander

View GitHub Profile
package dev.isxander.yacl3.mixin;
import net.minecraft.client.gui.components.events.ContainerEventHandler;
import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.client.gui.components.tabs.TabNavigationBar;
import net.minecraft.client.gui.navigation.FocusNavigationEvent;
import net.minecraft.client.gui.navigation.ScreenAxis;
import net.minecraft.client.gui.navigation.ScreenDirection;
import net.minecraft.client.gui.navigation.ScreenRectangle;
import org.jetbrains.annotations.Nullable;
private static AnimatedNativeImageBacked createFromImageReader(ImageReader reader, AnimFrameProvider animationProvider, ResourceLocation uniqueLocation) throws Exception {
if (reader.isSeekForwardOnly()) {
throw new RuntimeException("Image reader is not seekable");
}
int frameCount = reader.getNumImages(true);
// Because this is being backed into a texture atlas, we need a maximum dimension
// so you can get the texture atlas size.
// Smaller frames are given black borders
fn create_face(
x: f32, y: f32, z: f32,
face: Face,
) -> Vec<engine::model::ModelVertex> {
let mut vertices = Vec::new();
println!("Creating face: {:?}", face);
let (x_axis, y_axis, z_axis, x_off, y_off, z_off, norm_x, norm_y, norm_z) = match face {
Face::Top => (1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0),
pub fn receive_generated_chunks(&mut self, texture_atlas: &Arc<TextureAtlas>) {
while let Ok((coords, state)) = self.chunkgen_thread_receiver.try_recv() {
let (x, z) = Self::unpack_coordinates(coords);
println!("Generated chunk at {},{}", x, z);
self.chunks.insert(coords, state);
let state = self.chunks.get(&coords).unwrap();
if let ChunkState::Loaded(LoadedChunk::Stored { chunk }) = state {
import de.undercouch.gradle.tasks.download.Download
plugins {
java
id("fabric-loom") version "1.6.+"
id("me.modmuss50.mod-publish-plugin") version "0.5.+"
`maven-publish`
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
`java-library`
kotlin("jvm") version "1.9.22"
id(/*"dev.architectury.loom"*/"fabric-loom") version "1.6.+"
id("me.modmuss50.mod-publish-plugin") version "0.5.+"
`maven-publish`
package nl.enjarai.doabarrelroll;
import net.minecraft.entity.LivingEntity;
import net.minecraft.fluid.Fluids;
import net.minecraft.particle.ParticleEffect;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.BlockStateRaycastContext;
import net.minecraft.world.RaycastContext;