1.12: Creative tab opt-out handling added (issue #90). 1.14/1.15: Dev snapshot.

This commit is contained in:
stfwi 2020-02-24 20:49:44 +01:00
parent 22b8d53f6e
commit adc0df9d47
14 changed files with 95 additions and 33 deletions

View file

@ -227,9 +227,11 @@ public class BlockDecorHopper extends StandardBlocks.Directed implements IDecorB
CompoundNBT nbt = new CompoundNBT();
block_power_signal_ = false;
writenbt(nbt, false);
for(int i=0; i<stacks_.size(); ++i) stacks_.set(i, ItemStack.EMPTY);
boolean is_empty = true;
for(int i=0; i<stacks_.size(); ++i) { is_empty &= stacks_.get(i).isEmpty(); stacks_.set(i, ItemStack.EMPTY); }
reset_rtstate();
block_power_updated_ = false;
if(is_empty) nbt = new CompoundNBT();
return nbt;
}
@ -398,7 +400,7 @@ public class BlockDecorHopper extends StandardBlocks.Directed implements IDecorB
// ISidedInventory --------------------------------------------------------------------------------------
LazyOptional<? extends IItemHandler>[] item_handlers = SidedInvWrapper.create(this, Direction.UP, Direction.DOWN);
LazyOptional<? extends IItemHandler>[] item_handlers = SidedInvWrapper.create(this, Direction.UP);
private static final int[] SIDED_INV_SLOTS;
static {
SIDED_INV_SLOTS = new int[NUM_OF_SLOTS];
@ -423,10 +425,7 @@ public class BlockDecorHopper extends StandardBlocks.Directed implements IDecorB
public <T> LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing)
{
if(!this.removed && (facing != null)) {
if(capability==CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
if(facing == Direction.UP) return item_handlers[0].cast();
if(facing == Direction.DOWN) return item_handlers[1].cast();
}
if(capability==CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return item_handlers[0].cast();
}
return super.getCapability(capability, facing);
}

View file

@ -0,0 +1,22 @@
{
"conditions": [
{
"type": "engineersdecor:optional",
"result": "patchouli:guide_book",
"required": ["minecraft:iron_nugget", "minecraft:book"]
}
],
"type": "minecraft:crafting_shaped",
"pattern": [
"BN",
"N "
],
"key": {
"B": { "item": "minecraft:book" },
"N": { "item": "minecraft:iron_nugget" }
},
"result": {
"item": "patchouli:guide_book",
"nbt": { "patchouli:book": "engineersdecor:engineersdecor_manual" }
}
}