Version Conversion: 1.19 edition

- Mostly port to 1.19
- Remaining errors include:
  - Fluids
  - Features
  - Registry-related code
  - Fake worlds
  - Some datagen code
This commit is contained in:
PepperCode1 2022-07-25 23:33:10 -07:00
parent 82be76d893
commit 233d9b292e
333 changed files with 1302 additions and 1444 deletions

View file

@ -39,7 +39,8 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(17)
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
minecraft { minecraft {
mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}" //mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}"
mappings channel: 'official', version: "${minecraft_version}"
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs { runs {
@ -133,7 +134,7 @@ repositories {
dependencies { dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
jarJar(group: 'com.tterrag.registrate', name: 'Registrate', version: '[MC1.18.2-1.1.3,)') { jarJar(group: 'com.tterrag.registrate', name: 'Registrate', version: '[MC1.19-1.1.5,)') {
jarJar.pin(it, project.registrate_version) jarJar.pin(it, project.registrate_version)
} }
// Uncomment once Forge fixes mixins for included jars // Uncomment once Forge fixes mixins for included jars
@ -149,8 +150,8 @@ dependencies {
implementation fg.deobf("com.jozufozu.flywheel:flywheel-forge-${flywheel_minecraft_version}:${flywheel_version}") implementation fg.deobf("com.jozufozu.flywheel:flywheel-forge-${flywheel_minecraft_version}:${flywheel_version}")
} }
compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}:api") compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-forge-api:${jei_version}")
runtimeOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}") runtimeOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-forge:${jei_version}")
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_minecraft_version}-${curios_version}:api") compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_minecraft_version}-${curios_version}:api")
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_minecraft_version}-${curios_version}") runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_minecraft_version}-${curios_version}")

View file

@ -5,10 +5,10 @@ org.gradle.daemon = false
# mod version info # mod version info
mod_version = 0.5.0.c mod_version = 0.5.0.c
artifact_minecraft_version = 1.18.2 artifact_minecraft_version = 1.19
minecraft_version = 1.18.2 minecraft_version = 1.19
forge_version = 40.1.60 forge_version = 41.0.110
# build dependency versions # build dependency versions
forgegradle_version = 5.1.+ forgegradle_version = 5.1.+
@ -19,13 +19,13 @@ cursegradle_version = 1.4.0
parchment_version = 2022.07.10 parchment_version = 2022.07.10
# dependency versions # dependency versions
registrate_version = MC1.18.2-1.1.3 registrate_version = MC1.19-1.1.5
flywheel_minecraft_version = 1.18.2 flywheel_minecraft_version = 1.19
flywheel_version = 0.6.4-90 flywheel_version = 0.6.4-1
jei_minecraft_version = 1.18.2 jei_minecraft_version = 1.19
jei_version = 9.7.0.209 jei_version = 11.1.0.235
curios_minecraft_version = 1.18.2 curios_minecraft_version = 1.19
curios_version = 5.0.7.0 curios_version = 5.1.0.4
# curseforge information # curseforge information
projectId = 328085 projectId = 328085

View file

