Compare commits
35 Commits
20ba50b566
...
1.20.4
Author | SHA1 | Date | |
---|---|---|---|
ca8ef90c1e
|
|||
70822899fa
|
|||
5c5b307664
|
|||
f3d06b275a
|
|||
e78966f133
|
|||
419a5ab607 | |||
da2d60bf72 | |||
0aa33920ab | |||
15334b7221 | |||
1da82f241b | |||
f3d3cfb6ee | |||
9d4a291086 | |||
38f4464789 | |||
719702cb6d | |||
24a61bcd23 | |||
23bb09f795 | |||
0c372eaa8c | |||
706cb823e7 | |||
5e7ff98f05 | |||
caf573fc55 | |||
d59a623213 | |||
40887164a9 | |||
e33be889a4 | |||
d018c369ae | |||
791195a2a1 | |||
6c2df592c5 | |||
|
64c6f17d7f | ||
|
84afee23e9 | ||
|
2bccfd97fd | ||
|
20f4a65f8d | ||
|
06901be171 | ||
|
fbf9a16918 | ||
|
1107ead2a7 | ||
|
d1348868cd | ||
|
66d797b928 |
40
.github/workflows/build.yml
vendored
40
.github/workflows/build.yml
vendored
@@ -1,40 +0,0 @@
|
||||
# Automatically build the project and run any configured tests for every push
|
||||
# and submitted pull request. This can help catch issues that only occur on
|
||||
# certain platforms or Java versions, and provides a first line of defence
|
||||
# against bad commits.
|
||||
|
||||
name: build
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
# Use these Java versions
|
||||
java: [
|
||||
17, # Current Java LTS & minimum supported by Minecraft
|
||||
]
|
||||
# and run on both Linux and Windows
|
||||
os: [ubuntu-22.04, windows-2022]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v3
|
||||
- name: validate gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
- name: setup jdk ${{ matrix.java }}
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
distribution: 'microsoft'
|
||||
- name: make gradle wrapper executable
|
||||
if: ${{ runner.os != 'Windows' }}
|
||||
run: chmod +x ./gradlew
|
||||
- name: build
|
||||
run: ./gradlew build
|
||||
- name: capture build artifacts
|
||||
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Artifacts
|
||||
path: build/libs/
|
21
README.md
21
README.md
@@ -1,9 +1,24 @@
|
||||
# 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)
|
||||
|
||||
## 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 "Televator" 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
|
||||
block to go in between the different heights.
|
||||
|
||||
## Crafting
|
||||

|
||||
|
||||
```
|
||||
G A G
|
||||
A P A
|
||||
G A G
|
||||
```
|
||||
```A``` is amethyst shard
|
||||
```G``` is glass
|
||||
```P``` is an ender pearl
|
||||
|
||||
|
||||
## Removal
|
||||
|
||||
**NOTE:** Removing the mods from the mods folder will delete all Televator blocks in inventories and the world permanently!
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 27 KiB |
57
build.gradle
57
build.gradle
@@ -1,7 +1,5 @@
|
||||
plugins {
|
||||
id 'fabric-loom' version '1.2-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
id 'com.github.johnrengelman.shadow' version '7.0.0'
|
||||
id 'fabric-loom' version '1.11-SNAPSHOT'
|
||||
}
|
||||
|
||||
version = project.mod_version
|
||||
@@ -17,10 +15,7 @@ repositories {
|
||||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
||||
// for more information about repositories.
|
||||
|
||||
maven { url 'https://maven.nucleoid.xyz' }
|
||||
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -32,27 +27,31 @@ dependencies {
|
||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||
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}"))
|
||||
modImplementation include("eu.pb4:polymer-resource-pack:${project.polymer_version}")
|
||||
modImplementation include("eu.pb4:polymer-resource-pack-extras:${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}"))
|
||||
|
||||
shadow(implementation('org.spongepowered:configurate-hocon:4.1.2'))
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
inputs.property "minecraft_version", project.minecraft_version
|
||||
inputs.property "loader_version", project.loader_version
|
||||
inputs.property "loader_version", project.loader_version
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand "version": project.version
|
||||
expand "version": project.version,
|
||||
"minecraft_version": project.minecraft_version,
|
||||
"fabric_version": project.fabric_version,
|
||||
"loader_version": project.loader_version
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
it.options.release = 17
|
||||
it.options.release = 21
|
||||
}
|
||||
|
||||
java {
|
||||
@@ -61,8 +60,8 @@ java {
|
||||
// If you remove this line, sources will not be generated.
|
||||
withSourcesJar()
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
|
||||
jar {
|
||||
@@ -70,29 +69,3 @@ jar {
|
||||
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.
|
||||
}
|
||||
}
|
@@ -1,19 +1,19 @@
|
||||
# Done to increase the memory available to gradle.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
org.gradle.parallel=true
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/develop
|
||||
minecraft_version=1.20.1
|
||||
yarn_mappings=1.20.1+build.2
|
||||
loader_version=0.14.21
|
||||
|
||||
minecraft_version=1.21.8
|
||||
yarn_mappings=1.21.8+build.1
|
||||
loader_version=0.16.14
|
||||
# Mod Properties
|
||||
mod_version = 1.0.2+1.20.1
|
||||
maven_group = dev.venomcode
|
||||
archives_base_name = jumpvader
|
||||
mod_version=1.2.5
|
||||
maven_group=systems.brn.televator
|
||||
archives_base_name=televator
|
||||
# Dependencies
|
||||
fabric_version=0.129.0+1.21.8
|
||||
|
||||
|
||||
# Dependencies
|
||||
fabric_version=0.83.1+1.20.1
|
||||
polymer_version=0.5.2+1.20.1
|
||||
server_translations_api_version=2.0.0+1.20
|
||||
polymer_version=0.13.7+1.21.8
|
||||
server_translations_api_version=2.5.1+1.21.5
|
||||
|
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
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
6
gradlew
vendored
6
gradlew
vendored
@@ -205,6 +205,12 @@ set -- \
|
||||
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.
|
||||
#
|
||||
# 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
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
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
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
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);
|
||||
}
|
||||
}
|
55
src/main/java/systems/brn/televator/Televator.java
Normal file
55
src/main/java/systems/brn/televator/Televator.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package systems.brn.televator;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import eu.pb4.polymer.resourcepack.extras.api.ResourcePackExtras;
|
||||
import eu.pb4.polymer.resourcepack.impl.client.rendering.PolymerResourcePack;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
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;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Televator implements ModInitializer {
|
||||
public static final String MODID = "televator";
|
||||
public static final String MODELID = "televator";
|
||||
public static final HashMap<UUID, Boolean> primed = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
PolymerResourcePackUtils.addModAssets(MODID);
|
||||
ResourcePackExtras.forDefault().addBridgedModelsFolder(Identifier.of(MODID, "item"));
|
||||
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.getPlayerInput().sneak() && !player.getPlayerInput().jump()) {
|
||||
primed.put(player.getUuid(), true);
|
||||
}
|
||||
if (primed.getOrDefault(player.getUuid(), false)) {
|
||||
if (player.getPlayerInput().sneak()) {
|
||||
BlockPos testPos = player.getBlockPos().down();
|
||||
if (player.getWorld().getBlockState(testPos).getBlock() instanceof TelevatorBlock televatorBlock) {
|
||||
televatorBlock.handleMovement(testPos, player, false);
|
||||
}
|
||||
} else if (player.getPlayerInput().jump()) {
|
||||
BlockPos testPos = player.getBlockPos().down();
|
||||
if (player.getWorld().getBlockState(testPos).getBlock() instanceof TelevatorBlock televatorBlock) {
|
||||
televatorBlock.handleMovement(testPos, player, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,85 @@
|
||||
package systems.brn.televator.blocks;
|
||||
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.item.ItemGroups;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import systems.brn.televator.Televator;
|
||||
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.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;
|
||||
import xyz.nucleoid.packettweaker.PacketContext;
|
||||
|
||||
import static systems.brn.televator.Televator.primed;
|
||||
|
||||
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(Identifier.of(Televator.MODID, "block/" + modelId)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getPolymerBlockState(BlockState state, PacketContext packetContext) {
|
||||
return this.polymerBlockState;
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
var modId = Identifier.of(Televator.MODID, Televator.MODELID);
|
||||
var block = Registry.register(Registries.BLOCK, modId,
|
||||
new TelevatorBlock(AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).registryKey(RegistryKey.of(RegistryKeys.BLOCK, modId)), BlockModelType.FULL_BLOCK, Televator.MODELID));
|
||||
|
||||
Item item = Registry.register(Registries.ITEM, modId, new TelevatorBlockItem(new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, modId)), block, Televator.MODELID));
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register(content -> content.add(item));
|
||||
}
|
||||
|
||||
public void handleMovement(BlockPos pos, ServerPlayerEntity player, boolean isJumping) {
|
||||
pos = isJumping ? pos.up() : pos.down();
|
||||
ServerWorld world = (ServerWorld) player.getWorld();
|
||||
int maxY = world.getDimension().height() + world.getDimension().minY();
|
||||
int minY = world.getDimension().minY();
|
||||
while (pos.getY() <= maxY && pos.getY() >= minY) {
|
||||
Block blk = world.getBlockState(pos).getBlock();
|
||||
|
||||
if (blk instanceof TelevatorBlock) {
|
||||
final BlockPos tpPos = pos.up();
|
||||
|
||||
if (tpPos.getY() + 1 > maxY || (world.getBlockState(tpPos).getBlock().equals(Blocks.AIR) && world.getBlockState(tpPos.up()).getBlock().equals(Blocks.AIR))) {
|
||||
teleportWithEffect(player, world, tpPos);
|
||||
primed.put(player.getUuid(), false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
pos = isJumping ? pos.up() : pos.down();
|
||||
}
|
||||
}
|
||||
|
||||
private void teleportWithEffect(ServerPlayerEntity player, ServerWorld w, BlockPos tpPos) {
|
||||
|
||||
player.teleport(tpPos.getX() + 0.5d, tpPos.getY(), tpPos.getZ() + 0.5d, true);
|
||||
player.setVelocity(0, 0, 0);
|
||||
player.setSneaking(false);
|
||||
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,36 @@
|
||||
package systems.brn.televator.items;
|
||||
|
||||
import eu.pb4.polymer.resourcepack.extras.api.ResourcePackExtras;
|
||||
import eu.pb4.polymer.resourcepack.extras.api.format.item.model.BasicItemModel;
|
||||
import eu.pb4.polymer.resourcepack.impl.client.rendering.PolymerResourcePack;
|
||||
import net.minecraft.resource.ResourcePack;
|
||||
import systems.brn.televator.Televator;
|
||||
import eu.pb4.polymer.core.api.item.PolymerItem;
|
||||
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.util.Identifier;
|
||||
import xyz.nucleoid.packettweaker.PacketContext;
|
||||
|
||||
public class TelevatorBlockItem extends BlockItem implements PolymerItem {
|
||||
private final Identifier polymerModel;
|
||||
|
||||
public TelevatorBlockItem(Settings settings, Block block, String modelId) {
|
||||
super(block, settings);
|
||||
this.polymerModel = Identifier.of(Televator.MODID, modelId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getPolymerItem(ItemStack itemStack, PacketContext packetContext) {
|
||||
return Items.BARRIER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getPolymerItemModel(ItemStack stack, PacketContext context) {
|
||||
return polymerModel;
|
||||
}
|
||||
|
||||
}
|
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: 2.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 453 B |
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "televator:block/televator"
|
||||
}
|
||||
}
|
||||
}
|
6
src/main/resources/assets/televator/items/televator.json
Normal file
6
src/main/resources/assets/televator/items/televator.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"model": {
|
||||
"type": "minecraft:model",
|
||||
"model": "televator:item/televator"
|
||||
}
|
||||
}
|
4
src/main/resources/assets/televator/lang/en_us.json
Normal file
4
src/main/resources/assets/televator/lang/en_us.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"block.televator.televator": "Televator",
|
||||
"item.televator.televator": "Televator"
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"parent": "block/cube_column",
|
||||
"textures": {
|
||||
"end": "televator:block/televator_top",
|
||||
"side": "televator:block/televator_side"
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"parent": "televator:block/televator"
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 248 B |
Binary file not shown.
After Width: | Height: | Size: 241 B |
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"block.jumpvader.jumpvader_block": "Jump Vader"
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"#A#",
|
||||
"AEA",
|
||||
"#A#"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"item": "minecraft:glass"
|
||||
},
|
||||
"A": {
|
||||
"item": "minecraft:amethyst_shard"
|
||||
},
|
||||
"E": {
|
||||
"item": "minecraft:ender_pearl"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "jumpvader:jumpvader_block",
|
||||
"count": 2
|
||||
}
|
||||
}
|
@@ -6,7 +6,7 @@
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "jumpvader:jumpvader_block"
|
||||
"name": "televator:televator"
|
||||
}
|
||||
],
|
||||
"conditions": [
|
18
src/main/resources/data/televator/recipe/televator.json
Normal file
18
src/main/resources/data/televator/recipe/televator.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "redstone",
|
||||
"pattern": [
|
||||
"#A#",
|
||||
"AEA",
|
||||
"#A#"
|
||||
],
|
||||
"key": {
|
||||
"#": "minecraft:glass",
|
||||
"A": "minecraft:amethyst_shard",
|
||||
"E": "minecraft:ender_pearl"
|
||||
},
|
||||
"result": {
|
||||
"id": "televator:televator",
|
||||
"count": 2
|
||||
}
|
||||
}
|
@@ -1,38 +1,33 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "jumpvader",
|
||||
"id": "televator",
|
||||
"version": "${version}",
|
||||
|
||||
"name": "Jump Vader",
|
||||
"description": "Ender Vaders ServerSide Only",
|
||||
"name": "Televator",
|
||||
"description": "Televator Serversider",
|
||||
"authors": [
|
||||
"VenomCodeDev"
|
||||
"VenomCodeDev",
|
||||
"BRNSystems"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://github.com/VenomCodeDev/JumpVaderMod",
|
||||
"sources": "https://github.com/VenomCodeDev/JumpVaderMod"
|
||||
"homepage": "https://git.brn.systems/BRNSystems/Televator",
|
||||
"sources": "https://git.brn.systems/BRNSystems/Televator"
|
||||
},
|
||||
|
||||
"license": "MIT",
|
||||
"icon": "assets/jumpvader/icon.png",
|
||||
"icon": "assets/icon.png",
|
||||
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"dev.venomcode.jumpvader.JumpVaderMod"
|
||||
"systems.brn.televator.Televator"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"jumpvader.mixins.json"
|
||||
],
|
||||
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.21",
|
||||
"minecraft": "~1.20.1",
|
||||
"java": ">=17",
|
||||
"fabric-api": "*"
|
||||
},
|
||||
"suggests": {
|
||||
"another-mod": "*"
|
||||
"fabricloader": ">=${loader_version}",
|
||||
"minecraft": ">=${minecraft_version}",
|
||||
"java": ">=21",
|
||||
"fabric-api": ">=${fabric_version}"
|
||||
}
|
||||
}
|
||||
|
@@ -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