Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 1.19 #583

Open
wants to merge 7 commits into
base: 1.18
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ repositories {
includeGroup "curse.maven"
}
}
mavenLocal()
}

apply plugin: 'net.minecraftforge.gradle'
Expand All @@ -61,7 +62,7 @@ apply plugin: 'org.spongepowered.mixin'
ext.buildnumber = 0
ext.projversion = 0

project.projversion = '1.18.2-2.7.5'
project.projversion = "${mod_version}"
group = 'com.corosus.weather2' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'weather2'

Expand All @@ -88,7 +89,7 @@ minecraft {
//
// Use non-default mappings at your own risk. They may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'official', version: '1.18.1'
mappings channel: 'official', version: '1.19.2'

// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default.
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
Expand Down Expand Up @@ -205,15 +206,12 @@ dependencies {
//implementation fg.deobf(ltlib)


implementation fg.deobf('com.corosus.coroutil:coroutil:1.18.2-1.2.45')
implementation fg.deobf('com.corosus.coroutil:CoroUtil:1.19.2-1.2.37')
//implementation fg.deobf("com.lovetropics.minigames:LTWeather:0.0.1-alpha+custom")
//implementation fg.deobf("com.lovetropics.minigames:LTMinigames:0.1.0-alpha+custom")
//implementation fg.deobf("com.lovetropics.minigames:LTMinigames:0.1.0-alpha+639-gha")
//lazydfu-1.0-1.18+
implementation fg.deobf("curse.maven:lazydfu-460819:3544496")
//minecraft 'net.minecraftforge:forge:1.18.1-39.0.5'
minecraft 'net.minecraftforge:forge:1.18.2-40.1.0'
//minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
implementation fg.deobf("curse.maven:lazy-dfu-forge-460819:4327266")
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
annotationProcessor 'org.spongepowered:mixin:0.8.5-SNAPSHOT:processor'

// Real mod deobf dependency examples - these get remapped to your current mappings
Expand Down
8 changes: 3 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
mod_version=0.1.0
mod_version=1.19.2-2.7.5
#release_type=alpha
minecraft_version=1.18.2
forge_version=40.1.0

minecraft_version=1.19.2
forge_version=43.2.0
registrate_version=1.1.3
ltlib_version=1.2.0-release+2

# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
Expand Down
709 changes: 345 additions & 364 deletions src/main/java/extendedrenderer/ParticleManagerExtended.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
package extendedrenderer;

import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.WaterDropParticle;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.core.particles.ParticleType;
import net.minecraft.core.particles.SimpleParticleType;
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.client.event.RegisterParticleProvidersEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.ObjectHolder;
import net.minecraftforge.registries.RegistryObject;
import weather2.Weather;

@ObjectHolder(Weather.MODID)
@Mod.EventBusSubscriber(modid = Weather.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ParticleRegistry2ElectricBubbleoo {

@ObjectHolder("acidrain_splash")
public static SimpleParticleType ACIDRAIN_SPLASH;
public static final DeferredRegister<ParticleType<?>> PARTICLE_TYPES =
DeferredRegister.create(ForgeRegistries.Keys.PARTICLE_TYPES, Weather.MODID);

@ObjectHolder(registryName = Weather.MODID + ":acidrain_splash", value = Weather.MODID + ":acidrain_splash")
public static RegistryObject<SimpleParticleType> ACIDRAIN_SPLASH = PARTICLE_TYPES.register("acidrain_splash", () -> new SimpleParticleType(false));

@SubscribeEvent
public static void registerParticles(RegistryEvent.Register<ParticleType<?>> evt){
SimpleParticleType acidrain_splash = new SimpleParticleType(false);
acidrain_splash.setRegistryName(Weather.MODID, "acidrain_splash");
evt.getRegistry().register(acidrain_splash);
public static void registerHandlers(IEventBus modBus) {
PARTICLE_TYPES.register(modBus);
}

@OnlyIn(Dist.CLIENT)
@SubscribeEvent
public static void registerParticleFactory(ParticleFactoryRegisterEvent evt){
Minecraft.getInstance().particleEngine.register(ParticleRegistry2ElectricBubbleoo.ACIDRAIN_SPLASH,
@SubscribeEvent()
public static void registerParticleFactory(RegisterParticleProvidersEvent evt) {
evt.register(ParticleRegistry2ElectricBubbleoo.ACIDRAIN_SPLASH.get(),
WaterDropParticle.Provider::new);
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package extendedrenderer.particle.behavior;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import extendedrenderer.particle.entity.EntityRotFX;
import extendedrenderer.particle.entity.ParticleTexExtraRender;
import extendedrenderer.particle.entity.ParticleTexFX;
Expand All @@ -12,6 +8,7 @@
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.core.BlockPos;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
Expand All @@ -24,6 +21,10 @@
import weather2.client.SceneEnhancer;
import weather2.datatypes.PrecipitationType;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

@OnlyIn(Dist.CLIENT)
public class ParticleBehaviors {

Expand Down Expand Up @@ -222,11 +223,11 @@ public void initParticleRain(EntityRotFX particle, int extraRenderCount) {
particle.setTicksFadeOutMaxOnDeath(3);
particle.setFullAlphaTarget(0.6F);
particle.setAlpha(0);
particle.rotationYaw = particle.getWorld().random.nextInt(360) - 180F;
particle.rotationYaw = rand.nextInt(360) - 180F;
particle.setMotionY(-0.5D);
ClientTickHandler.getClientWeather().getWindManager().applyWindForceNew(particle, 10F, 0.5F);
Player entP = Minecraft.getInstance().player;
Biome biome = entP.level.m_204166_(new BlockPos(Mth.floor(entP.getX()), entP.getY(), Mth.floor(entP.getZ()))).m_203334_();
Biome biome = entP.level.getBiome(new BlockPos(Mth.floor(entP.getX()), entP.getY(), Mth.floor(entP.getZ()))).get();
if (ClientWeatherProxy.get().getPrecipitationType(biome) == PrecipitationType.ACID) {
particle.rCol = acidRainRed;
particle.gCol = acidRainGreen;
Expand Down Expand Up @@ -255,14 +256,14 @@ public void initParticleGroundSplash(EntityRotFX particle) {
particle.setAlpha(0);
particle.setTicksFadeOutMax(4);
particle.renderOrder = 2;
particle.rotationYaw = particle.getWorld().random.nextInt(360) - 180F;
particle.rotationYaw = rand.nextInt(360) - 180F;
particle.rotationPitch = 90;
particle.setMotionY(0D);
particle.setMotionX((rand.nextFloat() - 0.5F) * 0.01F);
particle.setMotionZ((rand.nextFloat() - 0.5F) * 0.01F);
//ClientTickHandler.getClientWeather().getWindManager().applyWindForceNew(particle, 1F / 5F, 0.5F);
Player entP = Minecraft.getInstance().player;
Biome biome = entP.level.m_204166_(new BlockPos(Mth.floor(entP.getX()), entP.getY(), Mth.floor(entP.getZ()))).m_203334_();
Biome biome = entP.level.getBiome(new BlockPos(Mth.floor(entP.getX()), entP.getY(), Mth.floor(entP.getZ()))).get();
if (ClientWeatherProxy.get().getPrecipitationType(biome) == PrecipitationType.ACID) {
particle.rCol = acidRainRed;
particle.gCol = acidRainGreen;
Expand Down Expand Up @@ -292,13 +293,13 @@ public void initParticleRainDownfall(EntityRotFX particle) {
particle.setFullAlphaTarget(1F);
particle.setAlpha(0);
particle.setTicksFadeOutMax(10);
particle.rotationYaw = particle.getWorld().random.nextInt(360) - 180F;
particle.rotationYaw = rand.nextInt(360) - 180F;
particle.rotationPitch = 0;
particle.setMotionY(-0.3D);
particle.setMotionX((rand.nextFloat() - 0.5F) * 0.01F);
particle.setMotionZ((rand.nextFloat() - 0.5F) * 0.01F);
Player entP = Minecraft.getInstance().player;
Biome biome = entP.level.m_204166_(new BlockPos(Mth.floor(entP.getX()), entP.getY(), Mth.floor(entP.getZ()))).m_203334_();
Biome biome = entP.level.getBiome(new BlockPos(Mth.floor(entP.getX()), entP.getY(), Mth.floor(entP.getZ()))).get();
if (ClientWeatherProxy.get().getPrecipitationType(biome) == PrecipitationType.ACID) {
particle.rCol = acidRainRed;
particle.gCol = acidRainGreen;
Expand Down Expand Up @@ -330,7 +331,7 @@ public void initParticleSnow(EntityRotFX particle, int extraRenderCount) {
particle.setTicksFadeInMax(5);
particle.setAlphaF(0);
particle.setTicksFadeOutMax(20);
particle.rotationYaw = particle.getWorld().random.nextInt(360) - 180F;
particle.rotationYaw = rand.nextInt(360) - 180F;
ClientTickHandler.getClientWeather().getWindManager().applyWindForceNew(particle, 1F, 0.5F);
}

Expand Down Expand Up @@ -358,7 +359,7 @@ public void initParticleHail(EntityRotFX particle) {
particle.setTicksFadeOutMaxOnDeath(50);
particle.setFullAlphaTarget(1F);
particle.setAlpha(0);
particle.rotationYaw = particle.getWorld().random.nextInt(360) - 180F;
particle.rotationYaw = rand.nextInt(360) - 180F;
particle.setMotionY(-0.5D);
ClientTickHandler.getClientWeather().getWindManager().applyWindForceNew(particle, 1F, 0.5F);
particle.rCol = 0.9F;
Expand Down Expand Up @@ -391,7 +392,7 @@ public void initParticleCube(EntityRotFX particle) {
particle.setTicksFadeOutMaxOnDeath(20);
particle.setFullAlphaTarget(1F);
particle.setAlpha(0);
particle.rotationYaw = particle.getWorld().random.nextInt(360) - 180F;
particle.rotationYaw = RandomSource.create().nextInt(360) - 180F;
//particle.setMotionY(-0.5D);
//ClientTickHandler.getClientWeather().getWindManager().applyWindForceNew(particle, 1F, 0.5F);
/*float tempBrightness = 0.5F;
Expand Down Expand Up @@ -429,7 +430,7 @@ public void initParticleDustAir(EntityRotFX particle) {
particle.setAlpha(0);
float brightness = 0.5F + (rand.nextFloat() * 0.5F);
particle.setColor(particle.rCol * brightness, particle.gCol * brightness, particle.bCol * brightness);
particle.rotationYaw = particle.getWorld().random.nextInt(360) - 180F;
particle.rotationYaw = rand.nextInt(360) - 180F;
//ClientTickHandler.getClientWeather().getWindManager().applyWindForceNew(particle, 10F, 0.5F);
}

Expand Down Expand Up @@ -464,7 +465,7 @@ public void initParticleDustGround(EntityRotFX particle, boolean spawnInside, bo
float brightness = 0.5F;
particle.setColor(particle.rCol * brightness, particle.gCol * brightness, particle.bCol * brightness);
}
particle.rotationYaw = particle.getWorld().random.nextInt(360) - 180F;
particle.rotationYaw = RandomSource.create().nextInt(360) - 180F;
}

public void initParticleLeaf(EntityRotFX particle, float particleAABB) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.core.BlockPos;
import net.minecraft.util.Mth;
Expand Down Expand Up @@ -201,7 +202,7 @@ public EntityRotFX(ClientLevel par1World, double par2, double par4, double par6,
//this.isImmuneToFire = true;
//this.setMaxAge(100);

this.entityID = par1World.random.nextInt(100000);
this.entityID = RandomSource.create().nextInt(100000);

//rotation = new Quaternion();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.client.model.data.ModelData;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class ParticleCube extends ParticleTexFX {

Expand Down Expand Up @@ -57,7 +58,7 @@ public TextureAtlasSprite getSpriteFromState(BlockState state) {
BlockRenderDispatcher blockrenderdispatcher = Minecraft.getInstance().getBlockRenderer();
BakedModel model = blockrenderdispatcher.getBlockModel(state);
for(Direction direction : Direction.values()) {
List<BakedQuad> list = model.getQuads(state, direction, new Random(), net.minecraftforge.client.model.data.EmptyModelData.INSTANCE);
List<BakedQuad> list = model.getQuads(state, direction, RandomSource.create(), ModelData.EMPTY, null);
if (list.size() > 0) {
return list.get(0).getSprite();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import com.corosus.coroutil.util.CoroUtilParticle;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Quaternion;
import com.mojang.math.Vector3f;
import net.minecraft.client.Camera;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.core.BlockPos;
import net.minecraft.util.Mth;
import com.mojang.math.Quaternion;
import net.minecraft.world.phys.Vec3;
import com.mojang.math.Vector3f;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.phys.Vec3;
import weather2.ClientTickHandler;
import weather2.weathersystem.WeatherManagerClient;
import weather2.weathersystem.wind.WindManager;
Expand Down Expand Up @@ -347,7 +347,7 @@ public void updateQuaternion(Entity camera) {
Quaternion.mul(qY, qX, this.rotation);

if (extraYRotation != 0) {
//float rot = (new Random()).nextFloat() * 360F;
//float rot = (RandomSource.create()).nextFloat() * 360F;
qY = new Quaternion();
qY.setFromAxisAngle(new Vector4f(0, 1, 0, extraYRotation));
Quaternion.mul(this.rotation, qY, this.rotation);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
package extendedrenderer.particle.entity;

import com.corosus.coroutil.util.CoroUtilColor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.color.block.BlockColors;
import net.minecraft.client.color.block.BlockColor;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.core.BlockPos;
import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
import net.minecraftforge.registries.IRegistryDelegate;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.block.state.BlockState;
import org.apache.commons.lang3.ArrayUtils;

import java.lang.reflect.Field;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class ParticleTexLeafColor extends ParticleTexFX {
Expand Down Expand Up @@ -91,9 +86,9 @@ public ParticleTexLeafColor(ClientLevel worldIn, double posXIn, double posYIn,
}

// Randomize the color with exponential decrease in likelihood. That is, the first color has a 50% chance, then 25%, etc.
int randMax = 1 << (colors.length - 1);
int choice = 32 - Integer.numberOfLeadingZeros(worldIn.random.nextInt(randMax));
int color = colors[choice];
int randMax = 1 << (colors.length - 1);
int choice = 32 - Integer.numberOfLeadingZeros(RandomSource.create().nextInt(randMax));
int color = colors[choice];

float mr = ((multiplier >>> 16) & 0xFF) / 255f;
float mg = ((multiplier >>> 8) & 0xFF) / 255f;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/weather2/ClientRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ClientRegistry {
@OnlyIn(Dist.CLIENT)
@SubscribeEvent
public static void registerRenderers(FMLClientSetupEvent event) {
EntityRenderers.register(EntityRegistry.lightning_bolt, render -> new LightningBoltWeatherNewRenderer(render));
EntityRenderers.register(WeatherEntityTypes.LIGHTNING_BOLT.get(), LightningBoltWeatherNewRenderer::new);
}

}
31 changes: 0 additions & 31 deletions src/main/java/weather2/EntityRegistry.java

This file was deleted.

Loading