@ -600,7 +600,7 @@ public class AllBlocks {
.initialProperties(SharedProperties.CRUSHING_WHEEL_CONTROLLER_MATERIAL) .initialProperties(SharedProperties.CRUSHING_WHEEL_CONTROLLER_MATERIAL)
.properties(p -> p.color(MaterialColor.STONE)) .properties(p -> p.color(MaterialColor.STONE))
.properties(p -> p.noOcclusion() .properties(p -> p.noOcclusion()
.noDrops() .noLootTable()
.air()) .air())
.blockstate((c, p) -> p.getVariantBuilder(c.get()) .blockstate((c, p) -> p.getVariantBuilder(c.get())
.forAllStatesExcept(state -> ConfiguredModel.builder() .forAllStatesExcept(state -> ConfiguredModel.builder()

View file

@ -2,17 +2,17 @@ package com.simibubi.create;
import com.simibubi.create.content.logistics.trains.entity.CarriageSyncDataSerializer; import com.simibubi.create.content.logistics.trains.entity.CarriageSyncDataSerializer;
import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.DataSerializerEntry; import net.minecraftforge.registries.RegisterEvent;
import net.minecraftforge.registries.IForgeRegistry;
public class AllEntityDataSerializers { public class AllEntityDataSerializers {
public static final CarriageSyncDataSerializer CARRIAGE_DATA = new CarriageSyncDataSerializer(); public static final CarriageSyncDataSerializer CARRIAGE_DATA = new CarriageSyncDataSerializer();
public static void register(RegistryEvent.Register<DataSerializerEntry> event) { public static void register(RegisterEvent event) {
IForgeRegistry<DataSerializerEntry> registry = event.getRegistry(); event.register(ForgeRegistries.Keys.ENTITY_DATA_SERIALIZERS, helper -> {
registry.register(new DataSerializerEntry(CARRIAGE_DATA).setRegistryName(Create.asResource("carriage_data"))); helper.register(Create.asResource("carriage_data"), CARRIAGE_DATA);
});
} }
} }

View file

@ -7,8 +7,12 @@ import com.mojang.blaze3d.platform.InputConstants;
import net.minecraft.client.KeyMapping; import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.Screen;
import net.minecraftforge.client.ClientRegistry; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
@EventBusSubscriber(value = Dist.CLIENT, bus = EventBusSubscriber.Bus.MOD)
public enum AllKeys { public enum AllKeys {
TOOL_MENU("toolmenu", GLFW.GLFW_KEY_LEFT_ALT), TOOL_MENU("toolmenu", GLFW.GLFW_KEY_LEFT_ALT),
@ -28,13 +32,14 @@ public enum AllKeys {
this.modifiable = !description.isEmpty(); this.modifiable = !description.isEmpty();
} }
public static void register() { @SubscribeEvent
public static void register(RegisterKeyMappingsEvent event) {
for (AllKeys key : values()) { for (AllKeys key : values()) {
key.keybind = new KeyMapping(key.description, key.key, Create.NAME); key.keybind = new KeyMapping(key.description, key.key, Create.NAME);
if (!key.modifiable) if (!key.modifiable)
continue; continue;
ClientRegistry.registerKeyBinding(key.keybind); event.register(key.keybind);
} }
} }

View file

@ -14,16 +14,14 @@ import com.simibubi.create.content.curiosities.bell.SoulBaseParticle;
import com.simibubi.create.content.curiosities.bell.SoulParticle; import com.simibubi.create.content.curiosities.bell.SoulParticle;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.client.Minecraft; import net.minecraft.core.Registry;
import net.minecraft.client.particle.ParticleEngine;
import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleType; import net.minecraft.core.particles.ParticleType;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.ParticleFactoryRegisterEvent; import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.registries.RegisterEvent;
import net.minecraftforge.registries.IForgeRegistry;
public enum AllParticleTypes { public enum AllParticleTypes {
@ -49,16 +47,17 @@ public enum AllParticleTypes {
entry = new ParticleEntry<>(new ResourceLocation(Create.ID, asId), typeFactory); entry = new ParticleEntry<>(new ResourceLocation(Create.ID, asId), typeFactory);
} }
public static void register(RegistryEvent.Register<ParticleType<?>> event) { public static void register(RegisterEvent event) {
for (AllParticleTypes particle : values()) event.register(Registry.PARTICLE_TYPE_REGISTRY, helper -> {
particle.entry.register(event.getRegistry()); for (AllParticleTypes particle : values())
particle.entry.register(helper);
});
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static void registerFactories(ParticleFactoryRegisterEvent event) { public static void registerFactories(RegisterParticleProvidersEvent event) {
ParticleEngine particles = Minecraft.getInstance().particleEngine;
for (AllParticleTypes particle : values()) for (AllParticleTypes particle : values())
particle.entry.registerFactory(particles); particle.entry.registerFactory(event);
} }
public ParticleType<?> get() { public ParticleType<?> get() {
@ -79,8 +78,8 @@ public enum AllParticleTypes {
this.typeFactory = typeFactory; this.typeFactory = typeFactory;
} }
void register(IForgeRegistry<ParticleType<?>> registry) { void register(RegisterEvent.RegisterHelper<ParticleType<?>> helper) {
registry.register(getOrCreateType()); helper.register(id, getOrCreateType());
} }
ParticleType<D> getOrCreateType() { ParticleType<D> getOrCreateType() {
@ -88,14 +87,13 @@ public enum AllParticleTypes {
return type; return type;
type = typeFactory.get() type = typeFactory.get()
.createType(); .createType();
type.setRegistryName(id);
return type; return type;
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
void registerFactory(ParticleEngine particles) { void registerFactory(RegisterParticleProvidersEvent event) {
typeFactory.get() typeFactory.get()
.register(getOrCreateType(), particles); .register(getOrCreateType(), event);
} }
} }

View file

@ -37,7 +37,7 @@ import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.item.crafting.ShapedRecipe; import net.minecraft.world.item.crafting.ShapedRecipe;
import net.minecraft.world.item.crafting.SimpleRecipeSerializer; import net.minecraft.world.item.crafting.SimpleRecipeSerializer;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.registries.RegisterEvent;
public enum AllRecipeTypes implements IRecipeTypeInfo { public enum AllRecipeTypes implements IRecipeTypeInfo {
@ -83,7 +83,7 @@ public enum AllRecipeTypes implements IRecipeTypeInfo {
AllRecipeTypes(Supplier<RecipeSerializer<?>> serializerSupplier) { AllRecipeTypes(Supplier<RecipeSerializer<?>> serializerSupplier) {
this.id = Create.asResource(Lang.asId(name())); this.id = Create.asResource(Lang.asId(name()));
this.serializerSupplier = serializerSupplier; this.serializerSupplier = serializerSupplier;
this.typeSupplier = () -> simpleType(id); this.typeSupplier = () -> RecipeType.simple(id);
} }
AllRecipeTypes(ProcessingRecipeFactory<?> processingFactory) { AllRecipeTypes(ProcessingRecipeFactory<?> processingFactory) {
@ -112,32 +112,28 @@ public enum AllRecipeTypes implements IRecipeTypeInfo {
.getRecipeFor(getType(), inv, world); .getRecipeFor(getType(), inv, world);
} }
public static void register(RegistryEvent.Register<RecipeSerializer<?>> event) { public static void register(RegisterEvent event) {
ShapedRecipe.setCraftingSize(9, 9); event.register(Registry.RECIPE_SERIALIZER_REGISTRY, helper -> {
ShapedRecipe.setCraftingSize(9, 9);
for (AllRecipeTypes r : AllRecipeTypes.values()) { for (AllRecipeTypes r : AllRecipeTypes.values()) {
r.serializer = r.serializerSupplier.get(); r.serializer = r.serializerSupplier.get();
r.type = r.typeSupplier.get(); helper.register(r.id, r.serializer);
r.serializer.setRegistryName(r.id); }
event.getRegistry() });
.register(r.serializer);
} event.register(Registry.RECIPE_TYPE_REGISTRY, helper -> {
for (AllRecipeTypes r : AllRecipeTypes.values()) {
r.type = r.typeSupplier.get();
helper.register(r.id, r.type);
}
});
} }
private static Supplier<RecipeSerializer<?>> processingSerializer(ProcessingRecipeFactory<?> factory) { private static Supplier<RecipeSerializer<?>> processingSerializer(ProcessingRecipeFactory<?> factory) {
return () -> new ProcessingRecipeSerializer<>(factory); return () -> new ProcessingRecipeSerializer<>(factory);
} }
public static <T extends Recipe<?>> RecipeType<T> simpleType(ResourceLocation id) {
String stringId = id.toString();
return Registry.register(Registry.RECIPE_TYPE, id, new RecipeType<T>() {
@Override
public String toString() {
return stringId;
}
});
}
public static final Set<ResourceLocation> RECIPE_DENY_SET = public static final Set<ResourceLocation> RECIPE_DENY_SET =
ImmutableSet.of(new ResourceLocation("occultism", "spirit_trade"), new ResourceLocation("occultism", "ritual")); ImmutableSet.of(new ResourceLocation("occultism", "spirit_trade"), new ResourceLocation("occultism", "ritual"));

View file

@ -8,17 +8,16 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.simibubi.create.foundation.utility.Couple; import com.simibubi.create.foundation.utility.Couple;
import com.simibubi.create.foundation.utility.Pair; import com.simibubi.create.foundation.utility.Pair;
import net.minecraft.core.Registry;
import net.minecraft.core.Vec3i; import net.minecraft.core.Vec3i;
import net.minecraft.data.CachedOutput;
import net.minecraft.data.DataGenerator; import net.minecraft.data.DataGenerator;
import net.minecraft.data.DataProvider; import net.minecraft.data.DataProvider;
import net.minecraft.data.HashCache;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
@ -27,8 +26,7 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.registries.RegisterEvent;
import net.minecraftforge.registries.IForgeRegistry;
//@EventBusSubscriber(bus = Bus.FORGE) //@EventBusSubscriber(bus = Bus.FORGE)
public class AllSoundEvents { public class AllSoundEvents {
@ -306,10 +304,11 @@ public class AllSoundEvents {
return new SoundEntryBuilder(id); return new SoundEntryBuilder(id);
} }
public static void register(RegistryEvent.Register<SoundEvent> event) { public static void register(RegisterEvent event) {
IForgeRegistry<SoundEvent> registry = event.getRegistry(); event.register(Registry.SOUND_EVENT_REGISTRY, helper -> {
for (SoundEntry entry : entries.values()) for (SoundEntry entry : entries.values())
entry.register(registry); entry.register(helper);
});
} }
public static void prepare() { public static void prepare() {
@ -353,7 +352,7 @@ public class AllSoundEvents {
} }
@Override @Override
public void run(HashCache cache) throws IOException { public void run(CachedOutput cache) throws IOException {
generate(generator.getOutputFolder(), cache); generate(generator.getOutputFolder(), cache);
} }
@ -362,10 +361,7 @@ public class AllSoundEvents {
return "Create's Custom Sounds"; return "Create's Custom Sounds";
} }
public void generate(Path path, HashCache cache) { public void generate(Path path, CachedOutput cache) {
Gson GSON = (new GsonBuilder()).setPrettyPrinting()
.disableHtmlEscaping()
.create();
path = path.resolve("assets/create"); path = path.resolve("assets/create");
try { try {
@ -377,7 +373,7 @@ public class AllSoundEvents {
entry.getValue() entry.getValue()
.write(json); .write(json);
}); });
DataProvider.save(GSON, cache, json, path.resolve("sounds.json")); DataProvider.saveStable(cache, json, path.resolve("sounds.json"));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
@ -465,7 +461,7 @@ public class AllSoundEvents {
public abstract void prepare(); public abstract void prepare();
public abstract void register(IForgeRegistry<SoundEvent> registry); public abstract void register(RegisterEvent.RegisterHelper<SoundEvent> registry);
public abstract void write(JsonObject json); public abstract void write(JsonObject json);
@ -546,16 +542,18 @@ public class AllSoundEvents {
public void prepare() { public void prepare() {
for (int i = 0; i < wrappedEvents.size(); i++) { for (int i = 0; i < wrappedEvents.size(); i++) {
ResourceLocation location = Create.asResource(getIdOf(i)); ResourceLocation location = Create.asResource(getIdOf(i));
SoundEvent sound = new SoundEvent(location).setRegistryName(location); SoundEvent sound = new SoundEvent(location);
compiledEvents.add(Pair.of(sound, wrappedEvents.get(i) compiledEvents.add(Pair.of(sound, wrappedEvents.get(i)
.getSecond())); .getSecond()));
} }
} }
@Override @Override
public void register(IForgeRegistry<SoundEvent> registry) { public void register(RegisterEvent.RegisterHelper<SoundEvent> helper) {
for (Pair<SoundEvent, Couple<Float>> pair : compiledEvents) for (Pair<SoundEvent, Couple<Float>> pair : compiledEvents) {
registry.register(pair.getFirst()); SoundEvent soundEvent = pair.getFirst();
helper.register(soundEvent.getLocation(), soundEvent);
}
} }
@Override @Override
@ -621,12 +619,12 @@ public class AllSoundEvents {
@Override @Override
public void prepare() { public void prepare() {
event = new SoundEvent(id).setRegistryName(id); event = new SoundEvent(id);
} }
@Override @Override
public void register(IForgeRegistry<SoundEvent> registry) { public void register(RegisterEvent.RegisterHelper<SoundEvent> helper) {
registry.register(event); helper.register(id, event);
} }
@Override @Override

View file

@ -33,20 +33,19 @@ import net.minecraft.world.level.material.Fluids;
import net.minecraftforge.common.Tags; import net.minecraftforge.common.Tags;
import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.IForgeRegistryEntry;
public class AllTags { public class AllTags {
private static final CreateRegistrate REGISTRATE = Create.registrate() private static final CreateRegistrate REGISTRATE = Create.registrate()
.creativeModeTab(() -> Create.BASE_CREATIVE_TAB); .creativeModeTab(() -> Create.BASE_CREATIVE_TAB);
public static <T extends IForgeRegistryEntry<T>> TagKey<T> optionalTag(IForgeRegistry<T> registry, public static <T> TagKey<T> optionalTag(IForgeRegistry<T> registry,
ResourceLocation id) { ResourceLocation id) {
return registry.tags() return registry.tags()
.createOptionalTagKey(id, Collections.emptySet()); .createOptionalTagKey(id, Collections.emptySet());
} }
public static <T extends IForgeRegistryEntry<T>> TagKey<T> forgeTag(IForgeRegistry<T> registry, String path) { public static <T> TagKey<T> forgeTag(IForgeRegistry<T> registry, String path) {
return optionalTag(registry, new ResourceLocation("forge", path)); return optionalTag(registry, new ResourceLocation("forge", path));
} }

View file

@ -39,16 +39,16 @@ import com.simibubi.create.foundation.networking.AllPackets;
import com.simibubi.create.foundation.worldgen.AllWorldFeatures; import com.simibubi.create.foundation.worldgen.AllWorldFeatures;
import com.tterrag.registrate.util.nullness.NonNullSupplier; import com.tterrag.registrate.util.nullness.NonNullSupplier;
import net.minecraft.core.particles.ParticleType;
import net.minecraft.data.DataGenerator; import net.minecraft.data.DataGenerator;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent; import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.level.Level;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.data.event.GatherDataEvent;
import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.DistExecutor;
@ -56,8 +56,6 @@ import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent;
import net.minecraftforge.registries.DataSerializerEntry;
@Mod(Create.ID) @Mod(Create.ID)
public class Create { public class Create {
@ -80,6 +78,8 @@ public class Create {
public static final TorquePropagator TORQUE_PROPAGATOR = new TorquePropagator(); public static final TorquePropagator TORQUE_PROPAGATOR = new TorquePropagator();
public static final GlobalRailwayManager RAILWAYS = new GlobalRailwayManager(); public static final GlobalRailwayManager RAILWAYS = new GlobalRailwayManager();
public static final ServerLagger LAGGER = new ServerLagger(); public static final ServerLagger LAGGER = new ServerLagger();
/** Use the {@link RandomSource} of a local {@link Level} or {@link Entity} or create one using {@link RandomSource#create()} */
@Deprecated
public static final Random RANDOM = new Random(); public static final Random RANDOM = new Random();
private static final NonNullSupplier<CreateRegistrate> REGISTRATE = CreateRegistrate.lazy(ID); private static final NonNullSupplier<CreateRegistrate> REGISTRATE = CreateRegistrate.lazy(ID);
@ -119,11 +119,11 @@ public class Create {
modEventBus.addListener(Create::init); modEventBus.addListener(Create::init);
modEventBus.addListener(EventPriority.LOWEST, Create::gatherData); modEventBus.addListener(EventPriority.LOWEST, Create::gatherData);
modEventBus.addGenericListener(Feature.class, AllWorldFeatures::registerOreFeatures); modEventBus.addListener(AllWorldFeatures::registerOreFeatures);
modEventBus.addGenericListener(RecipeSerializer.class, AllRecipeTypes::register); modEventBus.addListener(AllRecipeTypes::register);
modEventBus.addGenericListener(ParticleType.class, AllParticleTypes::register); modEventBus.addListener(AllParticleTypes::register);
modEventBus.addGenericListener(SoundEvent.class, AllSoundEvents::register); modEventBus.addListener(AllSoundEvents::register);
modEventBus.addGenericListener(DataSerializerEntry.class, AllEntityDataSerializers::register); modEventBus.addListener(AllEntityDataSerializers::register);
forgeEventBus.addListener(EventPriority.HIGH, SlidingDoorBlock::stopItQuark); forgeEventBus.addListener(EventPriority.HIGH, SlidingDoorBlock::stopItQuark);
@ -149,12 +149,12 @@ public class Create {
public static void gatherData(GatherDataEvent event) { public static void gatherData(GatherDataEvent event) {
DataGenerator gen = event.getGenerator(); DataGenerator gen = event.getGenerator();
gen.addProvider(new AllAdvancements(gen)); gen.addProvider(true, new AllAdvancements(gen));
gen.addProvider(new LangMerger(gen)); gen.addProvider(true, new LangMerger(gen));
gen.addProvider(AllSoundEvents.provider(gen)); gen.addProvider(true, AllSoundEvents.provider(gen));
gen.addProvider(new StandardRecipeGen(gen)); gen.addProvider(true, new StandardRecipeGen(gen));
gen.addProvider(new MechanicalCraftingRecipeGen(gen)); gen.addProvider(true, new MechanicalCraftingRecipeGen(gen));
gen.addProvider(new SequencedAssemblyRecipeGen(gen)); gen.addProvider(true, new SequencedAssemblyRecipeGen(gen));
ProcessingRecipeGen.registerAll(gen); ProcessingRecipeGen.registerAll(gen);
} }

View file

@ -2,18 +2,12 @@ package com.simibubi.create;
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueSelectionHandler; import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueSelectionHandler;
import com.simibubi.create.content.contraptions.components.structureMovement.interaction.controls.TrainHUD;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
import com.simibubi.create.content.contraptions.components.structureMovement.render.SBBContraptionManager; import com.simibubi.create.content.contraptions.components.structureMovement.render.SBBContraptionManager;
import com.simibubi.create.content.contraptions.goggles.GoggleOverlayRenderer;
import com.simibubi.create.content.contraptions.relays.encased.CasingConnectivity; import com.simibubi.create.content.contraptions.relays.encased.CasingConnectivity;
import com.simibubi.create.content.curiosities.armor.CopperBacktankArmorLayer;
import com.simibubi.create.content.curiosities.bell.SoulPulseEffectHandler; import com.simibubi.create.content.curiosities.bell.SoulPulseEffectHandler;
import com.simibubi.create.content.curiosities.toolbox.ToolboxHandlerClient;
import com.simibubi.create.content.curiosities.tools.BlueprintOverlayRenderer;
import com.simibubi.create.content.curiosities.weapons.PotatoCannonRenderHandler; import com.simibubi.create.content.curiosities.weapons.PotatoCannonRenderHandler;
import com.simibubi.create.content.curiosities.zapper.ZapperRenderHandler; import com.simibubi.create.content.curiosities.zapper.ZapperRenderHandler;
import com.simibubi.create.content.logistics.item.LinkedControllerClientHandler;
import com.simibubi.create.content.logistics.trains.GlobalRailwayManager; import com.simibubi.create.content.logistics.trains.GlobalRailwayManager;
import com.simibubi.create.content.schematics.ClientSchematicLoader; import com.simibubi.create.content.schematics.ClientSchematicLoader;
import com.simibubi.create.content.schematics.client.SchematicAndQuillHandler; import com.simibubi.create.content.schematics.client.SchematicAndQuillHandler;
@ -33,14 +27,11 @@ import com.simibubi.create.foundation.utility.outliner.Outliner;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.client.GraphicsStatus; import net.minecraft.client.GraphicsStatus;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.ChatType;
import net.minecraft.network.chat.ClickEvent; import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.ComponentUtils; import net.minecraft.network.chat.ComponentUtils;
import net.minecraft.network.chat.HoverEvent; import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraftforge.client.gui.ForgeIngameGui;
import net.minecraftforge.client.gui.OverlayRegistry;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
@ -84,7 +75,6 @@ public class CreateClient {
BUFFER_CACHE.registerCompartment(SBBContraptionManager.CONTRAPTION, 20); BUFFER_CACHE.registerCompartment(SBBContraptionManager.CONTRAPTION, 20);
BUFFER_CACHE.registerCompartment(WorldSectionElement.DOC_WORLD_SECTION, 20); BUFFER_CACHE.registerCompartment(WorldSectionElement.DOC_WORLD_SECTION, 20);
AllKeys.register();
// AllFluids.assignRenderLayers(); // AllFluids.assignRenderLayers();
AllBlockPartials.init(); AllBlockPartials.init();
AllStitchedTextures.init(); AllStitchedTextures.init();
@ -92,22 +82,9 @@ public class CreateClient {
PonderIndex.register(); PonderIndex.register();
PonderIndex.registerTags(); PonderIndex.registerTags();
registerOverlays();
UIRenderHelper.init(); UIRenderHelper.init();
} }
private static void registerOverlays() {
// Register overlays in reverse order
OverlayRegistry.registerOverlayAbove(ForgeIngameGui.AIR_LEVEL_ELEMENT, "Create's Remaining Air", CopperBacktankArmorLayer.REMAINING_AIR_OVERLAY);
OverlayRegistry.registerOverlayAbove(ForgeIngameGui.EXPERIENCE_BAR_ELEMENT, "Create's Train Driver HUD", TrainHUD.OVERLAY);
OverlayRegistry.registerOverlayAbove(ForgeIngameGui.HOTBAR_ELEMENT, "Create's Goggle Information", GoggleOverlayRenderer.OVERLAY);
OverlayRegistry.registerOverlayAbove(ForgeIngameGui.HOTBAR_ELEMENT, "Create's Blueprints", BlueprintOverlayRenderer.OVERLAY);
OverlayRegistry.registerOverlayAbove(ForgeIngameGui.HOTBAR_ELEMENT, "Create's Linked Controller", LinkedControllerClientHandler.OVERLAY);
OverlayRegistry.registerOverlayAbove(ForgeIngameGui.HOTBAR_ELEMENT, "Create's Schematics", SCHEMATIC_HANDLER.getOverlayRenderer());
OverlayRegistry.registerOverlayAbove(ForgeIngameGui.HOTBAR_ELEMENT, "Create's Toolboxes", ToolboxHandlerClient.OVERLAY);
}
public static void invalidateRenderers() { public static void invalidateRenderers() {
BUFFER_CACHE.invalidate(); BUFFER_CACHE.invalidate();
@ -120,22 +97,22 @@ public class CreateClient {
if (mc.player == null) if (mc.player == null)
return; return;
if (mc.options.graphicsMode != GraphicsStatus.FABULOUS) if (mc.options.graphicsMode().get() != GraphicsStatus.FABULOUS)
return; return;
if (AllConfigs.CLIENT.ignoreFabulousWarning.get()) if (AllConfigs.CLIENT.ignoreFabulousWarning.get())
return; return;
MutableComponent text = ComponentUtils.wrapInSquareBrackets(new TextComponent("WARN")) MutableComponent text = ComponentUtils.wrapInSquareBrackets(Component.literal("WARN"))
.withStyle(ChatFormatting.GOLD) .withStyle(ChatFormatting.GOLD)
.append(new TextComponent( .append(Component.literal(
" Some of Create's visual features will not be available while Fabulous graphics are enabled!")) " Some of Create's visual features will not be available while Fabulous graphics are enabled!"))
.withStyle(style -> style .withStyle(style -> style
.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/create dismissFabulousWarning")) .withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/create dismissFabulousWarning"))
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new TextComponent("Click here to disable this warning")))); Component.literal("Click here to disable this warning"))));
mc.gui.handleChat(ChatType.CHAT, text, mc.player.getUUID()); mc.player.displayClientMessage(text, false);
} }
} }

View file

@ -1,5 +1,7 @@
package com.simibubi.create.compat.jei; package com.simibubi.create.compat.jei;
import java.util.Optional;
import javax.annotation.ParametersAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -8,11 +10,14 @@ import com.simibubi.create.content.curiosities.tools.BlueprintAssignCompleteReci
import com.simibubi.create.content.curiosities.tools.BlueprintContainer; import com.simibubi.create.content.curiosities.tools.BlueprintContainer;
import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.networking.AllPackets;
import mezz.jei.api.constants.RecipeTypes;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView; import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import mezz.jei.api.recipe.RecipeType;
import mezz.jei.api.recipe.transfer.IRecipeTransferError; import mezz.jei.api.recipe.transfer.IRecipeTransferError;
import mezz.jei.api.recipe.transfer.IRecipeTransferHandler; import mezz.jei.api.recipe.transfer.IRecipeTransferHandler;
import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.item.crafting.CraftingRecipe; import net.minecraft.world.item.crafting.CraftingRecipe;
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
@ -25,8 +30,13 @@ public class BlueprintTransferHandler implements IRecipeTransferHandler<Blueprin
} }
@Override @Override
public Class<CraftingRecipe> getRecipeClass() { public Optional<MenuType<BlueprintContainer>> getMenuType() {
return CraftingRecipe.class; return Optional.empty();
}
@Override
public RecipeType<CraftingRecipe> getRecipeType() {
return RecipeTypes.CRAFTING;
} }
@Override @Override

View file

@ -75,6 +75,7 @@ import mezz.jei.api.JeiPlugin;
import mezz.jei.api.constants.RecipeTypes; import mezz.jei.api.constants.RecipeTypes;
import mezz.jei.api.forge.ForgeTypes; import mezz.jei.api.forge.ForgeTypes;
import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.helpers.IPlatformFluidHelper;
import mezz.jei.api.recipe.category.IRecipeCategory; import mezz.jei.api.recipe.category.IRecipeCategory;
import mezz.jei.api.registration.IGuiHandlerRegistration; import mezz.jei.api.registration.IGuiHandlerRegistration;
import mezz.jei.api.registration.IRecipeCatalystRegistration; import mezz.jei.api.registration.IRecipeCatalystRegistration;
@ -349,7 +350,7 @@ public class CreateJEI implements IModPlugin {
} }
@Override @Override
public void registerFluidSubtypes(ISubtypeRegistration registration) { public <T> void registerFluidSubtypes(ISubtypeRegistration registration, IPlatformFluidHelper<T> platformFluidHelper) {
PotionFluidSubtypeInterpreter interpreter = new PotionFluidSubtypeInterpreter(); PotionFluidSubtypeInterpreter interpreter = new PotionFluidSubtypeInterpreter();
PotionFluid potionFluid = AllFluids.POTION.get(); PotionFluid potionFluid = AllFluids.POTION.get();
registration.registerSubtypeInterpreter(ForgeTypes.FLUID_STACK, potionFluid.getSource(), interpreter); registration.registerSubtypeInterpreter(ForgeTypes.FLUID_STACK, potionFluid.getSource(), interpreter);

View file

@ -27,8 +27,6 @@ import mezz.jei.api.registration.IRecipeRegistration;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.Recipe;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
@ -77,18 +75,6 @@ public abstract class CreateRecipeCategory<T extends Recipe<?>> implements IReci
return icon; return icon;
} }
@Override
@Deprecated
public final ResourceLocation getUid() {
return type.getUid();
}
@Override
@Deprecated
public final Class<? extends T> getRecipeClass() {
return type.getRecipeClass();
}
public void registerRecipes(IRecipeRegistration registration) { public void registerRecipes(IRecipeRegistration registration) {
registration.addRecipes(type, recipes.get()); registration.addRecipes(type, recipes.get());
} }
@ -159,12 +145,12 @@ public abstract class CreateRecipeCategory<T extends Recipe<?>> implements IReci
} }
int amount = mbAmount == -1 ? fluidStack.getAmount() : mbAmount; int amount = mbAmount == -1 ? fluidStack.getAmount() : mbAmount;
Component text = new TextComponent(String.valueOf(amount)).append(Lang.translateDirect("generic.unit.millibuckets")).withStyle(ChatFormatting.GOLD); Component text = Component.literal(String.valueOf(amount)).append(Lang.translateDirect("generic.unit.millibuckets")).withStyle(ChatFormatting.GOLD);
if (tooltip.isEmpty()) if (tooltip.isEmpty())
tooltip.add(0, text); tooltip.add(0, text);
else { else {
List<Component> siblings = tooltip.get(0).getSiblings(); List<Component> siblings = tooltip.get(0).getSiblings();
siblings.add(new TextComponent(" ")); siblings.add(Component.literal(" "));
siblings.add(text); siblings.add(text);
} }
}; };

View file

@ -23,7 +23,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font; import net.minecraft.client.gui.Font;
import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.TooltipFlag;
@ -183,7 +183,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<CraftingRec
return ingredient.getTooltipLines(player, tooltipFlag); return ingredient.getTooltipLines(player, tooltipFlag);
} catch (RuntimeException | LinkageError e) { } catch (RuntimeException | LinkageError e) {
List<Component> list = new ArrayList<>(); List<Component> list = new ArrayList<>();
TranslatableComponent crash = new TranslatableComponent("jei.tooltip.error.crash"); MutableComponent crash = Component.translatable("jei.tooltip.error.crash");
list.add(crash.withStyle(ChatFormatting.RED)); list.add(crash.withStyle(ChatFormatting.RED));
return list; return list;
} }

View file

@ -25,8 +25,7 @@ import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font; import net.minecraft.client.gui.Font;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
@ -100,7 +99,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
AllGuiTextures.JEI_LONG_ARROW.render(matrixStack, 52 + xOffset, 79); AllGuiTextures.JEI_LONG_ARROW.render(matrixStack, 52 + xOffset, 79);
if (!singleOutput) { if (!singleOutput) {
AllGuiTextures.JEI_CHANCE_SLOT.render(matrixStack, 150 + xOffset, 75); AllGuiTextures.JEI_CHANCE_SLOT.render(matrixStack, 150 + xOffset, 75);
Component component = new TextComponent("?").withStyle(ChatFormatting.BOLD); Component component = Component.literal("?").withStyle(ChatFormatting.BOLD);
font.drawShadow(matrixStack, component, font.width(component) / -2 + 8 + 150 + xOffset, 2 + 78, font.drawShadow(matrixStack, component, font.width(component) / -2 + 8 + 150 + xOffset, 2 + 78,
0xefefef); 0xefefef);
} }
@ -109,7 +108,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
matrixStack.pushPose(); matrixStack.pushPose();
matrixStack.translate(15, 9, 0); matrixStack.translate(15, 9, 0);
AllIcons.I_SEQ_REPEAT.render(matrixStack, 50 + xOffset, 75); AllIcons.I_SEQ_REPEAT.render(matrixStack, 50 + xOffset, 75);
Component repeat = new TextComponent("x" + recipe.getLoops()); Component repeat = Component.literal("x" + recipe.getLoops());
font.draw(matrixStack, repeat, 66 + xOffset, 80, 0x888888); font.draw(matrixStack, repeat, 66 + xOffset, 80, 0x888888);
matrixStack.popPose(); matrixStack.popPose();
} }
@ -129,7 +128,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
SequencedRecipe<?> sequencedRecipe = sequence.get(i); SequencedRecipe<?> sequencedRecipe = sequence.get(i);
SequencedAssemblySubCategory subCategory = getSubCategory(sequencedRecipe); SequencedAssemblySubCategory subCategory = getSubCategory(sequencedRecipe);
int subWidth = subCategory.getWidth(); int subWidth = subCategory.getWidth();
TextComponent component = new TextComponent("" + romans[Math.min(i, 6)]); MutableComponent component = Component.literal("" + romans[Math.min(i, 6)]);
font.draw(matrixStack, component, font.width(component) / -2 + subWidth / 2, 2, 0x888888); font.draw(matrixStack, component, font.width(component) / -2 + subWidth / 2, 2, 0x888888);
subCategory.draw(sequencedRecipe, matrixStack, mouseX, mouseY, i); subCategory.draw(sequencedRecipe, matrixStack, mouseX, mouseY, i);
matrixStack.translate(subWidth + margin, 0, 0); matrixStack.translate(subWidth + margin, 0, 0);
@ -144,7 +143,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
public List<Component> getTooltipStrings(SequencedAssemblyRecipe recipe, IRecipeSlotsView iRecipeSlotsView, double mouseX, double mouseY) { public List<Component> getTooltipStrings(SequencedAssemblyRecipe recipe, IRecipeSlotsView iRecipeSlotsView, double mouseX, double mouseY) {
List<Component> tooltip = new ArrayList<>(); List<Component> tooltip = new ArrayList<>();
TranslatableComponent junk = Lang.translateDirect("recipe.assembly.junk"); MutableComponent junk = Lang.translateDirect("recipe.assembly.junk");
boolean singleOutput = recipe.getOutputChance() == 1; boolean singleOutput = recipe.getOutputChance() == 1;
boolean willRepeat = recipe.getLoops() > 1; boolean willRepeat = recipe.getLoops() > 1;

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.contraptions.base; package com.simibubi.create.content.contraptions.base;
import java.util.Random;
import com.simibubi.create.content.contraptions.base.IRotate.SpeedLevel; import com.simibubi.create.content.contraptions.base.IRotate.SpeedLevel;
import com.simibubi.create.content.contraptions.particle.RotationIndicatorParticleData; import com.simibubi.create.content.contraptions.particle.RotationIndicatorParticleData;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
@ -11,6 +9,7 @@ import net.minecraft.core.Direction.Axis;
import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
@ -63,7 +62,7 @@ public class KineticEffectHandler {
return; return;
if (!world.isClientSide) if (!world.isClientSide)
return; return;
Random r = world.random; RandomSource r = world.random;
for (int i = 0; i < amount; i++) { for (int i = 0; i < amount; i++) {
Vec3 motion = VecHelper.offsetRandomly(Vec3.ZERO, r, maxMotion); Vec3 motion = VecHelper.offsetRandomly(Vec3.ZERO, r, maxMotion);
Vec3 position = VecHelper.getCenterOf(kte.getBlockPos()); Vec3 position = VecHelper.getCenterOf(kte.getBlockPos());

View file

@ -15,16 +15,20 @@ import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer
import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.Color; import com.simibubi.create.foundation.utility.Color;
import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.core.Direction.AxisDirection; import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraftforge.client.ChunkRenderTypeSet;
import net.minecraftforge.client.model.data.ModelData;
public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTileEntity> { public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTileEntity> {
@ -55,8 +59,12 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
} }
protected RenderType getRenderType(KineticTileEntity te, BlockState state) { protected RenderType getRenderType(KineticTileEntity te, BlockState state) {
// TODO: this is not very clean
BakedModel model = Minecraft.getInstance()
.getBlockRenderer().getBlockModel(state);
ChunkRenderTypeSet typeSet = model.getRenderTypes(state, RandomSource.create(42L), ModelData.EMPTY);
for (RenderType type : REVERSED_CHUNK_BUFFER_LAYERS) for (RenderType type : REVERSED_CHUNK_BUFFER_LAYERS)
if (ItemBlockRenderTypes.canRenderInLayer(state, type)) if (typeSet.contains(type))
return type; return type;
return null; return null;
} }

View file

@ -153,7 +153,7 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
} }
}); });
if (level instanceof ServerLevel) if (level instanceof ServerLevel)
stateToBreak.spawnAfterBreak((ServerLevel) level, breakingPos, ItemStack.EMPTY); stateToBreak.spawnAfterBreak((ServerLevel) level, breakingPos, ItemStack.EMPTY, true);
level.setBlock(breakingPos, FluidState.createLegacyBlock(), 3); level.setBlock(breakingPos, FluidState.createLegacyBlock(), 3);
} }

View file

@ -1,11 +1,10 @@
package com.simibubi.create.content.contraptions.components.actors; package com.simibubi.create.content.contraptions.components.actors;
import java.util.Random;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.block.CampfireBlock; import net.minecraft.world.level.block.CampfireBlock;
public class CampfireMovementBehaviour implements MovementBehaviour { public class CampfireMovementBehaviour implements MovementBehaviour {
@ -21,7 +20,7 @@ public class CampfireMovementBehaviour implements MovementBehaviour {
return; return;
// Mostly copied from CampfireBlock and CampfireTileEntity // Mostly copied from CampfireBlock and CampfireTileEntity
Random random = context.world.random; RandomSource random = context.world.random;
if (random.nextFloat() < 0.11F) { if (random.nextFloat() < 0.11F) {
for (int i = 0; i < random.nextInt(2) + 2; ++i) { for (int i = 0; i < random.nextInt(2) + 2; ++i) {
context.world.addAlwaysVisibleParticle( context.world.addAlwaysVisibleParticle(

View file

@ -115,7 +115,7 @@ public class SeatBlock extends Block implements ProperWaterloggedBlock {
} }
@Override @Override
public BlockPathTypes getAiPathNodeType(BlockState state, BlockGetter world, BlockPos pos, @Nullable Mob entity) { public BlockPathTypes getBlockPathType(BlockState state, BlockGetter world, BlockPos pos, @Nullable Mob entity) {
return BlockPathTypes.RAIL; return BlockPathTypes.RAIL;
} }

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.contraptions.components.actors.dispenser; package com.simibubi.create.content.contraptions.components.actors.dispenser;
import java.util.Random;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import net.minecraft.Util; import net.minecraft.Util;
@ -11,6 +9,7 @@ import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraft.tags.FluidTags; import net.minecraft.tags.FluidTags;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.MobSpawnType;
@ -129,7 +128,7 @@ public interface IMovedDispenseItemBehaviour {
@Override @Override
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos,
Vec3 facing) { Vec3 facing) {
Random random = context.world.random; RandomSource random = context.world.random;
double x = pos.getX() + facing.x * .7 + .5; double x = pos.getX() + facing.x * .7 + .5;
double y = pos.getY() + facing.y * .7 + .5; double y = pos.getY() + facing.y * .7 + .5;
double z = pos.getZ() + facing.z * .7 + .5; double z = pos.getZ() + facing.z * .7 + .5;

View file

@ -265,8 +265,8 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
List<ItemStack> containers = new ArrayList<>(); List<ItemStack> containers = new ArrayList<>();
groupedItems.grid.values() groupedItems.grid.values()
.forEach(stack -> { .forEach(stack -> {
if (stack.hasContainerItem()) if (stack.hasCraftingRemainingItem())
containers.add(stack.getContainerItem() containers.add(stack.getCraftingRemainingItem()
.copy()); .copy());
}); });

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.contraptions.components.crusher; package com.simibubi.create.content.contraptions.components.crusher;
import java.util.Random;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllShapes; import com.simibubi.create.AllShapes;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
@ -16,6 +14,7 @@ import net.minecraft.core.Direction.Axis;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.NbtUtils;
import net.minecraft.util.RandomSource;
import net.minecraft.world.Difficulty; import net.minecraft.world.Difficulty;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -111,7 +110,7 @@ public class CrushingWheelControllerBlock extends DirectionalBlock implements IT
} }
@Override @Override
public void animateTick(BlockState stateIn, Level worldIn, BlockPos pos, Random rand) { public void animateTick(BlockState stateIn, Level worldIn, BlockPos pos, RandomSource rand) {
if (!stateIn.getValue(VALID)) if (!stateIn.getValue(VALID))
return; return;
if (rand.nextInt(1) != 0) if (rand.nextInt(1) != 0)

View file

@ -3,7 +3,6 @@ package com.simibubi.create.content.contraptions.components.crusher;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.Random;
import java.util.UUID; import java.util.UUID;
import com.simibubi.create.AllRecipeTypes; import com.simibubi.create.AllRecipeTypes;
@ -29,6 +28,7 @@ import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.NbtUtils;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.item.ItemEntity;
@ -283,7 +283,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
else else
particleData = new ItemParticleOption(ParticleTypes.ITEM, stack); particleData = new ItemParticleOption(ParticleTypes.ITEM, stack);
Random r = level.random; RandomSource r = level.random;
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
level.addParticle(particleData, worldPosition.getX() + r.nextFloat(), worldPosition.getY() + r.nextFloat(), level.addParticle(particleData, worldPosition.getX() + r.nextFloat(), worldPosition.getY() + r.nextFloat(),
worldPosition.getZ() + r.nextFloat(), 0, 0, 0); worldPosition.getZ() + r.nextFloat(), 0, 0, 0);

View file

@ -15,8 +15,6 @@ import com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuild
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
@ -59,9 +57,9 @@ public class DeployerApplicationRecipe extends ItemApplicationRecipe implements
ItemStack[] matchingStacks = ingredients.get(1) ItemStack[] matchingStacks = ingredients.get(1)
.getItems(); .getItems();
if (matchingStacks.length == 0) if (matchingStacks.length == 0)
return new TextComponent("Invalid"); return Component.literal("Invalid");
return Lang.translateDirect("recipe.assembly.deploying_item", return Lang.translateDirect("recipe.assembly.deploying_item",
new TranslatableComponent(matchingStacks[0].getDescriptionId()).getString()); Component.translatable(matchingStacks[0].getDescriptionId()).getString());
} }
@Override @Override

View file

@ -135,7 +135,7 @@ public class DeployerFakePlayer extends FakePlayer {
public static void entitiesDontRetaliate(LivingSetAttackTargetEvent event) { public static void entitiesDontRetaliate(LivingSetAttackTargetEvent event) {
if (!(event.getTarget() instanceof DeployerFakePlayer)) if (!(event.getTarget() instanceof DeployerFakePlayer))
return; return;
LivingEntity entityLiving = event.getEntityLiving(); LivingEntity entityLiving = event.getEntity();
if (!(entityLiving instanceof Mob)) if (!(entityLiving instanceof Mob))
return; return;
Mob mob = (Mob) entityLiving; Mob mob = (Mob) entityLiving;

View file

@ -392,7 +392,7 @@ public class DeployerHandler {
Block.getDrops(blockstate, world, pos, tileentity, player, prevHeldItem) Block.getDrops(blockstate, world, pos, tileentity, player, prevHeldItem)
.forEach(item -> player.getInventory().placeItemBackInInventory(item)); .forEach(item -> player.getInventory().placeItemBackInInventory(item));
blockstate.spawnAfterBreak(world, pos, prevHeldItem); blockstate.spawnAfterBreak(world, pos, prevHeldItem, true);
return true; return true;
} }

View file

@ -38,7 +38,7 @@ public class ManualApplicationRecipe extends ItemApplicationRecipe {
@SubscribeEvent @SubscribeEvent
public static void manualApplicationRecipesApplyInWorld(PlayerInteractEvent.RightClickBlock event) { public static void manualApplicationRecipesApplyInWorld(PlayerInteractEvent.RightClickBlock event) {
Level level = event.getWorld(); Level level = event.getLevel();
ItemStack heldItem = event.getItemStack(); ItemStack heldItem = event.getItemStack();
BlockPos pos = event.getPos(); BlockPos pos = event.getPos();
BlockState blockState = level.getBlockState(pos); BlockState blockState = level.getBlockState(pos);
@ -81,12 +81,12 @@ public class ManualApplicationRecipe extends ItemApplicationRecipe {
if (!unbreakable && !keepHeld) { if (!unbreakable && !keepHeld) {
if (heldItem.isDamageableItem()) if (heldItem.isDamageableItem())
heldItem.hurtAndBreak(1, event.getPlayer(), s -> s.broadcastBreakEvent(InteractionHand.MAIN_HAND)); heldItem.hurtAndBreak(1, event.getEntity(), s -> s.broadcastBreakEvent(InteractionHand.MAIN_HAND));
else else
heldItem.shrink(1); heldItem.shrink(1);
} }
awardAdvancements(event.getPlayer(), transformedBlock); awardAdvancements(event.getEntity(), transformedBlock);
event.setCancellationResult(InteractionResult.SUCCESS); event.setCancellationResult(InteractionResult.SUCCESS);
event.setCanceled(true); event.setCanceled(true);

View file

@ -1,6 +1,7 @@
package com.simibubi.create.content.contraptions.components.fan; package com.simibubi.create.content.contraptions.components.fan;
import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance; import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance;
import net.minecraft.client.resources.sounds.SoundInstance;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
@ -9,7 +10,7 @@ public class AirCurrentSound extends AbstractTickableSoundInstance {
private float pitch; private float pitch;
protected AirCurrentSound(SoundEvent p_i46532_1_, float pitch) { protected AirCurrentSound(SoundEvent p_i46532_1_, float pitch) {
super(p_i46532_1_, SoundSource.BLOCKS); super(p_i46532_1_, SoundSource.BLOCKS, SoundInstance.createUnseededRandom());
this.pitch = pitch; this.pitch = pitch;
volume = 0.01f; volume = 0.01f;
looping = true; looping = true;

View file

@ -5,7 +5,6 @@ import java.util.Optional;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllRecipeTypes; import com.simibubi.create.AllRecipeTypes;
import com.simibubi.create.Create;
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCraftingRecipe; import com.simibubi.create.content.contraptions.components.crafter.MechanicalCraftingRecipe;
import com.simibubi.create.content.contraptions.components.press.PressingBehaviour.Mode; import com.simibubi.create.content.contraptions.components.press.PressingBehaviour.Mode;
import com.simibubi.create.content.contraptions.components.press.PressingBehaviour.PressingBehaviourSpecifics; import com.simibubi.create.content.contraptions.components.press.PressingBehaviour.PressingBehaviourSpecifics;
@ -136,7 +135,7 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity implemen
ItemEntity created = ItemEntity created =
new ItemEntity(level, itemEntity.getX(), itemEntity.getY(), itemEntity.getZ(), result); new ItemEntity(level, itemEntity.getX(), itemEntity.getY(), itemEntity.getZ(), result);
created.setDefaultPickUpDelay(); created.setDefaultPickUpDelay();
created.setDeltaMovement(VecHelper.offsetRandomly(Vec3.ZERO, Create.RANDOM, .05f)); created.setDeltaMovement(VecHelper.offsetRandomly(Vec3.ZERO, level.random, .05f));
level.addFreshEntity(created); level.addFreshEntity(created);
} }
item.shrink(1); item.shrink(1);

View file

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.Random;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.function.Supplier; import java.util.function.Supplier;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -34,7 +33,6 @@ import com.simibubi.create.foundation.utility.recipe.RecipeFinder;
import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Registry;
import net.minecraft.core.particles.BlockParticleOption; import net.minecraft.core.particles.BlockParticleOption;
import net.minecraft.core.particles.ItemParticleOption; import net.minecraft.core.particles.ItemParticleOption;
import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleOptions;
@ -43,6 +41,7 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
@ -69,6 +68,7 @@ import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.registries.ForgeRegistries;
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
@ -76,7 +76,7 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
private static final Object cuttingRecipesKey = new Object(); private static final Object cuttingRecipesKey = new Object();
public static final Supplier<RecipeType<?>> woodcuttingRecipeType = public static final Supplier<RecipeType<?>> woodcuttingRecipeType =
Suppliers.memoize(() -> Registry.RECIPE_TYPE.get(new ResourceLocation("druidcraft", "woodcutting"))); Suppliers.memoize(() -> ForgeRegistries.RECIPE_TYPES.getValue(new ResourceLocation("druidcraft", "woodcutting")));
public ProcessingInventory inventory; public ProcessingInventory inventory;
private int recipeIndex; private int recipeIndex;
@ -279,7 +279,7 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
else else
particleData = new ItemParticleOption(ParticleTypes.ITEM, stack); particleData = new ItemParticleOption(ParticleTypes.ITEM, stack);
Random r = level.random; RandomSource r = level.random;
Vec3 v = VecHelper.getCenterOf(this.worldPosition) Vec3 v = VecHelper.getCenterOf(this.worldPosition)
.add(0, 5 / 16f, 0); .add(0, 5 / 16f, 0);
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
@ -302,7 +302,7 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
speed = .125f; speed = .125f;
} }
Random r = level.random; RandomSource r = level.random;
Vec3 vec = getItemMovementVec(); Vec3 vec = getItemMovementVec();
Vec3 pos = VecHelper.getCenterOf(this.worldPosition); Vec3 pos = VecHelper.getCenterOf(this.worldPosition);
float offset = inventory.recipeDuration != 0 ? (float) (inventory.remainingTime) / inventory.recipeDuration : 0; float offset = inventory.recipeDuration != 0 ? (float) (inventory.remainingTime) / inventory.recipeDuration : 0;

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.contraptions.components.steam; package com.simibubi.create.content.contraptions.components.steam;
import java.util.Random;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllShapes; import com.simibubi.create.AllShapes;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
@ -15,6 +13,7 @@ import com.simibubi.create.foundation.utility.placement.PlacementHelpers;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -67,7 +66,7 @@ public class PoweredShaftBlock extends AbstractShaftBlock {
} }
@Override @Override
public void tick(BlockState pState, ServerLevel pLevel, BlockPos pPos, Random pRandom) { public void tick(BlockState pState, ServerLevel pLevel, BlockPos pPos, RandomSource pRandom) {
if (!stillValid(pState, pLevel, pPos)) if (!stillValid(pState, pLevel, pPos))
pLevel.setBlock(pPos, AllBlocks.SHAFT.getDefaultState() pLevel.setBlock(pPos, AllBlocks.SHAFT.getDefaultState()
.setValue(ShaftBlock.AXIS, pState.getValue(AXIS)) .setValue(ShaftBlock.AXIS, pState.getValue(AXIS))

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.contraptions.components.steam.whistle; package com.simibubi.create.content.contraptions.components.steam.whistle;
import java.util.Random;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllShapes; import com.simibubi.create.AllShapes;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
@ -19,6 +17,7 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.util.RandomSource;
import net.minecraft.util.StringRepresentable; import net.minecraft.util.StringRepresentable;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
@ -180,7 +179,7 @@ public class WhistleBlock extends Block implements ITE<WhistleTileEntity>, IWren
} }
@Override @Override
public void tick(BlockState pState, ServerLevel pLevel, BlockPos pPos, Random pRandom) { public void tick(BlockState pState, ServerLevel pLevel, BlockPos pPos, RandomSource pRandom) {
withTileEntityDo(pLevel, pPos, WhistleTileEntity::updatePitch); withTileEntityDo(pLevel, pPos, WhistleTileEntity::updatePitch);
} }

View file

@ -7,6 +7,7 @@ import static com.simibubi.create.AllSoundEvents.WHISTLE_MEDIUM;
import com.simibubi.create.content.contraptions.components.steam.whistle.WhistleBlock.WhistleSize; import com.simibubi.create.content.contraptions.components.steam.whistle.WhistleBlock.WhistleSize;
import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance; import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance;
import net.minecraft.client.resources.sounds.SoundInstance;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
@ -19,7 +20,7 @@ public class WhistleSoundInstance extends AbstractTickableSoundInstance {
public WhistleSoundInstance(WhistleSize size, BlockPos worldPosition) { public WhistleSoundInstance(WhistleSize size, BlockPos worldPosition) {
super((size == WhistleSize.SMALL ? WHISTLE_HIGH : size == WhistleSize.MEDIUM ? WHISTLE_MEDIUM : WHISTLE_LOW) super((size == WhistleSize.SMALL ? WHISTLE_HIGH : size == WhistleSize.MEDIUM ? WHISTLE_MEDIUM : WHISTLE_LOW)
.getMainEvent(), SoundSource.RECORDS); .getMainEvent(), SoundSource.RECORDS, SoundInstance.createUnseededRandom());
this.size = size; this.size = size;
looping = true; looping = true;
active = true; active = true;

View file

@ -25,7 +25,7 @@ import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.MutableComponent;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
@ -110,7 +110,7 @@ public class WhistleTileEntity extends SmartTileEntity implements IHaveGoggleInf
String[] pitches = Lang.translateDirect("generic.notes") String[] pitches = Lang.translateDirect("generic.notes")
.getString() .getString()
.split(";"); .split(";");
TextComponent textComponent = new TextComponent(spacing); MutableComponent textComponent = Component.literal(spacing);
tooltip.add(textComponent.append(Lang.translateDirect("generic.pitch", pitches[pitch % pitches.length]))); tooltip.add(textComponent.append(Lang.translateDirect("generic.pitch", pitches[pitch % pitches.length])));
return true; return true;
} }

View file

@ -86,7 +86,7 @@ import net.minecraft.nbt.Tag;
import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.network.protocol.game.DebugPackets;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.ai.village.poi.PoiType; import net.minecraft.world.entity.ai.village.poi.PoiTypes;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
@ -115,7 +115,7 @@ import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.client.model.data.ModelData;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.IItemHandlerModifiable;
@ -148,7 +148,7 @@ public abstract class Contraption {
private CompletableFuture<Void> simplifiedEntityColliderProvider; private CompletableFuture<Void> simplifiedEntityColliderProvider;
// Client // Client
public Map<BlockPos, IModelData> modelData; public Map<BlockPos, ModelData> modelData;
public Map<BlockPos, BlockEntity> presentTileEntities; public Map<BlockPos, BlockEntity> presentTileEntities;
public List<BlockEntity> maybeInstancedTileEntities; public List<BlockEntity> maybeInstancedTileEntities;
public List<BlockEntity> specialRenderedTileEntities; public List<BlockEntity> specialRenderedTileEntities;
@ -982,7 +982,7 @@ public abstract class Contraption {
// we add the POI data back now // we add the POI data back now
// (code copied from ServerWorld.onBlockStateChange) // (code copied from ServerWorld.onBlockStateChange)
ServerLevel serverWorld = (ServerLevel) world; ServerLevel serverWorld = (ServerLevel) world;
PoiType.forState(block.state) PoiTypes.forState(block.state)
.ifPresent(poiType -> { .ifPresent(poiType -> {
world.getServer() world.getServer()
.execute(() -> { .execute(() -> {
@ -1136,7 +1136,7 @@ public abstract class Contraption {
} }
protected boolean shouldUpdateAfterMovement(StructureBlockInfo info) { protected boolean shouldUpdateAfterMovement(StructureBlockInfo info) {
if (PoiType.forState(info.state) if (PoiTypes.forState(info.state)
.isPresent()) .isPresent())
return false; return false;
if (info.state.getBlock() instanceof SlidingDoorBlock) if (info.state.getBlock() instanceof SlidingDoorBlock)

View file

@ -33,7 +33,7 @@ import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.InputEvent.ClickInputEvent; import net.minecraftforge.client.event.InputEvent;
import net.minecraftforge.event.TickEvent.Phase; import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.event.TickEvent.PlayerTickEvent; import net.minecraftforge.event.TickEvent.PlayerTickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
@ -69,7 +69,7 @@ public class ContraptionHandlerClient {
@SubscribeEvent @SubscribeEvent
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static void rightClickingOnContraptionsGetsHandledLocally(ClickInputEvent event) { public static void rightClickingOnContraptionsGetsHandledLocally(InputEvent.InteractionKeyMappingTriggered event) {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
LocalPlayer player = mc.player; LocalPlayer player = mc.player;

View file

@ -9,7 +9,6 @@ import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
public interface IDisplayAssemblyExceptions { public interface IDisplayAssemblyExceptions {
@ -19,7 +18,7 @@ public interface IDisplayAssemblyExceptions {
return false; return false;
if (!tooltip.isEmpty()) if (!tooltip.isEmpty())
tooltip.add(TextComponent.EMPTY); tooltip.add(Component.empty());
tooltip.add(IHaveGoggleInformation.componentSpacing.plainCopy() tooltip.add(IHaveGoggleInformation.componentSpacing.plainCopy()
.append(Lang.translateDirect("gui.assembly.exception") .append(Lang.translateDirect("gui.assembly.exception")

View file

@ -26,7 +26,7 @@ import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult.Type; import net.minecraft.world.phys.HitResult.Type;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent; import net.minecraftforge.event.level.BlockEvent.EntityPlaceEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.network.PacketDistributor; import net.minecraftforge.network.PacketDistributor;
@ -36,7 +36,7 @@ public class SuperGlueHandler {
@SubscribeEvent @SubscribeEvent
public static void glueListensForBlockPlacement(EntityPlaceEvent event) { public static void glueListensForBlockPlacement(EntityPlaceEvent event) {
LevelAccessor world = event.getWorld(); LevelAccessor world = event.getLevel();
Entity entity = event.getEntity(); Entity entity = event.getEntity();
BlockPos pos = event.getPos(); BlockPos pos = event.getPos();

View file

@ -28,7 +28,7 @@ public class SuperGlueItem extends Item {
@SubscribeEvent @SubscribeEvent
public static void glueItemAlwaysPlacesWhenUsed(PlayerInteractEvent.RightClickBlock event) { public static void glueItemAlwaysPlacesWhenUsed(PlayerInteractEvent.RightClickBlock event) {
if (event.getHitVec() != null) { if (event.getHitVec() != null) {
BlockState blockState = event.getWorld() BlockState blockState = event.getLevel()
.getBlockState(event.getHitVec() .getBlockState(event.getHitVec()
.getBlockPos()); .getBlockPos());
if (blockState.getBlock()instanceof AbstractChassisBlock cb) if (blockState.getBlock()instanceof AbstractChassisBlock cb)

View file

@ -18,7 +18,7 @@ import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.Component;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
@ -62,7 +62,7 @@ public class SuperGlueSelectionHandler {
if (clusterCooldown > 0) { if (clusterCooldown > 0) {
if (clusterCooldown == 25) if (clusterCooldown == 25)
player.displayClientMessage(TextComponent.EMPTY, true); player.displayClientMessage(Component.empty(), true);
CreateClient.OUTLINER.keep(clusterOutlineSlot); CreateClient.OUTLINER.keep(clusterOutlineSlot);
clusterCooldown--; clusterCooldown--;
} }

View file

@ -23,12 +23,12 @@ import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.GameType; import net.minecraft.world.level.GameType;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
import net.minecraftforge.client.gui.ForgeIngameGui; import net.minecraftforge.client.gui.overlay.ForgeGui;
import net.minecraftforge.client.gui.IIngameOverlay; import net.minecraftforge.client.gui.overlay.IGuiOverlay;
public class TrainHUD { public class TrainHUD {
public static final IIngameOverlay OVERLAY = TrainHUD::renderOverlay; public static final IGuiOverlay OVERLAY = TrainHUD::renderOverlay;
static LerpedFloat displayedSpeed = LerpedFloat.linear(); static LerpedFloat displayedSpeed = LerpedFloat.linear();
static LerpedFloat displayedThrottle = LerpedFloat.linear(); static LerpedFloat displayedThrottle = LerpedFloat.linear();
@ -105,7 +105,7 @@ public class TrainHUD {
return cce.getCarriage(); return cce.getCarriage();
} }
public static void renderOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width, public static void renderOverlay(ForgeGui gui, PoseStack poseStack, float partialTicks, int width,
int height) { int height) {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
if (mc.options.hideGui || mc.gameMode.getPlayerMode() == GameType.SPECTATOR) if (mc.options.hideGui || mc.gameMode.getPlayerMode() == GameType.SPECTATOR)

View file

@ -292,7 +292,7 @@ public class CartAssemblerBlock extends BaseRailBlock
.forEach(itemStack -> player.getInventory() .forEach(itemStack -> player.getInventory()
.placeItemBackInInventory(itemStack)); .placeItemBackInInventory(itemStack));
if (world instanceof ServerLevel) if (world instanceof ServerLevel)
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY); state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
world.setBlockAndUpdate(pos, getRailBlock(state)); world.setBlockAndUpdate(pos, getRailBlock(state));
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
} }

View file

@ -195,7 +195,7 @@ public class MinecartContraptionItem extends Item {
@SubscribeEvent @SubscribeEvent
public static void wrenchCanBeUsedToPickUpMinecartContraptions(PlayerInteractEvent.EntityInteract event) { public static void wrenchCanBeUsedToPickUpMinecartContraptions(PlayerInteractEvent.EntityInteract event) {
Entity entity = event.getTarget(); Entity entity = event.getTarget();
Player player = event.getPlayer(); Player player = event.getEntity();
if (player == null || entity == null) if (player == null || entity == null)
return; return;
@ -223,7 +223,7 @@ public class MinecartContraptionItem extends Item {
return; return;
} }
if (event.getWorld().isClientSide) { if (event.getLevel().isClientSide) {
event.setCancellationResult(InteractionResult.SUCCESS); event.setCancellationResult(InteractionResult.SUCCESS);
event.setCanceled(true); event.setCanceled(true);
return; return;

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.contraptions.components.structureMovement.piston; package com.simibubi.create.content.contraptions.components.structureMovement.piston;
import java.util.Random;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllShapes; import com.simibubi.create.AllShapes;
import com.simibubi.create.AllSoundEvents; import com.simibubi.create.AllSoundEvents;
@ -15,6 +13,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.util.StringRepresentable; import net.minecraft.util.StringRepresentable;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
@ -111,7 +110,7 @@ public class MechanicalPistonBlock extends DirectionalAxisKineticBlock implement
} }
@Override @Override
public void tick(BlockState state, ServerLevel worldIn, BlockPos pos, Random r) { public void tick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource r) {
Direction direction = state.getValue(FACING); Direction direction = state.getValue(FACING);
BlockState pole = worldIn.getBlockState(pos.relative(direction.getOpposite())); BlockState pole = worldIn.getBlockState(pos.relative(direction.getOpposite()));
if (!AllBlocks.PISTON_EXTENSION_POLE.has(pole)) if (!AllBlocks.PISTON_EXTENSION_POLE.has(pole))

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.contraptions.components.structureMovement.train; package com.simibubi.create.content.contraptions.components.structureMovement.train;
import java.util.Random;
import com.mojang.math.Vector3f; import com.mojang.math.Vector3f;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.networking.AllPackets;
@ -13,6 +11,7 @@ import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.particles.DustParticleOptions; import net.minecraft.core.particles.DustParticleOptions;
import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.vehicle.AbstractMinecart; import net.minecraft.world.entity.vehicle.AbstractMinecart;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
@ -22,7 +21,7 @@ import net.minecraft.world.phys.Vec3;
public class CouplingHandlerClient { public class CouplingHandlerClient {
static AbstractMinecart selectedCart; static AbstractMinecart selectedCart;
static Random r = new Random(); static RandomSource r = RandomSource.create();
public static void tick() { public static void tick() {
if (selectedCart == null) if (selectedCart == null)

View file

@ -35,7 +35,7 @@ public class MinecartCouplingItem extends Item {
if (!(interacted instanceof AbstractMinecart)) if (!(interacted instanceof AbstractMinecart))
return; return;
AbstractMinecart minecart = (AbstractMinecart) interacted; AbstractMinecart minecart = (AbstractMinecart) interacted;
Player player = event.getPlayer(); Player player = event.getEntity();
if (player == null) if (player == null)
return; return;
LazyOptional<MinecartController> capability = LazyOptional<MinecartController> capability =
@ -60,7 +60,7 @@ public class MinecartCouplingItem extends Item {
protected static boolean onCouplingInteractOnMinecart(PlayerInteractEvent.EntityInteract event, protected static boolean onCouplingInteractOnMinecart(PlayerInteractEvent.EntityInteract event,
AbstractMinecart minecart, Player player, MinecartController controller) { AbstractMinecart minecart, Player player, MinecartController controller) {
Level world = event.getWorld(); Level world = event.getLevel();
if (controller.isFullyCoupled()) { if (controller.isFullyCoupled()) {
if (!world.isClientSide) if (!world.isClientSide)
CouplingHandler.status(player, "two_couplings_max"); CouplingHandler.status(player, "two_couplings_max");
@ -76,7 +76,7 @@ public class MinecartCouplingItem extends Item {
int couplings = (controller.isConnectedToCoupling() ? 1 : 0) + (controller.isLeadingCoupling() ? 1 : 0); int couplings = (controller.isConnectedToCoupling() ? 1 : 0) + (controller.isLeadingCoupling() ? 1 : 0);
if (couplings == 0) if (couplings == 0)
return false; return false;
if (event.getWorld().isClientSide) if (event.getLevel().isClientSide)
return true; return true;
for (boolean forward : Iterate.trueAndFalse) { for (boolean forward : Iterate.trueAndFalse) {

View file

@ -36,7 +36,7 @@ import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.common.util.NonNullConsumer; import net.minecraftforge.common.util.NonNullConsumer;
import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.world.ChunkEvent; import net.minecraftforge.event.level.ChunkEvent;
public class CapabilityMinecartController implements ICapabilitySerializable<CompoundTag> { public class CapabilityMinecartController implements ICapabilitySerializable<CompoundTag> {
@ -144,7 +144,7 @@ public class CapabilityMinecartController implements ICapabilitySerializable<Com
public static void onChunkUnloaded(ChunkEvent.Unload event) { public static void onChunkUnloaded(ChunkEvent.Unload event) {
ChunkPos chunkPos = event.getChunk() ChunkPos chunkPos = event.getChunk()
.getPos(); .getPos();
Map<UUID, MinecartController> carts = loadedMinecartsByUUID.get(event.getWorld()); Map<UUID, MinecartController> carts = loadedMinecartsByUUID.get(event.getLevel());
for (MinecartController minecartController : carts.values()) { for (MinecartController minecartController : carts.values()) {
if (minecartController == null) if (minecartController == null)
continue; continue;
@ -153,7 +153,7 @@ public class CapabilityMinecartController implements ICapabilitySerializable<Com
AbstractMinecart cart = minecartController.cart(); AbstractMinecart cart = minecartController.cart();
if (cart.chunkPosition() if (cart.chunkPosition()
.equals(chunkPos)) .equals(chunkPos))
queuedUnloads.get(event.getWorld()) queuedUnloads.get(event.getLevel())
.add(cart.getUUID()); .add(cart.getUUID());
} }
} }

View file

@ -33,8 +33,8 @@ public class FluidBottleItemHook extends Item {
if (!(itemStack.getItem() instanceof BottleItem)) if (!(itemStack.getItem() instanceof BottleItem))
return; return;
Level world = event.getWorld(); Level world = event.getLevel();
Player player = event.getPlayer(); Player player = event.getEntity();
HitResult raytraceresult = getPlayerPOVHitResult(world, player, ClipContext.Fluid.SOURCE_ONLY); HitResult raytraceresult = getPlayerPOVHitResult(world, player, ClipContext.Fluid.SOURCE_ONLY);
if (raytraceresult.getType() != HitResult.Type.BLOCK) if (raytraceresult.getType() != HitResult.Type.BLOCK)
return; return;

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.contraptions.fluids; package com.simibubi.create.content.contraptions.fluids;
import java.util.Random;
import com.simibubi.create.AllParticleTypes; import com.simibubi.create.AllParticleTypes;
import com.simibubi.create.content.contraptions.fluids.particle.FluidParticleData; import com.simibubi.create.content.contraptions.fluids.particle.FluidParticleData;
import com.simibubi.create.foundation.fluid.FluidHelper; import com.simibubi.create.foundation.fluid.FluidHelper;
@ -13,6 +11,7 @@ import net.minecraft.core.Direction;
import net.minecraft.core.particles.BlockParticleOption; import net.minecraft.core.particles.BlockParticleOption;
import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.FluidState;
@ -22,7 +21,7 @@ import net.minecraftforge.fluids.FluidStack;
public class FluidFX { public class FluidFX {
static Random r = new Random(); static RandomSource r = RandomSource.create();
public static void splash(BlockPos pos, FluidStack fluidStack) { public static void splash(BlockPos pos, FluidStack fluidStack) {
Fluid fluid = fluidStack.getFluid(); Fluid fluid = fluidStack.getFluid();

View file

@ -3,7 +3,6 @@ package com.simibubi.create.content.contraptions.fluids;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Random;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.content.contraptions.fluids.FluidTransportBehaviour.AttachmentTypes; import com.simibubi.create.content.contraptions.fluids.FluidTransportBehaviour.AttachmentTypes;
@ -14,14 +13,16 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.client.model.data.ModelData;
import net.minecraftforge.client.model.data.ModelDataMap.Builder; import net.minecraftforge.client.model.data.ModelData.Builder;
import net.minecraftforge.client.model.data.ModelProperty; import net.minecraftforge.client.model.data.ModelProperty;
public class PipeAttachmentModel extends BakedModelWrapperWithData { public class PipeAttachmentModel extends BakedModelWrapperWithData {
@ -55,25 +56,25 @@ public class PipeAttachmentModel extends BakedModelWrapperWithData {
data.putBracket(bracket.getBracket()); data.putBracket(bracket.getBracket());
data.setEncased(FluidPipeBlock.shouldDrawCasing(world, pos, state)); data.setEncased(FluidPipeBlock.shouldDrawCasing(world, pos, state));
return builder.withInitial(PIPE_PROPERTY, data); return builder.with(PIPE_PROPERTY, data);
} }
@Override @Override
public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand, IModelData data) { public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource rand, ModelData data, RenderType renderType) {
List<BakedQuad> quads = super.getQuads(state, side, rand, data); List<BakedQuad> quads = super.getQuads(state, side, rand, data, renderType);
if (data.hasProperty(PIPE_PROPERTY)) { if (data.has(PIPE_PROPERTY)) {
PipeModelData pipeData = data.getData(PIPE_PROPERTY); PipeModelData pipeData = data.get(PIPE_PROPERTY);
quads = side != null && pipeData.hasRim(side) ? new ArrayList<>() : new ArrayList<>(quads); quads = side != null && pipeData.hasRim(side) ? new ArrayList<>() : new ArrayList<>(quads);
addQuads(quads, state, side, rand, data, pipeData); addQuads(quads, state, side, rand, data, pipeData, renderType);
} }
return quads; return quads;
} }
private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, Random rand, IModelData data, private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, RandomSource rand, ModelData data,
PipeModelData pipeData) { PipeModelData pipeData, RenderType renderType) {
BakedModel bracket = pipeData.getBracket(); BakedModel bracket = pipeData.getBracket();
if (bracket != null) if (bracket != null)
quads.addAll(bracket.getQuads(state, side, rand, data)); quads.addAll(bracket.getQuads(state, side, rand, data, renderType));
if (hideAttachmentConnector && side == Direction.UP) if (hideAttachmentConnector && side == Direction.UP)
return; return;
for (Direction d : Iterate.directions) for (Direction d : Iterate.directions)
@ -81,10 +82,10 @@ public class PipeAttachmentModel extends BakedModelWrapperWithData {
quads.addAll(AllBlockPartials.PIPE_ATTACHMENTS.get(pipeData.getRim(d)) quads.addAll(AllBlockPartials.PIPE_ATTACHMENTS.get(pipeData.getRim(d))
.get(d) .get(d)
.get() .get()
.getQuads(state, side, rand, data)); .getQuads(state, side, rand, data, renderType));
if (pipeData.isEncased()) if (pipeData.isEncased())
quads.addAll(AllBlockPartials.FLUID_PIPE_CASING.get() quads.addAll(AllBlockPartials.FLUID_PIPE_CASING.get()
.getQuads(state, side, rand, data)); .getQuads(state, side, rand, data, renderType));
} }
private static class PipeModelData { private static class PipeModelData {

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.contraptions.fluids; package com.simibubi.create.content.contraptions.fluids;
import java.util.Random;
import com.simibubi.create.AllShapes; import com.simibubi.create.AllShapes;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock; import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock;
@ -13,6 +11,7 @@ import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.network.protocol.game.DebugPackets;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
@ -130,7 +129,7 @@ public class PumpBlock extends DirectionalKineticBlock implements SimpleWaterlog
} }
@Override @Override
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random r) { public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource r) {
FluidPropagator.propagateChangedPipe(world, pos, state); FluidPropagator.propagateChangedPipe(world, pos, state);
} }

View file

@ -14,7 +14,6 @@ import com.simibubi.create.foundation.fluid.FluidIngredient;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
@ -70,7 +69,7 @@ public class FillingRecipe extends ProcessingRecipe<RecipeWrapper> implements IA
List<FluidStack> matchingFluidStacks = fluidIngredients.get(0) List<FluidStack> matchingFluidStacks = fluidIngredients.get(0)
.getMatchingFluidStacks(); .getMatchingFluidStacks();
if (matchingFluidStacks.size() == 0) if (matchingFluidStacks.size() == 0)
return new TextComponent("Invalid"); return Component.literal("Invalid");
return Lang.translateDirect("recipe.assembly.spout_filling_fluid", return Lang.translateDirect("recipe.assembly.spout_filling_fluid",
matchingFluidStacks.get(0).getDisplayName().getString()); matchingFluidStacks.get(0).getDisplayName().getString());
} }

View file

@ -2,7 +2,6 @@ package com.simibubi.create.content.contraptions.fluids.pipes;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.Random;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllShapes; import com.simibubi.create.AllShapes;
@ -20,6 +19,7 @@ import net.minecraft.core.Direction.Axis;
import net.minecraft.core.Direction.AxisDirection; import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.network.protocol.game.DebugPackets;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
@ -108,7 +108,7 @@ public class AxisPipeBlock extends RotatedPillarBlock implements IWrenchableWith
} }
@Override @Override
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random r) { public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource r) {
FluidPropagator.propagateChangedPipe(world, pos, state); FluidPropagator.propagateChangedPipe(world, pos, state);
} }

View file

@ -8,7 +8,6 @@ import static net.minecraft.world.level.block.state.properties.BlockStatePropert
import static net.minecraft.world.level.block.state.properties.BlockStateProperties.WEST; import static net.minecraft.world.level.block.state.properties.BlockStateProperties.WEST;
import java.util.Map; import java.util.Map;
import java.util.Random;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
@ -25,6 +24,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.network.protocol.game.DebugPackets;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -101,7 +101,7 @@ public class EncasedPipeBlock extends Block implements IWrenchable, ISpecialBloc
} }
@Override @Override
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random r) { public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource r) {
FluidPropagator.propagateChangedPipe(world, pos, state); FluidPropagator.propagateChangedPipe(world, pos, state);
} }

View file

@ -2,7 +2,6 @@ package com.simibubi.create.content.contraptions.fluids.pipes;
import java.util.Arrays; import java.util.Arrays;
import java.util.Optional; import java.util.Optional;
import java.util.Random;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -23,6 +22,7 @@ import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.network.protocol.game.DebugPackets;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
@ -171,7 +171,7 @@ public class FluidPipeBlock extends PipeBlock
} }
@Override @Override
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random r) { public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource r) {
FluidPropagator.propagateChangedPipe(world, pos, state); FluidPropagator.propagateChangedPipe(world, pos, state);
} }

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.contraptions.fluids.pipes; package com.simibubi.create.content.contraptions.fluids.pipes;
import java.util.Random;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import com.simibubi.create.AllShapes; import com.simibubi.create.AllShapes;
@ -16,6 +14,7 @@ import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.network.protocol.game.DebugPackets;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
@ -122,7 +121,7 @@ public class FluidValveBlock extends DirectionalAxisKineticBlock implements IAxi
} }
@Override @Override
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random r) { public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource r) {
FluidPropagator.propagateChangedPipe(world, pos, state); FluidPropagator.propagateChangedPipe(world, pos, state);
} }

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.contraptions.fluids.pipes; package com.simibubi.create.content.contraptions.fluids.pipes;
import java.util.Random;
import com.simibubi.create.AllShapes; import com.simibubi.create.AllShapes;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.fluids.FluidPropagator; import com.simibubi.create.content.contraptions.fluids.FluidPropagator;
@ -16,6 +14,7 @@ import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.network.protocol.game.DebugPackets;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.BlockPlaceContext;
@ -124,7 +123,7 @@ public class SmartFluidPipeBlock extends FaceAttachedHorizontalDirectionalBlock
} }
@Override @Override
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random r) { public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource r) {
FluidPropagator.propagateChangedPipe(world, pos, state); FluidPropagator.propagateChangedPipe(world, pos, state);
} }

View file

@ -10,7 +10,6 @@ import com.simibubi.create.foundation.utility.NBTHelper;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag; import net.minecraft.nbt.ListTag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.item.alchemy.Potion;
@ -82,7 +81,7 @@ public class PotionFluid extends VirtualFluid {
@Override @Override
public Component getDisplayName(FluidStack stack) { public Component getDisplayName(FluidStack stack) {
return new TranslatableComponent(getTranslationKey(stack)); return Component.translatable(getTranslationKey(stack));
} }
@Override @Override

View file

@ -14,8 +14,7 @@ import com.simibubi.create.foundation.utility.Pair;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.util.Tuple; import net.minecraft.util.Tuple;
import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffectInstance;
@ -105,10 +104,10 @@ public class PotionFluidHandler {
List<MobEffectInstance> list = PotionUtils.getAllEffects(fs.getOrCreateTag()); List<MobEffectInstance> list = PotionUtils.getAllEffects(fs.getOrCreateTag());
List<Tuple<String, AttributeModifier>> list1 = Lists.newArrayList(); List<Tuple<String, AttributeModifier>> list1 = Lists.newArrayList();
if (list.isEmpty()) { if (list.isEmpty()) {
tooltip.add((new TranslatableComponent("effect.none")).withStyle(ChatFormatting.GRAY)); tooltip.add((Component.translatable("effect.none")).withStyle(ChatFormatting.GRAY));
} else { } else {
for (MobEffectInstance effectinstance : list) { for (MobEffectInstance effectinstance : list) {
TranslatableComponent textcomponent = new TranslatableComponent(effectinstance.getDescriptionId()); MutableComponent textcomponent = Component.translatable(effectinstance.getDescriptionId());
MobEffect effect = effectinstance.getEffect(); MobEffect effect = effectinstance.getEffect();
Map<Attribute, AttributeModifier> map = effect.getAttributeModifiers(); Map<Attribute, AttributeModifier> map = effect.getAttributeModifiers();
if (!map.isEmpty()) { if (!map.isEmpty()) {
@ -125,7 +124,7 @@ public class PotionFluidHandler {
if (effectinstance.getAmplifier() > 0) { if (effectinstance.getAmplifier() > 0) {
textcomponent.append(" ") textcomponent.append(" ")
.append(new TranslatableComponent("potion.potency." + effectinstance.getAmplifier()).getString()); .append(Component.translatable("potion.potency." + effectinstance.getAmplifier()).getString());
} }
if (effectinstance.getDuration() > 20) { if (effectinstance.getDuration() > 20) {
@ -140,8 +139,8 @@ public class PotionFluidHandler {
} }
if (!list1.isEmpty()) { if (!list1.isEmpty()) {
tooltip.add(new TextComponent("")); tooltip.add(Component.literal(""));
tooltip.add((new TranslatableComponent("potion.whenDrank")).withStyle(ChatFormatting.DARK_PURPLE)); tooltip.add((Component.translatable("potion.whenDrank")).withStyle(ChatFormatting.DARK_PURPLE));
for (Tuple<String, AttributeModifier> tuple : list1) { for (Tuple<String, AttributeModifier> tuple : list1) {
AttributeModifier attributemodifier2 = tuple.getB(); AttributeModifier attributemodifier2 = tuple.getB();
@ -155,19 +154,19 @@ public class PotionFluidHandler {
} }
if (d0 > 0.0D) { if (d0 > 0.0D) {
tooltip.add((new TranslatableComponent( tooltip.add((Component.translatable(
"attribute.modifier.plus." + attributemodifier2.getOperation() "attribute.modifier.plus." + attributemodifier2.getOperation()
.toValue(), .toValue(),
ItemStack.ATTRIBUTE_MODIFIER_FORMAT.format(d1), ItemStack.ATTRIBUTE_MODIFIER_FORMAT.format(d1),
new TranslatableComponent(tuple.getA()))) Component.translatable(tuple.getA())))
.withStyle(ChatFormatting.BLUE)); .withStyle(ChatFormatting.BLUE));
} else if (d0 < 0.0D) { } else if (d0 < 0.0D) {
d1 = d1 * -1.0D; d1 = d1 * -1.0D;
tooltip.add((new TranslatableComponent( tooltip.add((Component.translatable(
"attribute.modifier.take." + attributemodifier2.getOperation() "attribute.modifier.take." + attributemodifier2.getOperation()
.toValue(), .toValue(),
ItemStack.ATTRIBUTE_MODIFIER_FORMAT.format(d1), ItemStack.ATTRIBUTE_MODIFIER_FORMAT.format(d1),
new TranslatableComponent(tuple.getA()))) Component.translatable(tuple.getA())))
.withStyle(ChatFormatting.RED)); .withStyle(ChatFormatting.RED));
} }
} }

View file

@ -29,7 +29,6 @@ import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
@ -147,8 +146,8 @@ public class BoilerData {
if (!isActive()) if (!isActive())
return false; return false;
Component indent = new TextComponent(IHaveGoggleInformation.spacing); Component indent = Component.literal(IHaveGoggleInformation.spacing);
Component indent2 = new TextComponent(IHaveGoggleInformation.spacing + " "); Component indent2 = Component.literal(IHaveGoggleInformation.spacing + " ");
calcMinMaxForSize(boilerSize); calcMinMaxForSize(boilerSize);
@ -169,7 +168,7 @@ public class BoilerData {
double totalSU = getEngineEfficiency(boilerSize) * 16 * Math.max(boilerLevel, attachedEngines) double totalSU = getEngineEfficiency(boilerSize) * 16 * Math.max(boilerLevel, attachedEngines)
* BlockStressValues.getCapacity(AllBlocks.STEAM_ENGINE.get()); * BlockStressValues.getCapacity(AllBlocks.STEAM_ENGINE.get());
tooltip.add(Lang.empty()); tooltip.add(Component.empty());
Lang.translate("tooltip.capacityProvided") Lang.translate("tooltip.capacityProvided")
.style(ChatFormatting.GRAY) .style(ChatFormatting.GRAY)
@ -234,12 +233,12 @@ public class BoilerData {
} }
private MutableComponent blockComponent(int level) { private MutableComponent blockComponent(int level) {
return new TextComponent( return Component.literal(
"" + "\u2588".repeat(minValue) + "\u2592".repeat(level - minValue) + "\u2591".repeat(maxValue - level)); "" + "\u2588".repeat(minValue) + "\u2592".repeat(level - minValue) + "\u2591".repeat(maxValue - level));
} }
private MutableComponent barComponent(int level) { private MutableComponent barComponent(int level) {
return TextComponent.EMPTY.copy() return Component.empty()
.append(bars(Math.max(0, minValue - 1), ChatFormatting.DARK_GREEN)) .append(bars(Math.max(0, minValue - 1), ChatFormatting.DARK_GREEN))
.append(bars(minValue > 0 ? 1 : 0, ChatFormatting.GREEN)) .append(bars(minValue > 0 ? 1 : 0, ChatFormatting.GREEN))
.append(bars(Math.max(0, level - minValue), ChatFormatting.DARK_GREEN)) .append(bars(Math.max(0, level - minValue), ChatFormatting.DARK_GREEN))
@ -250,7 +249,7 @@ public class BoilerData {
} }
private MutableComponent bars(int level, ChatFormatting format) { private MutableComponent bars(int level, ChatFormatting format) {
return new TextComponent(Strings.repeat('|', level)).withStyle(format); return Component.literal(Strings.repeat('|', level)).withStyle(format);
} }
public boolean evaluate(FluidTankTileEntity controller) { public boolean evaluate(FluidTankTileEntity controller) {

View file

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Random;
import com.simibubi.create.AllSpriteShifts; import com.simibubi.create.AllSpriteShifts;
import com.simibubi.create.api.connectivity.ConnectivityHandler; import com.simibubi.create.api.connectivity.ConnectivityHandler;
@ -12,14 +11,16 @@ import com.simibubi.create.foundation.block.connected.CTModel;
import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry; import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry;
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.client.model.data.ModelData;
import net.minecraftforge.client.model.data.ModelDataMap.Builder; import net.minecraftforge.client.model.data.ModelData.Builder;
import net.minecraftforge.client.model.data.ModelProperty; import net.minecraftforge.client.model.data.ModelProperty;
public class FluidTankModel extends CTModel { public class FluidTankModel extends CTModel {
@ -46,22 +47,22 @@ public class FluidTankModel extends CTModel {
CullData cullData = new CullData(); CullData cullData = new CullData();
for (Direction d : Iterate.horizontalDirections) for (Direction d : Iterate.horizontalDirections)
cullData.setCulled(d, ConnectivityHandler.isConnected(world, pos, pos.relative(d))); cullData.setCulled(d, ConnectivityHandler.isConnected(world, pos, pos.relative(d)));
return super.gatherModelData(builder, world, pos, state).withInitial(CULL_PROPERTY, cullData); return super.gatherModelData(builder, world, pos, state).with(CULL_PROPERTY, cullData);
} }
@Override @Override
public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand, IModelData extraData) { public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource rand, ModelData extraData, RenderType renderType) {
if (side != null) if (side != null)
return Collections.emptyList(); return Collections.emptyList();
List<BakedQuad> quads = new ArrayList<>(); List<BakedQuad> quads = new ArrayList<>();
for (Direction d : Iterate.directions) { for (Direction d : Iterate.directions) {
if (extraData.hasProperty(CULL_PROPERTY) && extraData.getData(CULL_PROPERTY) if (extraData.has(CULL_PROPERTY) && extraData.get(CULL_PROPERTY)
.isCulled(d)) .isCulled(d))
continue; continue;
quads.addAll(super.getQuads(state, d, rand, extraData)); quads.addAll(super.getQuads(state, d, rand, extraData, renderType));
} }
quads.addAll(super.getQuads(state, null, rand, extraData)); quads.addAll(super.getQuads(state, null, rand, extraData, renderType));
return quads; return quads;
} }

View file

@ -13,7 +13,6 @@ import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.FormattedText; import net.minecraft.network.chat.FormattedText;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
@ -24,26 +23,26 @@ public class GoggleConfigScreen extends AbstractSimiScreen {
private final List<Component> tooltip; private final List<Component> tooltip;
public GoggleConfigScreen() { public GoggleConfigScreen() {
Component componentSpacing = new TextComponent(" "); Component componentSpacing = Component.literal(" ");
tooltip = new ArrayList<>(); tooltip = new ArrayList<>();
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translateDirect("gui.config.overlay1"))); .append(Lang.translateDirect("gui.config.overlay1")));
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translateDirect("gui.config.overlay2") .append(Lang.translateDirect("gui.config.overlay2")
.withStyle(ChatFormatting.GRAY))); .withStyle(ChatFormatting.GRAY)));
tooltip.add(TextComponent.EMPTY); tooltip.add(Component.empty());
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translateDirect("gui.config.overlay3"))); .append(Lang.translateDirect("gui.config.overlay3")));
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translateDirect("gui.config.overlay4"))); .append(Lang.translateDirect("gui.config.overlay4")));
tooltip.add(TextComponent.EMPTY); tooltip.add(Component.empty());
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translateDirect("gui.config.overlay5") .append(Lang.translateDirect("gui.config.overlay5")
.withStyle(ChatFormatting.GRAY))); .withStyle(ChatFormatting.GRAY)));
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translateDirect("gui.config.overlay6") .append(Lang.translateDirect("gui.config.overlay6")
.withStyle(ChatFormatting.GRAY))); .withStyle(ChatFormatting.GRAY)));
tooltip.add(TextComponent.EMPTY); tooltip.add(Component.empty());
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translateDirect("gui.config.overlay7"))); .append(Lang.translateDirect("gui.config.overlay7")));
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()

View file

@ -30,7 +30,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.FormattedText; import net.minecraft.network.chat.FormattedText;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.GameType; import net.minecraft.world.level.GameType;
@ -38,19 +37,19 @@ import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.HitResult;
import net.minecraftforge.client.gui.ForgeIngameGui; import net.minecraftforge.client.gui.overlay.ForgeGui;
import net.minecraftforge.client.gui.IIngameOverlay; import net.minecraftforge.client.gui.overlay.IGuiOverlay;
public class GoggleOverlayRenderer { public class GoggleOverlayRenderer {
public static final IIngameOverlay OVERLAY = GoggleOverlayRenderer::renderOverlay; public static final IGuiOverlay OVERLAY = GoggleOverlayRenderer::renderOverlay;
private static final Map<Object, OutlineEntry> outlines = CreateClient.OUTLINER.getOutlines(); private static final Map<Object, OutlineEntry> outlines = CreateClient.OUTLINER.getOutlines();
public static int hoverTicks = 0; public static int hoverTicks = 0;
public static BlockPos lastHovered = null; public static BlockPos lastHovered = null;
public static void renderOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width, public static void renderOverlay(ForgeGui gui, PoseStack poseStack, float partialTicks, int width,
int height) { int height) {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
if (mc.options.hideGui || mc.gameMode.getPlayerMode() == GameType.SPECTATOR) if (mc.options.hideGui || mc.gameMode.getPlayerMode() == GameType.SPECTATOR)
@ -100,7 +99,7 @@ public class GoggleOverlayRenderer {
if (hasHoveringInformation) { if (hasHoveringInformation) {
if (!tooltip.isEmpty()) if (!tooltip.isEmpty())
tooltip.add(TextComponent.EMPTY); tooltip.add(Component.empty());
IHaveHoveringInformation hte = (IHaveHoveringInformation) te; IHaveHoveringInformation hte = (IHaveHoveringInformation) te;
hoverAddedInformation = hte.addToTooltip(tooltip, mc.player.isShiftKeyDown()); hoverAddedInformation = hte.addToTooltip(tooltip, mc.player.isShiftKeyDown());
@ -143,11 +142,11 @@ public class GoggleOverlayRenderer {
if (!pistonFound) if (!pistonFound)
return; return;
if (!tooltip.isEmpty()) if (!tooltip.isEmpty())
tooltip.add(TextComponent.EMPTY); tooltip.add(Component.empty());
tooltip.add(IHaveGoggleInformation.componentSpacing.plainCopy() tooltip.add(IHaveGoggleInformation.componentSpacing.plainCopy()
.append(Lang.translateDirect("gui.goggles.pole_length")) .append(Lang.translateDirect("gui.goggles.pole_length"))
.append(new TextComponent(" " + poles))); .append(Component.literal(" " + poles)));
} }
if (tooltip.isEmpty()) if (tooltip.isEmpty())

View file

@ -14,11 +14,11 @@ public class GogglesModel extends BakedModelWrapper<BakedModel> {
} }
@Override @Override
public BakedModel handlePerspective(TransformType cameraTransformType, PoseStack mat) { public BakedModel applyTransform(TransformType cameraTransformType, PoseStack mat, boolean leftHanded) {
if (cameraTransformType == TransformType.HEAD) if (cameraTransformType == TransformType.HEAD)
return AllBlockPartials.GOGGLES.get() return AllBlockPartials.GOGGLES.get()
.handlePerspective(cameraTransformType, mat); .applyTransform(cameraTransformType, mat, leftHanded);
return super.handlePerspective(cameraTransformType, mat); return super.applyTransform(cameraTransformType, mat, leftHanded);
} }
} }

View file

@ -8,7 +8,6 @@ import com.simibubi.create.foundation.utility.LangBuilder;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler;
@ -27,7 +26,7 @@ public interface IHaveGoggleInformation {
* Use Lang.[...].forGoggles(list) * Use Lang.[...].forGoggles(list)
*/ */
@Deprecated @Deprecated
Component componentSpacing = new TextComponent(spacing); Component componentSpacing = Component.literal(spacing);
/** /**
* this method will be called when looking at a TileEntity that implemented this * this method will be called when looking at a TileEntity that implemented this

View file

@ -19,7 +19,6 @@ import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.Container; import net.minecraft.world.Container;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
@ -239,7 +238,7 @@ public class SequencedAssemblyRecipe implements Recipe<RecipeWrapper> {
int length = sequencedAssemblyRecipe.sequence.size(); int length = sequencedAssemblyRecipe.sequence.size();
int step = sequencedAssemblyRecipe.getStep(stack); int step = sequencedAssemblyRecipe.getStep(stack);
int total = length * sequencedAssemblyRecipe.loops; int total = length * sequencedAssemblyRecipe.loops;
toolTip.add(new TextComponent("")); toolTip.add(Component.literal(""));
toolTip.add(Lang.translateDirect("recipe.sequenced_assembly") toolTip.add(Lang.translateDirect("recipe.sequenced_assembly")
.withStyle(ChatFormatting.GRAY)); .withStyle(ChatFormatting.GRAY));
toolTip.add(Lang.translateDirect("recipe.assembly.progress", step, total) toolTip.add(Lang.translateDirect("recipe.assembly.progress", step, total)
@ -256,7 +255,7 @@ public class SequencedAssemblyRecipe implements Recipe<RecipeWrapper> {
toolTip.add(Lang.translateDirect("recipe.assembly.next", textComponent) toolTip.add(Lang.translateDirect("recipe.assembly.next", textComponent)
.withStyle(ChatFormatting.AQUA)); .withStyle(ChatFormatting.AQUA));
else else
toolTip.add(new TextComponent("-> ").append(textComponent) toolTip.add(Component.literal("-> ").append(textComponent)
.withStyle(ChatFormatting.DARK_AQUA)); .withStyle(ChatFormatting.DARK_AQUA));
} }

View file

@ -10,10 +10,8 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.GsonHelper; import net.minecraft.util.GsonHelper;
import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraftforge.registries.ForgeRegistryEntry;
public class SequencedAssemblyRecipeSerializer extends ForgeRegistryEntry<RecipeSerializer<?>> public class SequencedAssemblyRecipeSerializer implements RecipeSerializer<SequencedAssemblyRecipe> {
implements RecipeSerializer<SequencedAssemblyRecipe> {
public SequencedAssemblyRecipeSerializer() {} public SequencedAssemblyRecipeSerializer() {}

View file

@ -2,7 +2,6 @@ package com.simibubi.create.content.contraptions.particle;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import com.simibubi.create.Create;
import com.simibubi.create.content.contraptions.components.fan.IAirCurrentSource; import com.simibubi.create.content.contraptions.components.fan.IAirCurrentSource;
import com.simibubi.create.content.contraptions.processing.InWorldProcessing; import com.simibubi.create.content.contraptions.processing.InWorldProcessing;
import com.simibubi.create.foundation.utility.Color; import com.simibubi.create.foundation.utility.Color;
@ -35,7 +34,7 @@ public class AirFlowParticle extends SimpleAnimatedParticle {
this.lifetime = 40; this.lifetime = 40;
hasPhysics = false; hasPhysics = false;
selectSprite(7); selectSprite(7);
Vec3 offset = VecHelper.offsetRandomly(Vec3.ZERO, Create.RANDOM, .25f); Vec3 offset = VecHelper.offsetRandomly(Vec3.ZERO, world.random, .25f);
this.setPos(x + offset.x, y + offset.y, z + offset.z); this.setPos(x + offset.x, y + offset.y, z + offset.z);
this.xo = x; this.xo = x;
this.yo = y; this.yo = y;

View file

@ -2,13 +2,13 @@ package com.simibubi.create.content.contraptions.particle;
import com.mojang.serialization.Codec; import com.mojang.serialization.Codec;
import net.minecraft.client.particle.ParticleEngine;
import net.minecraft.client.particle.ParticleProvider; import net.minecraft.client.particle.ParticleProvider;
import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleOptions.Deserializer; import net.minecraft.core.particles.ParticleOptions.Deserializer;
import net.minecraft.core.particles.ParticleType; import net.minecraft.core.particles.ParticleType;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
public interface ICustomParticleData<T extends ParticleOptions> { public interface ICustomParticleData<T extends ParticleOptions> {
@ -30,8 +30,8 @@ public interface ICustomParticleData<T extends ParticleOptions> {
public ParticleProvider<T> getFactory(); public ParticleProvider<T> getFactory();
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public default void register(ParticleType<T> type, ParticleEngine particles) { public default void register(ParticleType<T> type, RegisterParticleProvidersEvent event) {
particles.register(type, getFactory()); event.register(type, getFactory());
} }
} }

View file

@ -2,7 +2,6 @@ package com.simibubi.create.content.contraptions.particle;
import com.mojang.serialization.Codec; import com.mojang.serialization.Codec;
import net.minecraft.client.particle.ParticleEngine;
import net.minecraft.client.particle.ParticleEngine.SpriteParticleRegistration; import net.minecraft.client.particle.ParticleEngine.SpriteParticleRegistration;
import net.minecraft.client.particle.ParticleProvider; import net.minecraft.client.particle.ParticleProvider;
import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleOptions;
@ -10,6 +9,7 @@ import net.minecraft.core.particles.ParticleOptions.Deserializer;
import net.minecraft.core.particles.ParticleType; import net.minecraft.core.particles.ParticleType;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
public interface ICustomParticleDataWithSprite<T extends ParticleOptions> extends ICustomParticleData<T> { public interface ICustomParticleDataWithSprite<T extends ParticleOptions> extends ICustomParticleData<T> {
@ -36,8 +36,8 @@ public interface ICustomParticleDataWithSprite<T extends ParticleOptions> extend
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public default void register(ParticleType<T> type, ParticleEngine particles) { public default void register(ParticleType<T> type, RegisterParticleProvidersEvent event) {
particles.register(type, getMetaFactory()); event.register(type, getMetaFactory());
} }
} }

View file

@ -101,13 +101,13 @@ public class BasinRecipe extends ProcessingRecipe<SmartInventory> {
if (!ingredient.test(extracted)) if (!ingredient.test(extracted))
continue; continue;
// Catalyst items are never consumed // Catalyst items are never consumed
if (extracted.hasContainerItem() && extracted.getContainerItem() if (extracted.hasCraftingRemainingItem() && extracted.getCraftingRemainingItem()
.sameItem(extracted)) .sameItem(extracted))
continue Ingredients; continue Ingredients;
if (!simulate) if (!simulate)
availableItems.extractItem(slot, 1, false); availableItems.extractItem(slot, 1, false);
else if (extracted.hasContainerItem()) else if (extracted.hasCraftingRemainingItem())
recipeOutputItems.add(extracted.getContainerItem() recipeOutputItems.add(extracted.getCraftingRemainingItem()
.copy()); .copy());
extractedItemsFromSlot[slot]++; extractedItemsFromSlot[slot]++;
continue Ingredients; continue Ingredients;

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.contraptions.processing; package com.simibubi.create.content.contraptions.processing;
import java.util.Random;
import com.jozufozu.flywheel.util.transform.TransformStack; import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.foundation.fluid.FluidRenderer; import com.simibubi.create.foundation.fluid.FluidRenderer;
@ -21,6 +19,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
@ -49,7 +48,7 @@ public class BasinRenderer extends SmartTileEntityRenderer<BasinTileEntity> {
TransformStack.cast(ms) TransformStack.cast(ms)
.rotateY(basin.ingredientRotation.getValue(partialTicks)); .rotateY(basin.ingredientRotation.getValue(partialTicks));
Random r = new Random(pos.hashCode()); RandomSource r = RandomSource.create(pos.hashCode());
Vec3 baseVector = new Vec3(.125, level, 0); Vec3 baseVector = new Vec3(.125, level, 0);
IItemHandlerModifiable inv = basin.itemCapability.orElse(new ItemStackHandler()); IItemHandlerModifiable inv = basin.itemCapability.orElse(new ItemStackHandler());

View file

@ -5,7 +5,6 @@ import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.Random;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@ -47,6 +46,7 @@ import net.minecraft.nbt.StringTag;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
@ -525,7 +525,7 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor
if (simulate) if (simulate)
return true; return true;
for (ItemStack itemStack : outputItems) { for (ItemStack itemStack : outputItems) {
if (itemStack.hasContainerItem() && itemStack.getContainerItem() if (itemStack.hasCraftingRemainingItem() && itemStack.getCraftingRemainingItem()
.sameItem(itemStack)) .sameItem(itemStack))
continue; continue;
spoutputBuffer.add(itemStack.copy()); spoutputBuffer.add(itemStack.copy());
@ -570,7 +570,7 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor
private boolean acceptItemOutputsIntoBasin(List<ItemStack> outputItems, boolean simulate, IItemHandler targetInv) { private boolean acceptItemOutputsIntoBasin(List<ItemStack> outputItems, boolean simulate, IItemHandler targetInv) {
for (ItemStack itemStack : outputItems) { for (ItemStack itemStack : outputItems) {
// Catalyst items are never consumed // Catalyst items are never consumed
if (itemStack.hasContainerItem() && itemStack.getContainerItem() if (itemStack.hasCraftingRemainingItem() && itemStack.getCraftingRemainingItem()
.sameItem(itemStack)) .sameItem(itemStack))
continue; continue;
if (!ItemHandlerHelper.insertItemStacked(targetInv, itemStack.copy(), simulate) if (!ItemHandlerHelper.insertItemStacked(targetInv, itemStack.copy(), simulate)
@ -609,7 +609,7 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor
} }
private void createFluidParticles() { private void createFluidParticles() {
Random r = level.random; RandomSource r = level.random;
if (!visualizedOutputFluids.isEmpty()) if (!visualizedOutputFluids.isEmpty())
createOutputFluidParticles(r); createOutputFluidParticles(r);
@ -656,7 +656,7 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor
} }
} }
private void createOutputFluidParticles(Random r) { private void createOutputFluidParticles(RandomSource r) {
BlockState blockState = getBlockState(); BlockState blockState = getBlockState();
if (!(blockState.getBlock() instanceof BasinBlock)) if (!(blockState.getBlock() instanceof BasinBlock))
return; return;

View file

@ -17,12 +17,10 @@ import net.minecraft.util.GsonHelper;
import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.registries.ForgeRegistryEntry;
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
public class ProcessingRecipeSerializer<T extends ProcessingRecipe<?>> extends ForgeRegistryEntry<RecipeSerializer<?>> public class ProcessingRecipeSerializer<T extends ProcessingRecipe<?>> implements RecipeSerializer<T> {
implements RecipeSerializer<T> {
private final ProcessingRecipeFactory<T> factory; private final ProcessingRecipeFactory<T> factory;

View file

@ -182,7 +182,7 @@ public class BlazeBurnerBlock extends HorizontalDirectionalBlock implements ITE<
return InteractionResultHolder.fail(ItemStack.EMPTY); return InteractionResultHolder.fail(ItemStack.EMPTY);
if (!doNotConsume) { if (!doNotConsume) {
ItemStack container = stack.hasContainerItem() ? stack.getContainerItem() : ItemStack.EMPTY; ItemStack container = stack.hasCraftingRemainingItem() ? stack.getCraftingRemainingItem() : ItemStack.EMPTY;
if (!world.isClientSide) { if (!world.isClientSide) {
stack.shrink(1); stack.shrink(1);
} }

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.contraptions.processing.burner; package com.simibubi.create.content.contraptions.processing.burner;
import java.util.Random;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld; import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
@ -23,6 +21,7 @@ import net.minecraft.core.Direction.Axis;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
@ -42,7 +41,7 @@ public class BlazeBurnerMovementBehaviour implements MovementBehaviour {
if (!shouldRender(context)) if (!shouldRender(context))
return; return;
Random r = context.world.getRandom(); RandomSource r = context.world.getRandom();
Vec3 c = context.position; Vec3 c = context.position;
Vec3 v = c.add(VecHelper.offsetRandomly(Vec3.ZERO, r, .125f) Vec3 v = c.add(VecHelper.offsetRandomly(Vec3.ZERO, r, .125f)
.multiply(1, 0, 1)); .multiply(1, 0, 1));

View file

@ -1,7 +1,6 @@
package com.simibubi.create.content.contraptions.processing.burner; package com.simibubi.create.content.contraptions.processing.burner;
import java.util.List; import java.util.List;
import java.util.Random;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
@ -24,6 +23,7 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
@ -291,7 +291,7 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
if (heatLevel == BlazeBurnerBlock.HeatLevel.NONE) if (heatLevel == BlazeBurnerBlock.HeatLevel.NONE)
return; return;
Random r = level.getRandom(); RandomSource r = level.getRandom();
Vec3 c = VecHelper.getCenterOf(worldPosition); Vec3 c = VecHelper.getCenterOf(worldPosition);
Vec3 v = c.add(VecHelper.offsetRandomly(Vec3.ZERO, r, .125f) Vec3 v = c.add(VecHelper.offsetRandomly(Vec3.ZERO, r, .125f)
@ -323,7 +323,7 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
public void spawnParticleBurst(boolean soulFlame) { public void spawnParticleBurst(boolean soulFlame) {
Vec3 c = VecHelper.getCenterOf(worldPosition); Vec3 c = VecHelper.getCenterOf(worldPosition);
Random r = level.random; RandomSource r = level.random;
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
Vec3 offset = VecHelper.offsetRandomly(Vec3.ZERO, r, .5f) Vec3 offset = VecHelper.offsetRandomly(Vec3.ZERO, r, .5f)
.multiply(1, .25f, 1) .multiply(1, .25f, 1)

View file

@ -6,7 +6,6 @@ import java.util.List;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
public enum InstructionSpeedModifiers { public enum InstructionSpeedModifiers {
@ -24,7 +23,7 @@ public enum InstructionSpeedModifiers {
value = modifier; value = modifier;
} }
private InstructionSpeedModifiers(int modifier, String label) { private InstructionSpeedModifiers(int modifier, String label) {
this.label = new TextComponent(label); this.label = Component.literal(label);
translationKey = "gui.sequenced_gearshift.speed." + Lang.asId(name()); translationKey = "gui.sequenced_gearshift.speed." + Lang.asId(name());
value = modifier; value = modifier;
} }

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.contraptions.relays.advanced.sequencer; package com.simibubi.create.content.contraptions.relays.advanced.sequencer;
import java.util.Random;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.base.HorizontalAxisKineticBlock; import com.simibubi.create.content.contraptions.base.HorizontalAxisKineticBlock;
@ -15,6 +13,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -65,7 +64,7 @@ public class SequencedGearshiftBlock extends HorizontalAxisKineticBlock implemen
} }
@Override @Override
public void tick(BlockState state, ServerLevel worldIn, BlockPos pos, Random r) { public void tick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource r) {
boolean previouslyPowered = state.getValue(STATE) != 0; boolean previouslyPowered = state.getValue(STATE) != 0;
boolean isPowered = worldIn.hasNeighborSignal(pos); boolean isPowered = worldIn.hasNeighborSignal(pos);
withTileEntityDo(worldIn, pos, sgte -> sgte.onRedstoneUpdate(isPowered, previouslyPowered)); withTileEntityDo(worldIn, pos, sgte -> sgte.onRedstoneUpdate(isPowered, previouslyPowered));

View file

@ -17,7 +17,6 @@ import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.ListTag; import net.minecraft.nbt.ListTag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
public class SequencedGearshiftScreen extends AbstractSimiScreen { public class SequencedGearshiftScreen extends AbstractSimiScreen {
@ -150,7 +149,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
if (def.hasValueParameter) { if (def.hasValueParameter) {
String text = def.formatValue(instruction.value); String text = def.formatValue(instruction.value);
int stringWidth = font.width(text); int stringWidth = font.width(text);
label(ms, 90 + (12 - stringWidth / 2), yOffset - 3, new TextComponent(text)); label(ms, 90 + (12 - stringWidth / 2), yOffset - 3, Component.literal(text));
} }
if (def.hasSpeedParameter) if (def.hasSpeedParameter)
label(ms, 127, yOffset - 3, instruction.speedModifier.label); label(ms, 127, yOffset - 3, instruction.speedModifier.label);

View file

@ -77,7 +77,7 @@ import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.IBlockRenderProperties; import net.minecraftforge.client.extensions.common.IClientBlockExtensions;
import net.minecraftforge.common.Tags; import net.minecraftforge.common.Tags;
import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
@ -96,7 +96,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void initializeClient(Consumer<IBlockRenderProperties> consumer) { public void initializeClient(Consumer<IClientBlockExtensions> consumer) {
consumer.accept(new RenderProperties()); consumer.accept(new RenderProperties());
} }
@ -147,7 +147,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
} }
@Override @Override
public void spawnAfterBreak(BlockState state, ServerLevel worldIn, BlockPos pos, ItemStack p_220062_4_) { public void spawnAfterBreak(BlockState state, ServerLevel worldIn, BlockPos pos, ItemStack p_220062_4_, boolean b) {
BeltTileEntity controllerTE = BeltHelper.getControllerTE(worldIn, pos); BeltTileEntity controllerTE = BeltHelper.getControllerTE(worldIn, pos);
if (controllerTE != null) if (controllerTE != null)
controllerTE.getInventory() controllerTE.getInventory()
@ -351,7 +351,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
} }
@Override @Override
public BlockPathTypes getAiPathNodeType(BlockState state, BlockGetter world, BlockPos pos, Mob entity) { public BlockPathTypes getBlockPathType(BlockState state, BlockGetter world, BlockPos pos, Mob entity) {
return BlockPathTypes.RAIL; return BlockPathTypes.RAIL;
} }

View file

@ -4,20 +4,21 @@ import static com.simibubi.create.content.contraptions.relays.belt.BeltTileEntit
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random;
import com.simibubi.create.AllSpriteShifts; import com.simibubi.create.AllSpriteShifts;
import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity.CasingType; import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity.CasingType;
import com.simibubi.create.foundation.block.render.QuadHelper; import com.simibubi.create.foundation.block.render.QuadHelper;
import com.simibubi.create.foundation.block.render.SpriteShiftEntry; import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.model.BakedModelWrapper; import net.minecraftforge.client.model.BakedModelWrapper;
import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.client.model.data.ModelData;
public class BeltModel extends BakedModelWrapper<BakedModel> { public class BeltModel extends BakedModelWrapper<BakedModel> {
@ -28,11 +29,11 @@ public class BeltModel extends BakedModelWrapper<BakedModel> {
} }
@Override @Override
public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand, IModelData extraData) { public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource rand, ModelData extraData, RenderType renderType) {
List<BakedQuad> quads = super.getQuads(state, side, rand, extraData); List<BakedQuad> quads = super.getQuads(state, side, rand, extraData, renderType);
if (!extraData.hasProperty(CASING_PROPERTY)) if (!extraData.has(CASING_PROPERTY))
return quads; return quads;
CasingType type = extraData.getData(CASING_PROPERTY); CasingType type = extraData.get(CASING_PROPERTY);
if (type == CasingType.NONE || type == CasingType.BRASS) if (type == CasingType.NONE || type == CasingType.BRASS)
return quads; return quads;

View file

@ -22,7 +22,7 @@ import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.Component;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
@ -473,7 +473,7 @@ public class BeltSlicer {
mc.player.displayClientMessage(Lang.translateDirect(feedback.langKey) mc.player.displayClientMessage(Lang.translateDirect(feedback.langKey)
.withStyle(feedback.formatting), true); .withStyle(feedback.formatting), true);
else else
mc.player.displayClientMessage(new TextComponent(""), true); mc.player.displayClientMessage(Component.literal(""), true);
if (feedback.bb != null) if (feedback.bb != null)
CreateClient.OUTLINER.chaseAABB("BeltSlicer", feedback.bb) CreateClient.OUTLINER.chaseAABB("BeltSlicer", feedback.bb)

View file

@ -54,8 +54,7 @@ import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.client.model.data.ModelData;
import net.minecraftforge.client.model.data.ModelDataMap;
import net.minecraftforge.client.model.data.ModelProperty; import net.minecraftforge.client.model.data.ModelProperty;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
@ -511,8 +510,8 @@ public class BeltTileEntity extends KineticTileEntity {
public static final ModelProperty<CasingType> CASING_PROPERTY = new ModelProperty<>(); public static final ModelProperty<CasingType> CASING_PROPERTY = new ModelProperty<>();
@Override @Override
public IModelData getModelData() { public ModelData getModelData() {
return new ModelDataMap.Builder().withInitial(CASING_PROPERTY, casing) return ModelData.builder().with(CASING_PROPERTY, casing)
.build(); .build();
} }

View file

@ -2,21 +2,21 @@ package com.simibubi.create.content.contraptions.relays.elementary;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Random;
import com.jozufozu.flywheel.core.virtual.VirtualEmptyModelData; import com.jozufozu.flywheel.core.model.ModelUtil;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.model.BakedModelWrapper; import net.minecraftforge.client.model.BakedModelWrapper;
import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.client.model.data.ModelData;
import net.minecraftforge.client.model.data.ModelDataMap;
import net.minecraftforge.client.model.data.ModelProperty; import net.minecraftforge.client.model.data.ModelProperty;
public class BracketedKineticBlockModel extends BakedModelWrapper<BakedModel> { public class BracketedKineticBlockModel extends BakedModelWrapper<BakedModel> {
@ -28,30 +28,35 @@ public class BracketedKineticBlockModel extends BakedModelWrapper<BakedModel> {
} }
@Override @Override
public IModelData getModelData(BlockAndTintGetter world, BlockPos pos, BlockState state, IModelData tileData) { public ModelData getModelData(BlockAndTintGetter world, BlockPos pos, BlockState state, ModelData tileData) {
if (VirtualEmptyModelData.is(tileData)) if (isVirtual(tileData))
return tileData; return tileData;
BracketedModelData data = new BracketedModelData(); BracketedModelData data = new BracketedModelData();
BracketedTileEntityBehaviour attachmentBehaviour = BracketedTileEntityBehaviour attachmentBehaviour =
TileEntityBehaviour.get(world, pos, BracketedTileEntityBehaviour.TYPE); TileEntityBehaviour.get(world, pos, BracketedTileEntityBehaviour.TYPE);
if (attachmentBehaviour != null) if (attachmentBehaviour != null)
data.putBracket(attachmentBehaviour.getBracket()); data.putBracket(attachmentBehaviour.getBracket());
return new ModelDataMap.Builder().withInitial(BRACKET_PROPERTY, data) return ModelData.builder().with(BRACKET_PROPERTY, data)
.build(); .build();
} }
@Override @Override
public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand, IModelData data) { public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource rand, ModelData data, RenderType renderType) {
if (!VirtualEmptyModelData.is(data)) { if (!isVirtual(data)) {
if (data.hasProperty(BRACKET_PROPERTY)) { if (data.has(BRACKET_PROPERTY)) {
BracketedModelData pipeData = data.getData(BRACKET_PROPERTY); BracketedModelData pipeData = data.get(BRACKET_PROPERTY);
BakedModel bracket = pipeData.getBracket(); BakedModel bracket = pipeData.getBracket();
if (bracket != null) if (bracket != null)
return bracket.getQuads(state, side, rand, data); return bracket.getQuads(state, side, rand, data, renderType);
} }
return Collections.emptyList(); return Collections.emptyList();
} }
return super.getQuads(state, side, rand, data); return super.getQuads(state, side, rand, data, renderType);
}
// TODO: move to Flywheel's ModelUtil
private static boolean isVirtual(ModelData data) {
return data.has(ModelUtil.VIRTUAL_PROPERTY) && data.get(ModelUtil.VIRTUAL_PROPERTY);
} }
private static class BracketedModelData { private static class BracketedModelData {

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.contraptions.relays.encased; package com.simibubi.create.content.contraptions.relays.encased;
import java.util.Random;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.RotationPropagator; import com.simibubi.create.content.contraptions.RotationPropagator;
import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.KineticTileEntity;
@ -9,6 +7,7 @@ import com.simibubi.create.foundation.block.ITE;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
@ -76,7 +75,7 @@ public class GearshiftBlock extends AbstractEncasedShaftBlock implements ITE<Spl
} }
@Override @Override
public void tick(BlockState state, ServerLevel worldIn, BlockPos pos, Random random) { public void tick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource random) {
BlockEntity te = worldIn.getBlockEntity(pos); BlockEntity te = worldIn.getBlockEntity(pos);
if (te == null || !(te instanceof KineticTileEntity)) if (te == null || !(te instanceof KineticTileEntity))
return; return;

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.contraptions.relays.gauge; package com.simibubi.create.content.contraptions.relays.gauge;
import java.util.Random;
import com.mojang.math.Vector3f; import com.mojang.math.Vector3f;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock; import com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock;
@ -19,6 +17,7 @@ import net.minecraft.core.Direction.Axis;
import net.minecraft.core.Direction.AxisDirection; import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.core.particles.DustParticleOptions; import net.minecraft.core.particles.DustParticleOptions;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.util.StringRepresentable; import net.minecraft.util.StringRepresentable;
import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
@ -119,7 +118,7 @@ public class GaugeBlock extends DirectionalAxisKineticBlock implements ITE<Gauge
} }
@Override @Override
public void animateTick(BlockState stateIn, Level worldIn, BlockPos pos, Random rand) { public void animateTick(BlockState stateIn, Level worldIn, BlockPos pos, RandomSource rand) {
BlockEntity te = worldIn.getBlockEntity(pos); BlockEntity te = worldIn.getBlockEntity(pos);
if (te == null || !(te instanceof GaugeTileEntity)) if (te == null || !(te instanceof GaugeTileEntity))
return; return;

View file

@ -61,7 +61,7 @@ public interface IWrenchable {
.forEach(itemStack -> { .forEach(itemStack -> {
player.getInventory().placeItemBackInInventory(itemStack); player.getInventory().placeItemBackInInventory(itemStack);
}); });
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY); state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
world.destroyBlock(pos, false); world.destroyBlock(pos, false);
playRemoveSound(world, pos); playRemoveSound(world, pos);
} }

View file

@ -25,7 +25,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.IItemRenderProperties; import net.minecraftforge.client.extensions.common.IClientItemExtensions;
import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.event.entity.player.AttackEntityEvent;
public class WrenchItem extends Item { public class WrenchItem extends Item {
@ -71,7 +71,7 @@ public class WrenchItem extends Item {
if (player != null && !player.isCreative()) if (player != null && !player.isCreative())
Block.getDrops(state, (ServerLevel) world, pos, world.getBlockEntity(pos), player, context.getItemInHand()) Block.getDrops(state, (ServerLevel) world, pos, world.getBlockEntity(pos), player, context.getItemInHand())
.forEach(itemStack -> player.getInventory().placeItemBackInInventory(itemStack)); .forEach(itemStack -> player.getInventory().placeItemBackInInventory(itemStack));
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY); state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
world.destroyBlock(pos, false); world.destroyBlock(pos, false);
AllSoundEvents.WRENCH_REMOVE.playOnServer(world, pos, 1, Create.RANDOM.nextFloat() * .5f + .5f); AllSoundEvents.WRENCH_REMOVE.playOnServer(world, pos, 1, Create.RANDOM.nextFloat() * .5f + .5f);
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
@ -81,7 +81,7 @@ public class WrenchItem extends Item {
Entity target = event.getTarget(); Entity target = event.getTarget();
if (!(target instanceof AbstractMinecart)) if (!(target instanceof AbstractMinecart))
return; return;
Player player = event.getPlayer(); Player player = event.getEntity();
ItemStack heldItem = player.getMainHandItem(); ItemStack heldItem = player.getMainHandItem();
if (!AllItems.WRENCH.isIn(heldItem)) if (!AllItems.WRENCH.isIn(heldItem))
return; return;
@ -93,7 +93,7 @@ public class WrenchItem extends Item {
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void initializeClient(Consumer<IItemRenderProperties> consumer) { public void initializeClient(Consumer<IClientItemExtensions> consumer) {
consumer.accept(SimpleCustomRenderer.create(this, new WrenchItemRenderer())); consumer.accept(SimpleCustomRenderer.create(this, new WrenchItemRenderer()));
} }

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.curiosities; package com.simibubi.create.content.curiosities;
import java.util.Random;
import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.commons.lang3.mutable.MutableBoolean;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
@ -20,6 +18,7 @@ import net.minecraft.core.NonNullList;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTab;
@ -67,7 +66,7 @@ public class ChromaticCompoundItem extends Item {
} }
@Override @Override
public int getItemStackLimit(ItemStack stack) { public int getMaxStackSize(ItemStack stack) {
return isBarVisible(stack) ? 1 : 16; return isBarVisible(stack) ? 1 : 16;
} }
@ -162,7 +161,7 @@ public class ChromaticCompoundItem extends Item {
} }
// Find a light source and eat it. // Find a light source and eat it.
Random r = world.random; RandomSource r = world.random;
int range = 3; int range = 3;
float rate = 1 / 2f; float rate = 1 / 2f;
if (r.nextFloat() > rate) if (r.nextFloat() > rate)

View file

@ -10,8 +10,8 @@ import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.player.LocalPlayer;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.protocol.game.ClientboundSetSubtitleTextPacket; import net.minecraft.network.protocol.game.ClientboundSetSubtitleTextPacket;
import net.minecraft.network.protocol.game.ClientboundSetTitleTextPacket; import net.minecraft.network.protocol.game.ClientboundSetTitleTextPacket;
import net.minecraft.network.protocol.game.ClientboundSetTitlesAnimationPacket; import net.minecraft.network.protocol.game.ClientboundSetTitlesAnimationPacket;
@ -20,7 +20,6 @@ import net.minecraft.util.Mth;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -70,13 +69,13 @@ public class BackTankUtil {
player.connection.send(new ClientboundSetTitlesAnimationPacket(10, 40, 10)); player.connection.send(new ClientboundSetTitlesAnimationPacket(10, 40, 10));
player.connection.send(new ClientboundSetSubtitleTextPacket( player.connection.send(new ClientboundSetSubtitleTextPacket(
new TextComponent("\u26A0 ").withStyle(depleted ? ChatFormatting.RED : ChatFormatting.GOLD) Component.literal("\u26A0 ").withStyle(depleted ? ChatFormatting.RED : ChatFormatting.GOLD)
.append(component.withStyle(ChatFormatting.GRAY)))); .append(component.withStyle(ChatFormatting.GRAY))));
player.connection.send(new ClientboundSetTitleTextPacket(new TextComponent(""))); player.connection.send(new ClientboundSetTitleTextPacket(Component.literal("")));
} }
public static int maxAir(ItemStack backtank) { public static int maxAir(ItemStack backtank) {
return maxAir(EnchantmentHelper.getItemEnchantmentLevel(AllEnchantments.CAPACITY.get(), backtank)); return maxAir(backtank.getEnchantmentLevel(AllEnchantments.CAPACITY.get()));
} }
public static int maxAir(int enchantLevel) { public static int maxAir(int enchantLevel) {

View file

@ -25,7 +25,6 @@ import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.client.renderer.entity.layers.RenderLayer; import net.minecraft.client.renderer.entity.layers.RenderLayer;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.tags.FluidTags; import net.minecraft.tags.FluidTags;
import net.minecraft.util.StringUtil; import net.minecraft.util.StringUtil;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
@ -33,12 +32,12 @@ import net.minecraft.world.entity.Pose;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.GameType; import net.minecraft.world.level.GameType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.gui.ForgeIngameGui; import net.minecraftforge.client.gui.overlay.ForgeGui;
import net.minecraftforge.client.gui.IIngameOverlay; import net.minecraftforge.client.gui.overlay.IGuiOverlay;
public class CopperBacktankArmorLayer<T extends LivingEntity, M extends EntityModel<T>> extends RenderLayer<T, M> { public class CopperBacktankArmorLayer<T extends LivingEntity, M extends EntityModel<T>> extends RenderLayer<T, M> {
public static final IIngameOverlay REMAINING_AIR_OVERLAY = CopperBacktankArmorLayer::renderRemainingAirOverlay; public static final IGuiOverlay REMAINING_AIR_OVERLAY = CopperBacktankArmorLayer::renderRemainingAirOverlay;
public CopperBacktankArmorLayer(RenderLayerParent<T, M> renderer) { public CopperBacktankArmorLayer(RenderLayerParent<T, M> renderer) {
super(renderer); super(renderer);
@ -106,7 +105,7 @@ public class CopperBacktankArmorLayer<T extends LivingEntity, M extends EntityMo
livingRenderer.addLayer((CopperBacktankArmorLayer) layer); livingRenderer.addLayer((CopperBacktankArmorLayer) layer);
} }
public static void renderRemainingAirOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width, int height) { public static void renderRemainingAirOverlay(ForgeGui gui, PoseStack poseStack, float partialTicks, int width, int height) {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
if (mc.options.hideGui || mc.gameMode.getPlayerMode() == GameType.SPECTATOR) if (mc.options.hideGui || mc.gameMode.getPlayerMode() == GameType.SPECTATOR)
return; return;
@ -129,7 +128,7 @@ public class CopperBacktankArmorLayer<T extends LivingEntity, M extends EntityMo
poseStack.translate(width / 2 + 90, height - 53, 0); poseStack.translate(width / 2 + 90, height - 53, 0);
Component text = new TextComponent(StringUtil.formatTickDuration(timeLeft * 20)); Component text = Component.literal(StringUtil.formatTickDuration(timeLeft * 20));
GuiGameElement.of(AllItems.COPPER_BACKTANK.asStack()) GuiGameElement.of(AllItems.COPPER_BACKTANK.asStack())
.at(0, 0) .at(0, 0)
.render(poseStack); .render(poseStack);

View file

@ -42,7 +42,7 @@ public class CopperBacktankItem extends CopperArmorItem implements ICapacityEnch
@Override @Override
public void fillItemCategory(CreativeModeTab p_150895_1_, NonNullList<ItemStack> p_150895_2_) { public void fillItemCategory(CreativeModeTab p_150895_1_, NonNullList<ItemStack> p_150895_2_) {
if (!allowdedIn(p_150895_1_)) if (!allowedIn(p_150895_1_))
return; return;
ItemStack stack = new ItemStack(this); ItemStack stack = new ItemStack(this);

View file

@ -4,7 +4,6 @@ import java.util.List;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.AllSoundEvents; import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.Create;
import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.content.contraptions.particle.AirParticleData; import com.simibubi.create.content.contraptions.particle.AirParticleData;
import com.simibubi.create.foundation.advancement.AllAdvancements; import com.simibubi.create.foundation.advancement.AllAdvancements;
@ -73,7 +72,7 @@ public class CopperBacktankTileEntity extends KineticTileEntity implements Namea
int max = BackTankUtil.maxAir(capacityEnchantLevel); int max = BackTankUtil.maxAir(capacityEnchantLevel);
if (level.isClientSide) { if (level.isClientSide) {
Vec3 centerOf = VecHelper.getCenterOf(worldPosition); Vec3 centerOf = VecHelper.getCenterOf(worldPosition);
Vec3 v = VecHelper.offsetRandomly(centerOf, Create.RANDOM, .65f); Vec3 v = VecHelper.offsetRandomly(centerOf, level.random, .65f);
Vec3 m = centerOf.subtract(v); Vec3 m = centerOf.subtract(v);
if (airLevel != max) if (airLevel != max)
level.addParticle(new AirParticleData(1, .05f), v.x, v.y, v.z, m.x, m.y, m.z); level.addParticle(new AirParticleData(1, .05f), v.x, v.y, v.z, m.x, m.y, m.z);

View file

@ -8,7 +8,7 @@ import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.Pose;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingTickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
@ -20,8 +20,8 @@ public class DivingBootsItem extends CopperArmorItem {
} }
@SubscribeEvent @SubscribeEvent
public static void accellerateDescentUnderwater(LivingUpdateEvent event) { public static void accellerateDescentUnderwater(LivingTickEvent event) {
LivingEntity entity = event.getEntityLiving(); LivingEntity entity = event.getEntity();
if (!affects(entity)) if (!affects(entity))
return; return;

View file

@ -12,7 +12,7 @@ import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingTickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
@ -24,8 +24,8 @@ public class DivingHelmetItem extends CopperArmorItem {
} }
@SubscribeEvent @SubscribeEvent
public static void breatheUnderwater(LivingUpdateEvent event) { public static void breatheUnderwater(LivingTickEvent event) {
LivingEntity entity = event.getEntityLiving(); LivingEntity entity = event.getEntity();
Level world = entity.level; Level world = entity.level;
boolean second = world.getGameTime() % 20 == 0; boolean second = world.getGameTime() % 20 == 0;
boolean drowning = entity.getAirSupply() == 0; boolean drowning = entity.getAirSupply() == 0;

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.curiosities.bell; package com.simibubi.create.content.curiosities.bell;
import java.util.Random;
import com.jozufozu.flywheel.core.PartialModel; import com.jozufozu.flywheel.core.PartialModel;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
@ -11,6 +9,7 @@ import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
@ -67,7 +66,7 @@ public class HauntedBellTileEntity extends AbstractBellTileEntity {
if (!level.isClientSide) if (!level.isClientSide)
return; return;
Random rand = level.getRandom(); RandomSource rand = level.getRandom();
if (rand.nextFloat() > 0.25f) if (rand.nextFloat() > 0.25f)
return; return;
@ -75,7 +74,7 @@ public class HauntedBellTileEntity extends AbstractBellTileEntity {
playSound(rand); playSound(rand);
} }
protected void spawnParticle(Random rand) { protected void spawnParticle(RandomSource rand) {
double x = worldPosition.getX() + rand.nextDouble(); double x = worldPosition.getX() + rand.nextDouble();
double y = worldPosition.getY() + 0.5; double y = worldPosition.getY() + 0.5;
double z = worldPosition.getZ() + rand.nextDouble(); double z = worldPosition.getZ() + rand.nextDouble();
@ -85,7 +84,7 @@ public class HauntedBellTileEntity extends AbstractBellTileEntity {
level.addParticle(ParticleTypes.SOUL, x, y, z, vx, vy, vz); level.addParticle(ParticleTypes.SOUL, x, y, z, vx, vy, vz);
} }
protected void playSound(Random rand) { protected void playSound(RandomSource rand) {
float vol = rand.nextFloat() * 0.4F + rand.nextFloat() > 0.9F ? 0.6F : 0.0F; float vol = rand.nextFloat() * 0.4F + rand.nextFloat() > 0.9F ? 0.6F : 0.0F;
float pitch = 0.6F + rand.nextFloat() * 0.4F; float pitch = 0.6F + rand.nextFloat() * 0.4F;
level.playSound(null, worldPosition, SoundEvents.SOUL_ESCAPE, SoundSource.BLOCKS, vol, pitch); level.playSound(null, worldPosition, SoundEvents.SOUL_ESCAPE, SoundSource.BLOCKS, vol, pitch);

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.curiosities.bell; package com.simibubi.create.content.curiosities.bell;
import java.util.Random;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllSoundEvents; import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
@ -9,6 +7,7 @@ import com.simibubi.create.AllTileEntities;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelAccessor;
@ -81,7 +80,7 @@ public class PeculiarBellBlock extends AbstractBellBlock<PeculiarBellTileEntity>
} }
public void spawnConversionParticles(LevelAccessor world, BlockPos blockPos) { public void spawnConversionParticles(LevelAccessor world, BlockPos blockPos) {
Random random = world.getRandom(); RandomSource random = world.getRandom();
int num = random.nextInt(10) + 15; int num = random.nextInt(10) + 15;
for (int i = 0; i < num; i++) { for (int i = 0; i < num; i++) {
float pitch = random.nextFloat() * 120 - 90; float pitch = random.nextFloat() * 120 - 90;

Some files were not shown because too many files have changed in this diff Show more