Skip to content

Commit

Permalink
switch incubus core versions - chests
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed Apr 26, 2024
1 parent ed56409 commit 41f4eab
Show file tree
Hide file tree
Showing 51 changed files with 563 additions and 1,610 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ loaderVersion=0.15.7
javaVersion=17

fabricApiVersion=0.77.0+1.19.2
incubusCoreVersion=1.9.4
incubusCoreVersion=2.0.0
customportalapiVersion=0.0.1-beta63.5-1.19.X
cardinalComponentsVersion=5.0.1
trinketsVersion=3.4.0
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/net/id/paradiselost/ParadiseLost.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import net.id.paradiselost.client.rendering.util.ParadiseLostColorProviders;
import net.id.paradiselost.commands.ParadiseLostCommands;
import net.id.paradiselost.config.ParadiseLostConfig;
import net.id.paradiselost.effect.ParadiseLostStatusEffects;
import net.id.paradiselost.effect.condition.Conditions;
import net.id.paradiselost.entities.ParadiseLostEntityTypes;
import net.id.paradiselost.entities.passive.moa.MoaRaces;
import net.id.paradiselost.fluids.ParadiseLostFluids;
Expand Down Expand Up @@ -83,7 +81,6 @@ public void onInitialize() {
ParadiseLostFeatures.init();
ParadiseLostBiomes.init();
ParadiseLostDimension.init();
ParadiseLostStatusEffects.init();
ParadiseLostBlocks.init();
ParadiseLostFluids.init();
ParadiseLostEntityTypes.init();
Expand All @@ -94,7 +91,6 @@ public void onInitialize() {
ParadiseLostGameRules.init();
ParadiseLostLootNumberProviderTypes.init();
ParadiseLostSoundEvents.init();
Conditions.init();
MoaRaces.init();
ParadiseLostScreens.init();
ParadiseLostLore.init();
Expand Down Expand Up @@ -123,7 +119,6 @@ public void onInitializeClient() {
ParadiseLostBlocks.initClient();
ParadiseLostItemRenderers.initClient();
ParadiseLostScreens.initClient();
Conditions.clientInit();
ParadiseLostScreens.clientInit();
}

Expand Down
274 changes: 274 additions & 0 deletions src/main/java/net/id/paradiselost/blocks/BlockRegistration.java

Large diffs are not rendered by default.

220 changes: 56 additions & 164 deletions src/main/java/net/id/paradiselost/blocks/ParadiseLostBlocks.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package net.id.paradiselost.blocks.blockentity;

import net.id.paradiselost.blocks.mechanical.FoodBowlBlock;
import net.id.incubus_core.be.InventoryBlockEntity;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.ItemEntity;
Expand All @@ -15,7 +14,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class FoodBowlBlockEntity extends BlockEntity implements InventoryBlockEntity {
public class FoodBowlBlockEntity extends BlockEntity {
private final DefaultedList<ItemStack> inventory;

public FoodBowlBlockEntity(BlockPos pos, BlockState state) {
Expand Down Expand Up @@ -57,19 +56,7 @@ private void updateState() {
world.setBlockState(pos, getCachedState().with(FoodBowlBlock.FULL, !inventory.get(0).isEmpty()));
}

@Override
public @NotNull HopperStrategy getHopperStrategy() {
return HopperStrategy.IN_ANY_OUT_BOTTOM;
}

@SuppressWarnings("ConstantConditions")
@Override
public boolean canInsert(int slot, ItemStack stack, @Nullable Direction dir) {
return InventoryBlockEntity.super.canInsert(slot, stack, dir) && stack.isFood() && stack.getItem().getFoodComponent().isMeat();
}

@Override
public DefaultedList<ItemStack> getItems() {
return inventory;
public ItemStack getContainedItem() {
return inventory.get(0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import net.id.paradiselost.component.MoaGenes;
import net.id.paradiselost.items.ParadiseLostItems;
import net.id.paradiselost.util.ParadiseLostSoundEvents;
import net.id.incubus_core.be.InventoryBlockEntity;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
Expand All @@ -18,7 +17,7 @@

import java.util.UUID;

public class IncubatorBlockEntity extends BlockEntity implements InventoryBlockEntity {
public class IncubatorBlockEntity extends BlockEntity {

private UUID owner;
private int hatchTicks = 100;
Expand Down Expand Up @@ -52,9 +51,12 @@ public void handleUse(PlayerEntity player, Hand hand, ItemStack handStack) {
hatchTicks = (int) (12000 / world.getBiome(pos).value().getTemperature());
}

@Override
public DefaultedList<ItemStack> getItems() {
return inventory;
public boolean hasItem() {
return !inventory.isEmpty();
}

public ItemStack getItem() {
return inventory.get(0);
}

@Override
Expand All @@ -69,8 +71,4 @@ public void readNbt(NbtCompound nbt) {
hatchTicks = nbt.getInt("hatchTicks");
}

@Override
public @NotNull HopperStrategy getHopperStrategy() {
return HopperStrategy.ALL_PASS;
}
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
package net.id.paradiselost.blocks.blockentity;

import net.id.incubus_core.be.InventoryBlockEntity;
import net.id.paradiselost.recipe.ParadiseLostRecipeTypes;
import net.id.paradiselost.recipe.TreeTapRecipe;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.HopperBlockEntity;
import net.minecraft.block.entity.LootableContainerBlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventories;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.listener.ClientPlayPacketListener;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.state.property.Properties;
import net.minecraft.text.Text;
import net.minecraft.util.Hand;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Optional;

public class TreeTapBlockEntity extends BlockEntity implements InventoryBlockEntity {
public class TreeTapBlockEntity extends LootableContainerBlockEntity {

private final DefaultedList<ItemStack> inventory;

Expand All @@ -47,24 +49,13 @@ public void handleUse(PlayerEntity player, Hand hand, ItemStack handStack) {
markDirty();
}

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

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

@Override
public @NotNull HopperStrategy getHopperStrategy() {
return HopperStrategy.IN_ANY;
public DefaultedList<ItemStack> getItems() {
return inventory;
}

@Override
public DefaultedList<ItemStack> getItems() {
return inventory;
public int size() {
return 1;
}

@Override
Expand All @@ -76,6 +67,16 @@ public void setStack(int slot, ItemStack stack) {
inventoryChanged();
}

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

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

}

private void inventoryChanged() {
markDirty();
if (world != null && !world.isClient) updateInClientWorld();
Expand All @@ -94,7 +95,17 @@ public void writeNbt(NbtCompound nbt) {
Inventories.writeNbt(nbt, inventory);
}

public BlockState getTappedState() {
@Override
protected Text getContainerName() {
return null;
}

@Override
protected ScreenHandler createScreenHandler(int syncId, PlayerInventory playerInventory) {
return null;
}

public BlockState getTappedState() {
return this.world.getBlockState(this.pos.offset(getCachedState().get(Properties.HORIZONTAL_FACING).getOpposite()));
}

Expand Down

This file was deleted.

Loading

0 comments on commit 41f4eab

Please sign in to comment.