bugs removed, but not yet finished
This commit is contained in:
@@ -25,20 +25,20 @@ public class BackpackInventory extends SimpleInventory {
|
||||
|
||||
public static final BackpackInventory getInventory(BackpackScreenHandler handler, PlayerEntity player,
|
||||
ItemStack stack) {
|
||||
return new BackpackInventory(init(stack).getTag().getCompound("backpack"), handler);
|
||||
return new BackpackInventory(init(stack).getNbt().getCompound("backpack"), handler);
|
||||
}
|
||||
|
||||
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) {
|
||||
if (stack != null) {
|
||||
if (!stack.hasTag()) {
|
||||
stack.setTag(new NbtCompound());
|
||||
if (!stack.hasNbt()) {
|
||||
stack.setNbt(new NbtCompound());
|
||||
}
|
||||
if (!stack.getTag().contains("backpack")) {
|
||||
stack.getTag().put("backpack", new NbtCompound());
|
||||
if (!stack.getNbt().contains("backpack")) {
|
||||
stack.getNbt().put("backpack", new NbtCompound());
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
@@ -55,12 +55,12 @@ public class BackpackInventory extends SimpleInventory {
|
||||
super.onClose(player);
|
||||
ItemStack stack = player.getStackInHand(hand);
|
||||
if (stack != null) {
|
||||
if (!stack.hasTag()) {
|
||||
stack.setTag(new NbtCompound());
|
||||
if (!stack.hasNbt()) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class BackpackInventory extends SimpleInventory {
|
||||
if (!(itemStack == null) && !itemStack.isEmpty()) {
|
||||
NbtCompound compoundTag = new NbtCompound();
|
||||
compoundTag.putInt("slot", i);
|
||||
itemStack.setTag(compoundTag);
|
||||
itemStack.setNbt(compoundTag);
|
||||
listTag.add(compoundTag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package de.jottyfan.minecraft.quickiefabric.container;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import de.jottyfan.minecraft.quickiefabric.init.RegistryManager;
|
||||
import de.jottyfan.minecraft.quickiefabric.items.ItemBackpack;
|
||||
import net.fabricmc.api.EnvType;
|
||||
@@ -55,7 +53,6 @@ public class BackpackScreen extends HandledScreen<BackpackScreenHandler>
|
||||
|
||||
@Override
|
||||
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);
|
||||
int guiX = this.titleX;
|
||||
int guiY = (this.height - this.containerHeight) / 2;
|
||||
|
||||
@@ -6,15 +6,6 @@ import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
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.container.BackpackScreenHandler;
|
||||
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.Blocks;
|
||||
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.Item;
|
||||
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.Feature;
|
||||
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
|
||||
.configure(new OreFeatureConfig(OreFeatureConfig.Rules.BASE_STONE_NETHER,
|
||||
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
|
||||
.configure(new OreFeatureConfig(OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
|
||||
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
|
||||
.configure(new OreFeatureConfig(OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
|
||||
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
|
||||
.configure(
|
||||
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
|
||||
.configure(
|
||||
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
|
||||
.configure(new OreFeatureConfig(new BlockMatchRuleTest(Blocks.SANDSTONE),
|
||||
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,
|
||||
FEATURE_ORESULPHOR, FEATURE_DIRTSALPETER, FEATURE_SANDSALPETER, FEATURE_ORESANDSALPETER);
|
||||
|
||||
@@ -29,7 +29,7 @@ public class ToolSpeedpowderPickaxe extends PickaxeItem implements ToolRangeable
|
||||
|
||||
@Override
|
||||
public HarvestRange getRange(ItemStack stack) {
|
||||
NbtCompound tag = stack.getTag();
|
||||
NbtCompound tag = stack.getNbt();
|
||||
int[] range = tag.getIntArray("range");
|
||||
if (range.length < 3) {
|
||||
range = DEFAULT_HARVEST_RANGE;
|
||||
@@ -49,7 +49,7 @@ public class ToolSpeedpowderPickaxe extends PickaxeItem implements ToolRangeable
|
||||
}
|
||||
|
||||
public void setPlusRange(ItemStack stack, Integer plusRange) {
|
||||
NbtCompound tag = stack.getTag();
|
||||
NbtCompound tag = stack.getNbt();
|
||||
int[] range = tag.getIntArray("range");
|
||||
if (range.length < 3) {
|
||||
range = DEFAULT_HARVEST_RANGE;
|
||||
|
||||
Reference in New Issue
Block a user