Skip to content

Commit

Permalink
fix block entities. fix shell item size
Browse files Browse the repository at this point in the history
  • Loading branch information
eerussianguy committed Sep 18, 2022
1 parent c760340 commit 5273287
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 9 deletions.
2 changes: 1 addition & 1 deletion resources/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def generate(rm: ResourceManager):
rm.item_model(('plant', '%s_sapling' % fruit), 'firmalife:block/fruit_tree/%s_sapling' % fruit)
flower_pot_cross(rm, '%s sapling' % fruit, 'firmalife:plant/potted/%s_sapling' % fruit, 'plant/flowerpot/%s_sapling' % fruit, 'firmalife:block/fruit_tree/%s_sapling' % fruit, 'firmalife:plant/%s_sapling' % fruit)

contained_fluid(rm, 'hollow_shell', 'firmalife:item/hollow_shell', 'firmalife:item/hollow_shell_overlay').with_lang(lang('Hollow Shell'))
contained_fluid(rm, 'hollow_shell', 'firmalife:item/hollow_shell', 'firmalife:item/hollow_shell_overlay').with_lang(lang('Hollow Shell')).with_tag('tfc:buckets')

for jar, _, texture, _ in JARS:
make_jar(rm, jar, texture)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.eerussianguy.firmalife.common;

import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;

import com.eerussianguy.firmalife.common.blockentities.FLBlockEntities;
Expand All @@ -12,4 +13,10 @@ public FLTickCounterBlockEntity(BlockPos pos, BlockState state)
{
super(FLBlockEntities.TICK_COUNTER.get(), pos, state);
}

@Override
public BlockEntityType<?> getType()
{
return FLBlockEntities.TICK_COUNTER.get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.core.BlockPos;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;

import com.eerussianguy.firmalife.common.FLHelpers;
Expand All @@ -16,12 +17,12 @@ public class DryingMatBlockEntity extends SimpleItemRecipeBlockEntity<DryingReci
{
public static DryingMatBlockEntity dryingMat(BlockPos pos, BlockState state)
{
return new DryingMatBlockEntity(pos, state, FLConfig.SERVER.dryingTicks);
return new DryingMatBlockEntity(FLBlockEntities.DRYING_MAT.get(), pos, state, FLConfig.SERVER.dryingTicks);
}

public static DryingMatBlockEntity solarDrier(BlockPos pos, BlockState state)
{
return new DryingMatBlockEntity(pos, state, FLConfig.SERVER.solarDryingTicks);
return new DryingMatBlockEntity(FLBlockEntities.SOLAR_DRIER.get(), pos, state, FLConfig.SERVER.solarDryingTicks);
}

public static void serverTick(Level level, BlockPos pos, BlockState state, DryingMatBlockEntity mat)
Expand All @@ -41,9 +42,9 @@ public static void serverTick(Level level, BlockPos pos, BlockState state, Dryin
}
}

public DryingMatBlockEntity(BlockPos pos, BlockState state, Supplier<Integer> dryTicks)
public DryingMatBlockEntity(BlockEntityType<DryingMatBlockEntity> type, BlockPos pos, BlockState state, Supplier<Integer> dryTicks)
{
super(FLBlockEntities.DRYING_MAT.get(), pos, state, FLHelpers.blockEntityName("drying_mat"), dryTicks);
super(type, pos, state, FLHelpers.blockEntityName("drying_mat"), dryTicks);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.eerussianguy.firmalife.common.blockentities;

import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;

import net.dries007.tfc.common.blockentities.BerryBushBlockEntity;

public class FLBerryBushBlockEntity extends BerryBushBlockEntity
{
public FLBerryBushBlockEntity(BlockPos pos, BlockState state)
{
super(pos, state);
}

protected FLBerryBushBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state)
{
super(type, pos, state);
}

@Override
public BlockEntityType<?> getType()
{
return FLBlockEntities.BERRY_BUSH.get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class FLBlockEntities
public static final RegistryObject<BlockEntityType<IronComposterBlockEntity>> IRON_COMPOSTER = register("iron_composter", IronComposterBlockEntity::new, FLBlocks.IRON_COMPOSTER);
public static final RegistryObject<BlockEntityType<StringBlockEntity>> STRING = register("string", StringBlockEntity::new, FLBlocks.WOOL_STRING);
public static final RegistryObject<BlockEntityType<MixingBowlBlockEntity>> MIXING_BOWL = register("mixing_bowl", MixingBowlBlockEntity::new, FLBlocks.MIXING_BOWL);
public static final RegistryObject<BlockEntityType<BerryBushBlockEntity>> BERRY_BUSH = register("berry_bush", BerryBushBlockEntity::new, Stream.of(FLBlocks.FRUIT_TREE_LEAVES.values()).<Supplier<? extends Block>>flatMap(Helpers::flatten));
public static final RegistryObject<BlockEntityType<BerryBushBlockEntity>> BERRY_BUSH = register("berry_bush", FLBerryBushBlockEntity::new, Stream.of(FLBlocks.FRUIT_TREE_LEAVES.values()).<Supplier<? extends Block>>flatMap(Helpers::flatten));

public static final RegistryObject<BlockEntityType<LargePlanterBlockEntity>> LARGE_PLANTER = register("large_planter", LargePlanterBlockEntity::new, FLBlocks.LARGE_PLANTER);
public static final RegistryObject<BlockEntityType<BonsaiPlanterBlockEntity>> BONSAI_PLANTER = register("bonsai_planter", BonsaiPlanterBlockEntity::new, FLBlocks.BONSAI_PLANTER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ public static InteractionResult use(Level level, BlockPos pos, Player player, In
if (level.getBlockEntity(pos) instanceof SimpleItemRecipeBlockEntity<?> mat)
{
InteractionResult result = mat.getCapability(Capabilities.ITEM).map(inv -> {
if (mat.readStack().isEmpty() && !held.isEmpty())
if (inv.getStackInSlot(0).isEmpty() && !held.isEmpty())
{
InteractionResult res = FLHelpers.insertOne(level, held, 0, inv, player);
if (res.consumesAction())
{
mat.markForSync();
mat.start();
}
mat.markForSync();
return res;
}
else if (!mat.readStack().isEmpty() && held.isEmpty() && player.isShiftKeyDown())
else if (!inv.getStackInSlot(0).isEmpty() && held.isEmpty() && player.isShiftKeyDown())
{
mat.markForSync();
return FLHelpers.takeOne(level, 0, inv, player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public void registerRecipes(IRecipeRegistration r)
public void registerRecipeCatalysts(IRecipeCatalystRegistration r)
{
r.addRecipeCatalyst(new ItemStack(FLBlocks.DRYING_MAT.get()), DRYING);
r.addRecipeCatalyst(new ItemStack(FLBlocks.SOLAR_DRIER.get()), DRYING);
r.addRecipeCatalyst(new ItemStack(TFCItems.WOOL_YARN.get()), SMOKING);
r.addRecipeCatalyst(new ItemStack(FLBlocks.MIXING_BOWL.get()), MIXING_BOWL);
r.addRecipeCatalyst(new ItemStack(FLItems.SPOON.get()), MIXING_BOWL);
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/data/tfc/tags/items/buckets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"__comment__": "This file was automatically created by mcresources",
"replace": false,
"values": [
"firmalife:hollow_shell"
]
}

0 comments on commit 5273287

Please sign in to comment.