-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redid the *RiftFX classes based on the old 1.6.4 code, but overriding ParticleSimpleAnimated.
- Loading branch information
Showing
9 changed files
with
130 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 0 additions & 88 deletions
88
src/main/java/com/zixiken/dimdoors/client/ClosingRiftFX.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
src/main/java/com/zixiken/dimdoors/client/GoggleRiftFX.java
This file was deleted.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
src/main/java/com/zixiken/dimdoors/client/ParticleRiftEffect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.zixiken.dimdoors.client; | ||
|
||
import com.zixiken.dimdoors.shared.util.WorldUtils; | ||
import com.zixiken.dimdoors.shared.world.DimDoorDimensions; | ||
import net.minecraft.client.particle.ParticleFirework; | ||
import net.minecraft.client.particle.ParticleSimpleAnimated; | ||
import net.minecraft.client.renderer.BufferBuilder; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.world.World; | ||
|
||
// This has exactly the same appearence as the 1.6.4 mod. | ||
public class ParticleRiftEffect extends ParticleSimpleAnimated { // TODO: colors, density | ||
|
||
private float colorMultiplier; | ||
|
||
public ParticleRiftEffect(World world, double x, double y, double z, double motionX, double motionY, double motionZ, float nonPocketColorMultiplier, float pocketColorMultiplier, float scale, int size, int spread) { | ||
super(world, x, y, z, 160, 8, 0); | ||
this.motionX = motionX; | ||
this.motionY = motionY; | ||
this.motionZ = motionZ; | ||
|
||
particleScale *= scale; | ||
particleMaxAge = size - spread / 2 + rand.nextInt(spread); | ||
colorMultiplier = DimDoorDimensions.isPocketDimension(WorldUtils.getDim(world)) ? pocketColorMultiplier : nonPocketColorMultiplier; | ||
} | ||
|
||
@Override | ||
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { | ||
if (particleAge < particleMaxAge / 3 || (particleAge + particleMaxAge) / 3 % 2 == 0) { | ||
float oldRed = particleRed; | ||
float oldGreen = particleGreen; | ||
float oldBlue = particleBlue; | ||
float oldAlpha = particleAlpha; | ||
setRBGColorF(colorMultiplier * particleRed, colorMultiplier * particleGreen, colorMultiplier * particleBlue); | ||
setAlphaF(0.7f); | ||
super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ); | ||
setRBGColorF(oldRed, oldGreen, oldBlue); | ||
setAlphaF(oldAlpha); | ||
} | ||
} | ||
|
||
public static class Rift extends ParticleRiftEffect { | ||
public Rift(World world, double x, double y, double z, double motionX, double motionY, double motionZ) { | ||
super(world, x, y, z, motionX, motionY, motionZ, 0.0f, 0.7f, 0.55f, 38, 16); | ||
} | ||
} | ||
|
||
public static class ClosingRiftEffect extends ParticleRiftEffect { | ||
public ClosingRiftEffect(World world, double x, double y, double z, double motionX, double motionY, double motionZ) { | ||
super(world, x, y, z, motionX, motionY, motionZ, 0.8f, 0.4f, 0.55f, 38, 16); | ||
} | ||
} | ||
|
||
public static class GogglesRiftEffect extends ParticleRiftEffect { | ||
public GogglesRiftEffect(World world, double x, double y, double z, double motionX, double motionY, double motionZ) { | ||
super(world, x, y, z, motionX, motionY, motionZ, 0.0f, 0.7f, 0.55f, 38, 16); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/com/zixiken/dimdoors/shared/util/MCPReflection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.zixiken.dimdoors.shared.util; | ||
|
||
import net.minecraft.entity.Entity; | ||
|
||
import java.lang.reflect.Field; | ||
import java.lang.reflect.Method; | ||
import java.lang.reflect.Modifier; | ||
|
||
public class MCPReflection { | ||
public static Field getMCPField(Class<?> class0, String deobfuscatedName, String obfuscatedName) throws NoSuchFieldException { | ||
Field field; | ||
try { | ||
field = class0.getDeclaredField(obfuscatedName); | ||
} catch (NoSuchFieldException e) { // Running on deobfuscated Minecraft | ||
field = class0.getDeclaredField(deobfuscatedName); | ||
} | ||
field.setAccessible(true); | ||
|
||
try { | ||
Field modifiers = Field.class.getDeclaredField("modifiers"); | ||
modifiers.setAccessible(true); | ||
modifiers.setInt(field, field.getModifiers() & ~Modifier.FINAL); | ||
} catch (IllegalAccessException e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
return field; | ||
} | ||
|
||
public static Method getMCPMethod(Class<?> class0, String deobfuscatedName, String obfuscatedName, Class<?> args) throws NoSuchMethodException { | ||
Method method; | ||
try { | ||
method = Entity.class.getDeclaredMethod(obfuscatedName, args); | ||
} catch (NoSuchMethodException e) { // Running on deobfuscated Minecraft | ||
method = Entity.class.getDeclaredMethod(deobfuscatedName, args); | ||
} | ||
method.setAccessible(true); | ||
return method; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters