Skip to content

Commit

Permalink
more updates and temp removals, stripped out shader work
Browse files Browse the repository at this point in the history
  • Loading branch information
Corosauce committed Oct 7, 2023
1 parent 4de5f20 commit 93214f9
Show file tree
Hide file tree
Showing 56 changed files with 615 additions and 5,045 deletions.
235 changes: 142 additions & 93 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,46 @@
package extendedrenderer;

import weather2.DeferredHelper;
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.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.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.ObjectHolder;
import net.minecraftforge.registries.RegistryObject;
import weather2.Weather;

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

@ObjectHolder("acidrain_splash")
public static SimpleParticleType ACIDRAIN_SPLASH;
//@ObjectHolder("acidrain_splash")
//public static SimpleParticleType ACIDRAIN_SPLASH;
public static final RegistryObject<SimpleParticleType> ACIDRAIN_SPLASH = Weather.R.particle("acidrain_splash", () -> new SimpleParticleType(false));

@SubscribeEvent
/*@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);
}
}*/

@OnlyIn(Dist.CLIENT)
/*@OnlyIn(Dist.CLIENT)
@SubscribeEvent
public static void registerParticleFactory(ParticleFactoryRegisterEvent evt){
Minecraft.getInstance().particleEngine.register(ParticleRegistry2ElectricBubbleoo.ACIDRAIN_SPLASH,
Minecraft.getInstance().particleEngine.register(ParticleRegistry2ElectricBubbleoo.ACIDRAIN_SPLASH.get(),
WaterDropParticle.Provider::new);
}*/

@SubscribeEvent
@OnlyIn(Dist.CLIENT)
public static void factories(RegisterParticleProvidersEvent event) {
//event.registerSprite(ACIDRAIN_SPLASH.get(), WaterDropParticleImpl::new);
Minecraft.getInstance().particleEngine.register(new SimpleParticleType(false), WaterDropParticle.Provider::new);
//event.registerSpecial(new SimpleParticleType(false), WaterDropParticle.Provider::new);
}

public static void bootstrap() {}
}
140 changes: 1 addition & 139 deletions src/main/java/extendedrenderer/particle/ParticleRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
Expand Down Expand Up @@ -58,143 +59,4 @@ public class ParticleRegistry {
public static TextureAtlasSprite cloud_square;
public static TextureAtlasSprite square16;
public static TextureAtlasSprite square64;

@SubscribeEvent
@OnlyIn(Dist.CLIENT)
public static void registerParticles(TextureStitchEvent. event) {

/**
* avoid stitching to all maps
*
* event.getAtlas().getBasePath():
* textures
* textures/particle
* textures/painting
* textures/mob_effect
*
*/
if (!event.getAtlas().location().equals(TextureAtlas.LOCATION_PARTICLES)) {
return;
}

//TODO: 1.14 uncomment
/*MeshBufferManagerParticle.cleanup();
MeshBufferManagerFoliage.cleanup();*/

event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/white"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/smoke_00"));
//smokeTest = event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/smoke_2"));
//cloud = event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud64"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud256"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud256_fire"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud256_test"));
//cloud256_2 = event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud256_5"));
//ground splash
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud256_6"));
//cloud256_7 = event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud256_7"));
//downfall2 = event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/downfall2"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/downfall3"));
//downfall4 = event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/downfall4"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/chicken"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/potato"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/leaf"));
//rain = event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/rain"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/test_texture"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/white_square"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/rain_white"));
//rain_white_trans = event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/rain_white_trans"));
//rain_white_2 = event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/rain_white_2"));
//rain_10 = event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/rain_10"));
//rain_vanilla = event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/vanilla/rain"));
//snow_vanilla = event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/vanilla/snow"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/snow"));
//cloud256dark = event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud256dark"));
//cloudDownfall = event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/downfall"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/tumbleweed"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/debris_1"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/debris_2"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/debris_3"));
/*for (int i = 1; i <= 9; i++) {
listFish.add(event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/fish_" + i)));
}
for (int i = 1; i <= 7; i++) {
listSeaweed.add(event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/seaweed_section_" + i)));
}*/
//used indirectly not via reference
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/grass"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/hail"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud_square"));

