Merge pull request #3053 from LordGrimmauld/mc1.18/miscfixes

Mc1.18/miscfixes
This commit is contained in:
simibubi 2022-05-22 16:56:27 +02:00 committed by GitHub
commit 8ae15d794a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 28 additions and 17 deletions

View file

@ -4105,7 +4105,7 @@ a7c97582bae243ab04ff5ff9914b24af25d40d59 data/create/recipes/crushing/iron_horse
554b6555888fe01de349efaaab36b68a338ac397 data/create/recipes/crushing/iron_ore.json
c9a9d6d28a7eac1210108d52840b60b26d58bcfe data/create/recipes/crushing/lapis_ore.json
e870d049abc5cd5f389f70414c67e76ddc14060d data/create/recipes/crushing/leather_horse_armor.json
cc5a817901d6f0d68e4ceb3e65d7f2187ab37ceb data/create/recipes/crushing/nether_gold_ore.json
cab15acd2d62f1d70e0972b443f7987048d5183a data/create/recipes/crushing/nether_gold_ore.json
6cd97c6f12687790943db810f85036b02586c753 data/create/recipes/crushing/nether_quartz_ore.json
6e424d7e9f7d8b585384053a713db28f9d36448b data/create/recipes/crushing/nether_wart_block.json
8003e7db3ee11066b365c251f04f84028820de94 data/create/recipes/crushing/netherrack.json

View file

@ -8,11 +8,7 @@
"results": [
{
"item": "minecraft:gold_nugget",
"count": 7
},
{
"item": "minecraft:gold_nugget",
"chance": 0.5
"count": 18
},
{
"item": "create:experience_nugget",

View file

@ -162,7 +162,7 @@ public class CartAssemblerTileEntity extends SmartTileEntity implements IDisplay
OrientedContraptionEntity entity = OrientedContraptionEntity.create(world, contraption, initialOrientation);
if (couplingFound)
entity.setCouplingId(cart.getUUID());
entity.setPos(pos.getX(), pos.getY(), pos.getZ());
entity.setPos(pos.getX() + .5, pos.getY(), pos.getZ() + .5);
world.addFreshEntity(entity);
entity.startRiding(cart);

View file

@ -4,14 +4,18 @@ import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationS
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.item.BoneMealItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.block.AzaleaBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.BonemealableBlock;
import net.minecraft.world.level.block.SaplingBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
public class TreeFertilizerItem extends Item {
@ -24,7 +28,7 @@ public class TreeFertilizerItem extends Item {
BlockState state = context.getLevel()
.getBlockState(context.getClickedPos());
Block block = state.getBlock();
if (block instanceof SaplingBlock) {
if (block instanceof BonemealableBlock bonemealableBlock && state.is(BlockTags.SAPLINGS)) {
if (context.getLevel().isClientSide) {
BoneMealItem.addGrowthParticles(context.getLevel(), context.getClickedPos(), 100);
@ -38,11 +42,11 @@ public class TreeFertilizerItem extends Item {
if (context.getLevel()
.getBlockState(saplingPos.offset(pos))
.getBlock() == block)
world.setBlockAndUpdate(pos.above(10), state.setValue(SaplingBlock.STAGE, 1));
world.setBlockAndUpdate(pos.above(10), withStage(state, 1));
}
((SaplingBlock) block).performBonemeal(world, world.getRandom(), BlockPos.ZERO.above(10),
state.setValue(SaplingBlock.STAGE, 1));
bonemealableBlock.performBonemeal(world, world.getRandom(), BlockPos.ZERO.above(10),
withStage(state, 1));
for (BlockPos pos : world.blocksAdded.keySet()) {
BlockPos actualPos = pos.offset(saplingPos).below(10);
@ -76,6 +80,12 @@ public class TreeFertilizerItem extends Item {
return super.useOn(context);
}
private BlockState withStage(BlockState original, int stage) {
if (!original.hasProperty(BlockStateProperties.STAGE))
return original;
return original.setValue(BlockStateProperties.STAGE, 1);
}
private static class TreesDreamWorld extends PlacementSimulationServerWorld {
private final BlockPos saplingPos;
private final BlockState soil;

View file

@ -1,6 +1,7 @@
package com.simibubi.create.content.curiosities.toolbox;
import java.util.List;
import java.util.Objects;
import java.util.WeakHashMap;
import java.util.stream.Collectors;
@ -111,6 +112,7 @@ public class ToolboxHandler {
.sorted((p1, p2) -> Double.compare(distance(location, p1), distance(location, p2)))
.limit(maxAmount)
.map(toolboxes.get(world)::get)
.filter(ToolboxTileEntity::isFullyInitialized)
.collect(Collectors.toList());
}

View file

@ -6,6 +6,7 @@ import static com.simibubi.create.foundation.gui.AllGuiTextures.TOOLBELT_SELECTE
import static com.simibubi.create.foundation.gui.AllGuiTextures.TOOLBELT_SELECTED_ON;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import com.google.common.collect.ImmutableList;
@ -111,10 +112,7 @@ public class ToolboxHandlerClient {
Level level = player.level;
List<ToolboxTileEntity> toolboxes = ToolboxHandler.getNearest(player.level, player, 8);
if (!toolboxes.isEmpty())
Collections.sort(toolboxes, (te1, te2) -> te1.getUniqueId()
.compareTo(te2.getUniqueId()));
toolboxes.sort(Comparator.comparing(ToolboxTileEntity::getUniqueId));
CompoundTag compound = player.getPersistentData()
.getCompound("CreateToolboxData");

View file

@ -380,6 +380,11 @@ public class ToolboxTileEntity extends SmartTileEntity implements MenuProvider,
return uniqueId;
}
public boolean isFullyInitialized() {
// returns true when uniqueId has been initialized
return uniqueId != null;
}
public void setCustomName(Component customName) {
this.customName = customName;
}

View file

@ -95,7 +95,7 @@ public class CrushingRecipeGen extends ProcessingRecipeGen {
DEEP_REDSTONE_ORE = deepslateOre(() -> Items.DEEPSLATE_REDSTONE_ORE, () -> Items.REDSTONE, 7.5f, 350),
DEEP_LAPIS_ORE = deepslateOre(() -> Items.DEEPSLATE_LAPIS_ORE, () -> Items.LAPIS_LAZULI, 12.5f, 350),
NETHER_GOLD_ORE = netherOre(() -> Items.NETHER_GOLD_ORE, () -> Items.GOLD_NUGGET, 7.5f, 350),
NETHER_GOLD_ORE = netherOre(() -> Items.NETHER_GOLD_ORE, () -> Items.GOLD_NUGGET, 18, 350),
NETHER_QUARTZ_ORE = netherOre(() -> Items.NETHER_QUARTZ_ORE, () -> Items.QUARTZ, 2.25f, 350),
RAW_COPPER_ORE = rawOre(() -> Items.RAW_COPPER, AllItems.CRUSHED_COPPER::get, 1),

View file

@ -229,7 +229,7 @@ public class ItemHelper {
for (int slot = 0; slot < inv.getSlots(); slot++) {
if (extracting.isEmpty()) {
ItemStack stackInSlot = inv.getStackInSlot(slot);
if (stackInSlot.isEmpty())
if (stackInSlot.isEmpty() || !test.test(stackInSlot))
continue;
int maxExtractionCountForItem = amountFunction.apply(stackInSlot);
if (maxExtractionCountForItem == 0)