mirror of
https://github.com/TeamMidnightDust/VisualOverhaul.git
synced 2025-12-15 13:45:09 +01:00
Try to make Phonos compat work again
For some reason, the Phonos compat classes aren't getting remapped correctly, causing a crash.
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
package eu.midnightdust.visualoverhaul.compat.phonos.block;
|
||||
|
||||
//import io.github.foundationgames.phonos.block.PhonosBlocks;
|
||||
//import io.github.foundationgames.phonos.block.RadioJukeboxBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.IntProperty;
|
||||
|
||||
//public class RadioJukeboxTop extends Block {
|
||||
// public static final BooleanProperty PLAYING = RadioJukeboxBlock.PLAYING;
|
||||
// public static final IntProperty CHANNEL = RadioJukeboxBlock.CHANNEL;
|
||||
//
|
||||
// public RadioJukeboxTop() {
|
||||
// super(FabricBlockSettings.copy(PhonosBlocks.RADIO_JUKEBOX));
|
||||
// this.setDefaultState(this.stateManager.getDefaultState());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
||||
// builder.add(PLAYING, CHANNEL);
|
||||
// }
|
||||
//}
|
||||
@@ -1,74 +0,0 @@
|
||||
package eu.midnightdust.visualoverhaul.compat.phonos.block.renderer;
|
||||
//
|
||||
//import eu.midnightdust.visualoverhaul.compat.phonos.block.RadioJukeboxTop;
|
||||
//import eu.midnightdust.visualoverhaul.compat.phonos.init.PhonosCompatInit;
|
||||
//import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
//import io.github.foundationgames.phonos.block.RadioJukeboxBlock;
|
||||
//import io.github.foundationgames.phonos.block.entity.RadioJukeboxBlockEntity;
|
||||
//import net.fabricmc.api.EnvType;
|
||||
//import net.fabricmc.api.Environment;
|
||||
//import net.minecraft.block.BlockState;
|
||||
//import net.minecraft.block.Blocks;
|
||||
//import net.minecraft.client.MinecraftClient;
|
||||
//import net.minecraft.client.render.RenderLayer;
|
||||
//import net.minecraft.client.render.VertexConsumerProvider;
|
||||
//import net.minecraft.client.render.WorldRenderer;
|
||||
//import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
|
||||
//import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
//import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
//import net.minecraft.client.util.math.MatrixStack;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//
|
||||
//import java.util.Random;
|
||||
//
|
||||
//@Environment(EnvType.CLIENT)
|
||||
//public class RadioJukeboxBlockEntityRenderer implements BlockEntityRenderer<RadioJukeboxBlockEntity> {
|
||||
// private ItemStack record;
|
||||
// private float rotation = 0;
|
||||
// private BlockState blockState;
|
||||
//
|
||||
// public RadioJukeboxBlockEntityRenderer(BlockEntityRenderDispatcher blockEntityRenderDispatcher) {
|
||||
// super();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void render(RadioJukeboxBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
|
||||
// if (VOConfig.jukebox) {
|
||||
// int lightAbove = WorldRenderer.getLightmapCoordinates(blockEntity.getWorld(), blockEntity.getPos().up());
|
||||
//
|
||||
// // Tries to get the disc using the serverside method
|
||||
// if (blockEntity.getStack(blockEntity.getPlayingSong()) != ItemStack.EMPTY) {
|
||||
// record = blockEntity.getStack(blockEntity.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.push();
|
||||
//
|
||||
// matrices.translate(0.5f, 1.03f, 0.5f);
|
||||
// matrices.scale(0.75f, 0.75f, 0.75f);
|
||||
//
|
||||
// if (blockEntity.isPlaying()) {
|
||||
// rotation = (blockEntity.getWorld().getTime() + tickDelta) * 4;
|
||||
// }
|
||||
// matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(rotation));
|
||||
// MinecraftClient.getInstance().getItemRenderer().renderItem(record, ModelTransformation.Mode.GROUND, lightAbove, overlay, matrices, vertexConsumers);
|
||||
//
|
||||
// matrices.pop();
|
||||
// if (VOConfig.jukebox_fake_block && blockEntity.getWorld().getBlockState(blockEntity.getPos().up()).getBlock() == Blocks.AIR) {
|
||||
// blockState = blockEntity.getWorld().getBlockState(blockEntity.getPos());
|
||||
// matrices.push();
|
||||
// matrices.translate(0f, 1f, 0f);
|
||||
// if (record == ItemStack.EMPTY) {
|
||||
// MinecraftClient.getInstance().getBlockRenderManager().renderBlock(PhonosCompatInit.RadioJukeboxTop.getDefaultState().with(RadioJukeboxTop.PLAYING, false).with(RadioJukeboxTop.CHANNEL, blockState.get(RadioJukeboxBlock.CHANNEL)), blockEntity.getPos().up(), blockEntity.getWorld(), matrices, vertexConsumers.getBuffer(RenderLayer.getCutout()), false, new Random());
|
||||
// } else {
|
||||
// MinecraftClient.getInstance().getBlockRenderManager().renderBlock(PhonosCompatInit.RadioJukeboxTop.getDefaultState().with(RadioJukeboxTop.PLAYING, true).with(RadioJukeboxTop.CHANNEL, blockState.get(RadioJukeboxBlock.CHANNEL)), blockEntity.getPos().up(), blockEntity.getWorld(), matrices, vertexConsumers.getBuffer(RenderLayer.getCutout()), false, new Random());
|
||||
// }
|
||||
// matrices.pop();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -1,19 +0,0 @@
|
||||
package eu.midnightdust.visualoverhaul.compat.phonos.init;
|
||||
|
||||
//import eu.midnightdust.visualoverhaul.compat.phonos.block.RadioJukeboxTop;
|
||||
//import io.github.foundationgames.phonos.block.PhonosBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
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);
|
||||
|
||||
//BlockRenderLayerMapImpl.INSTANCE.putBlock(PhonosBlocks.RADIO_JUKEBOX, RenderLayer.getCutout());
|
||||
//BlockRenderLayerMapImpl.INSTANCE.putBlock(RadioJukeboxTop, RenderLayer.getCutout());
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,9 @@ architectury {
|
||||
injectInjectables = false
|
||||
common(rootProject.enabled_platforms.split(","))
|
||||
}
|
||||
repositories {
|
||||
flatDir { dirs 'localMaven'}
|
||||
}
|
||||
|
||||
loom {
|
||||
}
|
||||
@@ -11,6 +14,7 @@ dependencies {
|
||||
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
|
||||
// Remove the next line if you don't want to depend on the API
|
||||
//modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}"
|
||||
modCompileOnlyApi "maven.modrinth:phonos:${rootProject.phonos_version}"
|
||||
|
||||
compileClasspath(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
}
|
||||
|
||||
BIN
fabric-like/localMaven/phonos-0.3.0+1.19.2.jar
Normal file
BIN
fabric-like/localMaven/phonos-0.3.0+1.19.2.jar
Normal file
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
package eu.midnightdust.visualoverhaul.compat.phonos.block;
|
||||
|
||||
import io.github.foundationgames.phonos.block.PhonosBlocks;
|
||||
import io.github.foundationgames.phonos.block.RadioJukeboxBlock;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.IntProperty;
|
||||
|
||||
public class RadioJukeboxTop extends Block {
|
||||
public static final BooleanProperty PLAYING = RadioJukeboxBlock.PLAYING;
|
||||
public static final IntProperty CHANNEL = RadioJukeboxBlock.CHANNEL;
|
||||
|
||||
public RadioJukeboxTop() {
|
||||
super(AbstractBlock.Settings.copy(PhonosBlocks.RADIO_JUKEBOX));
|
||||
this.setDefaultState(this.stateManager.getDefaultState());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
||||
builder.add(PLAYING, CHANNEL);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package eu.midnightdust.visualoverhaul.compat.phonos.block.renderer;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.compat.phonos.block.RadioJukeboxTop;
|
||||
import eu.midnightdust.visualoverhaul.compat.phonos.init.PhonosCompatInit;
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import io.github.foundationgames.phonos.block.RadioJukeboxBlock;
|
||||
import io.github.foundationgames.phonos.block.entity.RadioJukeboxBlockEntity;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.WorldRenderer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
|
||||
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;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class RadioJukeboxBlockEntityRenderer implements BlockEntityRenderer<RadioJukeboxBlockEntity> {
|
||||
private ItemStack record;
|
||||
private float rotation = 0;
|
||||
private BlockState blockState;
|
||||
private final MinecraftClient client = MinecraftClient.getInstance();
|
||||
|
||||
public RadioJukeboxBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) {
|
||||
super();
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package eu.midnightdust.visualoverhaul.compat.phonos.init;
|
||||
|
||||
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.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);
|
||||
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(PhonosBlocks.RADIO_JUKEBOX, RenderLayer.getCutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(RadioJukeboxTop, RenderLayer.getCutout());
|
||||
BlockEntityRendererRegistry.register(PhonosBlocks.RADIO_JUKEBOX_ENTITY, RadioJukeboxBlockEntityRenderer::new);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package eu.midnightdust.visualoverhaul.fabric;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.VisualOverhaulClient;
|
||||
import eu.midnightdust.visualoverhaul.block.JukeboxTop;
|
||||
import eu.midnightdust.visualoverhaul.block.model.FurnaceWoodenPlanksModel;
|
||||
import eu.midnightdust.visualoverhaul.block.renderer.BrewingStandBlockEntityRenderer;
|
||||
import eu.midnightdust.visualoverhaul.block.renderer.FurnaceBlockEntityRenderer;
|
||||
import eu.midnightdust.visualoverhaul.block.renderer.JukeboxBlockEntityRenderer;
|
||||
import eu.midnightdust.visualoverhaul.compat.phonos.init.PhonosCompatInit;
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||
@@ -41,6 +43,7 @@ public class VisualOverhaulClientFabric implements ClientModInitializer {
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
VisualOverhaulClient.onInitializeClient();
|
||||
JukeBoxTop = new JukeboxTop();
|
||||
// Block only registered on client, because it's just used for the renderer //
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"jukebox_top"), JukeBoxTop);
|
||||
|
||||
@@ -58,11 +61,10 @@ public class VisualOverhaulClientFabric implements ClientModInitializer {
|
||||
BlockEntityRendererRegistry.register(BlockEntityType.SMOKER, FurnaceBlockEntityRenderer::new);
|
||||
BlockEntityRendererRegistry.register(BlockEntityType.BLAST_FURNACE, FurnaceBlockEntityRenderer::new);
|
||||
|
||||
// // Phonos Compat //
|
||||
// if (FabricLoader.getInstance().isModLoaded("phonos")) {
|
||||
// Phonos Compat //
|
||||
if (FabricLoader.getInstance().isModLoaded("phonos")) {
|
||||
//PhonosCompatInit.init();
|
||||
// BlockEntityRendererRegistry.INSTANCE.register(PhonosBlocks.RADIO_JUKEBOX_ENTITY, RadioJukeboxBlockEntityRenderer::new);
|
||||
// }
|
||||
}
|
||||
|
||||
Registry.ITEM.forEach((item) -> {
|
||||
if(item instanceof MusicDiscItem || item.getName().getString().toLowerCase().contains("music_disc") || item.getName().getString().toLowerCase().contains("record") || item.getName().getString().toLowerCase().contains("dynamic_disc")) {
|
||||
|
||||
@@ -9,6 +9,7 @@ maven_group=eu.midnightdust
|
||||
|
||||
architectury_version=6.2.43
|
||||
midnightlib_version=1.0.0
|
||||
phonos_version=0.3.0+1.19.2
|
||||
|
||||
fabric_loader_version=0.14.9
|
||||
fabric_api_version=0.59.0+1.19.2
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package eu.midnightdust.visualoverhaul.quilt;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.VisualOverhaulClient;
|
||||
import eu.midnightdust.visualoverhaul.block.JukeboxTop;
|
||||
import eu.midnightdust.visualoverhaul.block.model.FurnaceWoodenPlanksModel;
|
||||
import eu.midnightdust.visualoverhaul.block.renderer.BrewingStandBlockEntityRenderer;
|
||||
import eu.midnightdust.visualoverhaul.block.renderer.FurnaceBlockEntityRenderer;
|
||||
import eu.midnightdust.visualoverhaul.block.renderer.JukeboxBlockEntityRenderer;
|
||||
import eu.midnightdust.visualoverhaul.compat.phonos.init.PhonosCompatInit;
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
|
||||
@@ -27,6 +29,7 @@ import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import org.quiltmc.loader.api.ModContainer;
|
||||
import org.quiltmc.loader.api.QuiltLoader;
|
||||
import org.quiltmc.qsl.base.api.entrypoint.client.ClientModInitializer;
|
||||
import org.quiltmc.qsl.block.extensions.api.client.BlockRenderLayerMap;
|
||||
import org.quiltmc.qsl.lifecycle.api.client.event.ClientTickEvents;
|
||||
@@ -41,6 +44,7 @@ public class VisualOverhaulClientQuilt implements ClientModInitializer {
|
||||
@Override
|
||||
public void onInitializeClient(ModContainer mod) {
|
||||
VisualOverhaulClient.onInitializeClient();
|
||||
JukeBoxTop = new JukeboxTop();
|
||||
// Block only registered on client, because it's just used for the renderer //
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"jukebox_top"), JukeBoxTop);
|
||||
|
||||
@@ -58,11 +62,10 @@ public class VisualOverhaulClientQuilt implements ClientModInitializer {
|
||||
BlockEntityRendererRegistry.register(BlockEntityType.SMOKER, FurnaceBlockEntityRenderer::new);
|
||||
BlockEntityRendererRegistry.register(BlockEntityType.BLAST_FURNACE, FurnaceBlockEntityRenderer::new);
|
||||
|
||||
// // Phonos Compat //
|
||||
// if (FabricLoader.getInstance().isModLoaded("phonos")) {
|
||||
// Phonos Compat //
|
||||
if (QuiltLoader.isModLoaded("phonos")) {
|
||||
//PhonosCompatInit.init();
|
||||
// BlockEntityRendererRegistry.INSTANCE.register(PhonosBlocks.RADIO_JUKEBOX_ENTITY, RadioJukeboxBlockEntityRenderer::new);
|
||||
// }
|
||||
}
|
||||
|
||||
Registry.ITEM.forEach((item) -> {
|
||||
if(item instanceof MusicDiscItem || item.getName().getString().toLowerCase().contains("music_disc") || item.getName().getString().toLowerCase().contains("record") || item.getName().getString().toLowerCase().contains("dynamic_disc")) {
|
||||
|
||||
Reference in New Issue
Block a user