mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-08 06:26:43 +01:00
Use the enum! It makes it clearer
This commit is contained in:
parent
cfa36497b7
commit
91109ba8bb
5 changed files with 18 additions and 7 deletions
|
@ -62,12 +62,12 @@ public class BlockCloudAnvil extends BlockAnvil implements ICloudBlock {
|
|||
|
||||
@Override
|
||||
public void onEndFalling(World world, BlockPos pos, IBlockState fallingState, IBlockState hitState) {
|
||||
WorldEvent.ENTITY_TAKEOFF.play(world, pos, 0);
|
||||
WorldEvent.ENTITY_TAKEOFF.play(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBroken(World world, BlockPos pos) {
|
||||
WorldEvent.ENTITY_TAKEOFF.play(world, pos, 0);
|
||||
WorldEvent.ENTITY_TAKEOFF.play(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -86,10 +86,10 @@ public class PowerGrow implements IPower<Location> {
|
|||
|
||||
if (g.canGrow(w, pos, state, w.isRemote) && g.canUseBonemeal(w, w.rand, pos, state)) {
|
||||
if (ItemDye.applyBonemeal(new ItemStack(Items.DYE, 1), w, pos)) {
|
||||
WorldEvent.BONEMEAL.play(w, pos, 0);
|
||||
WorldEvent.BONEMEAL.play(w, pos);
|
||||
|
||||
if (g instanceof BlockDoublePlant) {
|
||||
WorldEvent.BONEMEAL.play(w, pos.up(), 0);
|
||||
WorldEvent.BONEMEAL.play(w, pos.up());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.minelittlepony.unicopia.player.PlayerSpeciesList;
|
|||
import com.minelittlepony.unicopia.power.data.Location;
|
||||
import com.minelittlepony.util.MagicalDamageSource;
|
||||
import com.minelittlepony.util.PosHelper;
|
||||
import com.minelittlepony.util.WorldEvent;
|
||||
import com.minelittlepony.util.shape.IShape;
|
||||
import com.minelittlepony.util.shape.Sphere;
|
||||
import com.minelittlepony.util.vector.VecHelper;
|
||||
|
@ -181,7 +182,7 @@ public class PowerStomp implements IPower<PowerStomp.Data> {
|
|||
|
||||
if (state.getBlock() != Blocks.AIR) {
|
||||
if (w.getBlockState(pos.up()).getBlock() == Blocks.AIR) {
|
||||
w.playEvent(2001, pos, Block.getStateId(state));
|
||||
WorldEvent.DESTROY_BLOCK.play(w, pos, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -317,7 +318,7 @@ public class PowerStomp implements IPower<PowerStomp.Data> {
|
|||
IBlockState state = w.getBlockState(pos);
|
||||
|
||||
if (state.getBlock() instanceof BlockLeaves && w.getBlockState(pos.down()).getMaterial() == Material.AIR) {
|
||||
w.playEvent(2001, pos, Block.getStateId(state));
|
||||
WorldEvent.DESTROY_BLOCK.play(w, pos, state);
|
||||
|
||||
EntityItem item = new EntityItem(w);
|
||||
item.setPosition(pos.getX() + 0.5, pos.getY() - 0.5, pos.getZ() + 0.5);
|
||||
|
|
|
@ -96,7 +96,7 @@ public class SpellNecromancy extends AbstractSpell.RangedAreaSpell {
|
|||
}
|
||||
zombie.motionY += 0.3F;
|
||||
|
||||
source.getWorld().playEvent(WorldEvent.DOOR_BROKEN.getId(), zombie.getPosition(), 0);
|
||||
WorldEvent.DOOR_BROKEN.play(source.getWorld(), zombie.getPosition());
|
||||
|
||||
source.getWorld().spawnEntity(zombie);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.minelittlepony.util;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -72,6 +74,14 @@ public enum WorldEvent {
|
|||
return id;
|
||||
}
|
||||
|
||||
public void play(World world, BlockPos pos, IBlockState state) {
|
||||
play(world, pos, Block.getStateId(state));
|
||||
}
|
||||
|
||||
public void play(World world, BlockPos pos) {
|
||||
play(world, pos, 0);
|
||||
}
|
||||
|
||||
public void play(World world, BlockPos pos, int data) {
|
||||
world.playEvent(getId(), pos, data);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue