Skip to content

Commit

Permalink
everything except the vaults
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed May 2, 2024
1 parent 723b6be commit 81ebac7
Show file tree
Hide file tree
Showing 24 changed files with 114 additions and 287 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventories;
import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.SidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.Packet;
Expand All @@ -27,9 +28,10 @@
import net.minecraft.util.math.Direction;
import org.jetbrains.annotations.Nullable;

import java.util.List;
import java.util.Optional;

public class TreeTapBlockEntity extends LootableContainerBlockEntity {
public class TreeTapBlockEntity extends LootableContainerBlockEntity implements SidedInventory {

private final DefaultedList<ItemStack> inventory;

Expand All @@ -49,6 +51,20 @@ public void handleUse(PlayerEntity player, Hand hand, ItemStack handStack) {
markDirty();
}

public int[] getAvailableSlots(Direction side) {
return new int[1];
}

@Override
public boolean canInsert(int slot, ItemStack stack, @Nullable Direction dir) {
return dir != Direction.DOWN && this.inventory.get(0).isEmpty();
}

@Override
public boolean canExtract(int slot, ItemStack stack, Direction dir) {
return false;
}

public DefaultedList<ItemStack> getItems() {
return inventory;
}
Expand All @@ -69,12 +85,12 @@ public void setStack(int slot, ItemStack stack) {

@Override
protected DefaultedList<ItemStack> getInvStackList() {
return null;
return inventory;
}

@Override
protected void setInvStackList(DefaultedList<ItemStack> list) {

inventory.set(0, list.get(0));
}

private void inventoryChanged() {
Expand Down Expand Up @@ -122,15 +138,27 @@ public void tryCraft() {

if (!world.isClient) world.playSound(null, pos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.BLOCKS, 0.5f, world.getRandom().nextFloat() * 0.4f + 0.8f);

inventoryChanged();
BlockEntity possibleHopper = world.getBlockEntity(pos.down());
if (possibleHopper instanceof Inventory) {
output = HopperBlockEntity.transfer(this, (Inventory) possibleHopper, output, Direction.UP);
}
this.inventory.set(0, output);
inventoryChanged();
}
tryTansferItemsOut();
}

public void tryTansferItemsOut() {
ItemStack stack = getStack(0);
if (stack.isEmpty()) {
return;
}

ItemStack contents = this.inventory.get(0);
BlockEntity possibleHopper = world.getBlockEntity(pos.down());
if (possibleHopper instanceof Inventory) {
contents = HopperBlockEntity.transfer(this, (Inventory) possibleHopper, contents, Direction.UP);
}
this.inventory.set(0, contents);
inventoryChanged();
}

@Override
public NbtCompound toInitialChunkDataNbt() {
NbtCompound nbtCompound = new NbtCompound();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,8 @@ private static FabricItemSettings decoration() {

public static final BlockItem FLAXWEAVE_CUSHION = add("flaxweave_cushion", ParadiseLostBlocks.FLAXWEAVE_CUSHION, decoration, fuel(300));

public static final BlockItem CHEESECAKE = add("halflight_cheesecake", ParadiseLostBlocks.CHEESECAKE, food());
// TODO
//public static final BlockItem CHEESECAKE = add("halflight_cheesecake", ParadiseLostBlocks.CHEESECAKE, food());

public static final BlockItem AMADRYS_BUNDLE = add("amadrys_bundle", ParadiseLostBlocks.AMADRYS_BUNDLE, decoration());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

public class ParadiseLostStructureTags {

public static final TagKey<Biome> ORANGE_RUIN_HAS_STRUCTURE = register("has_structure/orange_ruin");
public static final TagKey<Biome> AUREL_TOWER_HAS_STRUCTURE = register("has_structure/aurel_tower");
public static final TagKey<Biome> WELL_HAS_STRUCTURE = register("has_structure/well");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ private static Biome createHighlandsPlains() {
merge(
Map.of(
SpawnGroup.MONSTER, List.of(
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.ENVOY, 50, 2, 4)
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.ENVOY, 50, 1, 3)
),
SpawnGroup.CREATURE, List.of(
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.PARADISE_HARE, 12, 4, 4),
Expand All @@ -271,7 +271,7 @@ private static Biome createHighlandsPlains() {
)
),
Map.of(
ParadiseLostEntityTypes.ENVOY, SpawnCost.of(0.1, 2.0)
ParadiseLostEntityTypes.ENVOY, SpawnCost.of(1.0, 0.5)
)
))
.precipitation(Biome.Precipitation.RAIN).temperature(0.5F).downfall(1)
Expand Down Expand Up @@ -309,7 +309,7 @@ private static Biome createHighlandsForest() {
merge(
Map.of(
SpawnGroup.MONSTER, List.of(
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.ENVOY, 50, 2, 4)
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.ENVOY, 50, 1, 3)
),
SpawnGroup.CREATURE, List.of(
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.PARADISE_HARE, 12, 4, 4),
Expand All @@ -318,7 +318,7 @@ private static Biome createHighlandsForest() {
)
),
Map.of(
ParadiseLostEntityTypes.ENVOY, SpawnCost.of(0.1, 2.0)
ParadiseLostEntityTypes.ENVOY, SpawnCost.of(1.0, 0.5)
)
))
.precipitation(Biome.Precipitation.RAIN).temperature(0.5F).downfall(1)
Expand Down Expand Up @@ -354,7 +354,7 @@ private static Biome createTradewinds() {
merge(
Map.of(
SpawnGroup.MONSTER, List.of(
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.ENVOY, 50, 2, 4)
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.ENVOY, 50, 1, 3)
),
SpawnGroup.CREATURE, List.of(
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.PARADISE_HARE, 12, 4, 4),
Expand All @@ -363,7 +363,7 @@ private static Biome createTradewinds() {
)
),
Map.of(
ParadiseLostEntityTypes.ENVOY, SpawnCost.of(0.1, 2.0)
ParadiseLostEntityTypes.ENVOY, SpawnCost.of(1.0, 0.5)
)
))
.precipitation(Biome.Precipitation.RAIN).temperature(0.5F).downfall(1)
Expand Down Expand Up @@ -404,7 +404,7 @@ private static Biome createHighlandsThicket() {
merge(
Map.of(
SpawnGroup.MONSTER, List.of(
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.ENVOY, 50, 2, 4)
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.ENVOY, 50, 1, 3)
),
SpawnGroup.CREATURE, List.of(
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.PARADISE_HARE, 12, 4, 4),
Expand All @@ -413,7 +413,7 @@ private static Biome createHighlandsThicket() {
)
),
Map.of(
ParadiseLostEntityTypes.ENVOY, SpawnCost.of(0.1, 2.0)
ParadiseLostEntityTypes.ENVOY, SpawnCost.of(1.0, 0.5)
)
))
.precipitation(Biome.Precipitation.RAIN).temperature(0.4F).downfall(2)
Expand Down Expand Up @@ -452,7 +452,7 @@ private static Biome createHighlandsGrandGlade() {
merge(
Map.of(
SpawnGroup.MONSTER, List.of(
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.ENVOY, 50, 2, 4)
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.ENVOY, 50, 1, 3)
),
SpawnGroup.CREATURE, List.of(
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.PARADISE_HARE, 12, 4, 4),
Expand All @@ -461,7 +461,7 @@ private static Biome createHighlandsGrandGlade() {
)
),
Map.of(
ParadiseLostEntityTypes.ENVOY, SpawnCost.of(0.1, 2.0)
ParadiseLostEntityTypes.ENVOY, SpawnCost.of(1.0, 0.5)
)
))
.precipitation(Biome.Precipitation.RAIN).temperature(0.4F).downfall(2)
Expand Down Expand Up @@ -497,7 +497,7 @@ private static Biome createWisteriaWoods() {
merge(
Map.of(
SpawnGroup.MONSTER, List.of(
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.ENVOY, 50, 2, 4)
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.ENVOY, 50, 1, 3)
),
SpawnGroup.CREATURE, List.of(
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.PARADISE_HARE, 12, 4, 4),
Expand All @@ -506,7 +506,7 @@ private static Biome createWisteriaWoods() {
)
),
Map.of(
ParadiseLostEntityTypes.ENVOY, SpawnCost.of(0.1, 2.0)
ParadiseLostEntityTypes.ENVOY, SpawnCost.of(1.0, 0.5)
)
))
.precipitation(Biome.Precipitation.RAIN).temperature(0.5F).downfall(1)
Expand Down Expand Up @@ -548,7 +548,7 @@ private static Biome createAutumnalTundra() {
merge(
Map.of(
SpawnGroup.MONSTER, List.of(
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.ENVOY, 50, 2, 4)
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.ENVOY, 50, 1, 3)
),
SpawnGroup.CREATURE, List.of(
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.PARADISE_HARE, 12, 4, 4),
Expand All @@ -558,7 +558,7 @@ private static Biome createAutumnalTundra() {
)
),
Map.of(
ParadiseLostEntityTypes.ENVOY, SpawnCost.of(0.1, 2.0)
ParadiseLostEntityTypes.ENVOY, SpawnCost.of(1.0, 0.5)
)
))
.precipitation(Biome.Precipitation.RAIN).temperature(0.1F).downfall(2)
Expand Down Expand Up @@ -598,7 +598,7 @@ private static Biome createContinentalPlateau() {
merge(
Map.of(
SpawnGroup.MONSTER, List.of(
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.ENVOY, 50, 2, 4)
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.ENVOY, 50, 1, 3)
),
SpawnGroup.CREATURE, List.of(
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.PARADISE_HARE, 12, 4, 4),
Expand All @@ -608,7 +608,7 @@ private static Biome createContinentalPlateau() {
)
),
Map.of(
ParadiseLostEntityTypes.ENVOY, SpawnCost.of(0.1, 2.0)
ParadiseLostEntityTypes.ENVOY, SpawnCost.of(1.0, 0.5)
)
))
.precipitation(Biome.Precipitation.RAIN).temperature(0.25F).downfall(0)
Expand Down Expand Up @@ -657,7 +657,7 @@ private static Biome createHighlandsShield() {
merge(
Map.of(
SpawnGroup.MONSTER, List.of(
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.ENVOY, 50, 2, 4)
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.ENVOY, 50, 1, 3)
),
SpawnGroup.CREATURE, List.of(
new SpawnSettings.SpawnEntry(ParadiseLostEntityTypes.PARADISE_HARE, 12, 4, 4),
Expand All @@ -667,7 +667,7 @@ private static Biome createHighlandsShield() {
)
),
Map.of(
ParadiseLostEntityTypes.ENVOY, SpawnCost.of(0.1, 2.0)
ParadiseLostEntityTypes.ENVOY, SpawnCost.of(1.0, 0.5)
)
))
.precipitation(Biome.Precipitation.RAIN).temperature(0.35F).downfall(2)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.id.paradiselost.world.feature.structure;

import net.id.paradiselost.world.feature.structure.generator.OrangeRuinGenerator;
import net.id.paradiselost.world.feature.structure.generator.AurelTowerGenerator;
import net.id.paradiselost.world.feature.structure.generator.WellGenerator;
import net.minecraft.structure.StructurePieceType;
Expand All @@ -20,18 +19,13 @@ public class ParadiseLostStructureFeatures {
public static final StructureType<AurelTowerFeature> AUREL_TOWER = () -> AurelTowerFeature.CODEC;
public static final StructurePieceType AUREL_TOWER_PIECE = AurelTowerGenerator.Piece::new;

public static final TagKey<Structure> ORANGE_RUIN_KEY = tagKey("orange_ruin");
public static final StructureType<OrangeRuinFeature> ORANGE_RUIN = () -> OrangeRuinFeature.CODEC;
public static final StructurePieceType ORANGE_RUIN_PIECE = OrangeRuinGenerator.Piece::new;

private static TagKey<Structure> tagKey(String name) {
return TagKey.of(Registry.STRUCTURE_KEY, locate(name));
}

public static void init() {
register(WELL_KEY, WELL, WELL_PIECE);
register(AUREL_TOWER_KEY, AUREL_TOWER, AUREL_TOWER_PIECE);
register(ORANGE_RUIN_KEY, ORANGE_RUIN, ORANGE_RUIN_PIECE);
}

private static <T extends Structure> void register(TagKey<? extends T> name, StructureType<? extends T> type, StructurePieceType pieceType) {
Expand Down
Loading

0 comments on commit 81ebac7

Please sign in to comment.