This commit is contained in:
gnembon committed 2019-05-11 11:20:56 -03:00
1 parent 71c07b63fd
commit 49118ce503
10 files changed
+98 -104

No files matched your search

@@ -1,9 +1,8 @@
package carpet.logging; package carpet.logging;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumDyeColor; import net.minecraft.util.DyeColor;
import net.minecraft.server.MinecraftServer;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Arrays; import java.util.Arrays;
@@ -40,7 +39,7 @@ public class LoggerRegistry
registerLogger("tps", new HUDLogger("tps", null, null)); registerLogger("tps", new HUDLogger("tps", null, null));
registerLogger("packets", new HUDLogger("packets", null, null)); registerLogger("packets", new HUDLogger("packets", null, null));
registerLogger("counter",new HUDLogger("counter","white", Arrays.stream(EnumDyeColor.values()).map(Object::toString).toArray(String[]::new))); registerLogger("counter",new HUDLogger("counter","white", Arrays.stream(DyeColor.values()).map(Object::toString).toArray(String[]::new)));
registerLogger("mobcaps", new HUDLogger("mobcaps", "dynamic",new String[]{"dynamic", "overworld", "nether","end"})); registerLogger("mobcaps", new HUDLogger("mobcaps", "dynamic",new String[]{"dynamic", "overworld", "nether","end"}));
} }
@@ -136,7 +135,7 @@ public class LoggerRegistry
setAccess(logger); setAccess(logger);
} }
public static void playerConnected(EntityPlayer player) public static void playerConnected(PlayerEntity player)
{ {
for(Logger log: loggerRegistry.values() ) for(Logger log: loggerRegistry.values() )
{ {
@@ -144,7 +143,7 @@ public class LoggerRegistry
} }
} }
public static void playerDisconnected(EntityPlayer player) public static void playerDisconnected(PlayerEntity player)
{ {
for(Logger log: loggerRegistry.values() ) for(Logger log: loggerRegistry.values() )
{ {
@@ -3,28 +3,28 @@ package carpet.logging.logHelpers;
import carpet.logging.LoggerRegistry; import carpet.logging.LoggerRegistry;
import carpet.utils.Messenger; import carpet.utils.Messenger;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.damage.DamageSource;
import net.minecraft.init.MobEffects; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.DamageSource; import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.util.text.ITextComponent; import net.minecraft.network.chat.BaseComponent;
import java.util.function.Supplier; import java.util.function.Supplier;
public class DamageReporter public class DamageReporter
{ {
private static ITextComponent[] verifyAndProduceMessage(String option, EntityPlayer player, Entity from, Entity to, Supplier<ITextComponent> messageFuture) private static BaseComponent[] verifyAndProduceMessage(String option, PlayerEntity player, Entity from, Entity to, Supplier<BaseComponent> messageFuture)
{ {
if ("all".equalsIgnoreCase(option) if ("all".equalsIgnoreCase(option)
|| ("players".equalsIgnoreCase(option) && (from instanceof EntityPlayer || to instanceof EntityPlayer)) || ("players".equalsIgnoreCase(option) && (from instanceof PlayerEntity || to instanceof PlayerEntity))
|| ("me".equalsIgnoreCase(option) && ( (from == player) || ( to == player) ) )) || ("me".equalsIgnoreCase(option) && ( (from == player) || ( to == player) ) ))
{ {
return new ITextComponent[]{messageFuture.get()}; return new BaseComponent[]{messageFuture.get()};
} }
return null; return null;
} }
public static boolean register_damage_attacker(Entity target, EntityLivingBase source, float amount) public static boolean register_damage_attacker(Entity target, LivingEntity source, float amount)
{ {
if (!LoggerRegistry.__damage) return true; if (!LoggerRegistry.__damage) return true;
LoggerRegistry.getLogger("damage").log( (option, player)-> LoggerRegistry.getLogger("damage").log( (option, player)->
@@ -37,27 +37,27 @@ public class DamageReporter
return true; return true;
} }
public static void register_damage(EntityLivingBase target, DamageSource source, float amount) public static void register_damage(LivingEntity target, DamageSource source, float amount)
{ {
if (!LoggerRegistry.__damage) return; if (!LoggerRegistry.__damage) return;
if (source.isFireDamage() && (target.isImmuneToFire() || if (source.isFire() && (target.isFireImmune() ||
target.isPotionActive(MobEffects.FIRE_RESISTANCE))) target.hasStatusEffect(StatusEffects.FIRE_RESISTANCE)))
return; return;
LoggerRegistry.getLogger("damage").log( (option, player)-> LoggerRegistry.getLogger("damage").log( (option, player)->
verifyAndProduceMessage(option, player, source.getTrueSource(), target, () -> verifyAndProduceMessage(option, player, source.getSource(), target, () ->
Messenger.c(target.getDisplayName(), Messenger.c(target.getDisplayName(),
"g receiving ", "g receiving ",
String.format("r %.2f", amount), String.format("r %.2f", amount),
String.format("g points of damage from %s", source.getDamageType())) String.format("g points of damage from %s", source.getName()))
) )
); );
} }
public static void register_final_damage(EntityLivingBase target, DamageSource source, float amount) public static void register_final_damage(LivingEntity target, DamageSource source, float amount)
{ {
if (!LoggerRegistry.__damage) return; if (!LoggerRegistry.__damage) return;
LoggerRegistry.getLogger("damage").log( (option, player)-> LoggerRegistry.getLogger("damage").log( (option, player)->
verifyAndProduceMessage(option, player, source.getTrueSource(), target, () -> verifyAndProduceMessage(option, player, source.getSource(), target, () ->
Messenger.c("g - total received ", Messenger.c("g - total received ",
String.format("r %.2f", amount), String.format("r %.2f", amount),
"g points of damage") "g points of damage")
@@ -65,17 +65,17 @@ public class DamageReporter
); );
} }
public static void modify_damage(EntityLivingBase target, DamageSource source, float previous_amount, float final_amount, String component) public static void modify_damage(LivingEntity target, DamageSource source, float previous_amount, float final_amount, String component)
{ {
if (!LoggerRegistry.__damage) if (!LoggerRegistry.__damage)
return; return;
if (previous_amount == final_amount) if (previous_amount == final_amount)
return; return;
if (source.isFireDamage() && (target.isImmuneToFire() || if (source.isFire() && (target.isFireImmune() ||
target.isPotionActive(MobEffects.FIRE_RESISTANCE))) target.hasStatusEffect(StatusEffects.FIRE_RESISTANCE)))
return; return;
LoggerRegistry.getLogger("damage").log( (option, player)-> LoggerRegistry.getLogger("damage").log( (option, player)->
verifyAndProduceMessage(option, player, source.getTrueSource(), target, () -> verifyAndProduceMessage(option, player, source.getSource(), target, () ->
{ {
if (final_amount == 0.0f) if (final_amount == 0.0f)
{ {
@@ -2,25 +2,25 @@ package carpet.logging.logHelpers;
import carpet.logging.LoggerRegistry; import carpet.logging.LoggerRegistry;
import carpet.utils.Messenger; import carpet.utils.Messenger;
import net.minecraft.util.text.ITextComponent; import net.minecraft.network.chat.BaseComponent;
public class KillLogHelper { public class KillLogHelper {
public static void onSweep(String name, int count) public static void onSweep(String name, int count)
{ {
LoggerRegistry.getLogger("kills").log( () -> new ITextComponent[]{ LoggerRegistry.getLogger("kills").log( () -> new BaseComponent[]{
Messenger.c("g "+name+" smacked ","r "+count,"g entities with sweeping")}); Messenger.c("g "+name+" smacked ","r "+count,"g entities with sweeping")});
} }
public static void onNonSweepAttack(String name) public static void onNonSweepAttack(String name)
{ {
LoggerRegistry.getLogger("kills").log( () -> new ITextComponent[]{ LoggerRegistry.getLogger("kills").log( () -> new BaseComponent[]{
Messenger.c("g "+name+" smacked ","r 1","g (no sweeping)")}); Messenger.c("g "+name+" smacked ","r 1","g (no sweeping)")});
} }
public static void onDudHit(String name) public static void onDudHit(String name)
{ {
LoggerRegistry.getLogger("kills").log( () -> new ITextComponent[]{ LoggerRegistry.getLogger("kills").log( () -> new BaseComponent[]{
Messenger.c("g "+name+" dud hot = no one affected")}); Messenger.c("g "+name+" dud hot = no one affected")});
} }
} }
@@ -2,7 +2,7 @@ package carpet.logging.logHelpers;
import carpet.logging.LoggerRegistry; import carpet.logging.LoggerRegistry;
import carpet.utils.Messenger; import carpet.utils.Messenger;
import net.minecraft.util.text.ITextComponent; import net.minecraft.network.chat.BaseComponent;
public class TNTLogHelper public class TNTLogHelper
{ {
@@ -26,11 +26,11 @@ public class TNTLogHelper
switch (option) switch (option)
{ {
case "brief": case "brief":
return new ITextComponent[]{Messenger.c( return new BaseComponent[]{Messenger.c(
"l P ",Messenger.dblt("l",primedX,primedY,primedZ,primedAngle), "l P ",Messenger.dblt("l",primedX,primedY,primedZ,primedAngle),
"r E ",Messenger.dblt("r",x, y, z))}; "r E ",Messenger.dblt("r",x, y, z))};
case "full": case "full":
return new ITextComponent[]{Messenger.c( return new BaseComponent[]{Messenger.c(
"l P ",Messenger.dblf("l",primedX,primedY,primedZ,primedAngle), "l P ",Messenger.dblf("l",primedX,primedY,primedZ,primedAngle),
"r E ",Messenger.dblf("r",x, y, z))}; "r E ",Messenger.dblf("r",x, y, z))};
} }
@@ -4,7 +4,7 @@ import carpet.logging.Logger;
import carpet.logging.LoggerRegistry; import carpet.logging.LoggerRegistry;
import carpet.utils.Messenger; import carpet.utils.Messenger;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.ITextComponent; import net.minecraft.network.chat.BaseComponent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -39,7 +39,7 @@ public class TrajectoryLogHelper
{ {
if (!doLog) return; if (!doLog) return;
logger.log( (option) -> { logger.log( (option) -> {
List<ITextComponent> comp = new ArrayList<>(); List<BaseComponent> comp = new ArrayList<>();
switch (option) switch (option)
{ {
case "brief": case "brief":
@@ -72,7 +72,7 @@ public class TrajectoryLogHelper
} }
break; break;
} }
return comp.toArray(new ITextComponent[0]); return comp.toArray(new BaseComponent[0]);
}); });
doLog = false; doLog = false;
} }
@@ -0,0 +1,12 @@
package carpet.mixins.spawnTracking;
import net.minecraft.util.WeightedPicker;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(WeightedPicker.Entry.class)
public interface WeightedPickerEntryMixin
{
@Accessor("weight")
int getWeight();
}
+7 -5
View File
@@ -1,6 +1,8 @@
package carpet.utils; package carpet.utils;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnType;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor; import net.minecraft.block.MaterialColor;
@@ -199,15 +201,15 @@ public class BlockInfo
private static BaseComponent wander_chances(BlockPos pos, World worldIn) private static BaseComponent wander_chances(BlockPos pos, World worldIn)
{ {
MobEntityWithAi creature = new ZombiePigmanEntity(worldIn); MobEntityWithAi creature = new ZombiePigmanEntity(EntityType.ZOMBIE_PIGMAN, worldIn);
creature.onInitialSpawn(worldIn.getDifficultyForLocation(pos), null, null); creature.initialize(worldIn, worldIn.getLocalDifficulty(pos), SpawnType.NATURAL, null, null);
creature.setLocationAndAngles(pos.getX()+0.5F, pos.getY(), pos.getZ()+0.5F, 0.0F, 0.0F); creature.setPositionAndAngles(pos.getX()+0.5F, pos.getY(), pos.getZ()+0.5F, 0.0F, 0.0F);
WanderAroundGoal wander = new WanderAroundGoal(creature, 0.8D); WanderAroundGoal wander = new WanderAroundGoal(creature, 0.8D);
int success = 0; int success = 0;
for (int i=0; i<1000; i++) for (int i=0; i<1000; i++)
{ {
Vec3d vec = PathfindingUtil.findRandomTarget(creature, 10, 7); Vec3d vec = PathfindingUtil.findTarget(creature, 10, 7);
if (vec == null) if (vec == null)
{ {
continue; continue;
@@ -220,7 +222,7 @@ public class BlockInfo
int i; int i;
for (i=1;i<30*20*60; i++) //*60 used to be 5 hours, limited to 30 mins for (i=1;i<30*20*60; i++) //*60 used to be 5 hours, limited to 30 mins
{ {
if (wander.shouldExecute()) if (wander.canStart())
{ {
break; break;
} }
+38 -59
View File
@@ -6,8 +6,9 @@ import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import net.minecraft.entity.player.PlayerEntity; import carpet.mixins.spawnTracking.WeightedPickerEntryMixin;
import net.minecraft.predicate.entity.EntityPredicates; import net.minecraft.entity.SpawnType;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.util.Pair; import net.minecraft.util.Pair;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.network.chat.BaseComponent; import net.minecraft.network.chat.BaseComponent;
@@ -24,7 +25,6 @@ import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.SpawnHelper; import net.minecraft.world.SpawnHelper;
import net.minecraft.entity.SpawnRestriction; import net.minecraft.entity.SpawnRestriction;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.passive.OcelotEntity; import net.minecraft.entity.passive.OcelotEntity;
@@ -239,16 +239,18 @@ public class SpawnReporter
lst.add(Messenger.c(String.format("r Incorrect creature type: %s",creature_type_code))); lst.add(Messenger.c(String.format("r Incorrect creature type: %s",creature_type_code)));
return lst; return lst;
} }
Class<?> cls = typ.getBaseClass();// getCreatureClass(); Class<?> cls = typ.getDeclaringClass();// getBaseClass();// getCreatureClass();
lst.add( Messenger.s(String.format("Loaded entities for %s class:", get_type_string(typ)))); lst.add( Messenger.s(String.format("Loaded entities for %s class:", get_type_string(typ))));
for (Entity entity : worldIn.loadedEntityList)
{ lst.add(Messenger.s(" <sorry, this list will be populated, once M figures out what counts>"));
if ((!(entity instanceof LivingEntity) || !((LivingEntity)entity).isNoDespawnRequired()) && cls.isAssignableFrom(entity.getClass())) //for (Entity entity : ((ServerWorld)worldIn).getEntities(...))
{ //{
lst.add(Messenger.c("w - ", // if ((!(entity instanceof LivingEntity) || !((LivingEntity)entity).isNoDespawnRequired()) && cls.isAssignableFrom(entity.getClass()))
Messenger.tp("w", entity.posX, entity.posY, entity.posZ),"w : "+EntityType.getId(entity.getType()))); // {
} // lst.add(Messenger.c("w - ",
} // Messenger.tp("w", entity.posX, entity.posY, entity.posZ),"w : "+EntityType.getId(entity.getType())));
// }
//}
if (lst.size()==1) if (lst.size()==1)
{ {
lst.add(Messenger.s(" - Empty.")); lst.add(Messenger.s(" - Empty."));
@@ -311,7 +313,7 @@ public class SpawnReporter
"w ' to enable")); "w ' to enable"));
return report; return report;
} }
Long duration = (long) worldIn.getServer().getTickCounter() - track_spawns; Long duration = (long) worldIn.getServer().getTicks() - track_spawns;
report.add(Messenger.c("bw --------------------")); report.add(Messenger.c("bw --------------------"));
String simulated = mock_spawns?"[SIMULATED] ":""; String simulated = mock_spawns?"[SIMULATED] ":"";
String location = (lower_spawning_limit != null)?String.format("[in (%d, %d, %d)x(%d, %d, %d)]", String location = (lower_spawning_limit != null)?String.format("[in (%d, %d, %d)x(%d, %d, %d)]",
@@ -358,20 +360,20 @@ public class SpawnReporter
public static void killEntity(LivingEntity entity) public static void killEntity(LivingEntity entity)
{ {
if (entity.isPassenger()) if (entity.hasVehicle())
{ {
entity.getRidingEntity().remove(); entity.getVehicle().remove();
} }
if (entity.isBeingRidden()) if (entity.hasPassengers())
{ {
for (Entity e: entity.getPassengers()) for (Entity e: entity.getPassengerList())
{ {
e.remove(); e.remove();
} }
} }
if (entity instanceof OcelotEntity) if (entity instanceof OcelotEntity)
{ {
for (Entity e: entity.getEntityWorld().getEntitiesWithinAABB(OcelotEntity.class, entity.getBoundingBox())) for (Entity e: entity.getEntityWorld().getEntities(OcelotEntity.class, entity.getBoundingBox()))
{ {
e.remove(); e.remove();
} }
@@ -384,7 +386,7 @@ public class SpawnReporter
List<BaseComponent> rep = new ArrayList<>(); List<BaseComponent> rep = new ArrayList<>();
int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); int x = pos.getX(); int y = pos.getY(); int z = pos.getZ();
Chunk chunk = worldIn.getChunk(pos); Chunk chunk = worldIn.getChunk(pos);
int lc = chunk.getTopBlockY(Heightmap.Type.LIGHT_BLOCKING, x, z) + 1; int lc = chunk.sampleHeightmap(Heightmap.Type.WORLD_SURFACE, x, z) + 1;
String where = String.format((y >= lc) ? "%d blocks above it." : "%d blocks below it.", MathHelper.abs(y-lc)); String where = String.format((y >= lc) ? "%d blocks above it." : "%d blocks below it.", MathHelper.abs(y-lc));
if (y == lc) where = "right at it."; if (y == lc) where = "right at it.";
rep.add(Messenger.s(String.format("Maximum spawn Y value for (%+d, %+d) is %d. You are "+where, x, z, lc ))); rep.add(Messenger.s(String.format("Maximum spawn Y value for (%+d, %+d) is %d. You are "+where, x, z, lc )));
@@ -395,17 +397,17 @@ public class SpawnReporter
List<Biome.SpawnEntry> lst = ((ChunkGenerator)worldIn.getChunkManager().getChunkGenerator()).getEntitySpawnList(enumcreaturetype, pos); List<Biome.SpawnEntry> lst = ((ChunkGenerator)worldIn.getChunkManager().getChunkGenerator()).getEntitySpawnList(enumcreaturetype, pos);
if (lst != null && !lst.isEmpty()) if (lst != null && !lst.isEmpty())
{ {
for (Biome.SpawnEntry SpawnListEntry animal : lst) for (Biome.SpawnEntry spawnEntry : lst)
{ {
boolean canspawn = SpawnHelper.canCreatureTypeSpawnAtLocation(SpawnRestriction.getPlacementType(animal.entityType), worldIn, pos, animal.entityType); boolean canspawn = SpawnHelper.canSpawn(SpawnRestriction.getLocation(spawnEntry.type), worldIn, pos, spawnEntry.type);
int will_spawn = -1; int will_spawn = -1;
boolean fits = false; boolean fits = false;
boolean fits1 = false; boolean fits1 = false;
LivingEntity entityliving; MobEntity mob;
try try
{ {
entityliving = animal.entityType.create(worldIn); mob = (MobEntity) spawnEntry.type.create(worldIn);
} }
catch (Exception exception) catch (Exception exception)
{ {
@@ -423,19 +425,19 @@ public class SpawnReporter
{ {
float f = (float)x + 0.5F; float f = (float)x + 0.5F;
float f1 = (float)z + 0.5F; float f1 = (float)z + 0.5F;
entityliving.setLocationAndAngles((double)f, (double)y, (double)f1, worldIn.rand.nextFloat() * 360.0F, 0.0F); mob.setPositionAndAngles((double)f, (double)y, (double)f1, worldIn.random.nextFloat() * 360.0F, 0.0F);
fits1 = entityliving.isNotColliding(); fits1 = worldIn.doesNotCollide(mob);
for (int i = 0; i < 20; ++i) for (int i = 0; i < 20; ++i)
{ {
if (entityliving.canSpawn(worldIn, false)) if (mob.canSpawn(worldIn, SpawnType.NATURAL))
{ {
will_spawn += 1; will_spawn += 1;
} }
} }
entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), null, null); mob.initialize(worldIn, worldIn.getLocalDifficulty(new BlockPos(mob)), SpawnType.NATURAL, null, null);
// the code invokes onInitialSpawn after getCanSpawHere // the code invokes onInitialSpawn after getCanSpawHere
fits = fits1 && entityliving.isNotColliding(); fits = fits1 && worldIn.doesNotCollide(mob);
if (fits) if (fits)
{ {
fits_true = true; fits_true = true;
@@ -445,11 +447,11 @@ public class SpawnReporter
fits_false = true; fits_false = true;
} }
killEntity(entityliving); killEntity(mob);
try try
{ {
entityliving = animal.entityType.create(worldIn); mob = (MobEntity) spawnEntry.type.create(worldIn);
} }
catch (Exception exception) catch (Exception exception)
{ {
@@ -459,14 +461,14 @@ public class SpawnReporter
} }
} }
String creature_name = Registry.ENTITY_TYPE.getKey(entityliving.getType()).toString().replaceFirst("minecraft:",""); String creature_name = Registry.ENTITY_TYPE.getId(mob.getType()).toString().replaceFirst("minecraft:","");
String pack_size = String.format("%d", entityliving.getMaxSpawnedInChunk());//String.format("%d-%d", animal.minGroupCount, animal.maxGroupCount); String pack_size = String.format("%d", mob.getLimitPerChunk());//String.format("%d-%d", animal.minGroupCount, animal.maxGroupCount);
int weight = animal.getItemWeight(); int weight = ((WeightedPickerEntryMixin) spawnEntry).getWeight();
if (canspawn) if (canspawn)
{ {
String c = (fits_true && will_spawn>0)?"e":"gi"; String c = (fits_true && will_spawn>0)?"e":"gi";
rep.add(Messenger.c( rep.add(Messenger.c(
String.format("%s %s: %s (%d:%d-%d/%d), can: ",c,type_code,creature_name,weight,animal.minGroupCount, animal.maxGroupCount, entityliving.getMaxSpawnedInChunk()), String.format("%s %s: %s (%d:%d-%d/%d), can: ",c,type_code,creature_name,weight,spawnEntry.minGroupSize, spawnEntry.maxGroupSize, mob.getLimitPerChunk()),
"l YES", "l YES",
c+" , fit: ", c+" , fit: ",
((fits_true && fits_false)?"y YES and NO":(fits_true?"l YES":"r NO")), ((fits_true && fits_false)?"y YES and NO":(fits_true?"l YES":"r NO")),
@@ -476,35 +478,12 @@ public class SpawnReporter
} }
else else
{ {
rep.add(Messenger.c(String.format("gi %s: %s (%d:%d-%d/%d), can: ",type_code,creature_name,weight,animal.minGroupCount, animal.maxGroupCount, entityliving.getMaxSpawnedInChunk()), "n NO")); rep.add(Messenger.c(String.format("gi %s: %s (%d:%d-%d/%d), can: ",type_code,creature_name,weight,spawnEntry.minGroupSize, spawnEntry.maxGroupSize, mob.getLimitPerChunk()), "n NO"));
} }
killEntity(entityliving); killEntity(mob);
} }
} }
} }
return rep; return rep;
} }
public static boolean check_player_within_spawning_range(World worldServerIn, float x, float y, float z)
{
for (int i = 0; i < worldServerIn.playerEntities.size(); ++i)
{
PlayerEntity entityplayer = worldServerIn.playerEntities.get(i);
if (EntityPredicates.NOT_SPECTATING.test(entityplayer))
{
double d0 = entityplayer.getDistanceSq(x, y, z);
if ( d0 > 24.0*24.0 && d0 < 128.0*128.0)
{
return true;
}
}
}
return false;
}
} }
+4 -3
View File
@@ -63,7 +63,8 @@ public class WoolTool
break; break;
case YELLOW: case YELLOW:
if (CarpetSettings.getBool("commandInfo")) if (CarpetSettings.getBool("commandInfo"))
EntityInfo.issue_entity_info(placer); Messenger.m(placer, "r use data get entity command");
//EntityInfo.issue_entity_info(placer);
break; break;
case GREEN: case GREEN:
if (CarpetSettings.getBool("hopperCounters")) if (CarpetSettings.getBool("hopperCounters"))
@@ -94,8 +95,8 @@ public class WoolTool
public static DyeColor getWoolColorAtPosition(World worldIn, BlockPos pos) public static DyeColor getWoolColorAtPosition(World worldIn, BlockPos pos)
{ {
BlockState state = worldIn.getBlockState(pos); BlockState state = worldIn.getBlockState(pos);
if (state.getMaterial() != Material.CLOTH || !state.isFullCube()) if (state.getMaterial() != Material.WOOL || !state.isSimpleFullBlock(worldIn, pos))
return null; return null;
return Material2Dye.get(state.getMaterialColor(worldIn, pos)); return Material2Dye.get(state.getTopMaterialColor(worldIn, pos));
} }
} }
+2 -1
View File
@@ -5,7 +5,8 @@
"mixins": [ "mixins": [
"carpetServer/CommandManagerMixin", "carpetServer/CommandManagerMixin",
"carpetServer/MinecraftServerMixin", "carpetServer/MinecraftServerMixin",
"logging/PlayerListHeaderS2CPacketMixin" "logging/PlayerListHeaderS2CPacketMixin",
"spawnTracking/WeightedPickerEntryMixin"
], ],
"client": [ "client": [
"carpetServer/MinecraftClientMixin", "carpetServer/MinecraftClientMixin",