mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-02-04 17:34:58 +01:00
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:
parent
82be76d893
commit
233d9b292e
333 changed files with 1302 additions and 1444 deletions
|
@ -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'))
|
||||
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')
|
||||
|
||||
runs {
|
||||
|
@ -133,7 +134,7 @@ repositories {
|
|||
dependencies {
|
||||
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)
|
||||
}
|
||||
// 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}")
|
||||
}
|
||||
|
||||
compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}:api")
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}")
|
||||
compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-forge-api:${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")
|
||||
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_minecraft_version}-${curios_version}")
|
||||
|
|
|
@ -5,10 +5,10 @@ org.gradle.daemon = false
|
|||
|
||||
# mod version info
|
||||
mod_version = 0.5.0.c
|
||||
artifact_minecraft_version = 1.18.2
|
||||
artifact_minecraft_version = 1.19
|
||||
|
||||
minecraft_version = 1.18.2
|
||||
forge_version = 40.1.60
|
||||
minecraft_version = 1.19
|
||||
forge_version = 41.0.110
|
||||
|
||||
# build dependency versions
|
||||
forgegradle_version = 5.1.+
|
||||
|
@ -19,13 +19,13 @@ cursegradle_version = 1.4.0
|
|||
parchment_version = 2022.07.10
|
||||
|
||||
# dependency versions
|
||||
registrate_version = MC1.18.2-1.1.3
|
||||
flywheel_minecraft_version = 1.18.2
|
||||
flywheel_version = 0.6.4-90
|
||||
jei_minecraft_version = 1.18.2
|
||||
jei_version = 9.7.0.209
|
||||
curios_minecraft_version = 1.18.2
|
||||
curios_version = 5.0.7.0
|
||||
registrate_version = MC1.19-1.1.5
|
||||
flywheel_minecraft_version = 1.19
|
||||
flywheel_version = 0.6.4-1
|
||||
jei_minecraft_version = 1.19
|
||||
jei_version = 11.1.0.235
|
||||
curios_minecraft_version = 1.19
|
||||
curios_version = 5.1.0.4
|
||||
|
||||
# curseforge information
|
||||
projectId = 328085
|
||||
|
|
|
@ -600,7 +600,7 @@ public class AllBlocks {
|
|||
.initialProperties(SharedProperties.CRUSHING_WHEEL_CONTROLLER_MATERIAL)
|
||||
.properties(p -> p.color(MaterialColor.STONE))
|
||||
.properties(p -> p.noOcclusion()
|
||||
.noDrops()
|
||||
.noLootTable()
|
||||
.air())
|
||||
.blockstate((c, p) -> p.getVariantBuilder(c.get())
|
||||
.forAllStatesExcept(state -> ConfiguredModel.builder()
|
||||
|
|
|
@ -2,17 +2,17 @@ package com.simibubi.create;
|
|||
|
||||
import com.simibubi.create.content.logistics.trains.entity.CarriageSyncDataSerializer;
|
||||
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.registries.DataSerializerEntry;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegisterEvent;
|
||||
|
||||
public class AllEntityDataSerializers {
|
||||
|
||||
public static final CarriageSyncDataSerializer CARRIAGE_DATA = new CarriageSyncDataSerializer();
|
||||
|
||||
public static void register(RegistryEvent.Register<DataSerializerEntry> event) {
|
||||
IForgeRegistry<DataSerializerEntry> registry = event.getRegistry();
|
||||
registry.register(new DataSerializerEntry(CARRIAGE_DATA).setRegistryName(Create.asResource("carriage_data")));
|
||||
public static void register(RegisterEvent event) {
|
||||
event.register(ForgeRegistries.Keys.ENTITY_DATA_SERIALIZERS, helper -> {
|
||||
helper.register(Create.asResource("carriage_data"), CARRIAGE_DATA);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,8 +7,12 @@ import com.mojang.blaze3d.platform.InputConstants;
|
|||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.client.Minecraft;
|
||||
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 {
|
||||
|
||||
TOOL_MENU("toolmenu", GLFW.GLFW_KEY_LEFT_ALT),
|
||||
|
@ -28,13 +32,14 @@ public enum AllKeys {
|
|||
this.modifiable = !description.isEmpty();
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
@SubscribeEvent
|
||||
public static void register(RegisterKeyMappingsEvent event) {
|
||||
for (AllKeys key : values()) {
|
||||
key.keybind = new KeyMapping(key.description, key.key, Create.NAME);
|
||||
if (!key.modifiable)
|
||||
continue;
|
||||
|
||||
ClientRegistry.registerKeyBinding(key.keybind);
|
||||
event.register(key.keybind);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,16 +14,14 @@ import com.simibubi.create.content.curiosities.bell.SoulBaseParticle;
|
|||
import com.simibubi.create.content.curiosities.bell.SoulParticle;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.ParticleEngine;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
import net.minecraft.core.particles.ParticleType;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.ParticleFactoryRegisterEvent;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
|
||||
import net.minecraftforge.registries.RegisterEvent;
|
||||
|
||||
public enum AllParticleTypes {
|
||||
|
||||
|
@ -49,16 +47,17 @@ public enum AllParticleTypes {
|
|||
entry = new ParticleEntry<>(new ResourceLocation(Create.ID, asId), typeFactory);
|
||||
}
|
||||
|
||||
public static void register(RegistryEvent.Register<ParticleType<?>> event) {
|
||||
public static void register(RegisterEvent event) {
|
||||
event.register(Registry.PARTICLE_TYPE_REGISTRY, helper -> {
|
||||
for (AllParticleTypes particle : values())
|
||||
particle.entry.register(event.getRegistry());
|
||||
particle.entry.register(helper);
|
||||
});
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void registerFactories(ParticleFactoryRegisterEvent event) {
|
||||
ParticleEngine particles = Minecraft.getInstance().particleEngine;
|
||||
public static void registerFactories(RegisterParticleProvidersEvent event) {
|
||||
for (AllParticleTypes particle : values())
|
||||
particle.entry.registerFactory(particles);
|
||||
particle.entry.registerFactory(event);
|
||||
}
|
||||
|
||||
public ParticleType<?> get() {
|
||||
|
@ -79,8 +78,8 @@ public enum AllParticleTypes {
|
|||
this.typeFactory = typeFactory;
|
||||
}
|
||||
|
||||
void register(IForgeRegistry<ParticleType<?>> registry) {
|
||||
registry.register(getOrCreateType());
|
||||
void register(RegisterEvent.RegisterHelper<ParticleType<?>> helper) {
|
||||
helper.register(id, getOrCreateType());
|
||||
}
|
||||
|
||||
ParticleType<D> getOrCreateType() {
|
||||
|
@ -88,14 +87,13 @@ public enum AllParticleTypes {
|
|||
return type;
|
||||
type = typeFactory.get()
|
||||
.createType();
|
||||
type.setRegistryName(id);
|
||||
return type;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void registerFactory(ParticleEngine particles) {
|
||||
void registerFactory(RegisterParticleProvidersEvent event) {
|
||||
typeFactory.get()
|
||||
.register(getOrCreateType(), particles);
|
||||
.register(getOrCreateType(), event);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ import net.minecraft.world.item.crafting.RecipeType;
|
|||
import net.minecraft.world.item.crafting.ShapedRecipe;
|
||||
import net.minecraft.world.item.crafting.SimpleRecipeSerializer;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.registries.RegisterEvent;
|
||||
|
||||
public enum AllRecipeTypes implements IRecipeTypeInfo {
|
||||
|
||||
|
@ -83,7 +83,7 @@ public enum AllRecipeTypes implements IRecipeTypeInfo {
|
|||
AllRecipeTypes(Supplier<RecipeSerializer<?>> serializerSupplier) {
|
||||
this.id = Create.asResource(Lang.asId(name()));
|
||||
this.serializerSupplier = serializerSupplier;
|
||||
this.typeSupplier = () -> simpleType(id);
|
||||
this.typeSupplier = () -> RecipeType.simple(id);
|
||||
}
|
||||
|
||||
AllRecipeTypes(ProcessingRecipeFactory<?> processingFactory) {
|
||||
|
@ -112,32 +112,28 @@ public enum AllRecipeTypes implements IRecipeTypeInfo {
|
|||
.getRecipeFor(getType(), inv, world);
|
||||
}
|
||||
|
||||
public static void register(RegistryEvent.Register<RecipeSerializer<?>> event) {
|
||||
public static void register(RegisterEvent event) {
|
||||
event.register(Registry.RECIPE_SERIALIZER_REGISTRY, helper -> {
|
||||
ShapedRecipe.setCraftingSize(9, 9);
|
||||
|
||||
for (AllRecipeTypes r : AllRecipeTypes.values()) {
|
||||
r.serializer = r.serializerSupplier.get();
|
||||
r.type = r.typeSupplier.get();
|
||||
r.serializer.setRegistryName(r.id);
|
||||
event.getRegistry()
|
||||
.register(r.serializer);
|
||||
helper.register(r.id, 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) {
|
||||
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 =
|
||||
ImmutableSet.of(new ResourceLocation("occultism", "spirit_trade"), new ResourceLocation("occultism", "ritual"));
|
||||
|
||||
|
|
|
@ -8,17 +8,16 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
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.JsonObject;
|
||||
import com.simibubi.create.foundation.utility.Couple;
|
||||
import com.simibubi.create.foundation.utility.Pair;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.data.CachedOutput;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.DataProvider;
|
||||
import net.minecraft.data.HashCache;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
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.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.RegisterEvent;
|
||||
|
||||
//@EventBusSubscriber(bus = Bus.FORGE)
|
||||
public class AllSoundEvents {
|
||||
|
@ -306,10 +304,11 @@ public class AllSoundEvents {
|
|||
return new SoundEntryBuilder(id);
|
||||
}
|
||||
|
||||
public static void register(RegistryEvent.Register<SoundEvent> event) {
|
||||
IForgeRegistry<SoundEvent> registry = event.getRegistry();
|
||||
public static void register(RegisterEvent event) {
|
||||
event.register(Registry.SOUND_EVENT_REGISTRY, helper -> {
|
||||
for (SoundEntry entry : entries.values())
|
||||
entry.register(registry);
|
||||
entry.register(helper);
|
||||
});
|
||||
}
|
||||
|
||||
public static void prepare() {
|
||||
|
@ -353,7 +352,7 @@ public class AllSoundEvents {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void run(HashCache cache) throws IOException {
|
||||
public void run(CachedOutput cache) throws IOException {
|
||||
generate(generator.getOutputFolder(), cache);
|
||||
}
|
||||
|
||||
|
@ -362,10 +361,7 @@ public class AllSoundEvents {
|
|||
return "Create's Custom Sounds";
|
||||
}
|
||||
|
||||
public void generate(Path path, HashCache cache) {
|
||||
Gson GSON = (new GsonBuilder()).setPrettyPrinting()
|
||||
.disableHtmlEscaping()
|
||||
.create();
|
||||
public void generate(Path path, CachedOutput cache) {
|
||||
path = path.resolve("assets/create");
|
||||
|
||||
try {
|
||||
|
@ -377,7 +373,7 @@ public class AllSoundEvents {
|
|||
entry.getValue()
|
||||
.write(json);
|
||||
});
|
||||
DataProvider.save(GSON, cache, json, path.resolve("sounds.json"));
|
||||
DataProvider.saveStable(cache, json, path.resolve("sounds.json"));
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -465,7 +461,7 @@ public class AllSoundEvents {
|
|||
|
||||
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);
|
||||
|
||||
|
@ -546,16 +542,18 @@ public class AllSoundEvents {
|
|||
public void prepare() {
|
||||
for (int i = 0; i < wrappedEvents.size(); 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)
|
||||
.getSecond()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(IForgeRegistry<SoundEvent> registry) {
|
||||
for (Pair<SoundEvent, Couple<Float>> pair : compiledEvents)
|
||||
registry.register(pair.getFirst());
|
||||
public void register(RegisterEvent.RegisterHelper<SoundEvent> helper) {
|
||||
for (Pair<SoundEvent, Couple<Float>> pair : compiledEvents) {
|
||||
SoundEvent soundEvent = pair.getFirst();
|
||||
helper.register(soundEvent.getLocation(), soundEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -621,12 +619,12 @@ public class AllSoundEvents {
|
|||
|
||||
@Override
|
||||
public void prepare() {
|
||||
event = new SoundEvent(id).setRegistryName(id);
|
||||
event = new SoundEvent(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(IForgeRegistry<SoundEvent> registry) {
|
||||
registry.register(event);
|
||||
public void register(RegisterEvent.RegisterHelper<SoundEvent> helper) {
|
||||
helper.register(id, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,20 +33,19 @@ import net.minecraft.world.level.material.Fluids;
|
|||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
public class AllTags {
|
||||
|
||||
private static final CreateRegistrate REGISTRATE = Create.registrate()
|
||||
.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) {
|
||||
return registry.tags()
|
||||
.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));
|
||||
}
|
||||
|
||||
|
|
|
@ -39,16 +39,16 @@ import com.simibubi.create.foundation.networking.AllPackets;
|
|||
import com.simibubi.create.foundation.worldgen.AllWorldFeatures;
|
||||
import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||
|
||||
import net.minecraft.core.particles.ParticleType;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
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.crafting.RecipeSerializer;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.data.event.GatherDataEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
|
@ -56,8 +56,6 @@ import net.minecraftforge.fml.ModLoadingContext;
|
|||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent;
|
||||
import net.minecraftforge.registries.DataSerializerEntry;
|
||||
|
||||
@Mod(Create.ID)
|
||||
public class Create {
|
||||
|
@ -80,6 +78,8 @@ public class Create {
|
|||
public static final TorquePropagator TORQUE_PROPAGATOR = new TorquePropagator();
|
||||
public static final GlobalRailwayManager RAILWAYS = new GlobalRailwayManager();
|
||||
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();
|
||||
|
||||
private static final NonNullSupplier<CreateRegistrate> REGISTRATE = CreateRegistrate.lazy(ID);
|
||||
|
@ -119,11 +119,11 @@ public class Create {
|
|||
|
||||
modEventBus.addListener(Create::init);
|
||||
modEventBus.addListener(EventPriority.LOWEST, Create::gatherData);
|
||||
modEventBus.addGenericListener(Feature.class, AllWorldFeatures::registerOreFeatures);
|
||||
modEventBus.addGenericListener(RecipeSerializer.class, AllRecipeTypes::register);
|
||||
modEventBus.addGenericListener(ParticleType.class, AllParticleTypes::register);
|
||||
modEventBus.addGenericListener(SoundEvent.class, AllSoundEvents::register);
|
||||
modEventBus.addGenericListener(DataSerializerEntry.class, AllEntityDataSerializers::register);
|
||||
modEventBus.addListener(AllWorldFeatures::registerOreFeatures);
|
||||
modEventBus.addListener(AllRecipeTypes::register);
|
||||
modEventBus.addListener(AllParticleTypes::register);
|
||||
modEventBus.addListener(AllSoundEvents::register);
|
||||
modEventBus.addListener(AllEntityDataSerializers::register);
|
||||
|
||||
forgeEventBus.addListener(EventPriority.HIGH, SlidingDoorBlock::stopItQuark);
|
||||
|
||||
|
@ -149,12 +149,12 @@ public class Create {
|
|||
|
||||
public static void gatherData(GatherDataEvent event) {
|
||||
DataGenerator gen = event.getGenerator();
|
||||
gen.addProvider(new AllAdvancements(gen));
|
||||
gen.addProvider(new LangMerger(gen));
|
||||
gen.addProvider(AllSoundEvents.provider(gen));
|
||||
gen.addProvider(new StandardRecipeGen(gen));
|
||||
gen.addProvider(new MechanicalCraftingRecipeGen(gen));
|
||||
gen.addProvider(new SequencedAssemblyRecipeGen(gen));
|
||||
gen.addProvider(true, new AllAdvancements(gen));
|
||||
gen.addProvider(true, new LangMerger(gen));
|
||||
gen.addProvider(true, AllSoundEvents.provider(gen));
|
||||
gen.addProvider(true, new StandardRecipeGen(gen));
|
||||
gen.addProvider(true, new MechanicalCraftingRecipeGen(gen));
|
||||
gen.addProvider(true, new SequencedAssemblyRecipeGen(gen));
|
||||
ProcessingRecipeGen.registerAll(gen);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,18 +2,12 @@ package com.simibubi.create;
|
|||
|
||||
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.interaction.controls.TrainHUD;
|
||||
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.goggles.GoggleOverlayRenderer;
|
||||
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.toolbox.ToolboxHandlerClient;
|
||||
import com.simibubi.create.content.curiosities.tools.BlueprintOverlayRenderer;
|
||||
import com.simibubi.create.content.curiosities.weapons.PotatoCannonRenderHandler;
|
||||
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.schematics.ClientSchematicLoader;
|
||||
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.client.GraphicsStatus;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.network.chat.ChatType;
|
||||
import net.minecraft.network.chat.ClickEvent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.ComponentUtils;
|
||||
import net.minecraft.network.chat.HoverEvent;
|
||||
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.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
|
||||
|
@ -84,7 +75,6 @@ public class CreateClient {
|
|||
BUFFER_CACHE.registerCompartment(SBBContraptionManager.CONTRAPTION, 20);
|
||||
BUFFER_CACHE.registerCompartment(WorldSectionElement.DOC_WORLD_SECTION, 20);
|
||||
|
||||
AllKeys.register();
|
||||
// AllFluids.assignRenderLayers();
|
||||
AllBlockPartials.init();
|
||||
AllStitchedTextures.init();
|
||||
|
@ -92,22 +82,9 @@ public class CreateClient {
|
|||
PonderIndex.register();
|
||||
PonderIndex.registerTags();
|
||||
|
||||
registerOverlays();
|
||||
|
||||
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() {
|
||||
BUFFER_CACHE.invalidate();
|
||||
|
||||
|
@ -120,22 +97,22 @@ public class CreateClient {
|
|||
if (mc.player == null)
|
||||
return;
|
||||
|
||||
if (mc.options.graphicsMode != GraphicsStatus.FABULOUS)
|
||||
if (mc.options.graphicsMode().get() != GraphicsStatus.FABULOUS)
|
||||
return;
|
||||
|
||||
if (AllConfigs.CLIENT.ignoreFabulousWarning.get())
|
||||
return;
|
||||
|
||||
MutableComponent text = ComponentUtils.wrapInSquareBrackets(new TextComponent("WARN"))
|
||||
MutableComponent text = ComponentUtils.wrapInSquareBrackets(Component.literal("WARN"))
|
||||
.withStyle(ChatFormatting.GOLD)
|
||||
.append(new TextComponent(
|
||||
.append(Component.literal(
|
||||
" Some of Create's visual features will not be available while Fabulous graphics are enabled!"))
|
||||
.withStyle(style -> style
|
||||
.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/create dismissFabulousWarning"))
|
||||
.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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simibubi.create.compat.jei;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
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.foundation.networking.AllPackets;
|
||||
|
||||
import mezz.jei.api.constants.RecipeTypes;
|
||||
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.IRecipeTransferHandler;
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.item.crafting.CraftingRecipe;
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
|
@ -25,8 +30,13 @@ public class BlueprintTransferHandler implements IRecipeTransferHandler<Blueprin
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class<CraftingRecipe> getRecipeClass() {
|
||||
return CraftingRecipe.class;
|
||||
public Optional<MenuType<BlueprintContainer>> getMenuType() {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeType<CraftingRecipe> getRecipeType() {
|
||||
return RecipeTypes.CRAFTING;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -75,6 +75,7 @@ import mezz.jei.api.JeiPlugin;
|
|||
import mezz.jei.api.constants.RecipeTypes;
|
||||
import mezz.jei.api.forge.ForgeTypes;
|
||||
import mezz.jei.api.gui.drawable.IDrawable;
|
||||
import mezz.jei.api.helpers.IPlatformFluidHelper;
|
||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||
import mezz.jei.api.registration.IGuiHandlerRegistration;
|
||||
import mezz.jei.api.registration.IRecipeCatalystRegistration;
|
||||
|
@ -349,7 +350,7 @@ public class CreateJEI implements IModPlugin {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void registerFluidSubtypes(ISubtypeRegistration registration) {
|
||||
public <T> void registerFluidSubtypes(ISubtypeRegistration registration, IPlatformFluidHelper<T> platformFluidHelper) {
|
||||
PotionFluidSubtypeInterpreter interpreter = new PotionFluidSubtypeInterpreter();
|
||||
PotionFluid potionFluid = AllFluids.POTION.get();
|
||||
registration.registerSubtypeInterpreter(ForgeTypes.FLUID_STACK, potionFluid.getSource(), interpreter);
|
||||
|
|
|
@ -27,8 +27,6 @@ import mezz.jei.api.registration.IRecipeRegistration;
|
|||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
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.crafting.Recipe;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
@ -77,18 +75,6 @@ public abstract class CreateRecipeCategory<T extends Recipe<?>> implements IReci
|
|||
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) {
|
||||
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;
|
||||
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())
|
||||
tooltip.add(0, text);
|
||||
else {
|
||||
List<Component> siblings = tooltip.get(0).getSiblings();
|
||||
siblings.add(new TextComponent(" "));
|
||||
siblings.add(Component.literal(" "));
|
||||
siblings.add(text);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||
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.item.ItemStack;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
|
@ -183,7 +183,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<CraftingRec
|
|||
return ingredient.getTooltipLines(player, tooltipFlag);
|
||||
} catch (RuntimeException | LinkageError e) {
|
||||
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));
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -25,8 +25,7 @@ import net.minecraft.ChatFormatting;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
|
@ -100,7 +99,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
|
|||
AllGuiTextures.JEI_LONG_ARROW.render(matrixStack, 52 + xOffset, 79);
|
||||
if (!singleOutput) {
|
||||
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,
|
||||
0xefefef);
|
||||
}
|
||||
|
@ -109,7 +108,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
|
|||
matrixStack.pushPose();
|
||||
matrixStack.translate(15, 9, 0);
|
||||
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);
|
||||
matrixStack.popPose();
|
||||
}
|
||||
|
@ -129,7 +128,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
|
|||
SequencedRecipe<?> sequencedRecipe = sequence.get(i);
|
||||
SequencedAssemblySubCategory subCategory = getSubCategory(sequencedRecipe);
|
||||
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);
|
||||
subCategory.draw(sequencedRecipe, matrixStack, mouseX, mouseY, i);
|
||||
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) {
|
||||
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 willRepeat = recipe.getLoops() > 1;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
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.particle.RotationIndicatorParticleData;
|
||||
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.ParticleTypes;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
@ -63,7 +62,7 @@ public class KineticEffectHandler {
|
|||
return;
|
||||
if (!world.isClientSide)
|
||||
return;
|
||||
Random r = world.random;
|
||||
RandomSource r = world.random;
|
||||
for (int i = 0; i < amount; i++) {
|
||||
Vec3 motion = VecHelper.offsetRandomly(Vec3.ZERO, r, maxMotion);
|
||||
Vec3 position = VecHelper.getCenterOf(kte.getBlockPos());
|
||||
|
|
|
@ -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.Color;
|
||||
|
||||
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
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.properties.BlockStateProperties;
|
||||
import net.minecraftforge.client.ChunkRenderTypeSet;
|
||||
import net.minecraftforge.client.model.data.ModelData;
|
||||
|
||||
public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTileEntity> {
|
||||
|
||||
|
@ -55,8 +59,12 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
|
|||
}
|
||||
|
||||
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)
|
||||
if (ItemBlockRenderTypes.canRenderInLayer(state, type))
|
||||
if (typeSet.contains(type))
|
||||
return type;
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
|
|||
}
|
||||
});
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
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.MovementContext;
|
||||
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.block.CampfireBlock;
|
||||
|
||||
public class CampfireMovementBehaviour implements MovementBehaviour {
|
||||
|
@ -21,7 +20,7 @@ public class CampfireMovementBehaviour implements MovementBehaviour {
|
|||
return;
|
||||
|
||||
// Mostly copied from CampfireBlock and CampfireTileEntity
|
||||
Random random = context.world.random;
|
||||
RandomSource random = context.world.random;
|
||||
if (random.nextFloat() < 0.11F) {
|
||||
for (int i = 0; i < random.nextInt(2) + 2; ++i) {
|
||||
context.world.addAlwaysVisibleParticle(
|
||||
|
|
|
@ -115,7 +115,7 @@ public class SeatBlock extends Block implements ProperWaterloggedBlock {
|
|||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.components.actors.dispenser;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
|
||||
import net.minecraft.Util;
|
||||
|
@ -11,6 +9,7 @@ import net.minecraft.sounds.SoundEvents;
|
|||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MobSpawnType;
|
||||
|
@ -129,7 +128,7 @@ public interface IMovedDispenseItemBehaviour {
|
|||
@Override
|
||||
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos,
|
||||
Vec3 facing) {
|
||||
Random random = context.world.random;
|
||||
RandomSource random = context.world.random;
|
||||
double x = pos.getX() + facing.x * .7 + .5;
|
||||
double y = pos.getY() + facing.y * .7 + .5;
|
||||
double z = pos.getZ() + facing.z * .7 + .5;
|
||||
|
|
|
@ -265,8 +265,8 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
|||
List<ItemStack> containers = new ArrayList<>();
|
||||
groupedItems.grid.values()
|
||||
.forEach(stack -> {
|
||||
if (stack.hasContainerItem())
|
||||
containers.add(stack.getContainerItem()
|
||||
if (stack.hasCraftingRemainingItem())
|
||||
containers.add(stack.getCraftingRemainingItem()
|
||||
.copy());
|
||||
});
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.components.crusher;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
|
@ -16,6 +14,7 @@ import net.minecraft.core.Direction.Axis;
|
|||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.Difficulty;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
@ -111,7 +110,7 @@ public class CrushingWheelControllerBlock extends DirectionalBlock implements IT
|
|||
}
|
||||
|
||||
@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))
|
||||
return;
|
||||
if (rand.nextInt(1) != 0)
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.simibubi.create.content.contraptions.components.crusher;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.simibubi.create.AllRecipeTypes;
|
||||
|
@ -29,6 +28,7 @@ import net.minecraft.core.particles.ParticleTypes;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
|
@ -283,7 +283,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
|
|||
else
|
||||
particleData = new ItemParticleOption(ParticleTypes.ITEM, stack);
|
||||
|
||||
Random r = level.random;
|
||||
RandomSource r = level.random;
|
||||
for (int i = 0; i < 4; i++)
|
||||
level.addParticle(particleData, worldPosition.getX() + r.nextFloat(), worldPosition.getY() + r.nextFloat(),
|
||||
worldPosition.getZ() + r.nextFloat(), 0, 0, 0);
|
||||
|
|
|
@ -15,8 +15,6 @@ import com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuild
|
|||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
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.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
|
@ -59,9 +57,9 @@ public class DeployerApplicationRecipe extends ItemApplicationRecipe implements
|
|||
ItemStack[] matchingStacks = ingredients.get(1)
|
||||
.getItems();
|
||||
if (matchingStacks.length == 0)
|
||||
return new TextComponent("Invalid");
|
||||
return Component.literal("Invalid");
|
||||
return Lang.translateDirect("recipe.assembly.deploying_item",
|
||||
new TranslatableComponent(matchingStacks[0].getDescriptionId()).getString());
|
||||
Component.translatable(matchingStacks[0].getDescriptionId()).getString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -135,7 +135,7 @@ public class DeployerFakePlayer extends FakePlayer {
|
|||
public static void entitiesDontRetaliate(LivingSetAttackTargetEvent event) {
|
||||
if (!(event.getTarget() instanceof DeployerFakePlayer))
|
||||
return;
|
||||
LivingEntity entityLiving = event.getEntityLiving();
|
||||
LivingEntity entityLiving = event.getEntity();
|
||||
if (!(entityLiving instanceof Mob))
|
||||
return;
|
||||
Mob mob = (Mob) entityLiving;
|
||||
|
|
|
@ -392,7 +392,7 @@ public class DeployerHandler {
|
|||
|
||||
Block.getDrops(blockstate, world, pos, tileentity, player, prevHeldItem)
|
||||
.forEach(item -> player.getInventory().placeItemBackInInventory(item));
|
||||
blockstate.spawnAfterBreak(world, pos, prevHeldItem);
|
||||
blockstate.spawnAfterBreak(world, pos, prevHeldItem, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public class ManualApplicationRecipe extends ItemApplicationRecipe {
|
|||
|
||||
@SubscribeEvent
|
||||
public static void manualApplicationRecipesApplyInWorld(PlayerInteractEvent.RightClickBlock event) {
|
||||
Level level = event.getWorld();
|
||||
Level level = event.getLevel();
|
||||
ItemStack heldItem = event.getItemStack();
|
||||
BlockPos pos = event.getPos();
|
||||
BlockState blockState = level.getBlockState(pos);
|
||||
|
@ -81,12 +81,12 @@ public class ManualApplicationRecipe extends ItemApplicationRecipe {
|
|||
|
||||
if (!unbreakable && !keepHeld) {
|
||||
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
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
|
||||
awardAdvancements(event.getPlayer(), transformedBlock);
|
||||
awardAdvancements(event.getEntity(), transformedBlock);
|
||||
|
||||
event.setCancellationResult(InteractionResult.SUCCESS);
|
||||
event.setCanceled(true);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.simibubi.create.content.contraptions.components.fan;
|
||||
|
||||
import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance;
|
||||
import net.minecraft.client.resources.sounds.SoundInstance;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
|
||||
|
@ -9,7 +10,7 @@ public class AirCurrentSound extends AbstractTickableSoundInstance {
|
|||
private 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;
|
||||
volume = 0.01f;
|
||||
looping = true;
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.Optional;
|
|||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
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.press.PressingBehaviour.Mode;
|
||||
import com.simibubi.create.content.contraptions.components.press.PressingBehaviour.PressingBehaviourSpecifics;
|
||||
|
@ -136,7 +135,7 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity implemen
|
|||
ItemEntity created =
|
||||
new ItemEntity(level, itemEntity.getX(), itemEntity.getY(), itemEntity.getZ(), result);
|
||||
created.setDefaultPickUpDelay();
|
||||
created.setDeltaMovement(VecHelper.offsetRandomly(Vec3.ZERO, Create.RANDOM, .05f));
|
||||
created.setDeltaMovement(VecHelper.offsetRandomly(Vec3.ZERO, level.random, .05f));
|
||||
level.addFreshEntity(created);
|
||||
}
|
||||
item.shrink(1);
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -34,7 +33,6 @@ import com.simibubi.create.foundation.utility.recipe.RecipeFinder;
|
|||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.particles.BlockParticleOption;
|
||||
import net.minecraft.core.particles.ItemParticleOption;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
|
@ -43,6 +41,7 @@ import net.minecraft.nbt.CompoundTag;
|
|||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
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.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
|
@ -76,7 +76,7 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
|
|||
|
||||
private static final Object cuttingRecipesKey = new Object();
|
||||
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;
|
||||
private int recipeIndex;
|
||||
|
@ -279,7 +279,7 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
|
|||
else
|
||||
particleData = new ItemParticleOption(ParticleTypes.ITEM, stack);
|
||||
|
||||
Random r = level.random;
|
||||
RandomSource r = level.random;
|
||||
Vec3 v = VecHelper.getCenterOf(this.worldPosition)
|
||||
.add(0, 5 / 16f, 0);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
|
@ -302,7 +302,7 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
|
|||
speed = .125f;
|
||||
}
|
||||
|
||||
Random r = level.random;
|
||||
RandomSource r = level.random;
|
||||
Vec3 vec = getItemMovementVec();
|
||||
Vec3 pos = VecHelper.getCenterOf(this.worldPosition);
|
||||
float offset = inventory.recipeDuration != 0 ? (float) (inventory.remainingTime) / inventory.recipeDuration : 0;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.components.steam;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllShapes;
|
||||
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.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
@ -67,7 +66,7 @@ public class PoweredShaftBlock extends AbstractShaftBlock {
|
|||
}
|
||||
|
||||
@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))
|
||||
pLevel.setBlock(pPos, AllBlocks.SHAFT.getDefaultState()
|
||||
.setValue(ShaftBlock.AXIS, pState.getValue(AXIS))
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.components.steam.whistle;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
|
@ -19,6 +17,7 @@ import net.minecraft.server.level.ServerLevel;
|
|||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.StringRepresentable;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
@ -180,7 +179,7 @@ public class WhistleBlock extends Block implements ITE<WhistleTileEntity>, IWren
|
|||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import static com.simibubi.create.AllSoundEvents.WHISTLE_MEDIUM;
|
|||
import com.simibubi.create.content.contraptions.components.steam.whistle.WhistleBlock.WhistleSize;
|
||||
|
||||
import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance;
|
||||
import net.minecraft.client.resources.sounds.SoundInstance;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
@ -19,7 +20,7 @@ public class WhistleSoundInstance extends AbstractTickableSoundInstance {
|
|||
|
||||
public WhistleSoundInstance(WhistleSize size, BlockPos worldPosition) {
|
||||
super((size == WhistleSize.SMALL ? WHISTLE_HIGH : size == WhistleSize.MEDIUM ? WHISTLE_MEDIUM : WHISTLE_LOW)
|
||||
.getMainEvent(), SoundSource.RECORDS);
|
||||
.getMainEvent(), SoundSource.RECORDS, SoundInstance.createUnseededRandom());
|
||||
this.size = size;
|
||||
looping = true;
|
||||
active = true;
|
||||
|
|
|
@ -25,7 +25,7 @@ import net.minecraft.core.Direction;
|
|||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
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.world.level.block.entity.BlockEntity;
|
||||
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")
|
||||
.getString()
|
||||
.split(";");
|
||||
TextComponent textComponent = new TextComponent(spacing);
|
||||
MutableComponent textComponent = Component.literal(spacing);
|
||||
tooltip.add(textComponent.append(Lang.translateDirect("generic.pitch", pitches[pitch % pitches.length])));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ import net.minecraft.nbt.Tag;
|
|||
import net.minecraft.network.protocol.game.DebugPackets;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
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.LevelAccessor;
|
||||
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.minecraftforge.api.distmarker.Dist;
|
||||
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.capability.IFluidHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
@ -148,7 +148,7 @@ public abstract class Contraption {
|
|||
private CompletableFuture<Void> simplifiedEntityColliderProvider;
|
||||
|
||||
// Client
|
||||
public Map<BlockPos, IModelData> modelData;
|
||||
public Map<BlockPos, ModelData> modelData;
|
||||
public Map<BlockPos, BlockEntity> presentTileEntities;
|
||||
public List<BlockEntity> maybeInstancedTileEntities;
|
||||
public List<BlockEntity> specialRenderedTileEntities;
|
||||
|
@ -982,7 +982,7 @@ public abstract class Contraption {
|
|||
// we add the POI data back now
|
||||
// (code copied from ServerWorld.onBlockStateChange)
|
||||
ServerLevel serverWorld = (ServerLevel) world;
|
||||
PoiType.forState(block.state)
|
||||
PoiTypes.forState(block.state)
|
||||
.ifPresent(poiType -> {
|
||||
world.getServer()
|
||||
.execute(() -> {
|
||||
|
@ -1136,7 +1136,7 @@ public abstract class Contraption {
|
|||
}
|
||||
|
||||
protected boolean shouldUpdateAfterMovement(StructureBlockInfo info) {
|
||||
if (PoiType.forState(info.state)
|
||||
if (PoiTypes.forState(info.state)
|
||||
.isPresent())
|
||||
return false;
|
||||
if (info.state.getBlock() instanceof SlidingDoorBlock)
|
||||
|
|
|
@ -33,7 +33,7 @@ import net.minecraft.world.phys.Vec3;
|
|||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
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.PlayerTickEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
@ -69,7 +69,7 @@ public class ContraptionHandlerClient {
|
|||
|
||||
@SubscribeEvent
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void rightClickingOnContraptionsGetsHandledLocally(ClickInputEvent event) {
|
||||
public static void rightClickingOnContraptionsGetsHandledLocally(InputEvent.InteractionKeyMappingTriggered event) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
LocalPlayer player = mc.player;
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import com.simibubi.create.foundation.utility.Lang;
|
|||
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
|
||||
public interface IDisplayAssemblyExceptions {
|
||||
|
||||
|
@ -19,7 +18,7 @@ public interface IDisplayAssemblyExceptions {
|
|||
return false;
|
||||
|
||||
if (!tooltip.isEmpty())
|
||||
tooltip.add(TextComponent.EMPTY);
|
||||
tooltip.add(Component.empty());
|
||||
|
||||
tooltip.add(IHaveGoggleInformation.componentSpacing.plainCopy()
|
||||
.append(Lang.translateDirect("gui.assembly.exception")
|
||||
|
|
|
@ -26,7 +26,7 @@ import net.minecraft.world.phys.BlockHitResult;
|
|||
import net.minecraft.world.phys.HitResult.Type;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
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.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.network.PacketDistributor;
|
||||
|
@ -36,7 +36,7 @@ public class SuperGlueHandler {
|
|||
|
||||
@SubscribeEvent
|
||||
public static void glueListensForBlockPlacement(EntityPlaceEvent event) {
|
||||
LevelAccessor world = event.getWorld();
|
||||
LevelAccessor world = event.getLevel();
|
||||
Entity entity = event.getEntity();
|
||||
BlockPos pos = event.getPos();
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ public class SuperGlueItem extends Item {
|
|||
@SubscribeEvent
|
||||
public static void glueItemAlwaysPlacesWhenUsed(PlayerInteractEvent.RightClickBlock event) {
|
||||
if (event.getHitVec() != null) {
|
||||
BlockState blockState = event.getWorld()
|
||||
BlockState blockState = event.getLevel()
|
||||
.getBlockState(event.getHitVec()
|
||||
.getBlockPos());
|
||||
if (blockState.getBlock()instanceof AbstractChassisBlock cb)
|
||||
|
|
|
@ -18,7 +18,7 @@ import net.minecraft.client.multiplayer.ClientLevel;
|
|||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.core.BlockPos;
|
||||
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.SoundSource;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
@ -62,7 +62,7 @@ public class SuperGlueSelectionHandler {
|
|||
|
||||
if (clusterCooldown > 0) {
|
||||
if (clusterCooldown == 25)
|
||||
player.displayClientMessage(TextComponent.EMPTY, true);
|
||||
player.displayClientMessage(Component.empty(), true);
|
||||
CreateClient.OUTLINER.keep(clusterOutlineSlot);
|
||||
clusterCooldown--;
|
||||
}
|
||||
|
|
|
@ -23,12 +23,12 @@ import net.minecraft.util.Mth;
|
|||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.GameType;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
|
||||
import net.minecraftforge.client.gui.ForgeIngameGui;
|
||||
import net.minecraftforge.client.gui.IIngameOverlay;
|
||||
import net.minecraftforge.client.gui.overlay.ForgeGui;
|
||||
import net.minecraftforge.client.gui.overlay.IGuiOverlay;
|
||||
|
||||
public class TrainHUD {
|
||||
|
||||
public static final IIngameOverlay OVERLAY = TrainHUD::renderOverlay;
|
||||
public static final IGuiOverlay OVERLAY = TrainHUD::renderOverlay;
|
||||
|
||||
static LerpedFloat displayedSpeed = LerpedFloat.linear();
|
||||
static LerpedFloat displayedThrottle = LerpedFloat.linear();
|
||||
|
@ -105,7 +105,7 @@ public class TrainHUD {
|
|||
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) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.options.hideGui || mc.gameMode.getPlayerMode() == GameType.SPECTATOR)
|
||||
|
|
|
@ -292,7 +292,7 @@ public class CartAssemblerBlock extends BaseRailBlock
|
|||
.forEach(itemStack -> player.getInventory()
|
||||
.placeItemBackInInventory(itemStack));
|
||||
if (world instanceof ServerLevel)
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY);
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
|
||||
world.setBlockAndUpdate(pos, getRailBlock(state));
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ public class MinecartContraptionItem extends Item {
|
|||
@SubscribeEvent
|
||||
public static void wrenchCanBeUsedToPickUpMinecartContraptions(PlayerInteractEvent.EntityInteract event) {
|
||||
Entity entity = event.getTarget();
|
||||
Player player = event.getPlayer();
|
||||
Player player = event.getEntity();
|
||||
if (player == null || entity == null)
|
||||
return;
|
||||
|
||||
|
@ -223,7 +223,7 @@ public class MinecartContraptionItem extends Item {
|
|||
return;
|
||||
}
|
||||
|
||||
if (event.getWorld().isClientSide) {
|
||||
if (event.getLevel().isClientSide) {
|
||||
event.setCancellationResult(InteractionResult.SUCCESS);
|
||||
event.setCanceled(true);
|
||||
return;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.components.structureMovement.piston;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.AllSoundEvents;
|
||||
|
@ -15,6 +13,7 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.StringRepresentable;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
@ -111,7 +110,7 @@ public class MechanicalPistonBlock extends DirectionalAxisKineticBlock implement
|
|||
}
|
||||
|
||||
@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);
|
||||
BlockState pole = worldIn.getBlockState(pos.relative(direction.getOpposite()));
|
||||
if (!AllBlocks.PISTON_EXTENSION_POLE.has(pole))
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.components.structureMovement.train;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.simibubi.create.AllItems;
|
||||
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.ParticleOptions;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.vehicle.AbstractMinecart;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
@ -22,7 +21,7 @@ import net.minecraft.world.phys.Vec3;
|
|||
public class CouplingHandlerClient {
|
||||
|
||||
static AbstractMinecart selectedCart;
|
||||
static Random r = new Random();
|
||||
static RandomSource r = RandomSource.create();
|
||||
|
||||
public static void tick() {
|
||||
if (selectedCart == null)
|
||||
|
|
|
@ -35,7 +35,7 @@ public class MinecartCouplingItem extends Item {
|
|||
if (!(interacted instanceof AbstractMinecart))
|
||||
return;
|
||||
AbstractMinecart minecart = (AbstractMinecart) interacted;
|
||||
Player player = event.getPlayer();
|
||||
Player player = event.getEntity();
|
||||
if (player == null)
|
||||
return;
|
||||
LazyOptional<MinecartController> capability =
|
||||
|
@ -60,7 +60,7 @@ public class MinecartCouplingItem extends Item {
|
|||
|
||||
protected static boolean onCouplingInteractOnMinecart(PlayerInteractEvent.EntityInteract event,
|
||||
AbstractMinecart minecart, Player player, MinecartController controller) {
|
||||
Level world = event.getWorld();
|
||||
Level world = event.getLevel();
|
||||
if (controller.isFullyCoupled()) {
|
||||
if (!world.isClientSide)
|
||||
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);
|
||||
if (couplings == 0)
|
||||
return false;
|
||||
if (event.getWorld().isClientSide)
|
||||
if (event.getLevel().isClientSide)
|
||||
return true;
|
||||
|
||||
for (boolean forward : Iterate.trueAndFalse) {
|
||||
|
|
|
@ -36,7 +36,7 @@ import net.minecraftforge.common.util.LazyOptional;
|
|||
import net.minecraftforge.common.util.NonNullConsumer;
|
||||
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||
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> {
|
||||
|
||||
|
@ -144,7 +144,7 @@ public class CapabilityMinecartController implements ICapabilitySerializable<Com
|
|||
public static void onChunkUnloaded(ChunkEvent.Unload event) {
|
||||
ChunkPos chunkPos = event.getChunk()
|
||||
.getPos();
|
||||
Map<UUID, MinecartController> carts = loadedMinecartsByUUID.get(event.getWorld());
|
||||
Map<UUID, MinecartController> carts = loadedMinecartsByUUID.get(event.getLevel());
|
||||
for (MinecartController minecartController : carts.values()) {
|
||||
if (minecartController == null)
|
||||
continue;
|
||||
|
@ -153,7 +153,7 @@ public class CapabilityMinecartController implements ICapabilitySerializable<Com
|
|||
AbstractMinecart cart = minecartController.cart();
|
||||
if (cart.chunkPosition()
|
||||
.equals(chunkPos))
|
||||
queuedUnloads.get(event.getWorld())
|
||||
queuedUnloads.get(event.getLevel())
|
||||
.add(cart.getUUID());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,8 +33,8 @@ public class FluidBottleItemHook extends Item {
|
|||
if (!(itemStack.getItem() instanceof BottleItem))
|
||||
return;
|
||||
|
||||
Level world = event.getWorld();
|
||||
Player player = event.getPlayer();
|
||||
Level world = event.getLevel();
|
||||
Player player = event.getEntity();
|
||||
HitResult raytraceresult = getPlayerPOVHitResult(world, player, ClipContext.Fluid.SOURCE_ONLY);
|
||||
if (raytraceresult.getType() != HitResult.Type.BLOCK)
|
||||
return;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.fluids;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllParticleTypes;
|
||||
import com.simibubi.create.content.contraptions.fluids.particle.FluidParticleData;
|
||||
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.ParticleOptions;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
|
@ -22,7 +21,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
|
||||
public class FluidFX {
|
||||
|
||||
static Random r = new Random();
|
||||
static RandomSource r = RandomSource.create();
|
||||
|
||||
public static void splash(BlockPos pos, FluidStack fluidStack) {
|
||||
Fluid fluid = fluidStack.getFluid();
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.simibubi.create.content.contraptions.fluids;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
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 net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap.Builder;
|
||||
import net.minecraftforge.client.model.data.ModelData;
|
||||
import net.minecraftforge.client.model.data.ModelData.Builder;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
|
||||
public class PipeAttachmentModel extends BakedModelWrapperWithData {
|
||||
|
@ -55,25 +56,25 @@ public class PipeAttachmentModel extends BakedModelWrapperWithData {
|
|||
data.putBracket(bracket.getBracket());
|
||||
|
||||
data.setEncased(FluidPipeBlock.shouldDrawCasing(world, pos, state));
|
||||
return builder.withInitial(PIPE_PROPERTY, data);
|
||||
return builder.with(PIPE_PROPERTY, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand, IModelData data) {
|
||||
List<BakedQuad> quads = super.getQuads(state, side, rand, data);
|
||||
if (data.hasProperty(PIPE_PROPERTY)) {
|
||||
PipeModelData pipeData = data.getData(PIPE_PROPERTY);
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource rand, ModelData data, RenderType renderType) {
|
||||
List<BakedQuad> quads = super.getQuads(state, side, rand, data, renderType);
|
||||
if (data.has(PIPE_PROPERTY)) {
|
||||
PipeModelData pipeData = data.get(PIPE_PROPERTY);
|
||||
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;
|
||||
}
|
||||
|
||||
private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, Random rand, IModelData data,
|
||||
PipeModelData pipeData) {
|
||||
private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, RandomSource rand, ModelData data,
|
||||
PipeModelData pipeData, RenderType renderType) {
|
||||
BakedModel bracket = pipeData.getBracket();
|
||||
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)
|
||||
return;
|
||||
for (Direction d : Iterate.directions)
|
||||
|
@ -81,10 +82,10 @@ public class PipeAttachmentModel extends BakedModelWrapperWithData {
|
|||
quads.addAll(AllBlockPartials.PIPE_ATTACHMENTS.get(pipeData.getRim(d))
|
||||
.get(d)
|
||||
.get()
|
||||
.getQuads(state, side, rand, data));
|
||||
.getQuads(state, side, rand, data, renderType));
|
||||
if (pipeData.isEncased())
|
||||
quads.addAll(AllBlockPartials.FLUID_PIPE_CASING.get()
|
||||
.getQuads(state, side, rand, data));
|
||||
.getQuads(state, side, rand, data, renderType));
|
||||
}
|
||||
|
||||
private static class PipeModelData {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.fluids;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
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.network.protocol.game.DebugPackets;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
|
@ -130,7 +129,7 @@ public class PumpBlock extends DirectionalKineticBlock implements SimpleWaterlog
|
|||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ import com.simibubi.create.foundation.fluid.FluidIngredient;
|
|||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
@ -70,7 +69,7 @@ public class FillingRecipe extends ProcessingRecipe<RecipeWrapper> implements IA
|
|||
List<FluidStack> matchingFluidStacks = fluidIngredients.get(0)
|
||||
.getMatchingFluidStacks();
|
||||
if (matchingFluidStacks.size() == 0)
|
||||
return new TextComponent("Invalid");
|
||||
return Component.literal("Invalid");
|
||||
return Lang.translateDirect("recipe.assembly.spout_filling_fluid",
|
||||
matchingFluidStacks.get(0).getDisplayName().getString());
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.simibubi.create.content.contraptions.fluids.pipes;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllShapes;
|
||||
|
@ -20,6 +19,7 @@ import net.minecraft.core.Direction.Axis;
|
|||
import net.minecraft.core.Direction.AxisDirection;
|
||||
import net.minecraft.network.protocol.game.DebugPackets;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
|
@ -108,7 +108,7 @@ public class AxisPipeBlock extends RotatedPillarBlock implements IWrenchableWith
|
|||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
|
@ -25,6 +24,7 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.network.protocol.game.DebugPackets;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
@ -101,7 +101,7 @@ public class EncasedPipeBlock extends Block implements IWrenchable, ISpecialBloc
|
|||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.simibubi.create.content.contraptions.fluids.pipes;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -23,6 +22,7 @@ import net.minecraft.core.Direction;
|
|||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.network.protocol.game.DebugPackets;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
|
@ -171,7 +171,7 @@ public class FluidPipeBlock extends PipeBlock
|
|||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.fluids.pipes;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.simibubi.create.AllShapes;
|
||||
|
@ -16,6 +14,7 @@ import net.minecraft.core.Direction;
|
|||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.network.protocol.game.DebugPackets;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
|
@ -122,7 +121,7 @@ public class FluidValveBlock extends DirectionalAxisKineticBlock implements IAxi
|
|||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.fluids.pipes;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
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.network.protocol.game.DebugPackets;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
|
@ -124,7 +123,7 @@ public class SmartFluidPipeBlock extends FaceAttachedHorizontalDirectionalBlock
|
|||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import com.simibubi.create.foundation.utility.NBTHelper;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.item.alchemy.Potion;
|
||||
|
@ -82,7 +81,7 @@ public class PotionFluid extends VirtualFluid {
|
|||
|
||||
@Override
|
||||
public Component getDisplayName(FluidStack stack) {
|
||||
return new TranslatableComponent(getTranslationKey(stack));
|
||||
return Component.translatable(getTranslationKey(stack));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -14,8 +14,7 @@ import com.simibubi.create.foundation.utility.Pair;
|
|||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
|
@ -105,10 +104,10 @@ public class PotionFluidHandler {
|
|||
List<MobEffectInstance> list = PotionUtils.getAllEffects(fs.getOrCreateTag());
|
||||
List<Tuple<String, AttributeModifier>> list1 = Lists.newArrayList();
|
||||
if (list.isEmpty()) {
|
||||
tooltip.add((new TranslatableComponent("effect.none")).withStyle(ChatFormatting.GRAY));
|
||||
tooltip.add((Component.translatable("effect.none")).withStyle(ChatFormatting.GRAY));
|
||||
} else {
|
||||
for (MobEffectInstance effectinstance : list) {
|
||||
TranslatableComponent textcomponent = new TranslatableComponent(effectinstance.getDescriptionId());
|
||||
MutableComponent textcomponent = Component.translatable(effectinstance.getDescriptionId());
|
||||
MobEffect effect = effectinstance.getEffect();
|
||||
Map<Attribute, AttributeModifier> map = effect.getAttributeModifiers();
|
||||
if (!map.isEmpty()) {
|
||||
|
@ -125,7 +124,7 @@ public class PotionFluidHandler {
|
|||
|
||||
if (effectinstance.getAmplifier() > 0) {
|
||||
textcomponent.append(" ")
|
||||
.append(new TranslatableComponent("potion.potency." + effectinstance.getAmplifier()).getString());
|
||||
.append(Component.translatable("potion.potency." + effectinstance.getAmplifier()).getString());
|
||||
}
|
||||
|
||||
if (effectinstance.getDuration() > 20) {
|
||||
|
@ -140,8 +139,8 @@ public class PotionFluidHandler {
|
|||
}
|
||||
|
||||
if (!list1.isEmpty()) {
|
||||
tooltip.add(new TextComponent(""));
|
||||
tooltip.add((new TranslatableComponent("potion.whenDrank")).withStyle(ChatFormatting.DARK_PURPLE));
|
||||
tooltip.add(Component.literal(""));
|
||||
tooltip.add((Component.translatable("potion.whenDrank")).withStyle(ChatFormatting.DARK_PURPLE));
|
||||
|
||||
for (Tuple<String, AttributeModifier> tuple : list1) {
|
||||
AttributeModifier attributemodifier2 = tuple.getB();
|
||||
|
@ -155,19 +154,19 @@ public class PotionFluidHandler {
|
|||
}
|
||||
|
||||
if (d0 > 0.0D) {
|
||||
tooltip.add((new TranslatableComponent(
|
||||
tooltip.add((Component.translatable(
|
||||
"attribute.modifier.plus." + attributemodifier2.getOperation()
|
||||
.toValue(),
|
||||
ItemStack.ATTRIBUTE_MODIFIER_FORMAT.format(d1),
|
||||
new TranslatableComponent(tuple.getA())))
|
||||
Component.translatable(tuple.getA())))
|
||||
.withStyle(ChatFormatting.BLUE));
|
||||
} else if (d0 < 0.0D) {
|
||||
d1 = d1 * -1.0D;
|
||||
tooltip.add((new TranslatableComponent(
|
||||
tooltip.add((Component.translatable(
|
||||
"attribute.modifier.take." + attributemodifier2.getOperation()
|
||||
.toValue(),
|
||||
ItemStack.ATTRIBUTE_MODIFIER_FORMAT.format(d1),
|
||||
new TranslatableComponent(tuple.getA())))
|
||||
Component.translatable(tuple.getA())))
|
||||
.withStyle(ChatFormatting.RED));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ import net.minecraft.core.Direction;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
@ -147,8 +146,8 @@ public class BoilerData {
|
|||
if (!isActive())
|
||||
return false;
|
||||
|
||||
Component indent = new TextComponent(IHaveGoggleInformation.spacing);
|
||||
Component indent2 = new TextComponent(IHaveGoggleInformation.spacing + " ");
|
||||
Component indent = Component.literal(IHaveGoggleInformation.spacing);
|
||||
Component indent2 = Component.literal(IHaveGoggleInformation.spacing + " ");
|
||||
|
||||
calcMinMaxForSize(boilerSize);
|
||||
|
||||
|
@ -169,7 +168,7 @@ public class BoilerData {
|
|||
double totalSU = getEngineEfficiency(boilerSize) * 16 * Math.max(boilerLevel, attachedEngines)
|
||||
* BlockStressValues.getCapacity(AllBlocks.STEAM_ENGINE.get());
|
||||
|
||||
tooltip.add(Lang.empty());
|
||||
tooltip.add(Component.empty());
|
||||
|
||||
Lang.translate("tooltip.capacityProvided")
|
||||
.style(ChatFormatting.GRAY)
|
||||
|
@ -234,12 +233,12 @@ public class BoilerData {
|
|||
}
|
||||
|
||||
private MutableComponent blockComponent(int level) {
|
||||
return new TextComponent(
|
||||
return Component.literal(
|
||||
"" + "\u2588".repeat(minValue) + "\u2592".repeat(level - minValue) + "\u2591".repeat(maxValue - 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(minValue > 0 ? 1 : 0, ChatFormatting.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) {
|
||||
return new TextComponent(Strings.repeat('|', level)).withStyle(format);
|
||||
return Component.literal(Strings.repeat('|', level)).withStyle(format);
|
||||
}
|
||||
|
||||
public boolean evaluate(FluidTankTileEntity controller) {
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllSpriteShifts;
|
||||
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.utility.Iterate;
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap.Builder;
|
||||
import net.minecraftforge.client.model.data.ModelData;
|
||||
import net.minecraftforge.client.model.data.ModelData.Builder;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
|
||||
public class FluidTankModel extends CTModel {
|
||||
|
@ -46,22 +47,22 @@ public class FluidTankModel extends CTModel {
|
|||
CullData cullData = new CullData();
|
||||
for (Direction d : Iterate.horizontalDirections)
|
||||
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
|
||||
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)
|
||||
return Collections.emptyList();
|
||||
|
||||
List<BakedQuad> quads = new ArrayList<>();
|
||||
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))
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import com.simibubi.create.foundation.utility.Lang;
|
|||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.FormattedText;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
|
@ -24,26 +23,26 @@ public class GoggleConfigScreen extends AbstractSimiScreen {
|
|||
private final List<Component> tooltip;
|
||||
|
||||
public GoggleConfigScreen() {
|
||||
Component componentSpacing = new TextComponent(" ");
|
||||
Component componentSpacing = Component.literal(" ");
|
||||
tooltip = new ArrayList<>();
|
||||
tooltip.add(componentSpacing.plainCopy()
|
||||
.append(Lang.translateDirect("gui.config.overlay1")));
|
||||
tooltip.add(componentSpacing.plainCopy()
|
||||
.append(Lang.translateDirect("gui.config.overlay2")
|
||||
.withStyle(ChatFormatting.GRAY)));
|
||||
tooltip.add(TextComponent.EMPTY);
|
||||
tooltip.add(Component.empty());
|
||||
tooltip.add(componentSpacing.plainCopy()
|
||||
.append(Lang.translateDirect("gui.config.overlay3")));
|
||||
tooltip.add(componentSpacing.plainCopy()
|
||||
.append(Lang.translateDirect("gui.config.overlay4")));
|
||||
tooltip.add(TextComponent.EMPTY);
|
||||
tooltip.add(Component.empty());
|
||||
tooltip.add(componentSpacing.plainCopy()
|
||||
.append(Lang.translateDirect("gui.config.overlay5")
|
||||
.withStyle(ChatFormatting.GRAY)));
|
||||
tooltip.add(componentSpacing.plainCopy()
|
||||
.append(Lang.translateDirect("gui.config.overlay6")
|
||||
.withStyle(ChatFormatting.GRAY)));
|
||||
tooltip.add(TextComponent.EMPTY);
|
||||
tooltip.add(Component.empty());
|
||||
tooltip.add(componentSpacing.plainCopy()
|
||||
.append(Lang.translateDirect("gui.config.overlay7")));
|
||||
tooltip.add(componentSpacing.plainCopy()
|
||||
|
|
|
@ -30,7 +30,6 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.FormattedText;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
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.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraftforge.client.gui.ForgeIngameGui;
|
||||
import net.minecraftforge.client.gui.IIngameOverlay;
|
||||
import net.minecraftforge.client.gui.overlay.ForgeGui;
|
||||
import net.minecraftforge.client.gui.overlay.IGuiOverlay;
|
||||
|
||||
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();
|
||||
|
||||
public static int hoverTicks = 0;
|
||||
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) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.options.hideGui || mc.gameMode.getPlayerMode() == GameType.SPECTATOR)
|
||||
|
@ -100,7 +99,7 @@ public class GoggleOverlayRenderer {
|
|||
|
||||
if (hasHoveringInformation) {
|
||||
if (!tooltip.isEmpty())
|
||||
tooltip.add(TextComponent.EMPTY);
|
||||
tooltip.add(Component.empty());
|
||||
IHaveHoveringInformation hte = (IHaveHoveringInformation) te;
|
||||
hoverAddedInformation = hte.addToTooltip(tooltip, mc.player.isShiftKeyDown());
|
||||
|
||||
|
@ -143,11 +142,11 @@ public class GoggleOverlayRenderer {
|
|||
if (!pistonFound)
|
||||
return;
|
||||
if (!tooltip.isEmpty())
|
||||
tooltip.add(TextComponent.EMPTY);
|
||||
tooltip.add(Component.empty());
|
||||
|
||||
tooltip.add(IHaveGoggleInformation.componentSpacing.plainCopy()
|
||||
.append(Lang.translateDirect("gui.goggles.pole_length"))
|
||||
.append(new TextComponent(" " + poles)));
|
||||
.append(Component.literal(" " + poles)));
|
||||
}
|
||||
|
||||
if (tooltip.isEmpty())
|
||||
|
|
|
@ -14,11 +14,11 @@ public class GogglesModel extends BakedModelWrapper<BakedModel> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BakedModel handlePerspective(TransformType cameraTransformType, PoseStack mat) {
|
||||
public BakedModel applyTransform(TransformType cameraTransformType, PoseStack mat, boolean leftHanded) {
|
||||
if (cameraTransformType == TransformType.HEAD)
|
||||
return AllBlockPartials.GOGGLES.get()
|
||||
.handlePerspective(cameraTransformType, mat);
|
||||
return super.handlePerspective(cameraTransformType, mat);
|
||||
.applyTransform(cameraTransformType, mat, leftHanded);
|
||||
return super.applyTransform(cameraTransformType, mat, leftHanded);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.simibubi.create.foundation.utility.LangBuilder;
|
|||
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
|
@ -27,7 +26,7 @@ public interface IHaveGoggleInformation {
|
|||
* Use Lang.[...].forGoggles(list)
|
||||
*/
|
||||
@Deprecated
|
||||
Component componentSpacing = new TextComponent(spacing);
|
||||
Component componentSpacing = Component.literal(spacing);
|
||||
|
||||
/**
|
||||
* this method will be called when looking at a TileEntity that implemented this
|
||||
|
|
|
@ -19,7 +19,6 @@ import net.minecraft.ChatFormatting;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
@ -239,7 +238,7 @@ public class SequencedAssemblyRecipe implements Recipe<RecipeWrapper> {
|
|||
int length = sequencedAssemblyRecipe.sequence.size();
|
||||
int step = sequencedAssemblyRecipe.getStep(stack);
|
||||
int total = length * sequencedAssemblyRecipe.loops;
|
||||
toolTip.add(new TextComponent(""));
|
||||
toolTip.add(Component.literal(""));
|
||||
toolTip.add(Lang.translateDirect("recipe.sequenced_assembly")
|
||||
.withStyle(ChatFormatting.GRAY));
|
||||
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)
|
||||
.withStyle(ChatFormatting.AQUA));
|
||||
else
|
||||
toolTip.add(new TextComponent("-> ").append(textComponent)
|
||||
toolTip.add(Component.literal("-> ").append(textComponent)
|
||||
.withStyle(ChatFormatting.DARK_AQUA));
|
||||
}
|
||||
|
||||
|
|
|
@ -10,10 +10,8 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||
import net.minecraftforge.registries.ForgeRegistryEntry;
|
||||
|
||||
public class SequencedAssemblyRecipeSerializer extends ForgeRegistryEntry<RecipeSerializer<?>>
|
||||
implements RecipeSerializer<SequencedAssemblyRecipe> {
|
||||
public class SequencedAssemblyRecipeSerializer implements RecipeSerializer<SequencedAssemblyRecipe> {
|
||||
|
||||
public SequencedAssemblyRecipeSerializer() {}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.simibubi.create.content.contraptions.particle;
|
|||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.contraptions.components.fan.IAirCurrentSource;
|
||||
import com.simibubi.create.content.contraptions.processing.InWorldProcessing;
|
||||
import com.simibubi.create.foundation.utility.Color;
|
||||
|
@ -35,7 +34,7 @@ public class AirFlowParticle extends SimpleAnimatedParticle {
|
|||
this.lifetime = 40;
|
||||
hasPhysics = false;
|
||||
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.xo = x;
|
||||
this.yo = y;
|
||||
|
|
|
@ -2,13 +2,13 @@ package com.simibubi.create.content.contraptions.particle;
|
|||
|
||||
import com.mojang.serialization.Codec;
|
||||
|
||||
import net.minecraft.client.particle.ParticleEngine;
|
||||
import net.minecraft.client.particle.ParticleProvider;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
import net.minecraft.core.particles.ParticleOptions.Deserializer;
|
||||
import net.minecraft.core.particles.ParticleType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
|
||||
|
||||
public interface ICustomParticleData<T extends ParticleOptions> {
|
||||
|
||||
|
@ -30,8 +30,8 @@ public interface ICustomParticleData<T extends ParticleOptions> {
|
|||
public ParticleProvider<T> getFactory();
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public default void register(ParticleType<T> type, ParticleEngine particles) {
|
||||
particles.register(type, getFactory());
|
||||
public default void register(ParticleType<T> type, RegisterParticleProvidersEvent event) {
|
||||
event.register(type, getFactory());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.simibubi.create.content.contraptions.particle;
|
|||
|
||||
import com.mojang.serialization.Codec;
|
||||
|
||||
import net.minecraft.client.particle.ParticleEngine;
|
||||
import net.minecraft.client.particle.ParticleEngine.SpriteParticleRegistration;
|
||||
import net.minecraft.client.particle.ParticleProvider;
|
||||
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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
|
||||
|
||||
public interface ICustomParticleDataWithSprite<T extends ParticleOptions> extends ICustomParticleData<T> {
|
||||
|
||||
|
@ -36,8 +36,8 @@ public interface ICustomParticleDataWithSprite<T extends ParticleOptions> extend
|
|||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public default void register(ParticleType<T> type, ParticleEngine particles) {
|
||||
particles.register(type, getMetaFactory());
|
||||
public default void register(ParticleType<T> type, RegisterParticleProvidersEvent event) {
|
||||
event.register(type, getMetaFactory());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -101,13 +101,13 @@ public class BasinRecipe extends ProcessingRecipe<SmartInventory> {
|
|||
if (!ingredient.test(extracted))
|
||||
continue;
|
||||
// Catalyst items are never consumed
|
||||
if (extracted.hasContainerItem() && extracted.getContainerItem()
|
||||
if (extracted.hasCraftingRemainingItem() && extracted.getCraftingRemainingItem()
|
||||
.sameItem(extracted))
|
||||
continue Ingredients;
|
||||
if (!simulate)
|
||||
availableItems.extractItem(slot, 1, false);
|
||||
else if (extracted.hasContainerItem())
|
||||
recipeOutputItems.add(extracted.getContainerItem()
|
||||
else if (extracted.hasCraftingRemainingItem())
|
||||
recipeOutputItems.add(extracted.getCraftingRemainingItem()
|
||||
.copy());
|
||||
extractedItemsFromSlot[slot]++;
|
||||
continue Ingredients;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.processing;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
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.Axis;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
@ -49,7 +48,7 @@ public class BasinRenderer extends SmartTileEntityRenderer<BasinTileEntity> {
|
|||
TransformStack.cast(ms)
|
||||
.rotateY(basin.ingredientRotation.getValue(partialTicks));
|
||||
|
||||
Random r = new Random(pos.hashCode());
|
||||
RandomSource r = RandomSource.create(pos.hashCode());
|
||||
Vec3 baseVector = new Vec3(.125, level, 0);
|
||||
|
||||
IItemHandlerModifiable inv = basin.itemCapability.orElse(new ItemStackHandler());
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.Collections;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
@ -47,6 +46,7 @@ import net.minecraft.nbt.StringTag;
|
|||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
|
@ -525,7 +525,7 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
|||
if (simulate)
|
||||
return true;
|
||||
for (ItemStack itemStack : outputItems) {
|
||||
if (itemStack.hasContainerItem() && itemStack.getContainerItem()
|
||||
if (itemStack.hasCraftingRemainingItem() && itemStack.getCraftingRemainingItem()
|
||||
.sameItem(itemStack))
|
||||
continue;
|
||||
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) {
|
||||
for (ItemStack itemStack : outputItems) {
|
||||
// Catalyst items are never consumed
|
||||
if (itemStack.hasContainerItem() && itemStack.getContainerItem()
|
||||
if (itemStack.hasCraftingRemainingItem() && itemStack.getCraftingRemainingItem()
|
||||
.sameItem(itemStack))
|
||||
continue;
|
||||
if (!ItemHandlerHelper.insertItemStacked(targetInv, itemStack.copy(), simulate)
|
||||
|
@ -609,7 +609,7 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
|||
}
|
||||
|
||||
private void createFluidParticles() {
|
||||
Random r = level.random;
|
||||
RandomSource r = level.random;
|
||||
|
||||
if (!visualizedOutputFluids.isEmpty())
|
||||
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();
|
||||
if (!(blockState.getBlock() instanceof BasinBlock))
|
||||
return;
|
||||
|
|
|
@ -17,12 +17,10 @@ import net.minecraft.util.GsonHelper;
|
|||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.registries.ForgeRegistryEntry;
|
||||
|
||||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
public class ProcessingRecipeSerializer<T extends ProcessingRecipe<?>> extends ForgeRegistryEntry<RecipeSerializer<?>>
|
||||
implements RecipeSerializer<T> {
|
||||
public class ProcessingRecipeSerializer<T extends ProcessingRecipe<?>> implements RecipeSerializer<T> {
|
||||
|
||||
private final ProcessingRecipeFactory<T> factory;
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ public class BlazeBurnerBlock extends HorizontalDirectionalBlock implements ITE<
|
|||
return InteractionResultHolder.fail(ItemStack.EMPTY);
|
||||
|
||||
if (!doNotConsume) {
|
||||
ItemStack container = stack.hasContainerItem() ? stack.getContainerItem() : ItemStack.EMPTY;
|
||||
ItemStack container = stack.hasCraftingRemainingItem() ? stack.getCraftingRemainingItem() : ItemStack.EMPTY;
|
||||
if (!world.isClientSide) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.processing.burner;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
|
||||
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.nbt.CompoundTag;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -42,7 +41,7 @@ public class BlazeBurnerMovementBehaviour implements MovementBehaviour {
|
|||
if (!shouldRender(context))
|
||||
return;
|
||||
|
||||
Random r = context.world.getRandom();
|
||||
RandomSource r = context.world.getRandom();
|
||||
Vec3 c = context.position;
|
||||
Vec3 v = c.add(VecHelper.offsetRandomly(Vec3.ZERO, r, .125f)
|
||||
.multiply(1, 0, 1));
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.simibubi.create.content.contraptions.processing.burner;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
|
@ -24,6 +23,7 @@ import net.minecraft.nbt.CompoundTag;
|
|||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
@ -291,7 +291,7 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
|
|||
if (heatLevel == BlazeBurnerBlock.HeatLevel.NONE)
|
||||
return;
|
||||
|
||||
Random r = level.getRandom();
|
||||
RandomSource r = level.getRandom();
|
||||
|
||||
Vec3 c = VecHelper.getCenterOf(worldPosition);
|
||||
Vec3 v = c.add(VecHelper.offsetRandomly(Vec3.ZERO, r, .125f)
|
||||
|
@ -323,7 +323,7 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
|
|||
|
||||
public void spawnParticleBurst(boolean soulFlame) {
|
||||
Vec3 c = VecHelper.getCenterOf(worldPosition);
|
||||
Random r = level.random;
|
||||
RandomSource r = level.random;
|
||||
for (int i = 0; i < 20; i++) {
|
||||
Vec3 offset = VecHelper.offsetRandomly(Vec3.ZERO, r, .5f)
|
||||
.multiply(1, .25f, 1)
|
||||
|
|
|
@ -6,7 +6,6 @@ import java.util.List;
|
|||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
|
||||
public enum InstructionSpeedModifiers {
|
||||
|
||||
|
@ -24,7 +23,7 @@ public enum InstructionSpeedModifiers {
|
|||
value = modifier;
|
||||
}
|
||||
private InstructionSpeedModifiers(int modifier, String label) {
|
||||
this.label = new TextComponent(label);
|
||||
this.label = Component.literal(label);
|
||||
translationKey = "gui.sequenced_gearshift.speed." + Lang.asId(name());
|
||||
value = modifier;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.relays.advanced.sequencer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
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.Axis;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
@ -65,7 +64,7 @@ public class SequencedGearshiftBlock extends HorizontalAxisKineticBlock implemen
|
|||
}
|
||||
|
||||
@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 isPowered = worldIn.hasNeighborSignal(pos);
|
||||
withTileEntityDo(worldIn, pos, sgte -> sgte.onRedstoneUpdate(isPowered, previouslyPowered));
|
||||
|
|
|
@ -17,7 +17,6 @@ import com.simibubi.create.foundation.utility.Lang;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class SequencedGearshiftScreen extends AbstractSimiScreen {
|
||||
|
@ -150,7 +149,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
|
|||
if (def.hasValueParameter) {
|
||||
String text = def.formatValue(instruction.value);
|
||||
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)
|
||||
label(ms, 127, yOffset - 3, instruction.speedModifier.label);
|
||||
|
|
|
@ -77,7 +77,7 @@ import net.minecraft.world.phys.shapes.Shapes;
|
|||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
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.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
@ -96,7 +96,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void initializeClient(Consumer<IBlockRenderProperties> consumer) {
|
||||
public void initializeClient(Consumer<IClientBlockExtensions> consumer) {
|
||||
consumer.accept(new RenderProperties());
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||
}
|
||||
|
||||
@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);
|
||||
if (controllerTE != null)
|
||||
controllerTE.getInventory()
|
||||
|
@ -351,7 +351,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,20 +4,21 @@ import static com.simibubi.create.content.contraptions.relays.belt.BeltTileEntit
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllSpriteShifts;
|
||||
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.SpriteShiftEntry;
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
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> {
|
||||
|
||||
|
@ -28,11 +29,11 @@ public class BeltModel extends BakedModelWrapper<BakedModel> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand, IModelData extraData) {
|
||||
List<BakedQuad> quads = super.getQuads(state, side, rand, extraData);
|
||||
if (!extraData.hasProperty(CASING_PROPERTY))
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource rand, ModelData extraData, RenderType renderType) {
|
||||
List<BakedQuad> quads = super.getQuads(state, side, rand, extraData, renderType);
|
||||
if (!extraData.has(CASING_PROPERTY))
|
||||
return quads;
|
||||
CasingType type = extraData.getData(CASING_PROPERTY);
|
||||
CasingType type = extraData.get(CASING_PROPERTY);
|
||||
if (type == CasingType.NONE || type == CasingType.BRASS)
|
||||
return quads;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import net.minecraft.client.multiplayer.ClientLevel;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
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.SoundSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
|
@ -473,7 +473,7 @@ public class BeltSlicer {
|
|||
mc.player.displayClientMessage(Lang.translateDirect(feedback.langKey)
|
||||
.withStyle(feedback.formatting), true);
|
||||
else
|
||||
mc.player.displayClientMessage(new TextComponent(""), true);
|
||||
mc.player.displayClientMessage(Component.literal(""), true);
|
||||
|
||||
if (feedback.bb != null)
|
||||
CreateClient.OUTLINER.chaseAABB("BeltSlicer", feedback.bb)
|
||||
|
|
|
@ -54,8 +54,7 @@ import net.minecraft.world.phys.AABB;
|
|||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelData;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
|
@ -511,8 +510,8 @@ public class BeltTileEntity extends KineticTileEntity {
|
|||
public static final ModelProperty<CasingType> CASING_PROPERTY = new ModelProperty<>();
|
||||
|
||||
@Override
|
||||
public IModelData getModelData() {
|
||||
return new ModelDataMap.Builder().withInitial(CASING_PROPERTY, casing)
|
||||
public ModelData getModelData() {
|
||||
return ModelData.builder().with(CASING_PROPERTY, casing)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@ package com.simibubi.create.content.contraptions.relays.elementary;
|
|||
|
||||
import java.util.Collections;
|
||||
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 net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.model.BakedModelWrapper;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelData;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
|
||||
public class BracketedKineticBlockModel extends BakedModelWrapper<BakedModel> {
|
||||
|
@ -28,30 +28,35 @@ public class BracketedKineticBlockModel extends BakedModelWrapper<BakedModel> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IModelData getModelData(BlockAndTintGetter world, BlockPos pos, BlockState state, IModelData tileData) {
|
||||
if (VirtualEmptyModelData.is(tileData))
|
||||
public ModelData getModelData(BlockAndTintGetter world, BlockPos pos, BlockState state, ModelData tileData) {
|
||||
if (isVirtual(tileData))
|
||||
return tileData;
|
||||
BracketedModelData data = new BracketedModelData();
|
||||
BracketedTileEntityBehaviour attachmentBehaviour =
|
||||
TileEntityBehaviour.get(world, pos, BracketedTileEntityBehaviour.TYPE);
|
||||
if (attachmentBehaviour != null)
|
||||
data.putBracket(attachmentBehaviour.getBracket());
|
||||
return new ModelDataMap.Builder().withInitial(BRACKET_PROPERTY, data)
|
||||
return ModelData.builder().with(BRACKET_PROPERTY, data)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand, IModelData data) {
|
||||
if (!VirtualEmptyModelData.is(data)) {
|
||||
if (data.hasProperty(BRACKET_PROPERTY)) {
|
||||
BracketedModelData pipeData = data.getData(BRACKET_PROPERTY);
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource rand, ModelData data, RenderType renderType) {
|
||||
if (!isVirtual(data)) {
|
||||
if (data.has(BRACKET_PROPERTY)) {
|
||||
BracketedModelData pipeData = data.get(BRACKET_PROPERTY);
|
||||
BakedModel bracket = pipeData.getBracket();
|
||||
if (bracket != null)
|
||||
return bracket.getQuads(state, side, rand, data);
|
||||
return bracket.getQuads(state, side, rand, data, renderType);
|
||||
}
|
||||
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 {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.relays.encased;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
import com.simibubi.create.content.contraptions.RotationPropagator;
|
||||
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.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
@ -76,7 +75,7 @@ public class GearshiftBlock extends AbstractEncasedShaftBlock implements ITE<Spl
|
|||
}
|
||||
|
||||
@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);
|
||||
if (te == null || !(te instanceof KineticTileEntity))
|
||||
return;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.relays.gauge;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
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.particles.DustParticleOptions;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.StringRepresentable;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
|
@ -119,7 +118,7 @@ public class GaugeBlock extends DirectionalAxisKineticBlock implements ITE<Gauge
|
|||
}
|
||||
|
||||
@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);
|
||||
if (te == null || !(te instanceof GaugeTileEntity))
|
||||
return;
|
||||
|
|
|
@ -61,7 +61,7 @@ public interface IWrenchable {
|
|||
.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);
|
||||
playRemoveSound(world, pos);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import net.minecraft.world.level.block.Block;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
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;
|
||||
|
||||
public class WrenchItem extends Item {
|
||||
|
@ -71,7 +71,7 @@ public class WrenchItem extends Item {
|
|||
if (player != null && !player.isCreative())
|
||||
Block.getDrops(state, (ServerLevel) world, pos, world.getBlockEntity(pos), player, context.getItemInHand())
|
||||
.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);
|
||||
AllSoundEvents.WRENCH_REMOVE.playOnServer(world, pos, 1, Create.RANDOM.nextFloat() * .5f + .5f);
|
||||
return InteractionResult.SUCCESS;
|
||||
|
@ -81,7 +81,7 @@ public class WrenchItem extends Item {
|
|||
Entity target = event.getTarget();
|
||||
if (!(target instanceof AbstractMinecart))
|
||||
return;
|
||||
Player player = event.getPlayer();
|
||||
Player player = event.getEntity();
|
||||
ItemStack heldItem = player.getMainHandItem();
|
||||
if (!AllItems.WRENCH.isIn(heldItem))
|
||||
return;
|
||||
|
@ -93,7 +93,7 @@ public class WrenchItem extends Item {
|
|||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void initializeClient(Consumer<IItemRenderProperties> consumer) {
|
||||
public void initializeClient(Consumer<IClientItemExtensions> consumer) {
|
||||
consumer.accept(SimpleCustomRenderer.create(this, new WrenchItemRenderer()));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.curiosities;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.commons.lang3.mutable.MutableBoolean;
|
||||
|
||||
import com.simibubi.create.AllItems;
|
||||
|
@ -20,6 +18,7 @@ import net.minecraft.core.NonNullList;
|
|||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
|
@ -67,7 +66,7 @@ public class ChromaticCompoundItem extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getItemStackLimit(ItemStack stack) {
|
||||
public int getMaxStackSize(ItemStack stack) {
|
||||
return isBarVisible(stack) ? 1 : 16;
|
||||
}
|
||||
|
||||
|
@ -162,7 +161,7 @@ public class ChromaticCompoundItem extends Item {
|
|||
}
|
||||
|
||||
// Find a light source and eat it.
|
||||
Random r = world.random;
|
||||
RandomSource r = world.random;
|
||||
int range = 3;
|
||||
float rate = 1 / 2f;
|
||||
if (r.nextFloat() > rate)
|
||||
|
|
|
@ -10,8 +10,8 @@ import net.minecraft.ChatFormatting;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
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.ClientboundSetTitleTextPacket;
|
||||
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.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
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 ClientboundSetSubtitleTextPacket(
|
||||
new TextComponent("\u26A0 ").withStyle(depleted ? ChatFormatting.RED : ChatFormatting.GOLD)
|
||||
Component.literal("\u26A0 ").withStyle(depleted ? ChatFormatting.RED : ChatFormatting.GOLD)
|
||||
.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) {
|
||||
return maxAir(EnchantmentHelper.getItemEnchantmentLevel(AllEnchantments.CAPACITY.get(), backtank));
|
||||
return maxAir(backtank.getEnchantmentLevel(AllEnchantments.CAPACITY.get()));
|
||||
}
|
||||
|
||||
public static int maxAir(int enchantLevel) {
|
||||
|
|
|
@ -25,7 +25,6 @@ import net.minecraft.client.renderer.entity.RenderLayerParent;
|
|||
import net.minecraft.client.renderer.entity.layers.RenderLayer;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.util.StringUtil;
|
||||
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.level.GameType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.gui.ForgeIngameGui;
|
||||
import net.minecraftforge.client.gui.IIngameOverlay;
|
||||
import net.minecraftforge.client.gui.overlay.ForgeGui;
|
||||
import net.minecraftforge.client.gui.overlay.IGuiOverlay;
|
||||
|
||||
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) {
|
||||
super(renderer);
|
||||
|
@ -106,7 +105,7 @@ public class CopperBacktankArmorLayer<T extends LivingEntity, M extends EntityMo
|
|||
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();
|
||||
if (mc.options.hideGui || mc.gameMode.getPlayerMode() == GameType.SPECTATOR)
|
||||
return;
|
||||
|
@ -129,7 +128,7 @@ public class CopperBacktankArmorLayer<T extends LivingEntity, M extends EntityMo
|
|||
|
||||
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())
|
||||
.at(0, 0)
|
||||
.render(poseStack);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class CopperBacktankItem extends CopperArmorItem implements ICapacityEnch
|
|||
|
||||
@Override
|
||||
public void fillItemCategory(CreativeModeTab p_150895_1_, NonNullList<ItemStack> p_150895_2_) {
|
||||
if (!allowdedIn(p_150895_1_))
|
||||
if (!allowedIn(p_150895_1_))
|
||||
return;
|
||||
|
||||
ItemStack stack = new ItemStack(this);
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllSoundEvents;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.particle.AirParticleData;
|
||||
import com.simibubi.create.foundation.advancement.AllAdvancements;
|
||||
|
@ -73,7 +72,7 @@ public class CopperBacktankTileEntity extends KineticTileEntity implements Namea
|
|||
int max = BackTankUtil.maxAir(capacityEnchantLevel);
|
||||
if (level.isClientSide) {
|
||||
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);
|
||||
if (airLevel != max)
|
||||
level.addParticle(new AirParticleData(1, .05f), v.x, v.y, v.z, m.x, m.y, m.z);
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.world.entity.LivingEntity;
|
|||
import net.minecraft.world.entity.Pose;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
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.fml.common.Mod.EventBusSubscriber;
|
||||
|
||||
|
@ -20,8 +20,8 @@ public class DivingBootsItem extends CopperArmorItem {
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void accellerateDescentUnderwater(LivingUpdateEvent event) {
|
||||
LivingEntity entity = event.getEntityLiving();
|
||||
public static void accellerateDescentUnderwater(LivingTickEvent event) {
|
||||
LivingEntity entity = event.getEntity();
|
||||
if (!affects(entity))
|
||||
return;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import net.minecraft.world.entity.LivingEntity;
|
|||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
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.fml.common.Mod.EventBusSubscriber;
|
||||
|
||||
|
@ -24,8 +24,8 @@ public class DivingHelmetItem extends CopperArmorItem {
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void breatheUnderwater(LivingUpdateEvent event) {
|
||||
LivingEntity entity = event.getEntityLiving();
|
||||
public static void breatheUnderwater(LivingTickEvent event) {
|
||||
LivingEntity entity = event.getEntity();
|
||||
Level world = entity.level;
|
||||
boolean second = world.getGameTime() % 20 == 0;
|
||||
boolean drowning = entity.getAirSupply() == 0;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.curiosities.bell;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
|
||||
|
@ -11,6 +9,7 @@ import net.minecraft.core.particles.ParticleTypes;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
@ -67,7 +66,7 @@ public class HauntedBellTileEntity extends AbstractBellTileEntity {
|
|||
if (!level.isClientSide)
|
||||
return;
|
||||
|
||||
Random rand = level.getRandom();
|
||||
RandomSource rand = level.getRandom();
|
||||
if (rand.nextFloat() > 0.25f)
|
||||
return;
|
||||
|
||||
|
@ -75,7 +74,7 @@ public class HauntedBellTileEntity extends AbstractBellTileEntity {
|
|||
playSound(rand);
|
||||
}
|
||||
|
||||
protected void spawnParticle(Random rand) {
|
||||
protected void spawnParticle(RandomSource rand) {
|
||||
double x = worldPosition.getX() + rand.nextDouble();
|
||||
double y = worldPosition.getY() + 0.5;
|
||||
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);
|
||||
}
|
||||
|
||||
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 pitch = 0.6F + rand.nextFloat() * 0.4F;
|
||||
level.playSound(null, worldPosition, SoundEvents.SOUL_ESCAPE, SoundSource.BLOCKS, vol, pitch);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.curiosities.bell;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllSoundEvents;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
|
@ -9,6 +7,7 @@ import com.simibubi.create.AllTileEntities;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
|
@ -81,7 +80,7 @@ public class PeculiarBellBlock extends AbstractBellBlock<PeculiarBellTileEntity>
|
|||
}
|
||||
|
||||
public void spawnConversionParticles(LevelAccessor world, BlockPos blockPos) {
|
||||
Random random = world.getRandom();
|
||||
RandomSource random = world.getRandom();
|
||||
int num = random.nextInt(10) + 15;
|
||||
for (int i = 0; i < num; i++) {
|
||||
float pitch = random.nextFloat() * 120 - 90;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue