bugs removed, but not yet finished

This commit is contained in:
Jörg Henke 2021-07-23 09:46:44 +02:00
parent 88a41192a4
commit da4404e8d0
5 changed files with 50 additions and 57 deletions

View File

@ -10,8 +10,16 @@ archivesBaseName = project.archives_base_name
version = project.mod_version version = project.mod_version
group = project.maven_group group = project.maven_group
repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
}
dependencies { dependencies {
//to change the versions see the gradle.properties file // To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}" minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
@ -26,35 +34,32 @@ dependencies {
processResources { processResources {
inputs.property "version", project.version inputs.property "version", project.version
from(sourceSets.main.resources.srcDirs) { filesMatching("fabric.mod.json") {
include "fabric.mod.json"
expand "version": project.version expand "version": project.version
} }
from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
} }
// ensure that the encoding is set to UTF-8, no matter what the system default is tasks.withType(JavaCompile).configureEach {
// this fixes some edge cases with special characters not displaying correctly // ensure that the encoding is set to UTF-8, no matter what the system default is
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html // this fixes some edge cases with special characters not displaying correctly
tasks.withType(JavaCompile) { // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
options.encoding = "UTF-8" // If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
// Minecraft 1.17 (21w19a) upwards uses Java 16.
it.options.release = 16 it.options.release = 16
} }
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task java {
// if it is present. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// If you remove this task, sources will not be generated. // if it is present.
task sourcesJar(type: Jar, dependsOn: classes) { // If you remove this line, sources will not be generated.
classifier = "sources" withSourcesJar()
from sourceSets.main.allSource
} }
jar { jar {
from("LICENSE") { from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" } rename { "${it}_${project.archivesBaseName}"}
} }
} }
@ -72,9 +77,11 @@ publishing {
} }
} }
// select the repositories you want to publish to // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories { repositories {
// uncomment to publish to the local maven // Add repositories to publish to here.
// mavenLocal() // Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
} }
} }

View File

