Skip to content

Commit

Permalink
post merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Sep 2, 2024
1 parent a9f3a9c commit a0a7a6f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,37 +337,20 @@ public ItemStack insert(TransportedItemStack heldItem, TransactionContext ctx) {
return returned;
}

// if (this.isEmpty()) {
// if (heldItem.insertedFrom.getAxis()
// .isHorizontal())
// TransactionCallback.onSuccess(ctx, () -> AllSoundEvents.DEPOT_SLIDE.playOnServer(getWorld(), getPos()));
// else
// TransactionCallback.onSuccess(ctx, () -> AllSoundEvents.DEPOT_PLOP.playOnServer(getWorld(), getPos()));
// }
// snapshotParticipant.updateSnapshots(ctx);
// this.heldItem = heldItem;
// TransactionCallback.onSuccess(ctx, () -> onHeldInserted.accept(heldItem.stack));
// return ItemStack.EMPTY;
// }

ItemStack returned = ItemStack.EMPTY;
int maxCount = heldItem.stack.getMaxStackSize();
if (maxCount < heldItem.stack.getCount())
returned = ItemHandlerHelper.copyStackWithSize(heldItem.stack, heldItem.stack.getCount() - maxCount);

if (simulate)
return returned;

if (this.isEmpty()) {
if (heldItem.insertedFrom.getAxis()
.isHorizontal())
AllSoundEvents.DEPOT_SLIDE.playOnServer(getWorld(), getPos());
TransactionCallback.onSuccess(ctx, () -> AllSoundEvents.DEPOT_SLIDE.playOnServer(getWorld(), getPos()));
else
AllSoundEvents.DEPOT_PLOP.playOnServer(getWorld(), getPos());
TransactionCallback.onSuccess(ctx, () -> AllSoundEvents.DEPOT_PLOP.playOnServer(getWorld(), getPos()));
}

snapshotParticipant.updateSnapshots(ctx);
heldItem = heldItem.copy();
heldItem.stack.setCount(maxCount);
this.heldItem = heldItem;
onHeldInserted.accept(heldItem.stack);
return returned;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ private void tryClearingSpoutputOverflow() {
inserter = BlockEntityBehaviour.get(level, be.getBlockPos(), InvManipulationBehaviour.TYPE);
}

if (filter.isRecipeFilter())
if (filter != null && filter.isRecipeFilter())
filter = null; // Do not test spout outputs against the recipe filter

Storage<ItemVariant> targetInv = getItemSpoutputOutput(direction);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
package com.simibubi.create.foundation.block;

import java.lang.reflect.Field;
import java.util.function.BiConsumer;
import java.util.function.Supplier;

import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;

import com.google.common.base.Suppliers;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.ImmutableBiMap;
import com.simibubi.create.Create;

import net.minecraft.world.item.HoneycombItem;
import net.fabricmc.fabric.api.registry.OxidizableBlocksRegistry;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.WeatheringCopper;

public class CopperRegistries {
private static final BiMap<Supplier<Block>, Supplier<Block>> WEATHERING = HashBiMap.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder;
import com.simibubi.create.foundation.utility.Lang;

import me.alphamode.forgetags.Tags;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.fabricmc.fabric.api.resource.conditions.v1.DefaultResourceConditions;
import net.minecraft.core.Registry;
Expand All @@ -33,10 +34,6 @@
import net.minecraft.world.item.Items;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.common.Tags;
import net.minecraftforge.common.crafting.conditions.NotCondition;
import net.minecraftforge.common.crafting.conditions.TagEmptyCondition;
import net.minecraftforge.registries.ForgeRegistries;

public class CrushingRecipeGen extends ProcessingRecipeGen {

Expand Down Expand Up @@ -528,7 +525,7 @@ protected GeneratedRecipe moddedRawOre(CompatMetals metal, Supplier<ItemLike> re
int amount = block ? 9 : 1;
String tagPath = (block ? "storage_blocks/raw_" : "raw_materials/") + name;
return b.duration(400)
.withCondition(new NotCondition(new TagEmptyCondition("forge", tagPath)))
.withCondition(DefaultResourceConditions.itemTagsPopulated(AllTags.forgeItemTag(tagPath)))
.require(AllTags.forgeItemTag(tagPath))
.output(result.get(), amount)
.output(.75f, AllItems.EXP_NUGGET.get(), amount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.Widget;
import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.client.gui.narration.NarratableEntry;
import net.minecraft.client.gui.screens.PauseScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.TitleScreen;
Expand All @@ -23,6 +26,8 @@
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.item.ItemStack;

import org.apache.commons.lang3.mutable.MutableObject;

public class OpenCreateMenuButton extends Button {

public static final ItemStack ICON = AllItems.GOGGLES.asStack();
Expand Down Expand Up @@ -72,11 +77,7 @@ public MenuRows(List<SingleMenuRow> rows) {

public static class OpenConfigButtonHandler {

// onGuiInit
@SubscribeEvent
public static void onInitScreen(ScreenEvent.InitScreenEvent event) {
Screen screen = event.getScreen();

public static void onGuiInit(Minecraft client, Screen screen, int scaledWidth, int scaledHeight) {
MenuRows menu;
int rowIdx;
int offsetX;
Expand All @@ -100,9 +101,8 @@ public static void onInitScreen(ScreenEvent.InitScreenEvent event) {
String targetMessage = I18n.get((onLeft ? menu.leftTextKeys : menu.rightTextKeys).get(rowIdx - 1));

int offsetX_ = offsetX;
MutableObject<GuiEventListener> toAdd = new MutableObject<>(null);
event.getListenersList()
.stream()
MutableObject<OpenCreateMenuButton> toAdd = new MutableObject<>(null);
((ScreenAccessor) screen).port_lib$getChildren().stream()
.filter(w -> w instanceof AbstractWidget)
.map(w -> (AbstractWidget) w)
.filter(w -> w.getMessage()
Expand All @@ -112,7 +112,7 @@ public static void onInitScreen(ScreenEvent.InitScreenEvent event) {
.ifPresent(w -> toAdd
.setValue(new OpenCreateMenuButton(w.x + offsetX_ + (onLeft ? -20 : w.getWidth()), w.y)));
if (toAdd.getValue() != null)
event.addListener(toAdd.getValue());
screen.addRenderableWidget(toAdd.getValue());
}

}
Expand Down

0 comments on commit a0a7a6f

Please sign in to comment.