Bug hunt II

- Update catnip (Fixes doubled models in ponder)
- Add burn time for cardboard blocks
- Remove train colour scroll input when no map mods are present
- Fixed desyncs when picking up packages at the player reach limit
- Fixed stock keeper search results not comparing names in lowercase
- Fixed packages leaving encased chutes 'dying' through suffocation
- Fixed categories not collapsing on click when invalid filters are present
This commit is contained in:
simibubi 2024-12-12 22:28:13 +01:00
parent 400ac25af0
commit 9b042e51e5
6 changed files with 56 additions and 16 deletions

View file

@ -28,7 +28,7 @@ jei_minecraft_version = 1.20.1
jei_version = 15.10.0.39
curios_minecraft_version = 1.20.1
curios_version = 5.3.1
catnip_version = 0.8.35
catnip_version = 0.8.36
ponder_version = 0.8.12
mixin_extras_version = 0.4.1

View file

@ -55,6 +55,7 @@ import com.simibubi.create.content.contraptions.piston.MechanicalPistonHeadBlock
import com.simibubi.create.content.contraptions.piston.PistonExtensionPoleBlock;
import com.simibubi.create.content.contraptions.pulley.PulleyBlock;
import com.simibubi.create.content.decoration.CardboardBlock;
import com.simibubi.create.content.decoration.CardboardBlockItem;
import com.simibubi.create.content.decoration.MetalLadderBlock;
import com.simibubi.create.content.decoration.MetalScaffoldingBlock;
import com.simibubi.create.content.decoration.TrainTrapdoorBlock;
@ -811,7 +812,10 @@ public class AllBlocks {
public static final BlockEntry<ChuteBlock> CHUTE = REGISTRATE.block("chute", ChuteBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.mapColor(MapColor.COLOR_GRAY)
.sound(SoundType.NETHERITE_BLOCK))
.sound(SoundType.NETHERITE_BLOCK)
.noOcclusion()
.isSuffocating((level, pos, state) -> false)
.isRedstoneConductor((level, pos, state) -> false))
.transform(pickaxeOnly())
.addLayer(() -> RenderType::cutoutMipped)
.blockstate(new ChuteGenerator()::generate)
@ -2563,7 +2567,9 @@ public class AllBlocks {
.transform(axeOnly())
.blockstate(BlockStateGen.horizontalAxisBlockProvider(false))
.tag(Tags.Blocks.STORAGE_BLOCKS)
.transform(tagBlockAndItem("storage_blocks/cardboard"))
.tag(AllTags.forgeBlockTag("storage_blocks/cardboard"))
.item(CardboardBlockItem::new)
.tag(AllTags.forgeItemTag("storage_blocks/cardboard"))
.tag(Tags.Items.STORAGE_BLOCKS)
.build()
.lang("Block of Cardboard")
@ -2583,7 +2589,8 @@ public class AllBlocks {
.withPool(r.applyExplosionCondition(b, LootPool.lootPool()
.setRolls(ConstantValue.exactly(1.0F))
.add(LootItem.lootTableItem(AllBlocks.CARDBOARD_BLOCK.asItem()))))))
.simpleItem()
.item(CardboardBlockItem::new)
.build()
.lang("Bound block of Cardboard")
.register();

View file

@ -0,0 +1,21 @@
package com.simibubi.create.content.decoration;
import org.jetbrains.annotations.Nullable;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.level.block.Block;
public class CardboardBlockItem extends BlockItem {
public CardboardBlockItem(Block pBlock, Properties pProperties) {
super(pBlock, pProperties);
}
@Override
public int getBurnTime(ItemStack itemStack, @Nullable RecipeType<?> recipeType) {
return 4000;
}
}

View file

@ -253,6 +253,8 @@ public class PackageEntity extends LivingEntity implements IEntityAdditionalSpaw
if (!pPlayer.getItemInHand(pHand)
.isEmpty())
return super.interact(pPlayer, pHand);
if (pPlayer.level().isClientSide)
return InteractionResult.SUCCESS;
pPlayer.setItemInHand(pHand, box);
level().playSound(null, blockPosition(), SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, .2f,
.75f + level().random.nextFloat());
@ -359,15 +361,15 @@ public class PackageEntity extends LivingEntity implements IEntityAdditionalSpaw
ItemStackHandler contents = PackageItem.getContents(box);
for (int i = 0; i < contents.getSlots(); i++) {
ItemStack itemstack = contents.getStackInSlot(i);
if (itemstack.getItem() instanceof SpawnEggItem sei && level() instanceof ServerLevel sl) {
EntityType<?> entitytype = sei.getType(itemstack.getTag());
Entity entity = entitytype.spawn(sl, itemstack, null, blockPosition(),
MobSpawnType.SPAWN_EGG, false, false);
Entity entity =
entitytype.spawn(sl, itemstack, null, blockPosition(), MobSpawnType.SPAWN_EGG, false, false);
if (entity != null)
itemstack.shrink(1);
}
if (itemstack.isEmpty())
continue;
ItemEntity entityIn = new ItemEntity(level(), getX(), getY(), getZ(), itemstack);

View file

@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.Set;
import java.util.function.Function;
@ -296,7 +297,7 @@ public class StockKeeperRequestScreen extends AbstractSimiContainerScreen<StockK
boolean tagSearch = false;
if ((modSearch = valueWithPrefix.startsWith("@")) || (tagSearch = valueWithPrefix.startsWith("#")))
valueWithPrefix = valueWithPrefix.substring(1);
final String value = valueWithPrefix;
final String value = valueWithPrefix.toLowerCase(Locale.ROOT);
displayedItems = new ArrayList<>();
currentItemSource.forEach($ -> displayedItems.add(new ArrayList<>()));
@ -333,6 +334,7 @@ public class StockKeeperRequestScreen extends AbstractSimiContainerScreen<StockK
if (stack.getHoverName()
.getString()
.toLowerCase(Locale.ROOT)
.contains(value)
|| ForgeRegistries.ITEMS.getKey(stack.getItem())
.getPath()
@ -416,7 +418,7 @@ public class StockKeeperRequestScreen extends AbstractSimiContainerScreen<StockK
protected void renderBg(GuiGraphics graphics, float partialTicks, int mouseX, int mouseY) {
if (this != minecraft.screen)
return; // stencil buffer does not cooperate with ponders gui fade out
PoseStack ms = graphics.pose();
float currentScroll = itemScroll.getValue(partialTicks);
Couple<Integer> hoveredSlot = getHoveredSlot(mouseX, mouseY);
@ -778,7 +780,7 @@ public class StockKeeperRequestScreen extends AbstractSimiContainerScreen<StockK
drawItemCount(graphics, entry.count, customCount);
ms.popPose();
}
private void drawItemCount(GuiGraphics graphics, int count, int customCount) {
count = customCount;
String text = count >= 1000000 ? (count / 1000000) + "m"
@ -990,6 +992,8 @@ public class StockKeeperRequestScreen extends AbstractSimiContainerScreen<StockK
CategoryEntry entry = categories.get(categoryIndex);
if (Mth.floor((localY - entry.y) / (float) rowHeight + itemScroll.getChaseTarget()) != 0)
continue;
if (displayedItems.get(categoryIndex).isEmpty())
continue;
int indexOf = entry.filterStack == null ? -1 : blockEntity.categories.indexOf(entry.filterStack);
hiddenCategories.remove(indexOf);
if (!entry.hidden)

View file

@ -107,7 +107,7 @@ public class StationScreen extends AbstractStationScreen {
colorTypeScroll = new ScrollInput(x + 166, y + 17, 22, 14).titled(CreateLang.translateDirect("station.train_map_color"));
colorTypeScroll.withRange(0, 16);
colorTypeScroll.withStepFunction(ctx -> -colorTypeScroll.standardStep()
colorTypeScroll.withStepFunction(ctx -> colorTypeScroll.standardStep()
.apply(ctx));
colorTypeScroll.calling(s -> {
Train train = displayedTrain.get();
@ -188,9 +188,11 @@ public class StationScreen extends AbstractStationScreen {
disassembleTrainButton.visible = true;
dropScheduleButton.active = blockEntity.trainHasSchedule;
dropScheduleButton.visible = true;
colorTypeScroll.setState(imminentTrain.mapColorIndex);
colorTypeScroll.visible = true;
colorTypeScroll.active = true;
if (mapModsPresent()) {
colorTypeScroll.setState(imminentTrain.mapColorIndex);
colorTypeScroll.visible = true;
colorTypeScroll.active = true;
}
trainNameBox.active = true;
trainNameBox.setValue(imminentTrain.name.getString());
trainNameBox.setX(nameBoxX(trainNameBox.getValue(), trainNameBox));
@ -333,7 +335,7 @@ public class StationScreen extends AbstractStationScreen {
graphics.drawString(font, "...", guiLeft + 26, guiTop + 47, 0xa6a6a6);
}
if (!Mods.FTBCHUNKS.isLoaded())
if (!mapModsPresent())
return;
AllGuiTextures sprite = AllGuiTextures.TRAINMAP_SPRITES;
@ -355,6 +357,10 @@ public class StationScreen extends AbstractStationScreen {
}
}
public boolean mapModsPresent() {
return Mods.FTBCHUNKS.isLoaded() || Mods.JOURNEYMAP.isLoaded();
}
@Override
public boolean mouseClicked(double pMouseX, double pMouseY, int pButton) {
if (!nameBox.isFocused() && pMouseY > guiTop && pMouseY < guiTop + 14 && pMouseX > guiLeft