mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-02-19 08:35:33 +01:00
Merge branch 'mc1.18/dev' into mc1.19/dev
This commit is contained in:
commit
285a25cf08
27 changed files with 140 additions and 77 deletions
|
@ -4,7 +4,7 @@ org.gradle.jvmargs = -Xmx3G
|
||||||
org.gradle.daemon = false
|
org.gradle.daemon = false
|
||||||
|
|
||||||
# mod version info
|
# mod version info
|
||||||
mod_version = 0.5.1.h
|
mod_version = 0.5.1.i
|
||||||
artifact_minecraft_version = 1.19.2
|
artifact_minecraft_version = 1.19.2
|
||||||
|
|
||||||
minecraft_version = 1.19.2
|
minecraft_version = 1.19.2
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:recipes/root",
|
"parent": "minecraft:recipes/root",
|
||||||
|
"rewards": {
|
||||||
|
"recipes": [
|
||||||
|
"create:blasting/ingot_aluminium_compat_ic2"
|
||||||
|
]
|
||||||
|
},
|
||||||
"criteria": {
|
"criteria": {
|
||||||
"has_item": {
|
"has_item": {
|
||||||
|
"trigger": "minecraft:inventory_changed",
|
||||||
"conditions": {
|
"conditions": {
|
||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
|
@ -10,14 +16,13 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
"trigger": "minecraft:inventory_changed"
|
|
||||||
},
|
},
|
||||||
"has_the_recipe": {
|
"has_the_recipe": {
|
||||||
|
"trigger": "minecraft:recipe_unlocked",
|
||||||
"conditions": {
|
"conditions": {
|
||||||
"recipe": "create:blasting/ingot_aluminum_compat_ic2"
|
"recipe": "create:blasting/ingot_aluminium_compat_ic2"
|
||||||
},
|
}
|
||||||
"trigger": "minecraft:recipe_unlocked"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"requirements": [
|
"requirements": [
|
||||||
|
@ -25,10 +30,5 @@
|
||||||
"has_item",
|
"has_item",
|
||||||
"has_the_recipe"
|
"has_the_recipe"
|
||||||
]
|
]
|
||||||
],
|
]
|
||||||
"rewards": {
|
|
||||||
"recipes": [
|
|
||||||
"create:blasting/ingot_aluminum_compat_ic2"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,7 +1,13 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:recipes/root",
|
"parent": "minecraft:recipes/root",
|
||||||
|
"rewards": {
|
||||||
|
"recipes": [
|
||||||
|
"create:smelting/ingot_aluminium_compat_ic2"
|
||||||
|
]
|
||||||
|
},
|
||||||
"criteria": {
|
"criteria": {
|
||||||
"has_item": {
|
"has_item": {
|
||||||
|
"trigger": "minecraft:inventory_changed",
|
||||||
"conditions": {
|
"conditions": {
|
||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
|
@ -10,14 +16,13 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
"trigger": "minecraft:inventory_changed"
|
|
||||||
},
|
},
|
||||||
"has_the_recipe": {
|
"has_the_recipe": {
|
||||||
|
"trigger": "minecraft:recipe_unlocked",
|
||||||
"conditions": {
|
"conditions": {
|
||||||
"recipe": "create:smelting/ingot_aluminum_compat_ic2"
|
"recipe": "create:smelting/ingot_aluminium_compat_ic2"
|
||||||
},
|
}
|
||||||
"trigger": "minecraft:recipe_unlocked"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"requirements": [
|
"requirements": [
|
||||||
|
@ -25,10 +30,5 @@
|
||||||
"has_item",
|
"has_item",
|
||||||
"has_the_recipe"
|
"has_the_recipe"
|
||||||
]
|
]
|
||||||
],
|
]
|
||||||
"rewards": {
|
|
||||||
"recipes": [
|
|
||||||
"create:smelting/ingot_aluminum_compat_ic2"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,15 +1,15 @@
|
||||||
{
|
{
|
||||||
"type": "minecraft:blasting",
|
"type": "minecraft:blasting",
|
||||||
"conditions": [
|
|
||||||
{
|
|
||||||
"type": "forge:mod_loaded",
|
|
||||||
"modid": "ic2"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"cookingtime": 100,
|
|
||||||
"experience": 0.1,
|
|
||||||
"ingredient": {
|
"ingredient": {
|
||||||
"item": "create:crushed_raw_aluminum"
|
"item": "create:crushed_raw_aluminum"
|
||||||
},
|
},
|
||||||
"result": "ic2:ingot_aluminum"
|
"result": "ic2:ingot_aluminium",
|
||||||
|
"experience": 0.1,
|
||||||
|
"cookingtime": 100,
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"modid": "ic2",
|
||||||
|
"type": "forge:mod_loaded"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
|
@ -1,15 +1,15 @@
|
||||||
{
|
{
|
||||||
"type": "minecraft:smelting",
|
"type": "minecraft:smelting",
|
||||||
"conditions": [
|
|
||||||
{
|
|
||||||
"type": "forge:mod_loaded",
|
|
||||||
"modid": "ic2"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"cookingtime": 200,
|
|
||||||
"experience": 0.1,
|
|
||||||
"ingredient": {
|
"ingredient": {
|
||||||
"item": "create:crushed_raw_aluminum"
|
"item": "create:crushed_raw_aluminum"
|
||||||
},
|
},
|
||||||
"result": "ic2:ingot_aluminum"
|
"result": "ic2:ingot_aluminium",
|
||||||
|
"experience": 0.1,
|
||||||
|
"cookingtime": 200,
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"modid": "ic2",
|
||||||
|
"type": "forge:mod_loaded"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
|
@ -1,11 +1,5 @@
|
||||||
{
|
{
|
||||||
"type": "create:splashing",
|
"type": "create:splashing",
|
||||||
"conditions": [
|
|
||||||
{
|
|
||||||
"type": "forge:mod_loaded",
|
|
||||||
"modid": "ic2"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"ingredients": [
|
"ingredients": [
|
||||||
{
|
{
|
||||||
"item": "create:crushed_raw_aluminum"
|
"item": "create:crushed_raw_aluminum"
|
||||||
|
@ -13,8 +7,14 @@
|
||||||
],
|
],
|
||||||
"results": [
|
"results": [
|
||||||
{
|
{
|
||||||
"count": 9,
|
"item": "ic2:nugget_aluminium",
|
||||||
"item": "ic2:nugget_aluminum"
|
"count": 9
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"modid": "ic2",
|
||||||
|
"type": "forge:mod_loaded"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -60,7 +60,7 @@ public class Create {
|
||||||
|
|
||||||
public static final String ID = "create";
|
public static final String ID = "create";
|
||||||
public static final String NAME = "Create";
|
public static final String NAME = "Create";
|
||||||
public static final String VERSION = "0.5.1h";
|
public static final String VERSION = "0.5.1i";
|
||||||
|
|
||||||
public static final Logger LOGGER = LogUtils.getLogger();
|
public static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
|
||||||
|
|
|
@ -1395,6 +1395,9 @@ public abstract class Contraption {
|
||||||
|
|
||||||
private void gatherBBsOffThread() {
|
private void gatherBBsOffThread() {
|
||||||
getContraptionWorld();
|
getContraptionWorld();
|
||||||
|
if (simplifiedEntityColliderProvider != null) {
|
||||||
|
simplifiedEntityColliderProvider.cancel(false);
|
||||||
|
}
|
||||||
simplifiedEntityColliderProvider = CompletableFuture.supplyAsync(() -> {
|
simplifiedEntityColliderProvider = CompletableFuture.supplyAsync(() -> {
|
||||||
VoxelShape combinedShape = Shapes.empty();
|
VoxelShape combinedShape = Shapes.empty();
|
||||||
for (Entry<BlockPos, StructureBlockInfo> entry : blocks.entrySet()) {
|
for (Entry<BlockPos, StructureBlockInfo> entry : blocks.entrySet()) {
|
||||||
|
@ -1411,7 +1414,6 @@ public abstract class Contraption {
|
||||||
})
|
})
|
||||||
.thenAccept(r -> {
|
.thenAccept(r -> {
|
||||||
simplifiedEntityColliders = Optional.of(r);
|
simplifiedEntityColliders = Optional.of(r);
|
||||||
simplifiedEntityColliderProvider = null;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlockEntityTypes;
|
import com.simibubi.create.AllBlockEntityTypes;
|
||||||
import com.simibubi.create.AllTags.AllBlockTags;
|
import com.simibubi.create.AllTags.AllBlockTags;
|
||||||
|
import com.simibubi.create.content.equipment.toolbox.ToolboxInventory;
|
||||||
import com.simibubi.create.content.kinetics.crafter.MechanicalCrafterBlockEntity;
|
import com.simibubi.create.content.kinetics.crafter.MechanicalCrafterBlockEntity;
|
||||||
import com.simibubi.create.content.logistics.crate.BottomlessItemHandler;
|
import com.simibubi.create.content.logistics.crate.BottomlessItemHandler;
|
||||||
import com.simibubi.create.content.logistics.vault.ItemVaultBlockEntity;
|
import com.simibubi.create.content.logistics.vault.ItemVaultBlockEntity;
|
||||||
|
@ -177,6 +178,8 @@ public class MountedStorage {
|
||||||
CompoundTag tag = handler.serializeNBT();
|
CompoundTag tag = handler.serializeNBT();
|
||||||
if (noFuel)
|
if (noFuel)
|
||||||
NBTHelper.putMarker(tag, "NoFuel");
|
NBTHelper.putMarker(tag, "NoFuel");
|
||||||
|
if (handler instanceof ToolboxInventory)
|
||||||
|
NBTHelper.putMarker(tag, "Toolbox");
|
||||||
if (!(handler instanceof BottomlessItemHandler))
|
if (!(handler instanceof BottomlessItemHandler))
|
||||||
return tag;
|
return tag;
|
||||||
|
|
||||||
|
@ -191,6 +194,9 @@ public class MountedStorage {
|
||||||
storage.handler = new ItemStackHandler();
|
storage.handler = new ItemStackHandler();
|
||||||
if (nbt == null)
|
if (nbt == null)
|
||||||
return storage;
|
return storage;
|
||||||
|
if (nbt.contains("Toolbox"))
|
||||||
|
storage.handler = new ToolboxInventory(null);
|
||||||
|
|
||||||
storage.valid = true;
|
storage.valid = true;
|
||||||
storage.noFuel = nbt.contains("NoFuel");
|
storage.noFuel = nbt.contains("NoFuel");
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,8 @@ public class ClipboardBlockEntity extends SmartBlockEntity {
|
||||||
protected void read(CompoundTag tag, boolean clientPacket) {
|
protected void read(CompoundTag tag, boolean clientPacket) {
|
||||||
super.read(tag, clientPacket);
|
super.read(tag, clientPacket);
|
||||||
dataContainer = ItemStack.of(tag.getCompound("Item"));
|
dataContainer = ItemStack.of(tag.getCompound("Item"));
|
||||||
|
if (!AllBlocks.CLIPBOARD.isIn(dataContainer))
|
||||||
|
dataContainer = AllBlocks.CLIPBOARD.asStack();
|
||||||
|
|
||||||
if (clientPacket)
|
if (clientPacket)
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> readClientSide(tag));
|
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> readClientSide(tag));
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class ToolboxInventory extends ItemStackHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settling = false;
|
settling = false;
|
||||||
blockEntity.sendData();
|
notifyUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -109,7 +109,7 @@ public class ToolboxInventory extends ItemStackHandler {
|
||||||
if (!stack.isEmpty() && filters.get(compartment)
|
if (!stack.isEmpty() && filters.get(compartment)
|
||||||
.isEmpty()) {
|
.isEmpty()) {
|
||||||
filters.set(compartment, ItemHandlerHelper.copyStackWithSize(stack, 1));
|
filters.set(compartment, ItemHandlerHelper.copyStackWithSize(stack, 1));
|
||||||
blockEntity.sendData();
|
notifyUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ public class ToolboxInventory extends ItemStackHandler {
|
||||||
if (!stack.isEmpty() && filters.get(compartment)
|
if (!stack.isEmpty() && filters.get(compartment)
|
||||||
.isEmpty()) {
|
.isEmpty()) {
|
||||||
filters.set(compartment, ItemHandlerHelper.copyStackWithSize(stack, 1));
|
filters.set(compartment, ItemHandlerHelper.copyStackWithSize(stack, 1));
|
||||||
blockEntity.sendData();
|
notifyUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return insertItem;
|
return insertItem;
|
||||||
|
@ -136,10 +136,9 @@ public class ToolboxInventory extends ItemStackHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onContentsChanged(int slot) {
|
protected void onContentsChanged(int slot) {
|
||||||
if (!settling && !blockEntity.getLevel().isClientSide)
|
if (!settling && (blockEntity == null || !blockEntity.getLevel().isClientSide))
|
||||||
settle(slot / STACKS_PER_COMPARTMENT);
|
settle(slot / STACKS_PER_COMPARTMENT);
|
||||||
blockEntity.sendData();
|
notifyUpdate();
|
||||||
blockEntity.setChanged();
|
|
||||||
super.onContentsChanged(slot);
|
super.onContentsChanged(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,4 +207,9 @@ public class ToolboxInventory extends ItemStackHandler {
|
||||||
return ItemHandlerHelper.canItemStacksStack(stack1, stack2);
|
return ItemHandlerHelper.canItemStacksStack(stack1, stack2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void notifyUpdate() {
|
||||||
|
if (blockEntity != null)
|
||||||
|
blockEntity.notifyUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.simibubi.create.content.fluids.drain;
|
||||||
|
|
||||||
import com.simibubi.create.content.fluids.transfer.GenericItemEmptying;
|
import com.simibubi.create.content.fluids.transfer.GenericItemEmptying;
|
||||||
import com.simibubi.create.content.kinetics.belt.transport.TransportedItemStack;
|
import com.simibubi.create.content.kinetics.belt.transport.TransportedItemStack;
|
||||||
|
import com.simibubi.create.foundation.item.ItemHelper;
|
||||||
|
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
@ -38,7 +39,8 @@ public class ItemDrainItemHandler implements IItemHandler {
|
||||||
if (stack.getCount() > 1 && GenericItemEmptying.canItemBeEmptied(blockEntity.getLevel(), stack)) {
|
if (stack.getCount() > 1 && GenericItemEmptying.canItemBeEmptied(blockEntity.getLevel(), stack)) {
|
||||||
returned = ItemHandlerHelper.copyStackWithSize(stack, stack.getCount() - 1);
|
returned = ItemHandlerHelper.copyStackWithSize(stack, stack.getCount() - 1);
|
||||||
stack = ItemHandlerHelper.copyStackWithSize(stack, 1);
|
stack = ItemHandlerHelper.copyStackWithSize(stack, 1);
|
||||||
}
|
} else
|
||||||
|
returned = ItemHelper.limitCountToMaxStackSize(stack, simulate);
|
||||||
|
|
||||||
if (!simulate) {
|
if (!simulate) {
|
||||||
TransportedItemStack heldItem = new TransportedItemStack(stack);
|
TransportedItemStack heldItem = new TransportedItemStack(stack);
|
||||||
|
|
|
@ -218,6 +218,8 @@ public class BeltBlock extends HorizontalKineticBlock
|
||||||
.copy(), false);
|
.copy(), false);
|
||||||
if (remainder.isEmpty())
|
if (remainder.isEmpty())
|
||||||
itemEntity.discard();
|
itemEntity.discard();
|
||||||
|
else if (remainder.getCount() != itemEntity.getItem().getCount())
|
||||||
|
itemEntity.setItem(remainder);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,7 +233,7 @@ public class BeltRenderer extends SafeBlockEntityRenderer<BeltBlockEntity> {
|
||||||
be.getBlockPos().getZ())
|
be.getBlockPos().getZ())
|
||||||
.add(offsetVec);
|
.add(offsetVec);
|
||||||
|
|
||||||
if (this.shouldCullItem(itemPos)) {
|
if (this.shouldCullItem(itemPos, be.getLevel())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.simibubi.create.content.kinetics.belt.transport;
|
package com.simibubi.create.content.kinetics.belt.transport;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.item.ItemHelper;
|
||||||
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
|
@ -29,6 +31,7 @@ public class ItemHandlerBeltSegment implements IItemHandler {
|
||||||
@Override
|
@Override
|
||||||
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
|
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
|
||||||
if (this.beltInventory.canInsertAt(offset)) {
|
if (this.beltInventory.canInsertAt(offset)) {
|
||||||
|
ItemStack remainder = ItemHelper.limitCountToMaxStackSize(stack, simulate);
|
||||||
if (!simulate) {
|
if (!simulate) {
|
||||||
TransportedItemStack newStack = new TransportedItemStack(stack);
|
TransportedItemStack newStack = new TransportedItemStack(stack);
|
||||||
newStack.insertedAt = offset;
|
newStack.insertedAt = offset;
|
||||||
|
@ -38,7 +41,7 @@ public class ItemHandlerBeltSegment implements IItemHandler {
|
||||||
this.beltInventory.belt.setChanged();
|
this.beltInventory.belt.setChanged();
|
||||||
this.beltInventory.belt.sendData();
|
this.beltInventory.belt.sendData();
|
||||||
}
|
}
|
||||||
return ItemStack.EMPTY;
|
return remainder;
|
||||||
}
|
}
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.simibubi.create.content.kinetics.deployer;
|
package com.simibubi.create.content.kinetics.deployer;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.blockEntity.behaviour.filtering.FilteringBehaviour;
|
import com.simibubi.create.foundation.blockEntity.behaviour.filtering.FilteringBehaviour;
|
||||||
|
import com.simibubi.create.foundation.item.ItemHelper;
|
||||||
|
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
@ -52,9 +53,10 @@ public class DeployerItemHandler implements IItemHandlerModifiable {
|
||||||
|
|
||||||
ItemStack held = getHeld();
|
ItemStack held = getHeld();
|
||||||
if (held.isEmpty()) {
|
if (held.isEmpty()) {
|
||||||
|
ItemStack remainder = ItemHelper.limitCountToMaxStackSize(stack, simulate);
|
||||||
if (!simulate)
|
if (!simulate)
|
||||||
set(stack);
|
set(stack);
|
||||||
return ItemStack.EMPTY;
|
return remainder;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ItemHandlerHelper.canItemStacksStack(held, stack))
|
if (!ItemHandlerHelper.canItemStacksStack(held, stack))
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.simibubi.create.content.logistics.chute;
|
package com.simibubi.create.content.logistics.chute;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.item.ItemHelper;
|
||||||
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
|
@ -25,9 +27,10 @@ public class ChuteItemHandler implements IItemHandler {
|
||||||
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
|
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
|
||||||
if (!blockEntity.canAcceptItem(stack))
|
if (!blockEntity.canAcceptItem(stack))
|
||||||
return stack;
|
return stack;
|
||||||
|
ItemStack remainder = ItemHelper.limitCountToMaxStackSize(stack, simulate);
|
||||||
if (!simulate)
|
if (!simulate)
|
||||||
blockEntity.setItem(stack);
|
blockEntity.setItem(stack);
|
||||||
return ItemStack.EMPTY;
|
return remainder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -93,7 +93,7 @@ public abstract class FunnelBlock extends AbstractDirectionalFunnelBlock {
|
||||||
withBlockEntityDo(worldIn, pos, be -> {
|
withBlockEntityDo(worldIn, pos, be -> {
|
||||||
ItemStack toInsert = heldItem.copy();
|
ItemStack toInsert = heldItem.copy();
|
||||||
ItemStack remainder = tryInsert(worldIn, pos, toInsert, false);
|
ItemStack remainder = tryInsert(worldIn, pos, toInsert, false);
|
||||||
if (!ItemStack.matches(remainder, toInsert))
|
if (!ItemStack.matches(remainder, toInsert) || remainder.getCount() != heldItem.getCount())
|
||||||
player.setItemInHand(handIn, remainder);
|
player.setItemInHand(handIn, remainder);
|
||||||
});
|
});
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.simibubi.create.content.logistics.tunnel;
|
package com.simibubi.create.content.logistics.tunnel;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.item.ItemHelper;
|
||||||
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.common.util.LazyOptional;
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
@ -33,9 +35,11 @@ public class BrassTunnelItemHandler implements IItemHandler {
|
||||||
|
|
||||||
if (!blockEntity.canTakeItems())
|
if (!blockEntity.canTakeItems())
|
||||||
return stack;
|
return stack;
|
||||||
|
|
||||||
|
ItemStack remainder = ItemHelper.limitCountToMaxStackSize(stack, simulate);
|
||||||
if (!simulate)
|
if (!simulate)
|
||||||
blockEntity.setStackToDistribute(stack, null);
|
blockEntity.setStackToDistribute(stack, null);
|
||||||
return ItemStack.EMPTY;
|
return remainder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -412,7 +412,8 @@ public class BasinBlockEntity extends SmartBlockEntity implements IHaveGoggleInf
|
||||||
if (filter != null && !filter.test(itemStack))
|
if (filter != null && !filter.test(itemStack))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
visualizedOutputItems.add(IntAttached.withZero(itemStack));
|
if (visualizedOutputItems.size() < 3)
|
||||||
|
visualizedOutputItems.add(IntAttached.withZero(itemStack));
|
||||||
update = true;
|
update = true;
|
||||||
|
|
||||||
remainder = ItemHandlerHelper.insertItemStacked(targetInv, itemStack.copy(), false);
|
remainder = ItemHandlerHelper.insertItemStacked(targetInv, itemStack.copy(), false);
|
||||||
|
@ -446,7 +447,8 @@ public class BasinBlockEntity extends SmartBlockEntity implements IHaveGoggleInf
|
||||||
|
|
||||||
update = true;
|
update = true;
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
visualizedOutputFluids.add(IntAttached.withZero(fluidStack));
|
if (visualizedOutputFluids.size() < 3)
|
||||||
|
visualizedOutputFluids.add(IntAttached.withZero(fluidStack));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,13 @@ package com.simibubi.create.foundation.blockEntity.renderer;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.ponder.PonderWorld;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.MultiBufferSource;
|
import net.minecraft.client.renderer.MultiBufferSource;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||||
import net.minecraft.client.renderer.culling.Frustum;
|
import net.minecraft.client.renderer.culling.Frustum;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
|
@ -28,7 +31,10 @@ public abstract class SafeBlockEntityRenderer<T extends BlockEntity> implements
|
||||||
.getBlock() == Blocks.AIR;
|
.getBlock() == Blocks.AIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldCullItem(Vec3 itemPos) {
|
public boolean shouldCullItem(Vec3 itemPos, Level level) {
|
||||||
|
if (level instanceof PonderWorld)
|
||||||
|
return false;
|
||||||
|
|
||||||
Frustum frustum = Minecraft.getInstance().levelRenderer.capturedFrustum != null ?
|
Frustum frustum = Minecraft.getInstance().levelRenderer.capturedFrustum != null ?
|
||||||
Minecraft.getInstance().levelRenderer.capturedFrustum :
|
Minecraft.getInstance().levelRenderer.capturedFrustum :
|
||||||
Minecraft.getInstance().levelRenderer.cullingFrustum;
|
Minecraft.getInstance().levelRenderer.cullingFrustum;
|
||||||
|
|
|
@ -32,6 +32,12 @@ public enum CompatMetals {
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName(Mods mod) {
|
||||||
|
if (this == ALUMINUM && mod == IC2) // include in mods.builder if this happens again
|
||||||
|
return "aluminium";
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These mods must provide an ingot and nugget variant of the corresponding metal.
|
* These mods must provide an ingot and nugget variant of the corresponding metal.
|
||||||
|
|
|
@ -1223,8 +1223,8 @@ public class StandardRecipeGen extends CreateRecipeProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
GeneratedRecipe blastModdedCrushedMetal(ItemEntry<? extends Item> ingredient, CompatMetals metal) {
|
GeneratedRecipe blastModdedCrushedMetal(ItemEntry<? extends Item> ingredient, CompatMetals metal) {
|
||||||
String metalName = metal.getName();
|
|
||||||
for (Mods mod : metal.getMods()) {
|
for (Mods mod : metal.getMods()) {
|
||||||
|
String metalName = metal.getName(mod);
|
||||||
ResourceLocation ingot = mod.ingotOf(metalName);
|
ResourceLocation ingot = mod.ingotOf(metalName);
|
||||||
String modId = mod.getId();
|
String modId = mod.getId();
|
||||||
create(ingot).withSuffix("_compat_" + modId)
|
create(ingot).withSuffix("_compat_" + modId)
|
||||||
|
|
|
@ -133,8 +133,8 @@ public class WashingRecipeGen extends ProcessingRecipeGen {
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeneratedRecipe moddedCrushedOre(ItemEntry<? extends Item> crushed, CompatMetals metal) {
|
public GeneratedRecipe moddedCrushedOre(ItemEntry<? extends Item> crushed, CompatMetals metal) {
|
||||||
String metalName = metal.getName();
|
|
||||||
for (Mods mod : metal.getMods()) {
|
for (Mods mod : metal.getMods()) {
|
||||||
|
String metalName = metal.getName(mod);
|
||||||
ResourceLocation nugget = mod.nuggetOf(metalName);
|
ResourceLocation nugget = mod.nuggetOf(metalName);
|
||||||
create(mod.getId() + "/" + crushed.getId()
|
create(mod.getId() + "/" + crushed.getId()
|
||||||
.getPath(),
|
.getPath(),
|
||||||
|
|
|
@ -276,4 +276,16 @@ public class ItemHelper {
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ItemStack limitCountToMaxStackSize(ItemStack stack, boolean simulate) {
|
||||||
|
int count = stack.getCount();
|
||||||
|
int max = stack.getMaxStackSize();
|
||||||
|
if (count <= max)
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
ItemStack remainder = ItemHandlerHelper.copyStackWithSize(stack, count - max);
|
||||||
|
if (!simulate)
|
||||||
|
stack.setCount(max);
|
||||||
|
return remainder;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.world.item.BlockItem;
|
||||||
|
|
||||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||||
|
|
||||||
import net.minecraft.world.level.block.Blocks;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
@ -22,7 +21,7 @@ public class BlockItemMixin {
|
||||||
@Inject(method = "place", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "place", at = @At("HEAD"), cancellable = true)
|
||||||
private void create$fixDeployerPlacement(BlockPlaceContext pContext, CallbackInfoReturnable<InteractionResult> cir) {
|
private void create$fixDeployerPlacement(BlockPlaceContext pContext, CallbackInfoReturnable<InteractionResult> cir) {
|
||||||
BlockState state = pContext.getLevel().getBlockState(((UseOnContextAccessor) pContext).create$getHitResult().getBlockPos());
|
BlockState state = pContext.getLevel().getBlockState(((UseOnContextAccessor) pContext).create$getHitResult().getBlockPos());
|
||||||
if (state != Blocks.AIR.defaultBlockState() && pContext.getPlayer() instanceof DeployerFakePlayer) {
|
if (!state.getMaterial().isReplaceable() && pContext.getPlayer() instanceof DeployerFakePlayer) {
|
||||||
cir.setReturnValue(InteractionResult.PASS);
|
cir.setReturnValue(InteractionResult.PASS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ public final class NBTProcessors {
|
||||||
addProcessor(AllBlockEntityTypes.CREATIVE_CRATE.get(), itemProcessor("Filter"));
|
addProcessor(AllBlockEntityTypes.CREATIVE_CRATE.get(), itemProcessor("Filter"));
|
||||||
addProcessor(AllBlockEntityTypes.PLACARD.get(), itemProcessor("Item"));
|
addProcessor(AllBlockEntityTypes.PLACARD.get(), itemProcessor("Item"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Triggered by block tag, not BE type
|
// Triggered by block tag, not BE type
|
||||||
private static final UnaryOperator<CompoundTag> signProcessor = data -> {
|
private static final UnaryOperator<CompoundTag> signProcessor = data -> {
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
|
@ -86,14 +86,22 @@ public final class NBTProcessors {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack withUnsafeNBTDiscarded(ItemStack stack) {
|
public static ItemStack withUnsafeNBTDiscarded(ItemStack stack) {
|
||||||
if (stack.getTag() == null)
|
CompoundTag tag = stack.getTag();
|
||||||
|
if (tag == null)
|
||||||
return stack;
|
return stack;
|
||||||
ItemStack copy = stack.copy();
|
ItemStack copy = stack.copy();
|
||||||
stack.getTag()
|
copy.setTag(withUnsafeNBTDiscarded(tag));
|
||||||
.getAllKeys()
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CompoundTag withUnsafeNBTDiscarded(CompoundTag tag) {
|
||||||
|
if (tag == null)
|
||||||
|
return null;
|
||||||
|
CompoundTag copy = tag.copy();
|
||||||
|
tag.getAllKeys()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(NBTProcessors::isUnsafeItemNBTKey)
|
.filter(NBTProcessors::isUnsafeItemNBTKey)
|
||||||
.forEach(copy::removeTagKey);
|
.forEach(copy::remove);
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +144,7 @@ public final class NBTProcessors {
|
||||||
return signProcessor.apply(compound);
|
return signProcessor.apply(compound);
|
||||||
if (blockEntity.onlyOpCanSetNbt())
|
if (blockEntity.onlyOpCanSetNbt())
|
||||||
return null;
|
return null;
|
||||||
return compound;
|
return withUnsafeNBTDiscarded(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue