Skip to content

Commit

Permalink
Fix server compatibility, fix more cascading world gen issues
Browse files Browse the repository at this point in the history
  • Loading branch information
unascribed committed Apr 28, 2017
1 parent b0fa4ad commit d23112a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package com.elytradev.glasshearts.client.guiparticle;

import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class PendingEffect {
public interface EffectSpawner {
@SideOnly(Side.CLIENT)
void spawn(int x, int y);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.elytradev.glasshearts.client.guiparticle.GuiParticleHeartFragment;
import com.elytradev.glasshearts.client.guiparticle.GuiParticleSmoke;
import com.elytradev.glasshearts.client.guiparticle.PendingEffect;
import com.elytradev.glasshearts.client.guiparticle.PendingEffect.EffectSpawner;
import com.elytradev.glasshearts.enums.EnumGem;
import com.elytradev.glasshearts.enums.EnumGlassColor;

Expand Down Expand Up @@ -53,38 +54,54 @@ protected void handle(EntityPlayer sender) {
// heart shatter
if (meta == 0) {
// colorless
cp.heartRenderer.pendingEffects.add(new PendingEffect(index, (x, y) -> {
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.BLOCK_GLASS_BREAK, 1f));
GuiParticleHeartFragment.spawn(cp.guiParticles, x, y, 27, 36, 9, 9, 3, 3, 1, 1, 1);
cp.heartRenderer.pendingEffects.add(new PendingEffect(index, new EffectSpawner() {
@Override
@SideOnly(Side.CLIENT)
public void spawn(int x, int y) {
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.BLOCK_GLASS_BREAK, 1f));
GuiParticleHeartFragment.spawn(cp.guiParticles, x, y, 27, 36, 9, 9, 3, 3, 1, 1, 1);
}
}));
} else {
// stained
EnumGlassColor egc = EnumGlassColor.values()[meta];
float[] fleece = EntitySheep.getDyeRgb(egc.dye);
cp.heartRenderer.pendingEffects.add(new PendingEffect(index, (x, y) -> {
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.BLOCK_GLASS_BREAK, 1f));
GuiParticleHeartFragment.spawn(cp.guiParticles, x, y, 45, 36, 9, 9, 3, 3, fleece[0], fleece[1], fleece[2]);
cp.heartRenderer.pendingEffects.add(new PendingEffect(index, new EffectSpawner() {
@Override
@SideOnly(Side.CLIENT)
public void spawn(int x, int y) {
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.BLOCK_GLASS_BREAK, 1f));
GuiParticleHeartFragment.spawn(cp.guiParticles, x, y, 45, 36, 9, 9, 3, 3, fleece[0], fleece[1], fleece[2]);
}
}));
}
} else if (effect == EFFECT_GEM_SHATTER) {
// gem shatter
EnumGem gem = EnumGem.values()[meta+1];
cp.heartRenderer.pendingEffects.add(new PendingEffect(index, (x, y) -> {
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.BLOCK_GLASS_BREAK, 2f));
GuiParticleHeartFragment.spawn(cp.guiParticles, x, y, 27+(gem.ordinal()*9), 54, 9, 9, 1, 1, 1, 1, 1);
cp.heartRenderer.pendingEffects.add(new PendingEffect(index, new EffectSpawner() {
@Override
@SideOnly(Side.CLIENT)
public void spawn(int x, int y) {
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.BLOCK_GLASS_BREAK, 2f));
GuiParticleHeartFragment.spawn(cp.guiParticles, x, y, 27+(gem.ordinal()*9), 54, 9, 9, 1, 1, 1, 1, 1);
}
}));
} else if (effect == EFFECT_WASTED_HEALING) {
// wasted healing
cp.heartRenderer.pendingEffects.add(new PendingEffect(index, (x, y) -> {
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.BLOCK_FIRE_EXTINGUISH, 2f));
for (int i = 0; i < meta+1; i++) {
GuiParticleSmoke s = new GuiParticleSmoke(x+5, y);
s.motionX = (s.motionX+0.75f);
s.motionY = (s.rand.nextFloat()*2)-1;
s.red = 0.8f+(s.rand.nextFloat()*0.2f);
s.green = 0;
s.blue = 0;
cp.guiParticles.add(s);
cp.heartRenderer.pendingEffects.add(new PendingEffect(index, new EffectSpawner() {
@Override
@SideOnly(Side.CLIENT)
public void spawn(int x, int y) {
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.BLOCK_FIRE_EXTINGUISH, 2f));
for (int i = 0; i < meta+1; i++) {
GuiParticleSmoke s = new GuiParticleSmoke(x+5, y);
s.motionX = (s.motionX+0.75f);
s.motionY = (s.rand.nextFloat()*2)-1;
s.red = 0.8f+(s.rand.nextFloat()*0.2f);
s.green = 0;
s.blue = 0;
cp.guiParticles.add(s);
}
}
}));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public class GenerateGems implements IWorldGenerator {
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
if (!world.provider.isSurfaceWorld()) return;
for (int i = 0; i < 12; i++) {
int x = (chunkX*16)+random.nextInt(16);
int x = ((chunkX*16)+random.nextInt(16))+8;
int y = random.nextInt(24)+3;
int z = (chunkZ*16)+random.nextInt(16);
int z = ((chunkZ*16)+random.nextInt(16))+8;
BlockPos pos = new BlockPos(x, y, z);
if (world.getBlockState(pos).getBlock() == Blocks.STONE) {
EnumGem gem = BlockOre.VALID_GEMS[random.nextInt(BlockOre.VALID_GEMS.length)];
Expand Down

0 comments on commit d23112a

Please sign in to comment.