Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis;
import net.minecraft.core.HolderLookup.Provider;
import net.minecraft.core.NonNullList;
import net.minecraft.core.particles.ItemParticleOption;
Expand Down Expand Up @@ -310,8 +309,8 @@ private ItemStack digBlock(BlockPos relativePos, IMultiblockLevel level)
rawLevel.addFreshEntity(ei);
}
rawLevel.levelEvent(LevelEvent.PARTICLES_DESTROY_BLOCK, absolutePos, Block.getId(blockstate));
if(items.size() > 0)
return items.get(0);
if(!items.isEmpty())
return items.getFirst();
}
}
return ItemStack.EMPTY;
Expand All @@ -323,14 +322,13 @@ private boolean fillBucket(
int targetDown, IMultiblockLevel level
)
{
if(mineralVein.isDepleted())
return false;
boolean guaranteedSpoil = mineralVein.isDepleted();
ItemStack ore = mineralMix.getRandomOre(ApiUtils.RANDOM);
if(ore.isEmpty())
return false;
guaranteedSpoil = true;
// if random number of 0-1 is smaller than the fail chance of the specific mineral
// or if random number of 0-1 is smaller than the distance based fail chance of the vein
if(ApiUtils.RANDOM.nextFloat() < mineralMix.failChance||ApiUtils.RANDOM.nextFloat() < mineralVein.getFailChance(wheelPos))
if(guaranteedSpoil||ApiUtils.RANDOM.nextFloat() < mineralMix.failChance||ApiUtils.RANDOM.nextFloat() < mineralVein.getFailChance(wheelPos))
wheel.digStacks.set(targetDown, mineralMix.getRandomSpoil(ApiUtils.RANDOM));
else
wheel.digStacks.set(targetDown, ore);
Expand Down