Compare commits
10 Commits
20ba50b566
...
6c2df592c5
Author | SHA1 | Date | |
---|---|---|---|
6c2df592c5 | |||
|
64c6f17d7f | ||
|
84afee23e9 | ||
|
2bccfd97fd | ||
|
20f4a65f8d | ||
|
06901be171 | ||
|
fbf9a16918 | ||
|
1107ead2a7 | ||
|
d1348868cd | ||
|
66d797b928 |
12
README.md
12
README.md
@@ -1,9 +1,15 @@
|
|||||||
# Jump Vader - A Fabric Server-Side Elevator Mod
|
# Televator - A Fabric Server-Side Elevator Mod
|
||||||
|
|
||||||
|
based on [JumpVader](https://github.com/StimzRx/JumpVaderMod) by [StimzRx](https://github.com/StimzRx/JumpVaderMod)
|
||||||
|
|
||||||
## What is it
|
## What is it
|
||||||
I'ts a mod that lets you place "Jump Vader" blocks similar to the Quark mod's elevators.
|
It's a mod that lets you place "Jump Vader" blocks similar to the Quark mod's elevators.
|
||||||
You simply place one above the other at any vertical distance, and jump/crouch on top of the
|
You simply place one above the other at any vertical distance, and jump/crouch on top of the
|
||||||
block to go in between the different heights.
|
block to go in between the different heights.
|
||||||
|
|
||||||
## Crafting
|
## Crafting
|
||||||

|

|
||||||
|
|
||||||
|
## Removal
|
||||||
|
|
||||||
|
**NOTE:** Removing the mods from the mods folder will delete all Televator blocks in inventories and the world permanently!
|
||||||
|
42
build.gradle
42
build.gradle
@@ -1,7 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.2-SNAPSHOT'
|
id 'fabric-loom' version '1.6-SNAPSHOT'
|
||||||
id 'maven-publish'
|
|
||||||
id 'com.github.johnrengelman.shadow' version '7.0.0'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
version = project.mod_version
|
version = project.mod_version
|
||||||
@@ -17,10 +15,7 @@ repositories {
|
|||||||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
||||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
||||||
// for more information about repositories.
|
// for more information about repositories.
|
||||||
|
|
||||||
maven { url 'https://maven.nucleoid.xyz' }
|
maven { url 'https://maven.nucleoid.xyz' }
|
||||||
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
|
|
||||||
maven { url 'https://jitpack.io' }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -32,15 +27,12 @@ dependencies {
|
|||||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
|
|
||||||
// Uncomment the following line to enable the deprecated Fabric API modules.
|
|
||||||
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
|
|
||||||
|
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
|
|
||||||
|
|
||||||
include(modImplementation("eu.pb4:polymer-core:${project.polymer_version}"))
|
include(modImplementation("eu.pb4:polymer-core:${project.polymer_version}"))
|
||||||
|
modImplementation include("eu.pb4:polymer-resource-pack:${project.polymer_version}")
|
||||||
|
modImplementation include("eu.pb4:polymer-autohost:${project.polymer_version}")
|
||||||
|
modImplementation include("eu.pb4:polymer-blocks:${project.polymer_version}")
|
||||||
include(modImplementation("xyz.nucleoid:server-translations-api:${project.server_translations_api_version}"))
|
include(modImplementation("xyz.nucleoid:server-translations-api:${project.server_translations_api_version}"))
|
||||||
|
|
||||||
shadow(implementation('org.spongepowered:configurate-hocon:4.1.2'))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
@@ -70,29 +62,3 @@ jar {
|
|||||||
rename { "${it}_${project.archivesBaseName}"}
|
rename { "${it}_${project.archivesBaseName}"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shadowJar {
|
|
||||||
configurations = [project.configurations.shadow]
|
|
||||||
archiveClassifier.set("dev")
|
|
||||||
relocate "net.objecthunter", "de.siphalor.spiceoffabric.shadow.net.objecthunter"
|
|
||||||
}
|
|
||||||
remapJar {
|
|
||||||
dependsOn(shadowJar)
|
|
||||||
inputFile = tasks.shadowJar.archiveFile
|
|
||||||
}
|
|
||||||
|
|
||||||
// configure the maven publication
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
mavenJava(MavenPublication) {
|
|
||||||
from components.java
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
|
||||||
repositories {
|
|
||||||
// Add repositories to publish to here.
|
|
||||||
// Notice: This block does NOT have the same function as the block in the top level.
|
|
||||||
// The repositories here will be used for publishing your artifact, not for
|
|
||||||
// retrieving dependencies.
|
|
||||||
}
|
|
||||||
}
|
|
@@ -4,16 +4,17 @@ org.gradle.parallel=true
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/develop
|
# check these on https://fabricmc.net/develop
|
||||||
minecraft_version=1.20.1
|
minecraft_version=1.20.4
|
||||||
yarn_mappings=1.20.1+build.2
|
yarn_mappings=1.20.4+build.3
|
||||||
loader_version=0.14.21
|
loader_version=0.15.9
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.0.2+1.20.1
|
mod_version = 1.0.9+1.20.4
|
||||||
maven_group = dev.venomcode
|
maven_group = systems.brn.televator
|
||||||
archives_base_name = jumpvader
|
archives_base_name = televator
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
fabric_version=0.83.1+1.20.1
|
fabric_version=0.96.11+1.20.4
|
||||||
polymer_version=0.5.2+1.20.1
|
serverapi_version=1.0.8+1.20.1
|
||||||
server_translations_api_version=2.0.0+1.20
|
polymer_version=0.7.7+1.20.4
|
||||||
|
server_translations_api_version=2.2.0+1.20.3-rc1
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
6
gradlew
vendored
6
gradlew
vendored
@@ -205,6 +205,12 @@ set -- \
|
|||||||
org.gradle.wrapper.GradleWrapperMain \
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
# Use "xargs" to parse quoted args.
|
# Use "xargs" to parse quoted args.
|
||||||
#
|
#
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
10
gradlew.bat
vendored
10
gradlew.bat
vendored
@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
@@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
@@ -1,88 +0,0 @@
|
|||||||
package dev.venomcode.jumpvader;
|
|
||||||
|
|
||||||
import org.spongepowered.configurate.CommentedConfigurationNode;
|
|
||||||
import org.spongepowered.configurate.ConfigurateException;
|
|
||||||
import org.spongepowered.configurate.hocon.HoconConfigurationLoader;
|
|
||||||
import org.spongepowered.configurate.serialize.SerializationException;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
|
|
||||||
public class JumpVaderConfig
|
|
||||||
{
|
|
||||||
|
|
||||||
public boolean getEnabled()
|
|
||||||
{
|
|
||||||
return rootNode.node(ENABLED_TAG).getBoolean(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMaxVerticalBlocks()
|
|
||||||
{
|
|
||||||
return rootNode.node(MAX_VERTICAL_BLOCKS_TAG).getInt(128);
|
|
||||||
}
|
|
||||||
public String getAlternativeBlock()
|
|
||||||
{
|
|
||||||
return rootNode.node(USE_ALTERNATIVE_BLOCK_TAG).getString("default");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setupConfig() throws SerializationException
|
|
||||||
{
|
|
||||||
rootNode.node(ENABLED_TAG).comment(ENABLED_TAG_COMMENT).set(getEnabled());
|
|
||||||
rootNode.node(MAX_VERTICAL_BLOCKS_TAG).comment(MAX_VERTICAL_BLOCKS_TAG_COMMENT).set(getMaxVerticalBlocks());
|
|
||||||
rootNode.node(USE_ALTERNATIVE_BLOCK_TAG).comment(USE_ALTERNATIVE_BLOCK_TAG_COMMENT).set(getAlternativeBlock());
|
|
||||||
|
|
||||||
save();
|
|
||||||
}
|
|
||||||
|
|
||||||
// NODE LOCATION TAGS & COMMENTS
|
|
||||||
private static final String ENABLED_TAG = "enabled";
|
|
||||||
private static final String ENABLED_TAG_COMMENT = "Toggles this entire mod on and off.";
|
|
||||||
private static final String MAX_VERTICAL_BLOCKS_TAG = "max_blocks_vertical";
|
|
||||||
private static final String MAX_VERTICAL_BLOCKS_TAG_COMMENT = "The maximum amount of vertical blocks to travel when using the jump vader block.";
|
|
||||||
private static final String USE_ALTERNATIVE_BLOCK_TAG = "use_alternative_block";
|
|
||||||
private static final String USE_ALTERNATIVE_BLOCK_TAG_COMMENT = "Block to use for clients. Allowed Values: default, stained_glass, white_wool";
|
|
||||||
|
|
||||||
|
|
||||||
public JumpVaderConfig()
|
|
||||||
{
|
|
||||||
loader = HoconConfigurationLoader.builder()
|
|
||||||
.path(Path.of("./config/" + JumpVaderMod.MODID + ".conf"))
|
|
||||||
.build();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
rootNode = loader.load();
|
|
||||||
setupConfig();
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
JumpVaderMod.LOGGER.info("Error occurred loading config:" + ex.getMessage());
|
|
||||||
if(ex.getCause() != null)
|
|
||||||
{
|
|
||||||
ex.getCause().printStackTrace();
|
|
||||||
}
|
|
||||||
rootNode = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean save()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
loader.save(rootNode);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (final ConfigurateException ex)
|
|
||||||
{
|
|
||||||
JumpVaderMod.LOGGER.info("Unable to save config for '" + JumpVaderMod.MODID + "'! Error: " + ex.getMessage());
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private CommentedConfigurationNode getRootNode()
|
|
||||||
{
|
|
||||||
return rootNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final HoconConfigurationLoader loader;
|
|
||||||
private CommentedConfigurationNode rootNode;
|
|
||||||
}
|
|
@@ -1,38 +0,0 @@
|
|||||||
package dev.venomcode.jumpvader;
|
|
||||||
|
|
||||||
import dev.venomcode.jumpvader.blocks.JumpVaderBlock;
|
|
||||||
import eu.pb4.polymer.core.api.item.PolymerBlockItem;
|
|
||||||
import net.fabricmc.api.ModInitializer;
|
|
||||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
|
||||||
import net.minecraft.block.Blocks;
|
|
||||||
import net.minecraft.item.Items;
|
|
||||||
import net.minecraft.registry.Registries;
|
|
||||||
import net.minecraft.registry.Registry;
|
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
public class JumpVaderMod implements ModInitializer {
|
|
||||||
// This logger is used to write text to the console and the log file.
|
|
||||||
// It is considered best practice to use your mod id as the logger's name.
|
|
||||||
// That way, it's clear which mod wrote info, warnings, and errors.
|
|
||||||
public static final String MODID = "jumpvader";
|
|
||||||
public static final Logger LOGGER = LoggerFactory.getLogger(MODID);
|
|
||||||
private static JumpVaderConfig config;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onInitialize()
|
|
||||||
{
|
|
||||||
config = new JumpVaderConfig();
|
|
||||||
|
|
||||||
Registry.register(Registries.BLOCK, new Identifier(JumpVaderMod.MODID, "jumpvader_block"), JUMP_VADER_BLOCK);
|
|
||||||
|
|
||||||
Registry.register( Registries.ITEM, new Identifier(JumpVaderMod.MODID, "jumpvader_block"), new PolymerBlockItem( JUMP_VADER_BLOCK, new FabricItemSettings(), Items.ORANGE_STAINED_GLASS ) );
|
|
||||||
}
|
|
||||||
public static JumpVaderConfig getConfig()
|
|
||||||
{
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
public static final JumpVaderBlock JUMP_VADER_BLOCK = new JumpVaderBlock(FabricBlockSettings.copyOf(Blocks.BAMBOO_PLANKS), Blocks.ORANGE_STAINED_GLASS);
|
|
||||||
}
|
|
@@ -1,104 +0,0 @@
|
|||||||
package dev.venomcode.jumpvader.blocks;
|
|
||||||
|
|
||||||
import dev.venomcode.jumpvader.JumpVaderMod;
|
|
||||||
import dev.venomcode.jumpvader.ifaces.IJumpVaderListener;
|
|
||||||
import eu.pb4.polymer.core.api.block.PolymerBlock;
|
|
||||||
import eu.pb4.polymer.core.api.block.SimplePolymerBlock;
|
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
|
||||||
import net.minecraft.block.AbstractBlock;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockState;
|
|
||||||
import net.minecraft.block.Blocks;
|
|
||||||
import net.minecraft.particle.ParticleTypes;
|
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
|
||||||
import net.minecraft.server.world.ServerWorld;
|
|
||||||
import net.minecraft.sound.SoundCategory;
|
|
||||||
import net.minecraft.sound.SoundEvents;
|
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
|
|
||||||
public class JumpVaderBlock extends SimplePolymerBlock implements IJumpVaderListener {
|
|
||||||
|
|
||||||
public JumpVaderBlock(Settings settings, Block polymerBlock) {
|
|
||||||
super(settings, polymerBlock);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onJump(BlockPos pos , ServerPlayerEntity player )
|
|
||||||
{
|
|
||||||
if(!JumpVaderMod.getConfig().getEnabled())
|
|
||||||
return false;
|
|
||||||
pos = pos.up();
|
|
||||||
ServerWorld w = (ServerWorld) player.getWorld();
|
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
while(count < JumpVaderMod.getConfig().getMaxVerticalBlocks() && pos.getY() < 316)
|
|
||||||
{
|
|
||||||
Block blk = w.getBlockState( pos ).getBlock();
|
|
||||||
|
|
||||||
if(blk instanceof JumpVaderBlock)
|
|
||||||
{
|
|
||||||
final BlockPos tpPos = pos.up();
|
|
||||||
|
|
||||||
if(w.getBlockState( tpPos ).getBlock().equals( Blocks.AIR ) && w.getBlockState( tpPos.up() ).getBlock().equals( Blocks.AIR ))
|
|
||||||
{
|
|
||||||
player.networkHandler.requestTeleport( tpPos.getX() + 0.5f, tpPos.getY(), tpPos.getZ() + 0.5f, player.getHeadYaw(), 0f );
|
|
||||||
|
|
||||||
w.playSound( null, tpPos, SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 0.5f, 1.5f );
|
|
||||||
w.spawnParticles( ParticleTypes.POOF, tpPos.getX() + 0.5f, tpPos.getY(), tpPos.getZ() + 0.5f, 5, 0, 0, 0, 0.25f );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pos = pos.up();
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCrouch( BlockPos pos , ServerPlayerEntity player )
|
|
||||||
{
|
|
||||||
if(!JumpVaderMod.getConfig().getEnabled())
|
|
||||||
return;
|
|
||||||
|
|
||||||
pos = pos.down();
|
|
||||||
ServerWorld w = (ServerWorld) player.getWorld();
|
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
while(count < JumpVaderMod.getConfig().getMaxVerticalBlocks() && pos.getY() >= -64)
|
|
||||||
{
|
|
||||||
Block blk = w.getBlockState( pos ).getBlock();
|
|
||||||
|
|
||||||
if(blk instanceof JumpVaderBlock)
|
|
||||||
{
|
|
||||||
final BlockPos tpPos = pos.up();
|
|
||||||
|
|
||||||
if(w.getBlockState( tpPos ).getBlock().equals( Blocks.AIR ) && w.getBlockState( tpPos.up() ).getBlock().equals( Blocks.AIR ))
|
|
||||||
{
|
|
||||||
player.networkHandler.requestTeleport( tpPos.getX() + 0.5f, tpPos.getY(), tpPos.getZ() + 0.5f, player.getHeadYaw(), 0f );
|
|
||||||
|
|
||||||
w.playSound( null, tpPos, SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 0.5f, 1.5f );
|
|
||||||
w.spawnParticles( ParticleTypes.POOF, tpPos.getX() + 0.5f, tpPos.getY(), tpPos.getZ() + 0.5f, 5, 0, 0, 0, 0.25f );
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pos = pos.down();
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Block getPolymerBlock(BlockState state)
|
|
||||||
{
|
|
||||||
return switch (JumpVaderMod.getConfig().getAlternativeBlock()) {
|
|
||||||
case "tinted_glass" -> Blocks.TINTED_GLASS;
|
|
||||||
case "white_wool" -> Blocks.WHITE_WOOL;
|
|
||||||
default -> Blocks.ORANGE_STAINED_GLASS;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Identifier _identifier = new Identifier( JumpVaderMod.MODID, "jumpvader_block" );
|
|
||||||
}
|
|
@@ -1,10 +0,0 @@
|
|||||||
package dev.venomcode.jumpvader.ifaces;
|
|
||||||
|
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
|
|
||||||
public interface IJumpVaderListener
|
|
||||||
{
|
|
||||||
boolean onJump(BlockPos pos, ServerPlayerEntity player );
|
|
||||||
void onCrouch( BlockPos pos, ServerPlayerEntity player );
|
|
||||||
}
|
|
@@ -1,53 +0,0 @@
|
|||||||
package dev.venomcode.jumpvader.mixin;
|
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
import dev.venomcode.jumpvader.ifaces.IJumpVaderListener;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
|
||||||
import net.minecraft.network.encryption.PlayerPublicKey;
|
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
|
|
||||||
@Mixin( ServerPlayerEntity.class )
|
|
||||||
public abstract class ServerPlayerMixin extends PlayerEntity
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void jump( )
|
|
||||||
{
|
|
||||||
BlockPos p = this.getBlockPos().down();
|
|
||||||
Block blk = this.world.getBlockState( p ).getBlock();
|
|
||||||
|
|
||||||
if(blk instanceof IJumpVaderListener bActioner)
|
|
||||||
{
|
|
||||||
if(bActioner.onJump( p, (ServerPlayerEntity ) (Object)this ))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
super.jump( );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setSneaking( boolean sneaking )
|
|
||||||
{
|
|
||||||
super.setSneaking( sneaking );
|
|
||||||
if(sneaking)
|
|
||||||
{
|
|
||||||
BlockPos p = this.getBlockPos().down();
|
|
||||||
Block blk = this.world.getBlockState( p ).getBlock();
|
|
||||||
|
|
||||||
if(blk instanceof IJumpVaderListener bActioner)
|
|
||||||
{
|
|
||||||
bActioner.onCrouch( p, (ServerPlayerEntity ) (Object)this );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ServerPlayerMixin(World world , BlockPos pos , float yaw , GameProfile profile, PlayerPublicKey pubKey)
|
|
||||||
{
|
|
||||||
super(world, pos, yaw, profile, pubKey);
|
|
||||||
}
|
|
||||||
}
|
|
47
src/main/java/systems/brn/televator/Televator.java
Normal file
47
src/main/java/systems/brn/televator/Televator.java
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
package systems.brn.televator;
|
||||||
|
|
||||||
|
import systems.brn.televator.blocks.TelevatorBlock;
|
||||||
|
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
|
||||||
|
import net.fabricmc.api.ModInitializer;
|
||||||
|
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
|
public class Televator implements ModInitializer {
|
||||||
|
public static final String MODID = "televator";
|
||||||
|
public static final String MODELID = "televator";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInitialize()
|
||||||
|
{
|
||||||
|
|
||||||
|
PolymerResourcePackUtils.addModAssets(MODID);
|
||||||
|
PolymerResourcePackUtils.markAsRequired();
|
||||||
|
|
||||||
|
TelevatorBlock.register();
|
||||||
|
|
||||||
|
|
||||||
|
ServerTickEvents.END_SERVER_TICK.register(server -> {
|
||||||
|
// Iterate over all online players
|
||||||
|
server.getPlayerManager().getPlayerList().forEach(player -> {
|
||||||
|
// Check if the player is sneaking
|
||||||
|
if (player.isSneaking() && player.isOnGround()) {
|
||||||
|
BlockPos testPos = player.getBlockPos().down();
|
||||||
|
if(player.getWorld().getBlockState(testPos).getBlock() instanceof TelevatorBlock jumpVaderBlock) {
|
||||||
|
jumpVaderBlock.handleMovement(testPos, player, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the player is jumping
|
||||||
|
if (player.getVelocity().y > 0 && !player.isOnGround()) {
|
||||||
|
BlockPos testPos = player.getBlockPos().down();
|
||||||
|
if(player.getWorld().getBlockState(testPos).getBlock() instanceof TelevatorBlock jumpVaderBlock)
|
||||||
|
{
|
||||||
|
jumpVaderBlock.handleMovement(testPos, player, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public static TelevatorBlock JUMP_VADER_BLOCK;
|
||||||
|
|
||||||
|
}
|
12
src/main/java/systems/brn/televator/TelevatorConfig.java
Normal file
12
src/main/java/systems/brn/televator/TelevatorConfig.java
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package systems.brn.televator;
|
||||||
|
|
||||||
|
public class TelevatorConfig {
|
||||||
|
public static int getMaxVerticalBlocks()
|
||||||
|
{
|
||||||
|
return 128;
|
||||||
|
}
|
||||||
|
public static String getAlternativeBlock()
|
||||||
|
{
|
||||||
|
return "minecraft:orange_wool";
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,77 @@
|
|||||||
|
package systems.brn.televator.blocks;
|
||||||
|
|
||||||
|
import systems.brn.televator.Televator;
|
||||||
|
import systems.brn.televator.TelevatorConfig;
|
||||||
|
import systems.brn.televator.items.TelevatorBlockItem;
|
||||||
|
import eu.pb4.polymer.blocks.api.BlockModelType;
|
||||||
|
import eu.pb4.polymer.blocks.api.PolymerBlockModel;
|
||||||
|
import eu.pb4.polymer.blocks.api.PolymerTexturedBlock;
|
||||||
|
import eu.pb4.polymer.blocks.api.PolymerBlockResourceUtils;
|
||||||
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.particle.ParticleTypes;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
|
import net.minecraft.registry.Registry;
|
||||||
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.sound.SoundCategory;
|
||||||
|
import net.minecraft.sound.SoundEvents;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
|
public class TelevatorBlock extends Block implements PolymerTexturedBlock {
|
||||||
|
|
||||||
|
private final BlockState polymerBlockState;
|
||||||
|
|
||||||
|
public TelevatorBlock(Settings settings, BlockModelType type, String modelId) {
|
||||||
|
super(settings);
|
||||||
|
this.polymerBlockState = PolymerBlockResourceUtils.requestBlock(type, PolymerBlockModel.of(new Identifier(Televator.MODID, modelId)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Block getPolymerBlock(BlockState state) {
|
||||||
|
return this.polymerBlockState.getBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState getPolymerBlockState(BlockState state) {
|
||||||
|
return this.polymerBlockState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void register() {
|
||||||
|
var modId = new Identifier(Televator.MODID, Televator.MODELID);
|
||||||
|
var block = Registry.register(Registries.BLOCK, modId,
|
||||||
|
new TelevatorBlock(FabricBlockSettings.copy(Blocks.WHITE_WOOL), BlockModelType.FULL_BLOCK, Televator.MODELID));
|
||||||
|
|
||||||
|
Registry.register(Registries.ITEM, modId, new TelevatorBlockItem(new Item.Settings(), block, Televator.MODELID));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleMovement(BlockPos pos, ServerPlayerEntity player, boolean isJumping) {
|
||||||
|
pos = isJumping ? pos.up() : pos.down();
|
||||||
|
ServerWorld world = (ServerWorld) player.getWorld();
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
while (count < TelevatorConfig.getMaxVerticalBlocks() && pos.getY() < world.getTopY() && pos.getY() >= world.getBottomY()) {
|
||||||
|
Block blk = world.getBlockState(pos).getBlock();
|
||||||
|
|
||||||
|
if (blk instanceof TelevatorBlock) {
|
||||||
|
final BlockPos tpPos = pos.up();
|
||||||
|
|
||||||
|
if (world.getBlockState(tpPos).getBlock().equals(Blocks.AIR) && world.getBlockState(tpPos.up()).getBlock().equals(Blocks.AIR)) {
|
||||||
|
teleportWithEffect(player, world, tpPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pos = isJumping ? pos.up() : pos.down();
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void teleportWithEffect(ServerPlayerEntity player, ServerWorld w, BlockPos tpPos) {
|
||||||
|
player.teleport(tpPos.getX() + 0.5f, tpPos.getY(), tpPos.getZ() + 0.5f);
|
||||||
|
w.playSound(null, tpPos, SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 0.5f, 1.5f);
|
||||||
|
w.spawnParticles(ParticleTypes.POOF, tpPos.getX() + 0.5f, tpPos.getY(), tpPos.getZ() + 0.5f, 5, 0, 0, 0, 0.25f);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,33 @@
|
|||||||
|
package systems.brn.televator.items;
|
||||||
|
|
||||||
|
import systems.brn.televator.Televator;
|
||||||
|
import eu.pb4.polymer.core.api.item.PolymerItem;
|
||||||
|
import eu.pb4.polymer.resourcepack.api.PolymerModelData;
|
||||||
|
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.BlockItem;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public class TelevatorBlockItem extends BlockItem implements PolymerItem {
|
||||||
|
private final PolymerModelData polymerModel;
|
||||||
|
|
||||||
|
public TelevatorBlockItem(Settings settings, Block block, String modelId) {
|
||||||
|
super(block, settings);
|
||||||
|
this.polymerModel = PolymerResourcePackUtils.requestModel(Items.BARRIER, new Identifier(Televator.MODID, modelId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
|
||||||
|
return this.polymerModel.item();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPolymerCustomModelData(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
|
||||||
|
return this.polymerModel.value();
|
||||||
|
}
|
||||||
|
}
|
BIN
src/main/resources/assets/icon.png
Normal file
BIN
src/main/resources/assets/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 225 B |
Binary file not shown.
Before Width: | Height: | Size: 453 B |
3
src/main/resources/assets/televator/lang/en_us.json
Normal file
3
src/main/resources/assets/televator/lang/en_us.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"block.televator.televator": "Jump Vader"
|
||||||
|
}
|
BIN
src/main/resources/assets/televator/textures/block/televator.png
Normal file
BIN
src/main/resources/assets/televator/textures/block/televator.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 225 B |
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"block.jumpvader.jumpvader_block": "Jump Vader"
|
|
||||||
}
|
|
@@ -6,7 +6,7 @@
|
|||||||
"entries": [
|
"entries": [
|
||||||
{
|
{
|
||||||
"type": "minecraft:item",
|
"type": "minecraft:item",
|
||||||
"name": "jumpvader:jumpvader_block"
|
"name": "televator:televator"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"conditions": [
|
"conditions": [
|
@@ -17,7 +17,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"result": {
|
"result": {
|
||||||
"item": "jumpvader:jumpvader_block",
|
"item": "televator:televator",
|
||||||
"count": 2
|
"count": 2
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,38 +1,34 @@
|
|||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"id": "jumpvader",
|
"id": "televator",
|
||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
|
|
||||||
"name": "Jump Vader",
|
"name": "Jump Vader",
|
||||||
"description": "Ender Vaders ServerSide Only",
|
"description": "Ender Vaders ServerSide Only",
|
||||||
"authors": [
|
"authors": [
|
||||||
"VenomCodeDev"
|
"VenomCodeDev",
|
||||||
|
"BRNSystems"
|
||||||
],
|
],
|
||||||
"contact": {
|
"contact": {
|
||||||
"homepage": "https://github.com/VenomCodeDev/JumpVaderMod",
|
"homepage": "https://github.com/VenomCodeDev/TelevatorMod",
|
||||||
"sources": "https://github.com/VenomCodeDev/JumpVaderMod"
|
"sources": "https://github.com/VenomCodeDev/TelevatorMod"
|
||||||
},
|
},
|
||||||
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"icon": "assets/jumpvader/icon.png",
|
"icon": "assets/icon.png",
|
||||||
|
|
||||||
"environment": "*",
|
"environment": "*",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"main": [
|
"main": [
|
||||||
"dev.venomcode.jumpvader.JumpVaderMod"
|
"systems.brn.televator.Televator"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
|
||||||
"jumpvader.mixins.json"
|
|
||||||
],
|
|
||||||
|
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.14.21",
|
"fabricloader": ">=0.15.9",
|
||||||
"minecraft": "~1.20.1",
|
"minecraft": "~1.20.4",
|
||||||
"java": ">=17",
|
"java": ">=17",
|
||||||
"fabric-api": "*"
|
"fabric-api": "*",
|
||||||
},
|
"polymer-core": "0.7.7+1.20.4"
|
||||||
"suggests": {
|
|
||||||
"another-mod": "*"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"required": true,
|
|
||||||
"minVersion": "0.8",
|
|
||||||
"package": "dev.venomcode.jumpvader.mixin",
|
|
||||||
"compatibilityLevel": "JAVA_17",
|
|
||||||
"mixins": [
|
|
||||||
"ServerPlayerMixin"
|
|
||||||
],
|
|
||||||
"client": [
|
|
||||||
],
|
|
||||||
"injectors": {
|
|
||||||
"defaultRequire": 1
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user