started 1.16.3

This commit is contained in:
Jörg Henke 2020-09-13 14:57:32 +02:00
parent 4bae515817
commit 515f3a6d28
9 changed files with 58 additions and 35 deletions

View File

@ -1,5 +1,5 @@
plugins { plugins {
id 'fabric-loom' version '0.4-SNAPSHOT' id 'fabric-loom' version '0.5.25'
id 'maven-publish' id 'maven-publish'
} }

View File

@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
minecraft_version=1.16.1 minecraft_version=1.16.3
yarn_mappings=1.16.1+build.1 yarn_mappings=1.16.3+build.1
loader_version=0.8.8+build.202 loader_version=0.9.3+build.207
# Mod Properties # Mod Properties
mod_version = 1.16.1.13 mod_version = 1.16.3.0
maven_group = de.jottyfan.minecraft maven_group = de.jottyfan.minecraft
archives_base_name = quickiefabric archives_base_name = quickiefabric
# Dependencies # Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.16.2+build.385-1.16.1 fabric_version=0.20.2+build.402-1.16

View File

@ -2,7 +2,7 @@ package de.jottyfan.minecraft.quickiefabric;
import de.jottyfan.minecraft.quickiefabric.init.RegistryManager; import de.jottyfan.minecraft.quickiefabric.init.RegistryManager;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.BuiltinRegistries;
/** /**
* *
@ -19,6 +19,6 @@ public class QuickieFabric implements ModInitializer {
RegistryManager.registerBlocks(); RegistryManager.registerBlocks();
RegistryManager.registerBlockEntities(); RegistryManager.registerBlockEntities();
RegistryManager.registerContainer(); RegistryManager.registerContainer();
Registry.BIOME.forEach(RegistryManager::handleBiome); BuiltinRegistries.BIOME.forEach(RegistryManager::handleBiome);
} }
} }

View File

@ -58,7 +58,7 @@ public class ItemHoarderBlockEntity extends LootableContainerBlockEntity impleme
BlockPos pos = getPos(); BlockPos pos = getPos();
World world = getWorld(); World world = getWorld();
Box box = new Box(pos).expand(suckradius); Box box = new Box(pos).expand(suckradius);
List<Entity> entities = world.getEntities(null, box); List<Entity> entities = world.getOtherEntities(null, box);
for (Entity entity : entities) { for (Entity entity : entities) {
if (entity instanceof ItemEntity) { if (entity instanceof ItemEntity) {
ItemEntity itemEntity = (ItemEntity) entity; ItemEntity itemEntity = (ItemEntity) entity;

View File

@ -29,7 +29,7 @@ public class MonsterHoarderBlockEntity extends BlockEntity implements Tickable {
BlockPos pos = getPos(); BlockPos pos = getPos();
World world = getWorld(); World world = getWorld();
Box box = new Box(pos).expand(suckradius); Box box = new Box(pos).expand(suckradius);
List<Entity> entities = world.getEntities(null, box); List<Entity> entities = world.getOtherEntities(null, box);
for (Entity entity : entities) { for (Entity entity : entities) {
if (entity instanceof HostileEntity) { if (entity instanceof HostileEntity) {
HostileEntity mobEntity = (HostileEntity) entity; HostileEntity mobEntity = (HostileEntity) entity;

View File

@ -1,8 +1,5 @@
package de.jottyfan.minecraft.quickiefabric.container; package de.jottyfan.minecraft.quickiefabric.container;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import de.jottyfan.minecraft.quickiefabric.items.ItemBackpack; import de.jottyfan.minecraft.quickiefabric.items.ItemBackpack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.Inventories; import net.minecraft.inventory.Inventories;
@ -21,7 +18,6 @@ import net.minecraft.util.collection.DefaultedList;
* *
*/ */
public class BackpackInventory implements Inventory { public class BackpackInventory implements Inventory {
private final static Logger LOGGER = LogManager.getLogger(BackpackInventory.class);
private final DefaultedList<ItemStack> stacks; private final DefaultedList<ItemStack> stacks;
private final BackpackScreenHandler handler; private final BackpackScreenHandler handler;
private Hand hand; private Hand hand;

View File

@ -1,8 +1,5 @@
package de.jottyfan.minecraft.quickiefabric.container; package de.jottyfan.minecraft.quickiefabric.container;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import de.jottyfan.minecraft.quickiefabric.init.RegistryManager; import de.jottyfan.minecraft.quickiefabric.init.RegistryManager;
@ -25,7 +22,6 @@ import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class BackpackScreen extends HandledScreen<BackpackScreenHandler> public class BackpackScreen extends HandledScreen<BackpackScreenHandler>
implements ScreenHandlerProvider<BackpackScreenHandler> { implements ScreenHandlerProvider<BackpackScreenHandler> {
private final static Logger LOGGER = LogManager.getLogger(BackpackScreen.class);
private final static Identifier TEXTURE = new Identifier(RegistryManager.QUICKIEFABRIC, private final static Identifier TEXTURE = new Identifier(RegistryManager.QUICKIEFABRIC,
"textures/gui/backpack.png"); "textures/gui/backpack.png");
private final static Identifier SLOT_TEXTURE = new Identifier(RegistryManager.QUICKIEFABRIC, private final static Identifier SLOT_TEXTURE = new Identifier(RegistryManager.QUICKIEFABRIC,

View File

@ -2,10 +2,14 @@ package de.jottyfan.minecraft.quickiefabric.init;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.function.Supplier;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import de.jottyfan.minecraft.quickiefabric.blockentity.ItemHoarderBlockEntity; import de.jottyfan.minecraft.quickiefabric.blockentity.ItemHoarderBlockEntity;
import de.jottyfan.minecraft.quickiefabric.blockentity.MonsterHoarderBlockEntity; import de.jottyfan.minecraft.quickiefabric.blockentity.MonsterHoarderBlockEntity;
import de.jottyfan.minecraft.quickiefabric.blockentity.QuickieFabricBlockEntity; import de.jottyfan.minecraft.quickiefabric.blockentity.QuickieFabricBlockEntity;
@ -26,16 +30,19 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.screen.ScreenHandlerType; import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.structure.rule.RuleTest;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.GenerationSettings;
import net.minecraft.world.gen.GenerationStep; import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.decorator.ChanceDecoratorConfig;
import net.minecraft.world.gen.decorator.Decorator; import net.minecraft.world.gen.decorator.Decorator;
import net.minecraft.world.gen.decorator.RangeDecoratorConfig; import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.OreFeatureConfig; import net.minecraft.world.gen.feature.OreFeatureConfig;
import net.minecraft.world.gen.feature.OreFeatureConfig.Target; import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.SimpleBlockFeatureConfig; import net.minecraft.world.gen.feature.SimpleBlockFeatureConfig;
/** /**
@ -152,6 +159,30 @@ public class RegistryManager {
}); });
} }
/**
* add configured feature to biome
*
* @param biome the biome
* @param generationStep the genration step
* @param configuredFeature the configured feature
*/
private static final void addFeature(Biome biome, GenerationStep.Feature generationStep,
Supplier<ConfiguredFeature<?, ?>> configuredFeature) {
GenerationSettings generationSettings = biome.getGenerationSettings();
List<List<Supplier<ConfiguredFeature<?, ?>>>> features = generationSettings.getFeatures();
if (features instanceof ImmutableList) {
features = Lists.newArrayList(features);
}
for (int i = features.size(); i <= generationStep.ordinal(); i++) {
features.add(Lists.newArrayList());
}
List<Supplier<ConfiguredFeature<?, ?>>> suppliers = features.get(generationStep.ordinal());
if (suppliers instanceof ImmutableList) {
features.set(generationStep.ordinal(), suppliers = Lists.newArrayList(suppliers));
}
suppliers.add(configuredFeature);
}
/** /**
* generate ores * generate ores
* *
@ -164,12 +195,12 @@ public class RegistryManager {
* @param topOffset the upper limit * @param topOffset the upper limit
* @param maximum the maximum number of blocks in a vein * @param maximum the maximum number of blocks in a vein
*/ */
public static void generateOreForTarget(Biome biome, Target target, Block block, int veinsize, int count, public static void generateOreForTarget(Biome biome, RuleTest target, Block block, int veinsize, int count,
int bottomOffset, int topOffset, int maximum) { int bottomOffset, int topOffset, int maximum) {
OreFeatureConfig ofc = new OreFeatureConfig(target, block.getDefaultState(), veinsize); OreFeatureConfig ofc = new OreFeatureConfig(target, block.getDefaultState(), veinsize);
RangeDecoratorConfig rdc = new RangeDecoratorConfig(count, bottomOffset, topOffset, maximum); RangeDecoratorConfig rdc = new RangeDecoratorConfig(bottomOffset, topOffset, maximum);
biome.addFeature(GenerationStep.Feature.UNDERGROUND_ORES, addFeature(biome, GenerationStep.Feature.UNDERGROUND_ORES,
Feature.ORE.configure(ofc).createDecoratedFeature(Decorator.COUNT_RANGE.configure(rdc))); () -> Feature.ORE.configure(ofc).decorate(Decorator.RANGE.configure(rdc).spreadHorizontally().repeat(count)));
} }
/** /**
@ -183,10 +214,11 @@ public class RegistryManager {
* @param chance the chance for the replacement * @param chance the chance for the replacement
*/ */
public static void generateOreInBlocks(Biome biome, List<BlockState> placeOn, List<BlockState> placeIn, public static void generateOreInBlocks(Biome biome, List<BlockState> placeOn, List<BlockState> placeIn,
List<BlockState> placeUnder, Block block, float chance) { List<BlockState> placeUnder, Block block, int chance) {
SimpleBlockFeatureConfig sbfc = new SimpleBlockFeatureConfig(block.getDefaultState(), placeOn, placeIn, placeUnder); SimpleBlockFeatureConfig sbfc = new SimpleBlockFeatureConfig(block.getDefaultState(), placeOn, placeIn, placeUnder);
biome.addFeature(GenerationStep.Feature.LOCAL_MODIFICATIONS, ChanceDecoratorConfig cdc = new ChanceDecoratorConfig(chance);
Feature.SIMPLE_BLOCK.configure(sbfc).withChance(chance).feature); addFeature(biome, GenerationStep.Feature.LOCAL_MODIFICATIONS,
() -> Feature.SIMPLE_BLOCK.configure(sbfc).decorate(Decorator.CHANCE.configure(cdc)));
} }
/** /**
@ -196,7 +228,7 @@ public class RegistryManager {
*/ */
public static final void handleBiome(Biome biome) { public static final void handleBiome(Biome biome) {
if (biome.getCategory() == Biome.Category.NETHER) { if (biome.getCategory() == Biome.Category.NETHER) {
RegistryManager.generateOreForTarget(biome, OreFeatureConfig.Target.NETHER_ORE_REPLACEABLES, RegistryManager.generateOreForTarget(biome, OreFeatureConfig.Rules.BASE_STONE_NETHER,
QuickieBlocks.ORE_NETHER_SULPHOR, 24, 10, 0, 0, 128); QuickieBlocks.ORE_NETHER_SULPHOR, 24, 10, 0, 0, 128);
} else if (biome.getCategory() == Biome.Category.THEEND) { } else if (biome.getCategory() == Biome.Category.THEEND) {
} else { } else {
@ -208,13 +240,13 @@ public class RegistryManager {
List<BlockState> dirtlike = new ArrayList<>(); List<BlockState> dirtlike = new ArrayList<>();
dirtlike.add(Blocks.DIRT.getDefaultState()); dirtlike.add(Blocks.DIRT.getDefaultState());
dirtlike.add(Blocks.GRASS.getDefaultState()); dirtlike.add(Blocks.GRASS.getDefaultState());
RegistryManager.generateOreInBlocks(biome, dirtlike, dirtlike, dirtlike, QuickieBlocks.DIRT_SALPETER, 1.0f); RegistryManager.generateOreInBlocks(biome, dirtlike, dirtlike, dirtlike, QuickieBlocks.DIRT_SALPETER, 1);
RegistryManager.generateOreInBlocks(biome, sandlike, sandlike, sandlike, QuickieBlocks.SAND_SALPETER, 1.0f); RegistryManager.generateOreInBlocks(biome, sandlike, sandlike, sandlike, QuickieBlocks.SAND_SALPETER, 1);
RegistryManager.generateOreInBlocks(biome, sandlike, sandlike, sandlike, QuickieBlocks.ORE_SAND_SALPETER, 1.0f); RegistryManager.generateOreInBlocks(biome, sandlike, sandlike, sandlike, QuickieBlocks.ORE_SAND_SALPETER, 1);
RegistryManager.generateOreForTarget(biome, OreFeatureConfig.Target.NATURAL_STONE, QuickieBlocks.ORE_SULPHOR, 16, RegistryManager.generateOreForTarget(biome, OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
4, 4, 196, 255); QuickieBlocks.ORE_SULPHOR, 16, 4, 4, 32, 255);
RegistryManager.generateOreForTarget(biome, OreFeatureConfig.Target.NATURAL_STONE, QuickieBlocks.ORE_SALPETER, 12, RegistryManager.generateOreForTarget(biome, OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
10, 4, 196, 255); QuickieBlocks.ORE_SALPETER, 12, 10, 4, 32, 255);
} }
} }

View File

@ -11,7 +11,6 @@ import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.DyeableItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext; import net.minecraft.item.ItemUsageContext;