event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/white16"));
event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/white64"));
}

@SubscribeEvent
@OnlyIn(Dist.CLIENT)
public static void getRegisteredParticles(TextureStitchEvent.Post event) {

if (!event.getAtlas().location().equals(TextureAtlas.LOCATION_PARTICLES)) {
return;
}

squareGrey = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/white"));
smoke = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/smoke_00"));
//smokeTest = event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/smoke_2"));
//cloud = event.addSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud64"));
cloud256 = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud256"));
cloud256_fire = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud256_fire"));
cloud256_test = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud256_test"));
//cloud256_2 = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud256_5"));
//ground splash
cloud256_6 = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud256_6"));
//cloud256_7 = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud256_7"));
//downfall2 = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/downfall2"));
downfall3 = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/downfall3"));
//downfall4 = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/downfall4"));
chicken = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/chicken"));
potato = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/potato"));
leaf = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/leaf"));
//rain = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/rain"));
test_texture = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/test_texture"));
white_square = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/white_square"));
rain_white = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/rain_white"));
//rain_white_trans = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/rain_white_trans"));
//rain_white_2 = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/rain_white_2"));
//rain_10 = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/rain_10"));
//rain_vanilla = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/vanilla/rain"));
//snow_vanilla = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/vanilla/snow"));
snow = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/snow"));
//cloud256dark = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud256dark"));
//cloudDownfall = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/downfall"));
tumbleweed = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/tumbleweed"));
debris_1 = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/debris_1"));
debris_2 = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/debris_2"));
debris_3 = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/debris_3"));
/*for (int i = 1; i <= 9; i++) {
listFish.add(event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/fish_" + i)));
}
for (int i = 1; i <= 7; i++) {
listSeaweed.add(event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/seaweed_section_" + i)));
}*/
//used indirectly not via reference
grass = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/grass"));
hail = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/hail"));
cloudNew = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud"));
cloud_square = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/cloud_square"));

square16 = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/white16"));
square64 = event.getAtlas().getSprite(new ResourceLocation(ExtendedRenderer.modid + ":particles/white64"));

//TODO: 1.14 uncomment
/*if (RotatingParticleManager.useShaders) {
RotatingParticleManager.forceShaderReset = true;
}*/

}

