mirror of
https://github.com/TeamMidnightDust/VisualOverhaul.git
synced 2025-12-16 05:55:09 +01:00
port: 1.21.4
- Also substantially improve iconic buttons
This commit is contained in:
@@ -14,6 +14,7 @@ import eu.midnightdust.visualoverhaul.util.VOColorUtil;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.model.loading.v1.ModelModifier;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
|
||||
@@ -27,7 +28,10 @@ import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.block.entity.BrewingStandBlockEntity;
|
||||
import net.minecraft.client.color.world.BiomeColors;
|
||||
import net.minecraft.client.item.ModelPredicateProviderRegistry;
|
||||
import net.minecraft.client.data.ModelProvider;
|
||||
import net.minecraft.client.data.Models;
|
||||
import net.minecraft.client.model.Model;
|
||||
import net.minecraft.client.model.ModelData;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRendererFactories;
|
||||
import net.minecraft.component.DataComponentTypes;
|
||||
@@ -70,11 +74,11 @@ public class VisualOverhaulClientFabric implements ClientModInitializer {
|
||||
// PhonosCompatInit.init();
|
||||
//}
|
||||
|
||||
Registries.ITEM.forEach((item) -> {
|
||||
ModelPredicateProviderRegistry.register(item, Identifier.ofVanilla("round"), (stack, world, entity, seed) ->
|
||||
stack.getComponents().contains(DataComponentTypes.JUKEBOX_PLAYABLE) && stack.getComponents().contains(DataComponentTypes.CUSTOM_MODEL_DATA) &&
|
||||
stack.getComponents().get(DataComponentTypes.CUSTOM_MODEL_DATA).value() == 710 ? 1.0F : 0.0F);
|
||||
});
|
||||
// Registries.ITEM.forEach((item) -> {
|
||||
// ModelPredicateProviderRegistry.register(item, Identifier.ofVanilla("round"), (stack, world, entity, seed) ->
|
||||
// stack.getComponents().contains(DataComponentTypes.JUKEBOX_PLAYABLE) && stack.getComponents().contains(DataComponentTypes.CUSTOM_MODEL_DATA) &&
|
||||
// stack.getComponents().get(DataComponentTypes.CUSTOM_MODEL_DATA).value() == 710 ? 1.0F : 0.0F);
|
||||
// });
|
||||
|
||||
ClientPlayNetworking.registerGlobalReceiver(UpdateItemsPacket.PACKET_ID,
|
||||
(payload, context) -> context.client().execute(() -> {
|
||||
@@ -121,20 +125,20 @@ public class VisualOverhaulClientFabric implements ClientModInitializer {
|
||||
}
|
||||
});
|
||||
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> tintIndex == 0 ? -1 : waterColor, Items.WATER_BUCKET, Items.AXOLOTL_BUCKET, Items.COD_BUCKET, Items.PUFFERFISH_BUCKET, Items.TROPICAL_FISH_BUCKET, Items.SALMON_BUCKET);
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> grassColor, Items.GRASS_BLOCK, Items.SHORT_GRASS, Items.TALL_GRASS, Items.FERN, Items.LARGE_FERN);
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> foliageColor, Items.OAK_LEAVES, Items.DARK_OAK_LEAVES, Items.JUNGLE_LEAVES, Items.ACACIA_LEAVES, Items.VINE, Items.SUGAR_CANE);
|
||||
if (VOConfig.coloredLilypad) ColorProviderRegistry.ITEM.register((stack, tintIndex) -> foliageColor, Items.LILY_PAD);
|
||||
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> {
|
||||
var contents = stack.getComponents().get(DataComponentTypes.POTION_CONTENTS);
|
||||
if (contents == null || contents.potion().isEmpty()) return tintIndex > 0 ? -1 : potionColor;
|
||||
var potion = contents.potion().get();
|
||||
if ((potion == Potions.WATER || potion == Potions.MUNDANE || potion == Potions.THICK || potion == Potions.AWKWARD) && tintIndex == 0) {
|
||||
return potionColor;
|
||||
}
|
||||
return tintIndex > 0 ? -1 : contents.getColor();
|
||||
}, Items.POTION, Items.SPLASH_POTION, Items.LINGERING_POTION);
|
||||
// ColorProviderRegistry.ITEM.register((stack, tintIndex) -> tintIndex == 0 ? -1 : waterColor, Items.WATER_BUCKET, Items.AXOLOTL_BUCKET, Items.COD_BUCKET, Items.PUFFERFISH_BUCKET, Items.TROPICAL_FISH_BUCKET, Items.SALMON_BUCKET);
|
||||
// ColorProviderRegistry.ITEM.register((stack, tintIndex) -> grassColor, Items.GRASS_BLOCK, Items.SHORT_GRASS, Items.TALL_GRASS, Items.FERN, Items.LARGE_FERN);
|
||||
// ColorProviderRegistry.ITEM.register((stack, tintIndex) -> foliageColor, Items.OAK_LEAVES, Items.DARK_OAK_LEAVES, Items.JUNGLE_LEAVES, Items.ACACIA_LEAVES, Items.VINE, Items.SUGAR_CANE);
|
||||
// if (VOConfig.coloredLilypad) ColorProviderRegistry.ITEM.register((stack, tintIndex) -> foliageColor, Items.LILY_PAD);
|
||||
//
|
||||
// ColorProviderRegistry.ITEM.register((stack, tintIndex) -> {
|
||||
// var contents = stack.getComponents().get(DataComponentTypes.POTION_CONTENTS);
|
||||
// if (contents == null || contents.potion().isEmpty()) return tintIndex > 0 ? -1 : potionColor;
|
||||
// var potion = contents.potion().get();
|
||||
// if ((potion == Potions.WATER || potion == Potions.MUNDANE || potion == Potions.THICK || potion == Potions.AWKWARD) && tintIndex == 0) {
|
||||
// return potionColor;
|
||||
// }
|
||||
// return tintIndex > 0 ? -1 : contents.getColor();
|
||||
// }, Items.POTION, Items.SPLASH_POTION, Items.LINGERING_POTION);
|
||||
}
|
||||
if (VOConfig.coloredLilypad) {
|
||||
ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> world != null ? world.getColor(pos, BiomeColors.FOLIAGE_COLOR) : 0, Blocks.LILY_PAD);
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.block.entity.LockableContainerBlockEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -43,7 +44,7 @@ public abstract class MixinAbstractFurnaceBlockEntity extends LockableContainerB
|
||||
}
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "tick")
|
||||
private static void tick(World world, BlockPos pos, BlockState state, AbstractFurnaceBlockEntity blockEntity, CallbackInfo ci) {
|
||||
private static void tick(ServerWorld world, BlockPos pos, BlockState state, AbstractFurnaceBlockEntity blockEntity, CallbackInfo ci) {
|
||||
if (world.getBlockState(pos).hasBlockEntity()) {
|
||||
if (!world.isClient && (visualoverhaul$invUpdate || world.getPlayers().size() != visualoverhaul$playerUpdate)) {
|
||||
Stream<ServerPlayerEntity> watchingPlayers = PlayerLookup.tracking(blockEntity).stream();
|
||||
|
||||
Reference in New Issue
Block a user