-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add particle effect when breaking block in shiftdown mode
- Loading branch information
Showing
8 changed files
with
67 additions
and
14 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
3 changes: 3 additions & 0 deletions
3
common/src/main/java/fr/rakambda/fallingtree/common/wrapper/IServerLevel.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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
package fr.rakambda.fallingtree.common.wrapper; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
public interface IServerLevel extends ILevel{ | ||
void spawnParticle(@NotNull IBlockPos blockPos, @NotNull IBlockState blockState, int count, float xDist, float yDist, float zDist, float maxSpeed); | ||
} |
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
28 changes: 24 additions & 4 deletions
28
fabric/src/main/java/fr/rakambda/fallingtree/fabric/common/wrapper/ServerLevelWrapper.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 |
---|---|---|
@@ -1,11 +1,31 @@ | ||
package fr.rakambda.fallingtree.fabric.common.wrapper; | ||
|
||
import fr.rakambda.fallingtree.common.wrapper.IBlockPos; | ||
import fr.rakambda.fallingtree.common.wrapper.IBlockState; | ||
import fr.rakambda.fallingtree.common.wrapper.IServerLevel; | ||
import net.minecraft.core.particles.BlockParticleOption; | ||
import net.minecraft.core.particles.ParticleTypes; | ||
import net.minecraft.server.level.ServerLevel; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class ServerLevelWrapper extends LevelWrapper implements IServerLevel{ | ||
public ServerLevelWrapper(@NotNull ServerLevel serverLevel){ | ||
super(serverLevel); | ||
} | ||
public class ServerLevelWrapper extends LevelWrapper implements IServerLevel { | ||
public ServerLevelWrapper(@NotNull ServerLevel serverLevel) { | ||
super(serverLevel); | ||
} | ||
|
||
@Override | ||
@NotNull | ||
public ServerLevel getRaw() { | ||
return (ServerLevel) super.getRaw(); | ||
} | ||
|
||
@Override | ||
public void spawnParticle(@NotNull IBlockPos blockPos, @NotNull IBlockState blockState, int count, float xDist, float yDist, float zDist, float maxSpeed) { | ||
getRaw().sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, (BlockState) blockState.getRaw()), | ||
blockPos.getX() + 0.5f, blockPos.getY() + 0.5f, blockPos.getZ() + 0.5f, | ||
count, | ||
xDist, yDist, zDist, | ||
maxSpeed); | ||
} | ||
} |
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
20 changes: 20 additions & 0 deletions
20
forge/src/main/java/fr/rakambda/fallingtree/forge/common/wrapper/ServerLevelWrapper.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 |
---|---|---|
@@ -1,11 +1,31 @@ | ||
package fr.rakambda.fallingtree.forge.common.wrapper; | ||
|
||
import fr.rakambda.fallingtree.common.wrapper.IBlockPos; | ||
import fr.rakambda.fallingtree.common.wrapper.IBlockState; | ||
import fr.rakambda.fallingtree.common.wrapper.IServerLevel; | ||
import net.minecraft.core.particles.BlockParticleOption; | ||
import net.minecraft.core.particles.ParticleTypes; | ||
import net.minecraft.server.level.ServerLevel; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class ServerLevelWrapper extends LevelWrapper implements IServerLevel{ | ||
public ServerLevelWrapper(@NotNull ServerLevel serverLevel){ | ||
super(serverLevel); | ||
} | ||
|
||
@Override | ||
@NotNull | ||
public ServerLevel getRaw() { | ||
return (ServerLevel) super.getRaw(); | ||
} | ||
|
||
@Override | ||
public void spawnParticle(@NotNull IBlockPos blockPos, @NotNull IBlockState blockState, int count, float xDist, float yDist, float zDist, float maxSpeed) { | ||
getRaw().sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, (BlockState) blockState.getRaw()), | ||
blockPos.getX() + 0.5f, blockPos.getY() + 0.5f, blockPos.getZ() + 0.5f, | ||
count, | ||
xDist, yDist, zDist, | ||
maxSpeed); | ||
} | ||
} |
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