VisualOverhaul 5.0.0 - The Iconic Update

- Port to 1.19.4
- Use Architectury -> Forge & native Quilt support!
- New Feature: Icon Buttons!
  - Makes buttons look less bland by adding icons to them
  - Loaded from resourcepacks
  - Currently uses vanilla items as icons
- Organize config screen in tabs
This commit is contained in:
Motschen
2023-04-26 20:47:43 +02:00
parent 363a9ab634
commit c6ccdb0d95
94 changed files with 611 additions and 169 deletions

View File

@@ -19,8 +19,8 @@ import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3f;
import net.minecraft.util.math.random.Random;
import org.joml.Vector3f;
@Environment(EnvType.CLIENT)
public class RadioJukeboxBlockEntityRenderer implements BlockEntityRenderer<RadioJukeboxBlockEntity> {
@@ -36,42 +36,42 @@ public class RadioJukeboxBlockEntityRenderer implements BlockEntityRenderer<Radi
@Override
public void render(RadioJukeboxBlockEntity jukebox, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
if (VOConfig.jukebox && client.world != null) {
matrices.push();
Vec3f vecPos = matrices.peek().getNormalMatrix().decomposeLinearTransformation().getMiddle();
BlockPos pos = new BlockPos(vecPos.getX(), vecPos.getY(), vecPos.getZ());
int lightAbove = WorldRenderer.getLightmapCoordinates(client.world, pos.up());
// Tries to get the disc using the serverside method
if (jukebox.getStack(jukebox.getPlayingSong()) != ItemStack.EMPTY) {
record = jukebox.getStack(jukebox.getPlayingSong()).copy();
record.setCount(2);
}
// If the sound is stopped or no sound is playing, the stack is set to an empty stack //
else {
record = ItemStack.EMPTY;
}
matrices.translate(0.5f, 1.03f, 0.5f);
matrices.scale(0.75f, 0.75f, 0.75f);
if (jukebox.isPlaying()) {
rotation = (client.world.getTime() + tickDelta) * 4;
}
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(rotation));
client.getItemRenderer().renderItem(record, ModelTransformation.Mode.GROUND, lightAbove, overlay, matrices, vertexConsumers, 0);
matrices.pop();
if (VOConfig.jukebox_fake_block && client.world.getBlockState(pos.up()).getBlock() == Blocks.AIR) {
blockState = client.world.getBlockState(pos);
matrices.push();
matrices.translate(0f, 1f, 0f);
if (record == ItemStack.EMPTY) {
client.getBlockRenderManager().renderBlock(PhonosCompatInit.RadioJukeboxTop.getDefaultState().with(RadioJukeboxTop.PLAYING, false).with(RadioJukeboxTop.CHANNEL, blockState.get(RadioJukeboxBlock.CHANNEL)), pos.up(), client.world, matrices, vertexConsumers.getBuffer(RenderLayer.getCutout()), false, Random.create());
} else {
client.getBlockRenderManager().renderBlock(PhonosCompatInit.RadioJukeboxTop.getDefaultState().with(RadioJukeboxTop.PLAYING, true).with(RadioJukeboxTop.CHANNEL, blockState.get(RadioJukeboxBlock.CHANNEL)), pos.up(), client.world, matrices, vertexConsumers.getBuffer(RenderLayer.getCutout()), false, Random.create());
}
matrices.pop();
}
// matrices.push();
// Vector3f vecPos = matrices.peek().getNormalMatrix().decomposeLinearTransformation().getMiddle();
// BlockPos pos = new BlockPos(vecPos.getX(), vecPos.getY(), vecPos.getZ());
// int lightAbove = WorldRenderer.getLightmapCoordinates(client.world, pos.up());
//
// // Tries to get the disc using the serverside method
// if (jukebox.getStack(jukebox.getPlayingSong()) != ItemStack.EMPTY) {
// record = jukebox.getStack(jukebox.getPlayingSong()).copy();
// record.setCount(2);
// }
// // If the sound is stopped or no sound is playing, the stack is set to an empty stack //
// else {
// record = ItemStack.EMPTY;
// }
//
// matrices.translate(0.5f, 1.03f, 0.5f);
// matrices.scale(0.75f, 0.75f, 0.75f);
//
// if (jukebox.isPlaying()) {
// rotation = (client.world.getTime() + tickDelta) * 4;
// }
// matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(rotation));
// client.getItemRenderer().renderItem(record, ModelTransformation.Mode.GROUND, lightAbove, overlay, matrices, vertexConsumers, 0);
//
// matrices.pop();
// if (VOConfig.jukebox_fake_block && client.world.getBlockState(pos.up()).getBlock() == Blocks.AIR) {
// blockState = client.world.getBlockState(pos);
// matrices.push();
// matrices.translate(0f, 1f, 0f);
// if (record == ItemStack.EMPTY) {
// client.getBlockRenderManager().renderBlock(PhonosCompatInit.RadioJukeboxTop.getDefaultState().with(RadioJukeboxTop.PLAYING, false).with(RadioJukeboxTop.CHANNEL, blockState.get(RadioJukeboxBlock.CHANNEL)), pos.up(), client.world, matrices, vertexConsumers.getBuffer(RenderLayer.getCutout()), false, Random.create());
// } else {
// client.getBlockRenderManager().renderBlock(PhonosCompatInit.RadioJukeboxTop.getDefaultState().with(RadioJukeboxTop.PLAYING, true).with(RadioJukeboxTop.CHANNEL, blockState.get(RadioJukeboxBlock.CHANNEL)), pos.up(), client.world, matrices, vertexConsumers.getBuffer(RenderLayer.getCutout()), false, Random.create());
// }
// matrices.pop();
// }
}
}
}

View File

@@ -4,20 +4,21 @@ import eu.midnightdust.visualoverhaul.compat.phonos.block.RadioJukeboxTop;
import eu.midnightdust.visualoverhaul.compat.phonos.block.renderer.RadioJukeboxBlockEntityRenderer;
import io.github.foundationgames.phonos.block.PhonosBlocks;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
import net.minecraft.block.Block;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactories;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public class PhonosCompatInit {
public static Block RadioJukeboxTop = new RadioJukeboxTop();
public static void init() {
Registry.register(Registry.BLOCK, new Identifier("visualoverhaul","radio_jukebox_top"), RadioJukeboxTop);
Registry.register(Registries.BLOCK, new Identifier("visualoverhaul","radio_jukebox_top"), RadioJukeboxTop);
BlockRenderLayerMap.INSTANCE.putBlock(PhonosBlocks.RADIO_JUKEBOX, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(RadioJukeboxTop, RenderLayer.getCutout());
BlockEntityRendererRegistry.register(PhonosBlocks.RADIO_JUKEBOX_ENTITY, RadioJukeboxBlockEntityRenderer::new);
BlockEntityRendererFactories.register(PhonosBlocks.RADIO_JUKEBOX_ENTITY, RadioJukeboxBlockEntityRenderer::new);
}
}