Mildly Experienced

- Players can now sneak while using exp nuggets to only consume one item at a time
- Fixed brass funnels losing their filter when changing from or to a belt/depot funnel
- Minecart contraption items can no longer be placed in container items like toolboxes or shulkers (configurable)
- Implement #4436, #4419
This commit is contained in:
simibubi 2023-03-08 13:33:05 +01:00
parent 1b2ca00c44
commit af86a7366a
9 changed files with 43 additions and 8 deletions

View file

@ -49,6 +49,7 @@ body:
label: Mod Version
description: The version of the mod you were using when the bug occured
options:
- "0.5.0j"
- "0.5.0i"
- "0.5.0h"
- "0.5.0g"

View file

@ -25,10 +25,13 @@ public class Curios {
.get("head");
if (stacksHandler == null)
return false;
if (stacksHandler.getSlots() == 0)
return false;
return AllItems.GOGGLES.isIn(stacksHandler.getStacks()
.getStackInSlot(0));
int slots = stacksHandler.getSlots();
for (int slot = 0; slot < slots; slot++)
if (AllItems.GOGGLES.isIn(stacksHandler.getStacks()
.getStackInSlot(slot)))
return true;
return false;
})
.orElse(false));

View file

@ -92,7 +92,7 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
float speed = getGeneratedSpeed();
float prevSpeed = this.speed;
if (level.isClientSide)
if (level == null || level.isClientSide)
return;
if (prevSpeed != speed) {

View file

@ -67,6 +67,11 @@ public class MinecartContraptionItem extends Item {
public static MinecartContraptionItem chest(Properties builder) {
return new MinecartContraptionItem(Type.CHEST, builder);
}
@Override
public boolean canFitInsideContainerItems() {
return AllConfigs.SERVER.kinetics.minecartContraptionInContainers.get();
}
private MinecartContraptionItem(Type minecartTypeIn, Properties builder) {
super(builder);

View file

@ -35,8 +35,9 @@ public class ExperienceNuggetItem extends Item {
return InteractionResultHolder.consume(itemInHand);
}
int total = Mth.ceil(3f * itemInHand.getCount());
int maxOrbs = 5;
int amountUsed = pPlayer.isSteppingCarefully() ? 1 : itemInHand.getCount();
int total = Mth.ceil(3f * amountUsed);
int maxOrbs = amountUsed == 1 ? 1 : 5;
int valuePer = Math.max(1, 1 + total / maxOrbs);
for (int i = 0; i < maxOrbs; i++) {
@ -61,6 +62,10 @@ public class ExperienceNuggetItem extends Item {
pLevel.addFreshEntity(xp);
}
itemInHand.shrink(amountUsed);
if (!itemInHand.isEmpty())
return InteractionResultHolder.success(itemInHand);
pPlayer.setItemInHand(pUsedHand, ItemStack.EMPTY);
return InteractionResultHolder.consume(itemInHand);
}

View file

@ -71,6 +71,17 @@ public class BeltFunnelBlock extends AbstractHorizontalFunnelBlock implements IS
super.createBlockStateDefinition(p_206840_1_.add(SHAPE));
}
public boolean isOfSameType(FunnelBlock otherFunnel) {
return parent.get() == otherFunnel;
}
@Override
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean isMoving) {
if (newState.getBlock() instanceof FunnelBlock fb && isOfSameType(fb))
return;
super.onRemove(state, world, pos, newState, isMoving);
}
@Override
public VoxelShape getShape(BlockState state, BlockGetter p_220053_2_, BlockPos p_220053_3_,
CollisionContext p_220053_4_) {

View file

@ -12,7 +12,7 @@ public class BrassFunnelBlock extends FunnelBlock {
public BrassFunnelBlock(Properties p_i48415_1_) {
super(p_i48415_1_);
}
@Override
public BlockState getEquivalentBeltFunnel(BlockGetter world, BlockPos pos, BlockState state) {
Direction facing = getFacing(state);

View file

@ -64,6 +64,13 @@ public abstract class FunnelBlock extends AbstractDirectionalFunnelBlock {
super.createBlockStateDefinition(builder.add(EXTRACTING));
}
@Override
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean isMoving) {
if (newState.getBlock() instanceof BeltFunnelBlock bfb && bfb.isOfSameType(this))
return;
super.onRemove(state, world, pos, newState, isMoving);
}
@Override
public void setPlacedBy(Level pLevel, BlockPos pPos, BlockState pState, LivingEntity pPlacer, ItemStack pStack) {
super.setPlacedBy(pLevel, pPos, pState, pPlacer, pStack);

View file

@ -47,6 +47,8 @@ public class CKinetics extends ConfigBase {
public final ConfigBool moveItemsToStorage = b(true, "moveItemsToStorage", Comments.moveItemsToStorage);
public final ConfigBool harvestPartiallyGrown = b(false, "harvestPartiallyGrown", Comments.harvestPartiallyGrown);
public final ConfigBool harvesterReplants = b(true, "harvesterReplants", Comments.harvesterReplants);
public final ConfigBool minecartContraptionInContainers =
b(false, "minecartContraptionInContainers", Comments.minecartContraptionInContainers);
public final CStress stressValues = nested(1, CStress::new, Comments.stress);
@ -117,6 +119,7 @@ public class CKinetics extends ConfigBase {
static String spawnerMovement = "Configure how Spawner blocks can be moved by contraptions.";
static String amethystMovement = "Configure how Budding Amethyst can be moved by contraptions.";
static String obsidianMovement = "Configure how Obsidian blocks can be moved by contraptions.";
static String minecartContraptionInContainers = "Whether minecart contraptions can be placed into container items.";
}
public enum DeployerAggroSetting {