mirror of
https://github.com/FabricMC/fabric.git
synced 2025-03-13 16:53:35 -04:00
fabric-climbable-api-v1 - Re-implementing minecraft:climbable on 1.15 (#558)
This commit is contained in:
parent
ea0c4fa998
commit
ea4672f136
7 changed files with 120 additions and 1 deletions
|
@ -12,7 +12,7 @@ plugins {
|
|||
def ENV = System.getenv()
|
||||
|
||||
class Globals {
|
||||
static def baseVersion = "0.6.0"
|
||||
static def baseVersion = "0.7.0"
|
||||
static def mcVersion = "1.15.2"
|
||||
static def yarnVersion = "+build.1"
|
||||
}
|
||||
|
|
7
fabric-climbable-api-v1/build.gradle
Normal file
7
fabric-climbable-api-v1/build.gradle
Normal file
|
@ -0,0 +1,7 @@
|
|||
archivesBaseName = "fabric-climbable-api-v1"
|
||||
version = getSubprojectVersion(project, "1.0.0")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
compile project(path: ':fabric-tag-extensions-v0', configuration: 'dev')
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.impl.climbable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tag.Tag;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import net.fabricmc.fabric.api.tag.TagRegistry;
|
||||
|
||||
public class FabricClimbableImpl {
|
||||
public static final Tag<Block> CLIMBABLE = TagRegistry.block(new Identifier("minecraft", "climbable"));
|
||||
|
||||
private FabricClimbableImpl() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.mixin.climbable;
|
||||
|
||||
import net.fabricmc.fabric.impl.climbable.FabricClimbableImpl;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
@Mixin(LivingEntity.class)
|
||||
public abstract class MixinLivingEntity extends Entity {
|
||||
public MixinLivingEntity(EntityType<?> type, World world) {
|
||||
super(type, world);
|
||||
}
|
||||
|
||||
@Inject(method = "isClimbing", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;getBlock()Lnet/minecraft/block/Block;"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
public void onIsClimbing(CallbackInfoReturnable<Boolean> info, BlockState state) {
|
||||
if (state.matches(FabricClimbableImpl.CLIMBABLE)) {
|
||||
info.setReturnValue(true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"required": true,
|
||||
"package": "net.fabricmc.fabric.mixin.climbable",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"mixins": [
|
||||
"MixinLivingEntity"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
27
fabric-climbable-api-v1/src/main/resources/fabric.mod.json
Normal file
27
fabric-climbable-api-v1/src/main/resources/fabric.mod.json
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "fabric-climbable-api-v1",
|
||||
"name": "Fabric Climbable API (v1)",
|
||||
"version": "${version}",
|
||||
"environment": "*",
|
||||
"license": "Apache-2.0",
|
||||
"icon": "assets/fabric-climbable-api-v1/icon.png",
|
||||
"contact": {
|
||||
"homepage": "https://fabricmc.net",
|
||||
"irc": "irc://irc.esper.net:6667/fabric",
|
||||
"issues": "https://github.com/FabricMC/fabric/issues",
|
||||
"sources": "https://github.com/FabricMC/fabric"
|
||||
},
|
||||
"authors": [
|
||||
"FabricMC"
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.4.0",
|
||||
"fabric-tag-extensions-v0": ">=0.1.3",
|
||||
"minecraft": "<1.16-"
|
||||
},
|
||||
"description": "Re-implements the minecraft:climbable tag from 1.16+ back in 1.15",
|
||||
"mixins": [
|
||||
"fabric-climbable-api-v1.mixins.json"
|
||||
]
|
||||
}
|
|
@ -16,6 +16,7 @@ include 'fabric-api-base'
|
|||
|
||||
include 'fabric-biomes-v1'
|
||||
include 'fabric-blockrenderlayer-v1'
|
||||
include 'fabric-climbable-api-v1'
|
||||
include 'fabric-commands-v0'
|
||||
include 'fabric-containers-v0'
|
||||
include 'fabric-content-registries-v0'
|
||||
|
|
Loading…
Reference in a new issue