Import optimisation, carver adding fix

This commit is contained in:
paulevsGitch 2021-11-01 14:16:17 +03:00
parent 2518759f7b
commit 8eba063b40
22 changed files with 49 additions and 94 deletions

View file

@ -1,6 +1,9 @@
package org.anti_ad.mc.ipn.api;
import java.lang.annotation.*;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
// Included from "Inventory Profiles Next" (https://github.com/blackd/Inventory-Profiles)
@Retention(RetentionPolicy.RUNTIME)

View file

@ -1,7 +1,5 @@
package ru.bclib;
import java.util.List;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.loader.api.FabricLoader;
@ -25,6 +23,8 @@ import ru.bclib.world.generator.BCLibNetherBiomeSource;
import ru.bclib.world.generator.GeneratorOptions;
import ru.bclib.world.surface.BCLSurfaceBuilders;
import java.util.List;
public class BCLib implements ModInitializer {
public static final String MOD_ID = "bclib";
public static final Logger LOGGER = new Logger(MOD_ID);

View file

@ -1,12 +1,7 @@
package ru.bclib.api;
import java.util.Map;
import java.util.Set;
import java.util.function.Supplier;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import net.fabricmc.fabric.api.tag.TagRegistry;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
@ -23,6 +18,10 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import ru.bclib.BCLib;
import java.util.Map;
import java.util.Set;
import java.util.function.Supplier;
public class TagAPI {
private static final Map<ResourceLocation, Set<ResourceLocation>> TAGS_BLOCK = Maps.newConcurrentMap();
private static final Map<ResourceLocation, Set<ResourceLocation>> TAGS_ITEM = Maps.newConcurrentMap();

View file

@ -4,10 +4,10 @@ import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
import net.fabricmc.fabric.api.networking.v1.PacketSender;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ProgressListener;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.ProgressListener;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import ru.bclib.BCLib;

View file

@ -1,6 +1,5 @@
package ru.bclib.api.datafixer;
import net.fabricmc.loom.util.ModUtils;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtIo;

View file

@ -1,11 +1,6 @@
package ru.bclib.blocks;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import com.google.common.collect.Lists;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.client.renderer.block.model.BlockModel;
@ -25,6 +20,10 @@ import ru.bclib.interfaces.BlockModelProvider;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.util.MHelper;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider, RenderLayerProvider {
protected final Block sapling;

View file

@ -1,40 +1,11 @@
package ru.bclib.blocks;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.SaplingBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.BlockModelProvider;
import ru.bclib.interfaces.RenderLayerProvider;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Random;
@SuppressWarnings("deprecation")
public abstract class FeatureSaplingBlock extends FeatureSaplingBlockCommon {

View file

@ -9,10 +9,8 @@ import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.SaplingBlock;
import net.minecraft.world.level.block.SoundType;
@ -21,8 +19,6 @@ import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.ModelsHelper;

View file

@ -1,11 +1,6 @@
package ru.bclib.client.models;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import com.google.common.collect.Lists;
import com.mojang.math.Transformation;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -22,6 +17,10 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
@Environment(EnvType.CLIENT)
public class ModelsHelper {
public static BlockModel fromPattern(Optional<String> pattern) {

View file

@ -12,7 +12,6 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.dimension.DimensionType;
import net.minecraft.world.level.material.FogType;
import ru.bclib.api.BiomeAPI;
import ru.bclib.util.BackgroundInfo;

View file

@ -9,8 +9,6 @@ import com.mojang.blaze3d.vertex.VertexFormat;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.components.AbstractSelectionList;
import net.minecraft.client.gui.components.OptionsList;
import net.minecraft.client.gui.components.Widget;
import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.client.gui.narration.NarratableEntry;

View file

@ -1,6 +1,5 @@
package ru.bclib.gui.screens;
import com.mojang.blaze3d.vertex.PoseStack;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.screens.Screen;

View file

@ -7,7 +7,6 @@ import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import ru.bclib.gui.gridlayout.GridLayout.Alignment;
import ru.bclib.gui.gridlayout.GridRow;
import ru.bclib.gui.gridlayout.GridScreen;
@Environment(EnvType.CLIENT)
public class WarnBCLibVersionMismatch extends BCLibScreen {

View file

@ -1,10 +1,10 @@
package ru.bclib.interfaces;
import java.util.List;
import ru.bclib.recipes.AnvilRecipe;
import java.util.List;
public interface AnvilScreenHandlerExtended {
void be_updateCurrentRecipe(AnvilRecipe recipe);

View file

@ -1,9 +1,6 @@
package ru.bclib.mixin.client;
import java.util.List;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.components.Button;
@ -24,6 +21,8 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import ru.bclib.interfaces.AnvilScreenHandlerExtended;
import java.util.List;
@Mixin(AnvilScreen.class)
public class AnvilScreenMixin extends ItemCombinerScreen<AnvilMenu> {

View file

@ -1,11 +1,5 @@
package ru.bclib.mixin.common;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import org.jetbrains.annotations.Nullable;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
@ -18,6 +12,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.RecipeManager;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@ -30,6 +25,10 @@ import ru.bclib.blocks.LeveledAnvilBlock;
import ru.bclib.interfaces.AnvilScreenHandlerExtended;
import ru.bclib.recipes.AnvilRecipe;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@Mixin(AnvilMenu.class)
public abstract class AnvilMenuMixin extends ItemCombinerMenu implements AnvilScreenHandlerExtended {
private List<AnvilRecipe> be_recipes = Collections.emptyList();

View file

@ -1,9 +1,6 @@
package ru.bclib.recipes;
import java.util.Objects;
import com.google.gson.JsonObject;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -33,6 +30,8 @@ import ru.bclib.interfaces.UnknownReceipBookCategory;
import ru.bclib.util.ItemUtil;
import ru.bclib.util.RecipeHelper;
import java.util.Objects;
public class AnvilRecipe implements Recipe<Container>, UnknownReceipBookCategory {
public final static String GROUP = "smithing";
public final static RecipeType<AnvilRecipe> TYPE = BCLRecipeManager.registerType(BCLib.MOD_ID, GROUP);

View file

@ -1,15 +1,13 @@
package ru.bclib.util;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import com.google.gson.JsonObject;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.GsonHelper;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import ru.bclib.BCLib;
public class ItemUtil {

View file

@ -19,7 +19,6 @@ import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.jar.JarFile;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

View file

@ -378,9 +378,9 @@ public class BCLBiomeDef {
ConfiguredFeature<?, ?> feature;
}
private static final class CarverInfo {
private static final class CarverInfo <C extends CarverConfiguration> {
Carving carverStep;
ConfiguredWorldCarver<CarverConfiguration> carver;
ConfiguredWorldCarver<C> carver;
}
public ResourceLocation getID() {
@ -399,7 +399,7 @@ public class BCLBiomeDef {
return edgeSize;
}
public BCLBiomeDef addCarver(Carving carverStep, ConfiguredWorldCarver<CarverConfiguration> carver) {
public <C extends CarverConfiguration> BCLBiomeDef addCarver(Carving carverStep, ConfiguredWorldCarver<C> carver) {
CarverInfo info = new CarverInfo();
info.carverStep = carverStep;
info.carver = carver;

View file

@ -7,13 +7,13 @@
"SimpleReloadableResourceManagerMixin",
"EnchantingTableBlockMixin",
"BackgroundRendererMixin",
"ClientRecipeBookMixin",
"ModelManagerMixin",
"TextureAtlasMixin",
"AnvilScreenMixin",
"ModelBakeryMixin",
"MinecraftMixin",
"GameMixin",
"AnvilScreenMixin",
"ClientRecipeBookMixin"
"GameMixin"
],
"injectors": {
"defaultRequire": 1

View file

@ -5,31 +5,31 @@
"compatibilityLevel": "JAVA_16",
"mixins": [
"SimpleReloadableResourceManagerMixin",
"InternalBiomeDataMixin",
"shears.DiggingEnchantmentMixin",
"shears.TripWireBlockMixin",
"shears.BeehiveBlockMixin",
"shears.PumpkinBlockMixin",
"shears.MushroomCowMixin",
"shears.SnowGolemMixin",
"ComposterBlockAccessor",
"InternalBiomeDataMixin",
"PotionBrewingAccessor",
"RecipeManagerAccessor",
"EnchantmentMenuMixin",
"MinecraftServerMixin",
"PistonBaseBlockMixin",
"WorldGenRegionMixin",
"DimensionTypeMixin",
"RecipeManagerMixin",
"BoneMealItemMixin",
"shears.SheepMixin",
"PortalShapeMixin",
"ServerLevelMixin",
"AnvilBlockMixin",
"AnvilMenuMixin",
"TagLoaderMixin",
"BiomeMixin",
"MainMixin",
"shears.BeehiveBlockMixin",
"shears.DiggingEnchantmentMixin",
"shears.MushroomCowMixin",
"shears.PumpkinBlockMixin",
"shears.SheepMixin",
"shears.SnowGolemMixin",
"shears.TripWireBlockMixin",
"PortalShapeMixin",
"PistonBaseBlockMixin"
"MainMixin"
],
"injectors": {
"defaultRequire": 1