* Add javadocs to many methods * Added built-in ways to generate BundledModules and documented them * Add Eclipse launch files to .gitignore and fix 11 warnings * Remove many unused imports * Remove some dead and unused code around app loading * Allow extensions to have client-side rules in their SettingsManager Also change tabs to spaces when those changed * Remove unnecessary classloader param in BundledModule * Change max tickwarp duration to Integer.MAX_VALUE * Move RulePrinter into the source so it can be managed by the IDE * Properly reset hopperCounters when changing worlds Also change tabs to spaces again and minor tweaks to javadocs * Run mergedocs even if Full.md was modified * Update src/main/java/carpet/commands/TickCommand.java Co-authored-by: gnembon <41132274+gnembon@users.noreply.github.com>
48 lines
1.5 KiB
Java
48 lines
1.5 KiB
Java
package carpet.mixins;
|
|
|
|
import carpet.fakes.SpawnHelperInnerInterface;
|
|
import carpet.utils.SpawnReporter;
|
|
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
|
import net.minecraft.entity.SpawnGroup;
|
|
import net.minecraft.util.math.GravityField;
|
|
import net.minecraft.world.SpawnHelper;
|
|
import org.spongepowered.asm.mixin.Final;
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.Shadow;
|
|
import org.spongepowered.asm.mixin.injection.At;
|
|
import org.spongepowered.asm.mixin.injection.Inject;
|
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
|
|
@Mixin(SpawnHelper.Info.class)
|
|
public class SpawnHelperInnerMixin implements SpawnHelperInnerInterface
|
|
{
|
|
@Shadow @Final private int spawningChunkCount;
|
|
|
|
@Shadow @Final private GravityField densityField;
|
|
|
|
@Shadow @Final private Object2IntOpenHashMap<SpawnGroup> groupToCount;
|
|
|
|
@Inject(method = "isBelowCap", at = @At("HEAD"), cancellable = true)
|
|
private void changeMobCaps(SpawnGroup entityCategory, CallbackInfoReturnable<Boolean> cir)
|
|
{
|
|
int newCap = (int) ((double)entityCategory.getCapacity()*(Math.pow(2.0,(SpawnReporter.mobcap_exponent/4))));
|
|
int i = newCap * spawningChunkCount / SpawnReporter.MAGIC_NUMBER;
|
|
cir.setReturnValue(groupToCount.getInt(entityCategory) < i);
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
public GravityField getPotentialCalculator()
|
|
{
|
|
return densityField;
|
|
}
|
|
|
|
@Override
|
|
public int cmGetChunkCount() {
|
|
return spawningChunkCount;
|
|
}
|
|
|
|
|
|
}
|