/*public static TextureAtlasSprite addSprite(TextureStitchEvent.Pre event, ResourceLocation resourceLocation) {
event.addSprite(resourceLocation);
return event.getAtlas().getSprite(resourceLocation);
}*/
}
23 changes: 17 additions & 6 deletions src/main/java/extendedrenderer/particle/entity/EntityRotFX.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.corosus.coroutil.util.CoroUtilBlock;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.*;
import com.mojang.math.Axis;
import extendedrenderer.particle.behavior.ParticleBehaviors;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.ParticleRenderType;
Expand Down Expand Up @@ -44,7 +45,8 @@ public void begin(BufferBuilder p_217600_1_, TextureManager p_217600_2_) {

@Override
public void end(Tesselator p_217599_1_) {
p_217599_1_.getBuilder().setQuadSortOrigin(0, 0, 0);
//TODO: not possible in 1.20 now i guess, cant remember why this line was important
//p_217599_1_.getBuilder().setQuadSortOrigin(0, 0, 0);
ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT.end(p_217599_1_);
}

Expand All @@ -66,7 +68,8 @@ public void begin(BufferBuilder p_217600_1_, TextureManager p_217600_2_) {

@Override
public void end(Tesselator p_217599_1_) {
p_217599_1_.getBuilder().setQuadSortOrigin(0, 0, 0);
//TODO: not possible in 1.20 now i guess, cant remember why this line was important
//p_217599_1_.getBuilder().setQuadSortOrigin(0, 0, 0);
ParticleRenderType.PARTICLE_SHEET_OPAQUE.end(p_217599_1_);
}

Expand Down Expand Up @@ -632,19 +635,27 @@ public void render(VertexConsumer buffer, Camera renderInfo, float partialTicks)
// override rotations
quaternion = new Quaternionf(0, 0, 0, 1);
if (facePlayerYaw) {
quaternion.mul(Vector3f.YP.rotationDegrees(-renderInfo.getYRot()));
quaternion.mul(Axis.YP.rotationDegrees(-renderInfo.getYRot()));
} else {
quaternion.mul(Vector3f.YP.rotationDegrees(Mth.lerp(partialTicks, this.prevRotationYaw, rotationYaw)));
quaternion.mul(Axis.YP.rotationDegrees(Mth.lerp(partialTicks, this.prevRotationYaw, rotationYaw)));
}
quaternion.mul(Vector3f.XP.rotationDegrees(Mth.lerp(partialTicks, this.prevRotationPitch, rotationPitch)));
quaternion.mul(Axis.XP.rotationDegrees(Mth.lerp(partialTicks, this.prevRotationPitch, rotationPitch)));
}

Quaternionf quaternionf;
if (this.roll == 0.0F) {
quaternionf = renderInfo.rotation();
} else {
quaternionf = new Quaternionf(renderInfo.rotation());
quaternionf.rotateZ(Mth.lerp(partialTicks, this.oRoll, this.roll));
}

Vector3f[] avector3f = new Vector3f[]{new Vector3f(-1.0F, -1.0F, 0.0F), new Vector3f(-1.0F, 1.0F, 0.0F), new Vector3f(1.0F, 1.0F, 0.0F), new Vector3f(1.0F, -1.0F, 0.0F)};
float f4 = this.getQuadSize(partialTicks);

for(int i = 0; i < 4; ++i) {
Vector3f vector3f = avector3f[i];
vector3f.transform(quaternion);
vector3f.rotate(quaternion);
vector3f.mul(f4);
vector3f.add(f, f1, f2);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package extendedrenderer.particle.entity;

import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis;
import net.minecraft.client.Camera;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.multiplayer.ClientLevel;
Expand Down Expand Up @@ -32,11 +33,11 @@ public void render(VertexConsumer buffer, Camera renderInfo, float partialTicks)
// override rotations
quaternion = new Quaternionf(0, 0, 0, 1);
if (facePlayerYaw) {
quaternion.mul(Vector3f.YP.rotationDegrees(-renderInfo.getYRot()));
quaternion.mul(Axis.YP.rotationDegrees(-renderInfo.getYRot()));
} else {
quaternion.mul(Vector3f.YP.rotationDegrees(Mth.lerp(partialTicks, this.prevRotationYaw, rotationYaw)));
quaternion.mul(Axis.YP.rotationDegrees(Mth.lerp(partialTicks, this.prevRotationYaw, rotationYaw)));
}
quaternion.mul(Vector3f.XP.rotationDegrees(Mth.lerp(partialTicks, this.prevRotationPitch, rotationPitch)));
quaternion.mul(Axis.XP.rotationDegrees(Mth.lerp(partialTicks, this.prevRotationPitch, rotationPitch)));
}

Vector3f[] avector3f = new Vector3f[]{
Expand All @@ -61,21 +62,21 @@ public void render(VertexConsumer buffer, Camera renderInfo, float partialTicks)

for(int i = 0; i < 4; ++i) {
Vector3f vector3f = avector3f[i];
vector3f.transform(quaternion);
vector3f.rotate(quaternion);
vector3f.mul(f4);
vector3f.add(f, f1, f2);
}

for(int i = 0; i < 4; ++i) {
Vector3f vector3f = avector3f2[i];
vector3f.transform(quaternion);
vector3f.rotate(quaternion);
vector3f.mul(f4);
vector3f.add(f, f1, f2);
}

for(int i = 0; i < 4; ++i) {
Vector3f vector3f = avector3f3[i];
vector3f.transform(quaternion);
vector3f.rotate(quaternion);
vector3f.mul(f4);
vector3f.add(f, f1, f2);
}
Expand Down
Loading

0 comments on commit 93214f9

Please sign in to comment.