Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
🦀 YARN SNAP 🦀 (#57)
Browse files Browse the repository at this point in the history
And Coderbot said "Let there be bugs", and there were bugs. Coderbot saw that they were Glitch's fault, and he separated Glitch from push access.
  • Loading branch information
TheGlitch76 authored Mar 18, 2020
1 parent 5f2518c commit 91ced1f
Show file tree
Hide file tree
Showing 72 changed files with 146 additions and 149 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def ENV = System.getenv()
class Globals {
static def baseVersion = "0.4.0"
static def mcVersion = "1.14.4"
static def yarnVersion = "+build.15"
static def yarnVersion = "+build.16"
}

def getSubprojectVersion(project, version) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

import net.minecraft.world.biome.Biome;

import net.patchworkmc.impl.biomes.RiverSupplier;
import net.patchworkmc.impl.biomes.PatchworkBiomes;
import net.patchworkmc.impl.biomes.RiverSupplier;

@Mixin(Biome.class)
public class MixinBiome implements RiverSupplier {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ public CompoundTag serializeNBT() {
@Override
public void deserializeNBT(CompoundTag tag) {
for (int x = 0; x < writers.length; x++) {
if (tag.containsKey(names[x])) {
if (tag.contains(names[x])) {
try {
writers[x].deserializeNBT(tag.getTag(names[x]));
writers[x].deserializeNBT(tag.get(names[x]));
} catch (Exception exception) {
LogManager.getLogger().error("A capability provider with the name " + names[x] + " has thrown an exception trying to read state. It will not persist. Report this to the mod author", exception);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ private void serializeCapabilities(CompoundTag compoundTag, CallbackInfoReturnab

@Inject(method = "fromTag", at = @At("RETURN"))
private void deserializeCapabilities(CompoundTag compoundTag, CallbackInfo callbackInfo) {
if (getCapabilities() != null && compoundTag.containsKey("ForgeCaps")) {
if (getCapabilities() != null && compoundTag.contains("ForgeCaps")) {
deserializeCaps(compoundTag.getCompound("ForgeCaps"));
}
}

@Inject(method = "invalidate", at = @At("RETURN"))
@Inject(method = "markRemoved", at = @At("RETURN"))
private void invalidate(CallbackInfo callbackInfo) {
invalidateCaps();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import net.minecraft.server.world.ServerWorld;
import net.minecraft.structure.StructureManager;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.village.PointOfInterestStorage;
import net.minecraft.world.ChunkSerializer;
import net.minecraft.world.TickScheduler;
import net.minecraft.world.World;
Expand All @@ -47,6 +46,7 @@
import net.minecraft.world.chunk.ChunkSection;
import net.minecraft.world.chunk.UpgradeData;
import net.minecraft.world.chunk.WorldChunk;
import net.minecraft.world.poi.PointOfInterestStorage;

import net.patchworkmc.impl.capability.CapabilityProviderHolder;

Expand All @@ -59,7 +59,7 @@ private static WorldChunk newWorldChunk(
WorldChunk chunk = new WorldChunk(newWorld, newChunkPos, newBiomes, newUpgradeData, newTickScheduler, newTickScheduler2, newL, newChunkSections, newConsumer);
CompoundTag level = compoundTag.getCompound("Level");

if (level.containsKey("ForgeCaps")) {
if (level.contains("ForgeCaps")) {
((CapabilityProviderHolder) chunk).deserializeCaps(level.getCompound("ForgeCaps"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private void serializeCapabilities(CompoundTag tag, CallbackInfoReturnable<Compo

@Inject(method = "fromTag", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;readCustomDataFromTag(Lnet/minecraft/nbt/CompoundTag;)V"))
private void deserializeCapabilities(CompoundTag tag, CallbackInfo callbackInfo) {
if (tag.containsKey("ForgeCaps")) {
if (tag.contains("ForgeCaps")) {
deserializeCaps(tag.getCompound("ForgeCaps"));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private void deserializeCapabilities(CompoundTag tag, CallbackInfo callbackInfo)
// TODO: See above TODO
gatherCapabilities(null);

if (tag.containsKey("ForgeCaps")) {
if (tag.contains("ForgeCaps")) {
deserializeCaps(tag.getCompound("ForgeCaps"));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import java.util.function.Predicate;

import com.google.common.collect.ImmutableList;
import org.apache.commons.lang3.ArrayUtils;
import net.minecraftforge.common.util.TriPredicate;
import org.apache.commons.lang3.ArrayUtils;

import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BannerPattern;
Expand All @@ -45,7 +45,7 @@
import net.minecraft.util.Formatting;
import net.minecraft.util.Rarity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ViewableWorld;
import net.minecraft.world.CollisionView;
import net.minecraft.world.gen.feature.OreFeatureConfig;

import net.patchworkmc.impl.enumhacks.HackableEnum;
Expand Down Expand Up @@ -171,7 +171,7 @@ public static BannerPattern createBannerPattern(String constantName, String name
return constructAndAdd(BannerPattern.class, ordinal -> BannerPatternAccessor.invokeConstructor(constantName, ordinal, name, id, recipePattern0, recipePattern1, recipePattern2));
}

public static SpawnRestriction.Location createSpawnRestrictionLocation(String name, TriPredicate<ViewableWorld, BlockPos, EntityType<?>> predicate) {
public static SpawnRestriction.Location createSpawnRestrictionLocation(String name, TriPredicate<CollisionView, BlockPos, EntityType<?>> predicate) {
SpawnRestriction.Location instance = constructAndAdd(SpawnRestriction.Location.class, ordinal -> SpawnRestrictionLocationAccessor.invokeConstructor(name, ordinal));
((PatchworkSpawnRestrictionLocation) (Object) instance).patchwork_setPredicate(predicate);
return instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@

import net.minecraft.entity.EntityType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ViewableWorld;
import net.minecraft.world.CollisionView;

public interface PatchworkSpawnRestrictionLocation {
boolean patchwork_useVanillaBehavior();

void patchwork_setPredicate(TriPredicate<ViewableWorld, BlockPos, EntityType<?>> predicate);
void patchwork_setPredicate(TriPredicate<CollisionView, BlockPos, EntityType<?>> predicate);

// Forge method, so no prefix
boolean canSpawnAt(ViewableWorld world, BlockPos pos, EntityType<?> type);
boolean canSpawnAt(CollisionView world, BlockPos pos, EntityType<?> type);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnRestriction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.CollisionView;
import net.minecraft.world.SpawnHelper;
import net.minecraft.world.ViewableWorld;

import net.patchworkmc.impl.enumhacks.PatchworkSpawnRestrictionLocation;

@Mixin(SpawnHelper.class)
public class MixinSpawnHelper {
@Inject(method = "canSpawn(Lnet/minecraft/entity/SpawnRestriction$Location;Lnet/minecraft/world/CollisionView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/EntityType;)Z",
at = @At(value = "INVOKE", target = "net/minecraft/world/ViewableWorld.getBlockState(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/BlockState;"),
at = @At(value = "INVOKE", target = "net/minecraft/world/CollisionView.getBlockState(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/BlockState;"),
cancellable = true)
private static void handleCustomSpawnRestrictionLocation(SpawnRestriction.Location location, ViewableWorld world, BlockPos pos, EntityType<?> type, CallbackInfoReturnable<Boolean> callback) {
private static void handleCustomSpawnRestrictionLocation(SpawnRestriction.Location location, CollisionView world, BlockPos pos, EntityType<?> type, CallbackInfoReturnable<Boolean> callback) {
PatchworkSpawnRestrictionLocation patchworkLocation = (PatchworkSpawnRestrictionLocation) (Object) location;

if (patchworkLocation.patchwork_useVanillaBehavior()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnRestriction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ViewableWorld;
import net.minecraft.world.CollisionView;

import net.patchworkmc.impl.enumhacks.HackableEnum;
import net.patchworkmc.impl.enumhacks.PatchworkSpawnRestrictionLocation;

@Mixin(SpawnRestriction.Location.class)
public class MixinSpawnRestrictionLocation implements PatchworkSpawnRestrictionLocation, HackableEnum<SpawnRestriction.Location> {
@Unique
private TriPredicate<ViewableWorld, BlockPos, EntityType<?>> predicate;
private TriPredicate<CollisionView, BlockPos, EntityType<?>> predicate;

@Shadow
@Final
@Mutable
private static SpawnRestriction.Location[] field_6319;

public boolean canSpawnAt(ViewableWorld world, BlockPos pos, EntityType<?> type) {
public boolean canSpawnAt(CollisionView world, BlockPos pos, EntityType<?> type) {
return predicate.test(world, pos, type);
}

Expand All @@ -54,7 +54,7 @@ public boolean patchwork_useVanillaBehavior() {
}

@Override
public void patchwork_setPredicate(TriPredicate<ViewableWorld, BlockPos, EntityType<?>> predicate) {
public void patchwork_setPredicate(TriPredicate<CollisionView, BlockPos, EntityType<?>> predicate) {
this.predicate = predicate;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

package net.minecraftforge.event.entity.living;

import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;

/**
* LivingDamageEvent is fired just before damage is applied to entity.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.living.LivingDamageEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.event.entity.living.LivingFallEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.entity.player.AttackEntityEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.entity.player.PlayerFlyableFallEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.eventbus.api.Event.Result;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityDimensions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

import net.minecraft.entity.SpawnType;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.world.CollisionView;
import net.minecraft.world.IWorld;
import net.minecraft.world.MobSpawnerLogic;
import net.minecraft.world.ViewableWorld;
import net.minecraft.world.World;

import net.patchworkmc.impl.event.entity.EntityEvents;
Expand All @@ -41,8 +41,8 @@ private boolean spawnTestRedirect(MobEntity on, IWorld world, SpawnType type) {
return EntityEvents.canEntitySpawnFromSpawner(on, (World) world, on.x, on.y, on.z, spawner);
}

@Redirect(method = "update", at = @At(value = "INVOKE", target = "net/minecraft/entity/mob/MobEntity.canSpawn(Lnet/minecraft/world/ViewableWorld;)Z"))
private boolean makeTheOtherMethodNotMessItUp(MobEntity on, ViewableWorld world) {
@Redirect(method = "update", at = @At(value = "INVOKE", target = "net/minecraft/entity/mob/MobEntity.canSpawn(Lnet/minecraft/world/CollisionView;)Z"))
private boolean makeTheOtherMethodNotMessItUp(MobEntity on, CollisionView world) {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
import net.minecraft.entity.SpawnType;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.CollisionView;
import net.minecraft.world.IWorld;
import net.minecraft.world.LocalDifficulty;
import net.minecraft.world.SpawnHelper;
import net.minecraft.world.ViewableWorld;

import net.patchworkmc.impl.event.entity.EntityEvents;

Expand All @@ -52,8 +52,8 @@ private static boolean hookCheckSpawn(MobEntity entity, IWorld world, SpawnType
return EntityEvents.canEntitySpawnNaturally(entity, entity.world, entity.x, entity.y, entity.x, null, spawnType, playerDistanceStore);
}

@Redirect(method = "spawnEntitiesInChunk", at = @At(value = "INVOKE", target = "net/minecraft/entity/mob/MobEntity.canSpawn(Lnet/minecraft/world/ViewableWorld;)Z"))
private static boolean disableVanillaLogic(MobEntity entity, ViewableWorld world) {
@Redirect(method = "spawnEntitiesInChunk", at = @At(value = "INVOKE", target = "net/minecraft/entity/mob/MobEntity.canSpawn(Lnet/minecraft/world/CollisionView;)Z"))
private static boolean disableVanillaLogic(MobEntity entity, CollisionView world) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

package net.patchworkmc.mixin.event.input;

import net.minecraftforge.client.event.InputEvent;
import net.minecraftforge.common.MinecraftForge;
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.CallbackInfo;
import net.minecraftforge.client.event.InputEvent;
import net.minecraftforge.common.MinecraftForge;

import net.minecraft.client.Keyboard;
import net.minecraft.client.MinecraftClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@

package net.patchworkmc.mixin.event.input;

import net.minecraftforge.client.event.InputEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Event;
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.At.Shift;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import net.minecraftforge.client.event.InputEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Event;

import net.minecraft.client.Mouse;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,27 @@
import java.util.List;
import java.util.Random;

import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Event;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.EntityCategory;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.WorldGenerationProgressListener;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.ProgressListener;
import net.minecraft.util.profiler.Profiler;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.profiler.Profiler;
import net.minecraft.world.IWorld;
import net.minecraft.world.SpawnHelper;
import net.minecraft.world.WorldSaveHandler;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.level.LevelInfo;
import net.minecraft.world.biome.Biome.SpawnEntry;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.level.LevelInfo;
import net.minecraft.world.level.LevelProperties;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.profiler.Profiler;
import net.minecraft.world.World;
import net.minecraft.world.chunk.ChunkManager;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.level.LevelProperties;
import net.minecraft.world.World;
import net.minecraft.client.world.ClientWorld;

import net.patchworkmc.impl.event.world.WorldEvents;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.ServerTask;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.NonBlockingThreadExecutor;
import net.minecraft.util.thread.ReentrantThreadExecutor;
import net.minecraft.world.dimension.DimensionType;

import net.patchworkmc.impl.event.world.WorldEvents;

@Mixin(MinecraftServer.class)
public abstract class MixinMinecraftServer extends NonBlockingThreadExecutor<ServerTask> {
public abstract class MixinMinecraftServer extends ReentrantThreadExecutor<ServerTask> {
public MixinMinecraftServer(String name) {
super(name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@

import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.network.packet.BlockEntityUpdateS2CPacket;
import net.minecraft.client.network.packet.BlockUpdateS2CPacket;
import net.minecraft.item.ItemStack;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.network.packet.s2c.play.BlockUpdateS2CPacket;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.network.ServerPlayerInteractionManager;
import net.minecraft.server.world.ServerWorld;
Expand Down
Loading

0 comments on commit 91ced1f

Please sign in to comment.