mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-18 16:02:19 +01:00
itemvault hunters
This commit is contained in:
parent
71af841046
commit
5ca51bd58c
6 changed files with 65 additions and 14 deletions
|
@ -225,6 +225,7 @@ public class ConnectivityHandler {
|
||||||
part.preventConnectivityUpdate();
|
part.preventConnectivityUpdate();
|
||||||
cache.put(pos, be);
|
cache.put(pos, be);
|
||||||
part.setHeight(height);
|
part.setHeight(height);
|
||||||
|
part.setWidth(width);
|
||||||
part.notifyMultiUpdated();
|
part.notifyMultiUpdated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -333,7 +333,7 @@ public class BlockMovementChecks {
|
||||||
if (state.getBlock() instanceof FluidTankBlock)
|
if (state.getBlock() instanceof FluidTankBlock)
|
||||||
return ConnectivityHandler.isConnected(world, pos, pos.relative(direction)); //FluidTankConnectivityHandler.isConnected(world, pos, pos.relative(direction));
|
return ConnectivityHandler.isConnected(world, pos, pos.relative(direction)); //FluidTankConnectivityHandler.isConnected(world, pos, pos.relative(direction));
|
||||||
if (state.getBlock() instanceof ItemVaultBlock)
|
if (state.getBlock() instanceof ItemVaultBlock)
|
||||||
return ItemVaultConnectivityHandler.isConnected(world, pos, pos.relative(direction));
|
return ConnectivityHandler.isConnected(world, pos, pos.relative(direction)); //ItemVaultConnectivityHandler.isConnected(world, pos, pos.relative(direction));
|
||||||
if (AllBlocks.STICKER.has(state) && state.getValue(StickerBlock.EXTENDED)) {
|
if (AllBlocks.STICKER.has(state) && state.getValue(StickerBlock.EXTENDED)) {
|
||||||
return direction == state.getValue(StickerBlock.FACING)
|
return direction == state.getValue(StickerBlock.FACING)
|
||||||
&& !isNotSupportive(world.getBlockState(pos.relative(direction)), direction.getOpposite());
|
&& !isNotSupportive(world.getBlockState(pos.relative(direction)), direction.getOpposite());
|
||||||
|
|
|
@ -4,6 +4,7 @@ import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.AllTileEntities;
|
import com.simibubi.create.AllTileEntities;
|
||||||
|
import com.simibubi.create.api.connectivity.ConnectivityHandler;
|
||||||
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
||||||
import com.simibubi.create.foundation.block.ITE;
|
import com.simibubi.create.foundation.block.ITE;
|
||||||
import com.simibubi.create.foundation.item.ItemHelper;
|
import com.simibubi.create.foundation.item.ItemHelper;
|
||||||
|
@ -85,7 +86,8 @@ public class ItemVaultBlock extends Block implements IWrenchable, ITE<ItemVaultT
|
||||||
.getBlockEntity(context.getClickedPos());
|
.getBlockEntity(context.getClickedPos());
|
||||||
if (te instanceof ItemVaultTileEntity) {
|
if (te instanceof ItemVaultTileEntity) {
|
||||||
ItemVaultTileEntity vault = (ItemVaultTileEntity) te;
|
ItemVaultTileEntity vault = (ItemVaultTileEntity) te;
|
||||||
ItemVaultConnectivityHandler.splitVault(vault);
|
ConnectivityHandler.splitMulti(vault);
|
||||||
|
//ItemVaultConnectivityHandler.splitVault(vault);
|
||||||
vault.removeController(true);
|
vault.removeController(true);
|
||||||
}
|
}
|
||||||
state = state.setValue(LARGE, false);
|
state = state.setValue(LARGE, false);
|
||||||
|
@ -100,10 +102,11 @@ public class ItemVaultBlock extends Block implements IWrenchable, ITE<ItemVaultT
|
||||||
BlockEntity te = world.getBlockEntity(pos);
|
BlockEntity te = world.getBlockEntity(pos);
|
||||||
if (!(te instanceof ItemVaultTileEntity))
|
if (!(te instanceof ItemVaultTileEntity))
|
||||||
return;
|
return;
|
||||||
ItemVaultTileEntity tankTE = (ItemVaultTileEntity) te;
|
ItemVaultTileEntity vaultTE = (ItemVaultTileEntity) te;
|
||||||
ItemHelper.dropContents(world, pos, tankTE.inventory);
|
ItemHelper.dropContents(world, pos, vaultTE.inventory);
|
||||||
world.removeBlockEntity(pos);
|
world.removeBlockEntity(pos);
|
||||||
ItemVaultConnectivityHandler.splitVault(tankTE);
|
//ItemVaultConnectivityHandler.splitVault(tankTE);
|
||||||
|
ConnectivityHandler.splitMulti(vaultTE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.simibubi.create.content.logistics.block.vault;
|
package com.simibubi.create.content.logistics.block.vault;
|
||||||
|
|
||||||
import com.simibubi.create.AllSpriteShifts;
|
import com.simibubi.create.AllSpriteShifts;
|
||||||
|
import com.simibubi.create.api.connectivity.ConnectivityHandler;
|
||||||
import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry;
|
import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry;
|
||||||
import com.simibubi.create.foundation.block.connected.ConnectedTextureBehaviour;
|
import com.simibubi.create.foundation.block.connected.ConnectedTextureBehaviour;
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ public class ItemVaultCTBehaviour extends ConnectedTextureBehaviour {
|
||||||
@Override
|
@Override
|
||||||
public boolean connectsTo(BlockState state, BlockState other, BlockAndTintGetter reader, BlockPos pos,
|
public boolean connectsTo(BlockState state, BlockState other, BlockAndTintGetter reader, BlockPos pos,
|
||||||
BlockPos otherPos, Direction face) {
|
BlockPos otherPos, Direction face) {
|
||||||
return state == other && ItemVaultConnectivityHandler.isConnected(reader, pos, otherPos);
|
return state == other && ConnectivityHandler.isConnected(reader, pos, otherPos); //ItemVaultConnectivityHandler.isConnected(reader, pos, otherPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.simibubi.create.content.logistics.block.vault;
|
package com.simibubi.create.content.logistics.block.vault;
|
||||||
|
|
||||||
import com.simibubi.create.AllTileEntities;
|
import com.simibubi.create.AllTileEntities;
|
||||||
|
import com.simibubi.create.api.connectivity.ConnectivityHandler;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -64,7 +65,8 @@ public class ItemVaultItem extends BlockItem {
|
||||||
|
|
||||||
if (!ItemVaultBlock.isVault(placedOnState))
|
if (!ItemVaultBlock.isVault(placedOnState))
|
||||||
return;
|
return;
|
||||||
ItemVaultTileEntity tankAt = ItemVaultConnectivityHandler.vaultAt(AllTileEntities.ITEM_VAULT.get(), world, placedOnPos);
|
ItemVaultTileEntity tankAt = ConnectivityHandler.partAt(AllTileEntities.ITEM_VAULT.get(), world, placedOnPos);
|
||||||
|
//ItemVaultConnectivityHandler.vaultAt(AllTileEntities.ITEM_VAULT.get(), world, placedOnPos);
|
||||||
if (tankAt == null)
|
if (tankAt == null)
|
||||||
return;
|
return;
|
||||||
ItemVaultTileEntity controllerTE = tankAt.getControllerTE();
|
ItemVaultTileEntity controllerTE = tankAt.getControllerTE();
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.simibubi.create.content.logistics.block.vault;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.simibubi.create.AllTileEntities;
|
import com.simibubi.create.AllTileEntities;
|
||||||
|
import com.simibubi.create.api.connectivity.ConnectivityHandler;
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.tileEntity.IMultiTileContainer;
|
import com.simibubi.create.foundation.tileEntity.IMultiTileContainer;
|
||||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||||
|
@ -62,7 +63,8 @@ public class ItemVaultTileEntity extends SmartTileEntity implements IMultiTileCo
|
||||||
return;
|
return;
|
||||||
if (!isController())
|
if (!isController())
|
||||||
return;
|
return;
|
||||||
ItemVaultConnectivityHandler.formVaults(this);
|
//ItemVaultConnectivityHandler.formVaults(this);
|
||||||
|
ConnectivityHandler.formMulti(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateComparators() {
|
protected void updateComparators() {
|
||||||
|
@ -248,7 +250,8 @@ public class ItemVaultTileEntity extends SmartTileEntity implements IMultiTileCo
|
||||||
BlockPos vaultPos = alongZ ? worldPosition.offset(xOffset, zOffset, yOffset)
|
BlockPos vaultPos = alongZ ? worldPosition.offset(xOffset, zOffset, yOffset)
|
||||||
: worldPosition.offset(yOffset, xOffset, zOffset);
|
: worldPosition.offset(yOffset, xOffset, zOffset);
|
||||||
ItemVaultTileEntity vaultAt =
|
ItemVaultTileEntity vaultAt =
|
||||||
ItemVaultConnectivityHandler.vaultAt(AllTileEntities.ITEM_VAULT.get(), level, vaultPos);
|
//ItemVaultConnectivityHandler.vaultAt(AllTileEntities.ITEM_VAULT.get(), level, vaultPos);
|
||||||
|
ConnectivityHandler.partAt(AllTileEntities.ITEM_VAULT.get(), level, vaultPos);
|
||||||
invs[yOffset * radius * radius + xOffset * radius + zOffset] =
|
invs[yOffset * radius * radius + xOffset * radius + zOffset] =
|
||||||
vaultAt != null ? vaultAt.inventory : new ItemStackHandler();
|
vaultAt != null ? vaultAt.inventory : new ItemStackHandler();
|
||||||
}
|
}
|
||||||
|
@ -263,4 +266,45 @@ public class ItemVaultTileEntity extends SmartTileEntity implements IMultiTileCo
|
||||||
return radius * 3;
|
return radius * 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void preventConnectivityUpdate() { updateConnectivity = false; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyMultiUpdated () {
|
||||||
|
BlockState state = this.getBlockState();
|
||||||
|
if (ItemVaultBlock.isVault(state)) { // safety
|
||||||
|
level.setBlock(getBlockPos(), state.setValue(ItemVaultBlock.LARGE, radius > 2), 22);
|
||||||
|
}
|
||||||
|
itemCapability.invalidate();
|
||||||
|
setChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Direction.Axis getMainConnectionAxis() { return getMainAxisOf(this); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxLength (Direction.Axis longAxis, int width) {
|
||||||
|
if (longAxis == Direction.Axis.Y) return getMaxWidth();
|
||||||
|
return getMaxLength(width);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxWidth () {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHeight () { return length; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWidth () { return radius; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setHeight (int height) { this.length = height; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setWidth (int width) { this.radius = width; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasItems () { return true; }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue