This commit is contained in:
modmuss50 2021-10-20 21:31:17 +01:00
parent 01912dd2c6
commit 938d6de077
8 changed files with 16 additions and 32 deletions
build.gradle
fabric-entity-events-v1
build.gradle
src
main/java/net/fabricmc/fabric/mixin/entity/event
testmod/java/net/fabricmc/fabric/test/entity/event
fabric-particles-v1
build.gradle
src/main
java/net/fabricmc/fabric/impl/client/particle
resources

View file

@ -19,8 +19,8 @@ plugins {
def ENV = System.getenv()
class Globals {
static def baseVersion = "0.41.0"
static def mcVersion = "21w41a"
static def baseVersion = "0.41.1"
static def mcVersion = "21w42a"
static def yarnVersion = "+build.1"
static def loaderVersion = "0.11.7"
static def preRelease = true

View file

@ -1,5 +1,5 @@
archivesBaseName = "fabric-entity-events-v1"
version = getSubprojectVersion(project, "1.3.0")
version = getSubprojectVersion(project, "1.3.1")
moduleDependencies(project, [
'fabric-api-base'

View file

@ -33,7 +33,7 @@ abstract class BedBlockMixin {
// with a null message, which vanilla's code doesn't guard against. This prevents a (luckily caught) NPE
// when a failure reason like that is returned from the event.
// The NPE can also be reproduced in vanilla with custom data pack dimensions (MC-235035, which is also fixed here).
if (reason.toText() == null) {
if (reason.getMessage() == null) {
info.cancel();
}
}

View file

@ -57,7 +57,7 @@ public class TestBedBlock extends Block {
if (world.getDimension().isBedWorking()) {
if (!world.isClient) {
player.trySleep(pos).ifLeft(sleepFailureReason -> {
Text message = sleepFailureReason.toText();
Text message = sleepFailureReason.getMessage();
if (message != null) {
player.sendMessage(message, true);

View file

@ -1,5 +1,9 @@
archivesBaseName = "fabric-particles-v1"
version = getSubprojectVersion(project, "0.2.4")
version = getSubprojectVersion(project, "0.2.5")
loom {
accessWidenerPath = file("src/main/resources/fabric-particles-v1.accesswidener")
}
moduleDependencies(project, [
'fabric-api-base',

View file

@ -16,7 +16,6 @@
package net.fabricmc.fabric.impl.client.particle;
import java.lang.reflect.Constructor;
import java.util.IdentityHashMap;
import java.util.Map;
@ -29,7 +28,6 @@ import net.minecraft.util.registry.Registry;
import net.fabricmc.fabric.api.client.particle.v1.FabricSpriteProvider;
import net.fabricmc.fabric.mixin.client.particle.ParticleManagerAccessor;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
public final class ParticleFactoryRegistryImpl implements ParticleFactoryRegistry {
@ -66,28 +64,6 @@ public final class ParticleFactoryRegistryImpl implements ParticleFactoryRegistr
}
static class DirectParticleFactoryRegistry implements ParticleFactoryRegistry {
private static final Constructor<? extends SpriteProvider> SIMPLE_SPRITE_PROVIDER_CONSTRUCTOR;
static {
try {
String intermediaryClassName = "net.minecraft.class_702$class_4090";
String currentClassName = FabricLoader.getInstance().getMappingResolver().mapClassName("intermediary", intermediaryClassName);
@SuppressWarnings("unchecked")
Class<? extends SpriteProvider> clazz = (Class<? extends SpriteProvider>) Class.forName(currentClassName);
SIMPLE_SPRITE_PROVIDER_CONSTRUCTOR = clazz.getDeclaredConstructor(ParticleManager.class);
SIMPLE_SPRITE_PROVIDER_CONSTRUCTOR.setAccessible(true);
} catch (Exception e) {
throw new RuntimeException("Unable to register particles", e);
}
}
private static SpriteProvider createSimpleSpriteProvider(ParticleManager particleManager) {
try {
return SIMPLE_SPRITE_PROVIDER_CONSTRUCTOR.newInstance(particleManager);
} catch (Exception e) {
throw new RuntimeException("Unable to create SimpleSpriteProvider", e);
}
}
private final ParticleManager particleManager;
DirectParticleFactoryRegistry(ParticleManager particleManager) {
@ -101,7 +77,7 @@ public final class ParticleFactoryRegistryImpl implements ParticleFactoryRegistr
@Override
public <T extends ParticleEffect> void register(ParticleType<T> type, PendingParticleFactory<T> constructor) {
SpriteProvider delegate = createSimpleSpriteProvider(particleManager);
SpriteProvider delegate = new ParticleManager.SimpleSpriteProvider();
FabricSpriteProvider fabricSpriteProvider = new FabricSpriteProviderImpl(particleManager, delegate);
((ParticleManagerAccessor) particleManager).getSpriteAwareFactories().put(Registry.PARTICLE_TYPE.getId(type), delegate);
register(type, constructor.create(fabricSpriteProvider));

View file

@ -0,0 +1,3 @@
accessWidener v1 named
accessible method net/minecraft/client/particle/ParticleManager$SimpleSpriteProvider <init> ()V

View file

@ -24,5 +24,6 @@
],
"custom": {
"fabric-api:module-lifecycle": "stable"
}
},
"accessWidener": "fabric-particles-v1.accesswidener"
}