@ -25,20 +25,20 @@ public class BackpackInventory extends SimpleInventory {
public static final BackpackInventory getInventory(BackpackScreenHandler handler, PlayerEntity player, public static final BackpackInventory getInventory(BackpackScreenHandler handler, PlayerEntity player,
ItemStack stack) { ItemStack stack) {
return new BackpackInventory(init(stack).getTag().getCompound("backpack"), handler); return new BackpackInventory(init(stack).getNbt().getCompound("backpack"), handler);
} }
public BackpackInventory(ItemStack stack) { public BackpackInventory(ItemStack stack) {
this(init(stack).getTag().getCompound("backpack"), null); this(init(stack).getNbt().getCompound("backpack"), null);
} }
private final static ItemStack init(ItemStack stack) { private final static ItemStack init(ItemStack stack) {
if (stack != null) { if (stack != null) {
if (!stack.hasTag()) { if (!stack.hasNbt()) {
stack.setTag(new NbtCompound()); stack.setNbt(new NbtCompound());
} }
if (!stack.getTag().contains("backpack")) { if (!stack.getNbt().contains("backpack")) {
stack.getTag().put("backpack", new NbtCompound()); stack.getNbt().put("backpack", new NbtCompound());
} }
} }
return stack; return stack;
@ -55,12 +55,12 @@ public class BackpackInventory extends SimpleInventory {
super.onClose(player); super.onClose(player);
ItemStack stack = player.getStackInHand(hand); ItemStack stack = player.getStackInHand(hand);
if (stack != null) { if (stack != null) {
if (!stack.hasTag()) { if (!stack.hasNbt()) {
stack.setTag(new NbtCompound()); stack.setNbt(new NbtCompound());
} }
stack.getTag().put("backpack", writeItemsToTag()); stack.getNbt().put("backpack", writeItemsToTag());
} }
player.getStackInHand(hand).setTag(stack.getTag()); player.getStackInHand(hand).setNbt(stack.getNbt());
player.playSound(SoundEvents.BLOCK_WOOL_PLACE, SoundCategory.PLAYERS, 1f, 1f); player.playSound(SoundEvents.BLOCK_WOOL_PLACE, SoundCategory.PLAYERS, 1f, 1f);
} }
@ -83,7 +83,7 @@ public class BackpackInventory extends SimpleInventory {
if (!(itemStack == null) && !itemStack.isEmpty()) { if (!(itemStack == null) && !itemStack.isEmpty()) {
NbtCompound compoundTag = new NbtCompound(); NbtCompound compoundTag = new NbtCompound();
compoundTag.putInt("slot", i); compoundTag.putInt("slot", i);
itemStack.setTag(compoundTag); itemStack.setNbt(compoundTag);
listTag.add(compoundTag); listTag.add(compoundTag);
} }
} }

View File

@ -1,7 +1,5 @@
package de.jottyfan.minecraft.quickiefabric.container; package de.jottyfan.minecraft.quickiefabric.container;
import com.mojang.blaze3d.platform.GlStateManager;
import de.jottyfan.minecraft.quickiefabric.init.RegistryManager; import de.jottyfan.minecraft.quickiefabric.init.RegistryManager;
import de.jottyfan.minecraft.quickiefabric.items.ItemBackpack; import de.jottyfan.minecraft.quickiefabric.items.ItemBackpack;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
@ -55,7 +53,6 @@ public class BackpackScreen extends HandledScreen<BackpackScreenHandler>
@Override @Override
protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) { protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) {
// GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.client.getTextureManager().bindTexture(TEXTURE); this.client.getTextureManager().bindTexture(TEXTURE);
int guiX = this.titleX; int guiX = this.titleX;
int guiY = (this.height - this.containerHeight) / 2; int guiY = (this.height - this.containerHeight) / 2;

View File

@ -6,15 +6,6 @@ import java.util.List;
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 de.jottyfan.minecraft.quickiefabric.blockentity.DrillBlockDownEntity;
import de.jottyfan.minecraft.quickiefabric.blockentity.DrillBlockEastEntity;
import de.jottyfan.minecraft.quickiefabric.blockentity.DrillBlockNorthEntity;
import de.jottyfan.minecraft.quickiefabric.blockentity.DrillBlockSouthEntity;
import de.jottyfan.minecraft.quickiefabric.blockentity.DrillBlockWestEntity;
import de.jottyfan.minecraft.quickiefabric.blockentity.EmptyLavaHoarderBlockEntity;
import de.jottyfan.minecraft.quickiefabric.blockentity.ItemHoarderBlockEntity;
import de.jottyfan.minecraft.quickiefabric.blockentity.MonsterHoarderBlockEntity;
import de.jottyfan.minecraft.quickiefabric.blockentity.QuickieFabricBlockEntity;
import de.jottyfan.minecraft.quickiefabric.blocks.QuickieBlocks; import de.jottyfan.minecraft.quickiefabric.blocks.QuickieBlocks;
import de.jottyfan.minecraft.quickiefabric.container.BackpackScreenHandler; import de.jottyfan.minecraft.quickiefabric.container.BackpackScreenHandler;
import de.jottyfan.minecraft.quickiefabric.event.BreakBlockCallback; import de.jottyfan.minecraft.quickiefabric.event.BreakBlockCallback;
@ -29,9 +20,6 @@ import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.ComposterBlock; import net.minecraft.block.ComposterBlock;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.block.entity.BlockEntityType.Builder;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
@ -51,6 +39,7 @@ import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
import net.minecraft.world.gen.feature.ConfiguredFeature; import net.minecraft.world.gen.feature.ConfiguredFeature;
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.heightprovider.UniformHeightProvider;
/** /**
* *
@ -69,32 +58,32 @@ public class RegistryManager {
public static final ConfiguredFeature<?, ?> FEATURE_ORENETHERSULPHOR = Feature.ORE public static final ConfiguredFeature<?, ?> FEATURE_ORENETHERSULPHOR = Feature.ORE
.configure(new OreFeatureConfig(OreFeatureConfig.Rules.BASE_STONE_NETHER, .configure(new OreFeatureConfig(OreFeatureConfig.Rules.BASE_STONE_NETHER,
QuickieBlocks.ORE_NETHER_SULPHOR.getDefaultState(), 24)) QuickieBlocks.ORE_NETHER_SULPHOR.getDefaultState(), 24))
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(YOffset.aboveBottom(0), YOffset.belowTop(128))).spreadHorizontally().repeat(10)); .decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(UniformHeightProvider.create(YOffset.aboveBottom(0), YOffset.belowTop(128)))).spreadHorizontally().repeat(10));
public static final ConfiguredFeature<?, ?> FEATURE_ORESALPETER = Feature.ORE public static final ConfiguredFeature<?, ?> FEATURE_ORESALPETER = Feature.ORE
.configure(new OreFeatureConfig(OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, .configure(new OreFeatureConfig(OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
QuickieBlocks.ORE_SALPETER.getDefaultState(), 12)) QuickieBlocks.ORE_SALPETER.getDefaultState(), 12))
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(YOffset.aboveBottom(0), YOffset.belowTop(128)))).spreadHorizontally().repeat(10); .decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(UniformHeightProvider.create(YOffset.aboveBottom(0), YOffset.belowTop(128))))).spreadHorizontally().repeat(10);
public static final ConfiguredFeature<?, ?> FEATURE_ORESULPHOR = Feature.ORE public static final ConfiguredFeature<?, ?> FEATURE_ORESULPHOR = Feature.ORE
.configure(new OreFeatureConfig(OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, .configure(new OreFeatureConfig(OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
QuickieBlocks.ORE_SULPHOR.getDefaultState(), 16)) QuickieBlocks.ORE_SULPHOR.getDefaultState(), 16))
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(YOffset.aboveBottom(32), YOffset.belowTop(255)))).spreadHorizontally().repeat(4); .decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(UniformHeightProvider.create(YOffset.aboveBottom(32), YOffset.belowTop(255))))).spreadHorizontally().repeat(4);
public static final ConfiguredFeature<?, ?> FEATURE_DIRTSALPETER = Feature.ORE public static final ConfiguredFeature<?, ?> FEATURE_DIRTSALPETER = Feature.ORE
.configure( .configure(
new OreFeatureConfig(new BlockMatchRuleTest(Blocks.DIRT), QuickieBlocks.DIRT_SALPETER.getDefaultState(), 3)) new OreFeatureConfig(new BlockMatchRuleTest(Blocks.DIRT), QuickieBlocks.DIRT_SALPETER.getDefaultState(), 3))
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(YOffset.aboveBottom(0), YOffset.belowTop(255)))).spreadHorizontally().repeatRandomly(4); .decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(UniformHeightProvider.create(YOffset.aboveBottom(0), YOffset.belowTop(255))))).spreadHorizontally().repeatRandomly(4);
public static final ConfiguredFeature<?, ?> FEATURE_SANDSALPETER = Feature.ORE public static final ConfiguredFeature<?, ?> FEATURE_SANDSALPETER = Feature.ORE
.configure( .configure(
new OreFeatureConfig(new BlockMatchRuleTest(Blocks.SAND), QuickieBlocks.SAND_SALPETER.getDefaultState(), 3)) new OreFeatureConfig(new BlockMatchRuleTest(Blocks.SAND), QuickieBlocks.SAND_SALPETER.getDefaultState(), 3))
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(YOffset.aboveBottom(0), YOffset.belowTop(255)))).spreadHorizontally().repeatRandomly(4); .decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(UniformHeightProvider.create(YOffset.aboveBottom(0), YOffset.belowTop(255))))).spreadHorizontally().repeatRandomly(4);
public static final ConfiguredFeature<?, ?> FEATURE_ORESANDSALPETER = Feature.ORE public static final ConfiguredFeature<?, ?> FEATURE_ORESANDSALPETER = Feature.ORE
.configure(new OreFeatureConfig(new BlockMatchRuleTest(Blocks.SANDSTONE), .configure(new OreFeatureConfig(new BlockMatchRuleTest(Blocks.SANDSTONE),
QuickieBlocks.ORE_SAND_SALPETER.getDefaultState(), 3)) QuickieBlocks.ORE_SAND_SALPETER.getDefaultState(), 3))
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(YOffset.aboveBottom(0), YOffset.belowTop(255)))).spreadHorizontally().repeatRandomly(4); .decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(UniformHeightProvider.create(YOffset.aboveBottom(0), YOffset.belowTop(255))))).spreadHorizontally().repeatRandomly(4);
public static final List<ConfiguredFeature<?, ?>> FEATURE_UNDERGROUND_ORES = Arrays.asList(FEATURE_ORESALPETER, public static final List<ConfiguredFeature<?, ?>> FEATURE_UNDERGROUND_ORES = Arrays.asList(FEATURE_ORESALPETER,
FEATURE_ORESULPHOR, FEATURE_DIRTSALPETER, FEATURE_SANDSALPETER, FEATURE_ORESANDSALPETER); FEATURE_ORESULPHOR, FEATURE_DIRTSALPETER, FEATURE_SANDSALPETER, FEATURE_ORESANDSALPETER);

View File

@ -29,7 +29,7 @@ public class ToolSpeedpowderPickaxe extends PickaxeItem implements ToolRangeable
@Override @Override
public HarvestRange getRange(ItemStack stack) { public HarvestRange getRange(ItemStack stack) {
NbtCompound tag = stack.getTag(); NbtCompound tag = stack.getNbt();
int[] range = tag.getIntArray("range"); int[] range = tag.getIntArray("range");
if (range.length < 3) { if (range.length < 3) {
range = DEFAULT_HARVEST_RANGE; range = DEFAULT_HARVEST_RANGE;
@ -49,7 +49,7 @@ public class ToolSpeedpowderPickaxe extends PickaxeItem implements ToolRangeable
} }
public void setPlusRange(ItemStack stack, Integer plusRange) { public void setPlusRange(ItemStack stack, Integer plusRange) {
NbtCompound tag = stack.getTag(); NbtCompound tag = stack.getNbt();
int[] range = tag.getIntArray("range"); int[] range = tag.getIntArray("range");
if (range.length < 3) { if (range.length < 3) {
range = DEFAULT_HARVEST_RANGE; range = DEFAULT_HARVEST_RANGE;