use of com.simibubi.create.content.contraptions.processing.BasinTileEntity in project Create by Creators-of-Create.
the class BlazeBurnerBlock method onPlace.
@Override
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState p_220082_4_, boolean p_220082_5_) {
if (world.isClientSide)
return;
BlockEntity tileEntity = world.getBlockEntity(pos.above());
if (!(tileEntity instanceof BasinTileEntity))
return;
BasinTileEntity basin = (BasinTileEntity) tileEntity;
basin.notifyChangeOfContents();
}
use of com.simibubi.create.content.contraptions.processing.BasinTileEntity in project Create by Creators-of-Create.
the class MechanicalMixerTileEntity method getMatchingRecipes.
@Override
protected List<Recipe<?>> getMatchingRecipes() {
List<Recipe<?>> matchingRecipes = super.getMatchingRecipes();
Optional<BasinTileEntity> basin = getBasin();
if (!basin.isPresent())
return matchingRecipes;
IItemHandler availableItems = basin.get().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).orElse(null);
if (availableItems == null)
return matchingRecipes;
for (int i = 0; i < availableItems.getSlots(); i++) {
ItemStack stack = availableItems.getStackInSlot(i);
if (stack.isEmpty())
continue;
List<MixingRecipe> list = PotionMixingRecipes.BY_ITEM.get(stack.getItem());
if (list == null)
continue;
for (MixingRecipe mixingRecipe : list) if (matchBasinRecipe(mixingRecipe))
matchingRecipes.add(mixingRecipe);
}
return matchingRecipes;
}
use of com.simibubi.create.content.contraptions.processing.BasinTileEntity in project Create by Creators-of-Create.
the class MechanicalPressTileEntity method applyCompactingOnBasin.
protected void applyCompactingOnBasin() {
if (level.isClientSide)
return;
pressedItems.clear();
applyBasinRecipe();
Optional<BasinTileEntity> basin = getBasin();
if (basin.isPresent()) {
SmartInventory inputs = basin.get().getInputInventory();
for (int slot = 0; slot < inputs.getSlots(); slot++) {
ItemStack stackInSlot = inputs.getItem(slot);
if (stackInSlot.isEmpty())
continue;
pressedItems.add(stackInSlot);
}
}
sendData();
}
use of com.simibubi.create.content.contraptions.processing.BasinTileEntity in project Create by Creators-of-Create.
the class MechanicalMixerTileEntity method renderParticles.
public void renderParticles() {
Optional<BasinTileEntity> basin = getBasin();
if (!basin.isPresent() || level == null)
return;
for (SmartInventory inv : basin.get().getInvs()) {
for (int slot = 0; slot < inv.getSlots(); slot++) {
ItemStack stackInSlot = inv.getItem(slot);
if (stackInSlot.isEmpty())
continue;
ItemParticleOption data = new ItemParticleOption(ParticleTypes.ITEM, stackInSlot);
spillParticle(data);
}
}
for (SmartFluidTankBehaviour behaviour : basin.get().getTanks()) {
if (behaviour == null)
continue;
for (TankSegment tankSegment : behaviour.getTanks()) {
if (tankSegment.isEmpty(0))
continue;
spillParticle(FluidFX.getFluidParticle(tankSegment.getRenderedFluid()));
}
}
}
use of com.simibubi.create.content.contraptions.processing.BasinTileEntity in project Create by Creators-of-Create.
the class MechanicalPressTileEntity method tick.
@Override
public void tick() {
super.tick();
if (!running || level == null) {
if (hasLevel() && !level.isClientSide) {
if (getSpeed() == 0)
return;
if (entityScanCooldown > 0)
entityScanCooldown--;
if (entityScanCooldown <= 0) {
entityScanCooldown = ENTITY_SCAN;
if (TileEntityBehaviour.get(level, worldPosition.below(2), TransportedItemStackHandlerBehaviour.TYPE) != null)
return;
if (AllBlocks.BASIN.has(level.getBlockState(worldPosition.below(2))))
return;
for (ItemEntity itemEntity : level.getEntitiesOfClass(ItemEntity.class, new AABB(worldPosition.below()).deflate(.125f))) {
if (!itemEntity.isAlive() || !itemEntity.isOnGround())
continue;
ItemStack stack = itemEntity.getItem();
Optional<PressingRecipe> recipe = getRecipe(stack);
if (!recipe.isPresent())
continue;
start(Mode.WORLD);
return;
}
}
}
return;
}
if (level.isClientSide && runningTicks == -CYCLE / 2) {
prevRunningTicks = CYCLE / 2;
return;
}
if (runningTicks == CYCLE / 2 && getSpeed() != 0) {
if (inWorld())
applyPressingInWorld();
if (onBasin())
applyCompactingOnBasin();
if (level.getBlockState(worldPosition.below(2)).getSoundType() == SoundType.WOOL)
AllSoundEvents.MECHANICAL_PRESS_ACTIVATION_ON_BELT.playOnServer(level, worldPosition);
else
AllSoundEvents.MECHANICAL_PRESS_ACTIVATION.playOnServer(level, worldPosition, .5f, .75f + (Math.abs(getSpeed()) / 1024f));
if (!level.isClientSide)
sendData();
}
if (!level.isClientSide && runningTicks > CYCLE) {
finished = true;
running = false;
if (onBasin() && matchBasinRecipe(currentRecipe) && getBasin().filter(BasinTileEntity::canContinueProcessing).isPresent())
startProcessingBasin();
else
basinChecker.scheduleUpdate();
pressedItems.clear();
sendData();
return;
}
prevRunningTicks = runningTicks;
runningTicks += getRunningTickSpeed();
if (prevRunningTicks < CYCLE / 2 && runningTicks >= CYCLE / 2) {
runningTicks = CYCLE / 2;
// Pause the ticks until a packet is received
if (level.isClientSide && !isVirtual())
runningTicks = -(CYCLE / 2);
}
}
Aggregations