mapping updates
This commit is contained in:
1 parent
cdb79f9768
commit
b16991d84b
8 files changed
+64
-59
No files matched your search
@@ -3,8 +3,8 @@ package carpet.mixins;
|
||||
import carpet.fakes.SpawnHelperInnerInterface;
|
||||
import carpet.utils.SpawnReporter;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import net.minecraft.class_5263;
|
||||
import net.minecraft.entity.EntityCategory;
|
||||
import net.minecraft.util.math.GravityField;
|
||||
import net.minecraft.world.SpawnHelper;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -15,27 +15,34 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
// temporary mixin until naming for spawnhelper gets fixed.
|
||||
|
||||
@Mixin(SpawnHelper.class_5262.class)
|
||||
@Mixin(SpawnHelper.Info.class)
|
||||
public class SpawnHelperInnerMixin implements SpawnHelperInnerInterface
|
||||
{
|
||||
@Shadow @Final private int field_24394;
|
||||
//@Shadow @Final private int field_24394;
|
||||
|
||||
@Shadow @Final private Object2IntMap<EntityCategory> field_24395;
|
||||
//@Shadow @Final private Object2IntMap<EntityCategory> field_24395;
|
||||
|
||||
@Shadow @Final private class_5263 field_24396;
|
||||
//@Shadow @Final private class_5263 field_24396;
|
||||
|
||||
@Inject(method = "method_27826", at = @At("HEAD"), cancellable = true)
|
||||
@Shadow @Final private int spawningChunkCount;
|
||||
|
||||
@Shadow @Final private Object2IntMap<EntityCategory> categoryToCount;
|
||||
|
||||
@Shadow @Final private GravityField densityField;
|
||||
|
||||
|
||||
@Inject(method = "isBelowCap", at = @At("HEAD"), cancellable = true)
|
||||
private void changeMobCaps(EntityCategory entityCategory, CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
int newCap = (int) ((double)entityCategory.getSpawnCap()*(Math.pow(2.0,(SpawnReporter.mobcap_exponent/4))));
|
||||
int i = newCap * field_24394 / (int)Math.pow(17.0D, 2.0D);
|
||||
cir.setReturnValue(field_24395.getInt(entityCategory) < i);
|
||||
int i = newCap * spawningChunkCount / (int)Math.pow(17.0D, 2.0D);
|
||||
cir.setReturnValue(categoryToCount.getInt(entityCategory) < i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public class_5263 getPotentialCalculator()
|
||||
public GravityField getPotentialCalculator()
|
||||
{
|
||||
return field_24396;
|
||||
return densityField;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user