This commit is contained in:
gnembon committed 2020-07-01 15:41:25 -03:00
1 parent 150c1d41a7
commit 03061ba114
14 files changed
+60 -35

No files matched your search

+2 -2
View File
@@ -4,8 +4,8 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/use
# or better: https://modmuss50.me/fabric.html
minecraft_version=1.16.1
yarn_mappings=1.16.1+build.19
minecraft_version=20w27a
yarn_mappings=20w27a+build.1
loader_version=0.8.9+build.203
# Mod Properties
@@ -15,4 +15,8 @@ public interface EntityInterface
int getPortalTimer();
void setPortalTimer(int amount);
int getPublicNetherPortalCooldown();
void setPublicNetherPortalCooldown(int what);
}
@@ -72,7 +72,7 @@ public class FeatureGenerator
CarpetSettings.skipGenerationChecks=true;
try
{
return feature.generate(w, w.getStructureAccessor(), w.getChunkManager().getChunkGenerator(), w.random, p);
return feature.generate(w, w.getChunkManager().getChunkGenerator(), w.random, p);
}
finally
{
@@ -15,6 +15,7 @@ public abstract class Entity_scarpetEventsMixin implements EntityInterface
@Shadow public boolean removed;
@Shadow protected int netherPortalTime;
@Shadow private int netherPortalCooldown;
private boolean permanentVehicle;
private final EntityEventsGroup events = new EntityEventsGroup();
@@ -37,6 +38,18 @@ public abstract class Entity_scarpetEventsMixin implements EntityInterface
permanentVehicle = permanent;
}
@Override
public int getPublicNetherPortalCooldown()
{
return netherPortalCooldown;
}
@Override
public void setPublicNetherPortalCooldown(int what)
{
netherPortalCooldown = what;
}
@Override
public int getPortalTimer()
{
@@ -9,6 +9,7 @@ import net.minecraft.entity.mob.ElderGuardianEntity;
import net.minecraft.entity.mob.GuardianEntity;
import net.minecraft.entity.mob.HostileEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
@@ -20,15 +21,15 @@ public abstract class GuardianEntityMixin extends HostileEntity
{
super(entityType_1, world_1);
}
@Override
public void onStruckByLightning(LightningEntity lightning)
public void onStruckByLightning(ServerWorld serverWorld, LightningEntity lightningEntity)
{
if (!this.world.isClient && !this.removed && CarpetSettings.renewableSponges && !((Object)this instanceof ElderGuardianEntity))
{
ElderGuardianEntity elderGuardian = new ElderGuardianEntity(EntityType.ELDER_GUARDIAN ,this.world);
elderGuardian.refreshPositionAndAngles(this.getX(), this.getY(), this.getZ(), this.yaw, this.pitch);
elderGuardian.initialize(this.world ,this.world.getLocalDifficulty(elderGuardian.getBlockPos()), SpawnReason.CONVERSION, (EntityData)null, (CompoundTag)null);
elderGuardian.initialize(serverWorld ,this.world.getLocalDifficulty(elderGuardian.getBlockPos()), SpawnReason.CONVERSION, (EntityData)null, (CompoundTag)null);
elderGuardian.setAiDisabled(this.isAiDisabled());
if (this.hasCustomName())
@@ -42,7 +43,7 @@ public abstract class GuardianEntityMixin extends HostileEntity
}
else
{
super.onStruckByLightning(lightning);
super.onStruckByLightning(serverWorld, lightningEntity);
}
}
}
@@ -1,6 +1,7 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.class_5425;
import net.minecraft.entity.mob.HuskEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
@@ -14,10 +15,10 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(HuskEntity.class)
public class HuskEntityMixin
{
@Redirect(method = "canSpawn", at = @At(value = "INVOKE", target="Lnet/minecraft/world/WorldAccess;isSkyVisible(Lnet/minecraft/util/math/BlockPos;)Z"))
private static boolean isSkylightOrTempleVisible(WorldAccess WorldAccess, BlockPos blockPos_1)
@Redirect(method = "canSpawn", at = @At(value = "INVOKE", target="Lnet/minecraft/class_5425;isSkyVisible(Lnet/minecraft/util/math/BlockPos;)Z"))
private static boolean isSkylightOrTempleVisible(class_5425 class_5425, BlockPos pos)
{
return WorldAccess.isSkyVisible(blockPos_1) ||
(CarpetSettings.huskSpawningInTemples && (((ServerWorld)WorldAccess).getStructureAccessor().method_28388(blockPos_1, false, StructureFeature.DESERT_PYRAMID).hasChildren()));
return class_5425.isSkyVisible(pos) ||
(CarpetSettings.huskSpawningInTemples && (((ServerWorld)class_5425).getStructureAccessor().method_28388(pos, false, StructureFeature.DESERT_PYRAMID).hasChildren()));
}
}
@@ -6,6 +6,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.InfestedBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
@@ -23,11 +24,11 @@ public abstract class InfestedBlockMixin extends Block
@Inject(method = "spawnSilverfish", at = @At(value = "INVOKE", shift = At.Shift.AFTER,
target = "Lnet/minecraft/entity/mob/SilverfishEntity;playSpawnEffects()V"))
private void onOnStacksDropped(World world, BlockPos blockPos, CallbackInfo ci)
private void onOnStacksDropped(ServerWorld serverWorld, BlockPos pos, CallbackInfo ci)
{
if (CarpetSettings.silverFishDropGravel)
{
dropStack(world, blockPos, new ItemStack(Blocks.GRAVEL));
dropStack(serverWorld, pos, new ItemStack(Blocks.GRAVEL));
}
}
}
@@ -6,6 +6,7 @@ import carpet.utils.SpawnReporter;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.FenceGateBlock;
import net.minecraft.class_5425;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.EntityData;
@@ -175,12 +176,12 @@ public class SpawnHelperMixin
@Redirect(method = "spawnEntitiesInChunk(Lnet/minecraft/entity/SpawnGroup;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/chunk/Chunk;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/SpawnHelper$Checker;Lnet/minecraft/world/SpawnHelper$Runner;)V", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/mob/MobEntity;initialize(Lnet/minecraft/world/WorldAccess;Lnet/minecraft/world/LocalDifficulty;Lnet/minecraft/entity/SpawnReason;Lnet/minecraft/entity/EntityData;Lnet/minecraft/nbt/CompoundTag;)Lnet/minecraft/entity/EntityData;"
target = "Lnet/minecraft/entity/mob/MobEntity;initialize(Lnet/minecraft/class_5425;Lnet/minecraft/world/LocalDifficulty;Lnet/minecraft/entity/SpawnReason;Lnet/minecraft/entity/EntityData;Lnet/minecraft/nbt/CompoundTag;)Lnet/minecraft/entity/EntityData;"
))
private static EntityData spawnEntity(MobEntity mobEntity, WorldAccess WorldAccess_1, LocalDifficulty localDifficulty_1, SpawnReason spawnType_1, EntityData entityData_1, CompoundTag compoundTag_1)
private static EntityData spawnEntity(MobEntity mobEntity, class_5425 foo, LocalDifficulty localDifficulty_1, SpawnReason spawnType_1, EntityData entityData_1, CompoundTag compoundTag_1)
{
if (!SpawnReporter.mock_spawns)
return mobEntity.initialize(WorldAccess_1, localDifficulty_1, spawnType_1, entityData_1, compoundTag_1);
if (!SpawnReporter.mock_spawns) // WorldAccess
return mobEntity.initialize(foo, localDifficulty_1, spawnType_1, entityData_1, compoundTag_1);
return null;
}
@@ -2,6 +2,7 @@ package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.block.entity.StructureBlockBlockEntity;
import net.minecraft.class_5425;
import net.minecraft.structure.Structure;
import net.minecraft.structure.StructurePlacementData;
import net.minecraft.util.math.BlockPos;
@@ -17,9 +18,9 @@ public abstract class StructureBlockBlockEntity_fillUpdatesMixin
{
@Redirect(method = "place", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/structure/Structure;place(Lnet/minecraft/world/WorldAccess;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/structure/StructurePlacementData;Ljava/util/Random;)V"
target = "Lnet/minecraft/structure/Structure;place(Lnet/minecraft/class_5425;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/structure/StructurePlacementData;Ljava/util/Random;)V"
))
private void onStructurePlacen(Structure structure, WorldAccess world, BlockPos pos, StructurePlacementData placementData, Random random)
private void onStructurePlacen(Structure structure, class_5425 world, BlockPos pos, StructurePlacementData placementData, Random random)
{
if(!CarpetSettings.fillUpdates)
CarpetSettings.impendingFillSkipUpdates = true;
@@ -2,6 +2,7 @@ package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.block.Block;
import net.minecraft.class_5425;
import net.minecraft.structure.Structure;
import net.minecraft.structure.StructurePlacementData;
import net.minecraft.util.math.BlockPos;
@@ -13,17 +14,17 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(Structure.class)
public class Structure_fillUpdatesMixin
{
@Redirect( method = "place(Lnet/minecraft/world/WorldAccess;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/structure/StructurePlacementData;Ljava/util/Random;I)Z", at = @At(
@Redirect( method = "place(Lnet/minecraft/class_5425;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/structure/StructurePlacementData;Ljava/util/Random;I)Z", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/WorldAccess;updateNeighbors(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;)V"
target = "Lnet/minecraft/class_5425;updateNeighbors(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;)V"
))
private void skipUpdateNeighbours(WorldAccess WorldAccess, BlockPos var1, Block var2)
private void skipUpdateNeighbours(class_5425 class_5425, BlockPos pos, Block block)
{
if (!CarpetSettings.impendingFillSkipUpdates)
WorldAccess.updateNeighbors(var1, var2);
class_5425.updateNeighbors(pos, block);
}
@Redirect(method = "place(Lnet/minecraft/world/WorldAccess;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/structure/StructurePlacementData;Ljava/util/Random;I)Z", at = @At(
@Redirect(method = "place(Lnet/minecraft/class_5425;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/structure/StructurePlacementData;Ljava/util/Random;I)Z", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/structure/StructurePlacementData;shouldUpdateNeighbors()Z"
))
@@ -40,7 +40,7 @@ import java.util.stream.Collectors;
@Mixin(VillagerEntity.class)
public abstract class VillagerEntity_aiMixin extends AbstractTraderEntity
{
@Shadow protected abstract boolean hasSeenGolemRecently(long long_1);
//@Shadow protected abstract boolean hasSeenGolemRecently(long long_1);
@Shadow protected abstract void sayNo();
@@ -62,14 +62,15 @@ public abstract class VillagerEntity_aiMixin extends AbstractTraderEntity
if (MobAI.isTracking(this, MobAI.TrackingType.IRON_GOLEM_SPAWNING))
{
long time;
Optional<Long> optional_1 = this.brain.getOptionalMemory(MemoryModuleType.GOLEM_LAST_SEEN_TIME);
Optional<Boolean> optional_1 = this.brain.getOptionalMemory(MemoryModuleType.GOLEM_DETECTED_RECENTLY);
if (!optional_1.isPresent()) {
time = 0;
} else {
Long long_2 = optional_1.get();
time = long_2+600 - getEntityWorld().getTime();
//Long long_2 = optional_1.get(); #TODO fixme need last seen golem time.
//time = long_2+600 - getEntityWorld().getTime();
time = 600;
}
boolean recentlySeen = hasSeenGolemRecently(getEntityWorld().getTime());
boolean recentlySeen = time > 0;
Optional<Long> optional_11 = this.brain.getOptionalMemory(MemoryModuleType.LAST_SLEPT);
//Optional<Timestamp> optional_22 = this.brain.getOptionalMemory(MemoryModuleType.LAST_WORKED_AT_POI);
//boolean work = false;
@@ -177,7 +178,7 @@ public abstract class VillagerEntity_aiMixin extends AbstractTraderEntity
target = "Lnet/minecraft/util/math/Box;expand(DDD)Lnet/minecraft/util/math/Box;",
shift = At.Shift.AFTER
))
private void particleIt(long long_1, int int_1, CallbackInfo ci)
private void particleIt(ServerWorld serverWorld, long l, int i, CallbackInfo ci)
{
if (MobAI.isTracking(this, MobAI.TrackingType.IRON_GOLEM_SPAWNING))
{
@@ -264,7 +264,7 @@ public class EntityValue extends Value
put("count", (e, a) -> (e instanceof ItemEntity)?new NumericValue(((ItemEntity) e).getStack().getCount()):Value.NULL);
put("pickup_delay", (e, a) -> (e instanceof ItemEntity)?new NumericValue(((ItemEntityInterface) e).getPickupDelayCM()):Value.NULL);
put("portal_cooldown", (e , a) ->new NumericValue(((EntityInterface)e).getPortalTimer()));
put("portal_timer", (e , a) ->new NumericValue(e.netherPortalCooldown));
put("portal_timer", (e , a) ->new NumericValue(((EntityInterface)e).getPublicNetherPortalCooldown()));
// ItemEntity -> despawn timer via ssGetAge
put("is_baby", (e, a) -> (e instanceof LivingEntity)?new NumericValue(((LivingEntity) e).isBaby()):Value.NULL);
put("target", (e, a) -> {
@@ -871,7 +871,7 @@ public class EntityValue extends Value
{
if (v==null)
throw new InternalExpressionException("'portal_cooldown' requires a value to set");
e.netherPortalCooldown = NumericValue.asNumber(v).getInt();
((EntityInterface)e).setPublicNetherPortalCooldown(NumericValue.asNumber(v).getInt());
});
put("portal_timer", (e , v) ->
+3 -2
View File
@@ -11,6 +11,7 @@ import net.minecraft.entity.ai.goal.WanderAroundGoal;
import net.minecraft.entity.ai.pathing.NavigationType;
import net.minecraft.entity.mob.PathAwareEntity;
import net.minecraft.entity.mob.ZombifiedPiglinEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.text.BaseText;
import net.minecraft.util.math.BlockPos;
@@ -169,7 +170,7 @@ public class BlockInfo
put(Material.CAKE , "cake" );
}};
public static List<BaseText> blockInfo(BlockPos pos, World world)
public static List<BaseText> blockInfo(BlockPos pos, ServerWorld world)
{
BlockState state = world.getBlockState(pos);
Material material = state.getMaterial();
@@ -220,7 +221,7 @@ public class BlockInfo
return lst;
}
private static BaseText wander_chances(BlockPos pos, World worldIn)
private static BaseText wander_chances(BlockPos pos, ServerWorld worldIn)
{
PathAwareEntity creature = new ZombifiedPiglinEntity(EntityType.ZOMBIFIED_PIGLIN, worldIn);
creature.initialize(worldIn, worldIn.getLocalDifficulty(pos), SpawnReason.NATURAL, null, null);
@@ -181,7 +181,7 @@ public class PerimeterDiagnostics
{
el.refreshPositionAndAngles((float)pos.getX() + 0.5F, (float)pos.getY(), (float)pos.getZ()+0.5F, 0.0F, 0.0F);
return el.canSpawn(worldServer) && el.canSpawn(worldServer, SpawnReason.NATURAL) &&
SpawnRestriction.canSpawn(el.getType(),el.getEntityWorld(), SpawnReason.NATURAL, el.getBlockPos(), el.getEntityWorld().random) &&
SpawnRestriction.canSpawn(el.getType(),(ServerWorld)el.getEntityWorld(), SpawnReason.NATURAL, el.getBlockPos(), el.getEntityWorld().random) &&
worldServer.doesNotCollide(el); // check collision rules once they stop fiddling with them after 1.14.1
}
return false;