1.16 Pre-Release 3
Some checks failed
ScriptCraft/pipeline/head There was a failure building this commit
Some checks failed
ScriptCraft/pipeline/head There was a failure building this commit
This commit is contained in:
parent
f6d20db616
commit
07dd733630
@ -3,9 +3,9 @@ org.gradle.jvmargs = -Xmx1G
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/use
|
||||
minecraft_version = 1.15.2
|
||||
yarn_build = 15
|
||||
fabric_loader_version = 0.8.2+build.194
|
||||
minecraft_version = 1.16-pre3
|
||||
yarn_build = 1
|
||||
fabric_loader_version = 0.8.7+build.201
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.0.0
|
||||
|
@ -21,7 +21,7 @@
|
||||
},
|
||||
"depends": {
|
||||
"fabricloader": ">=0.7.4",
|
||||
"minecraft": "1.15.x",
|
||||
"minecraft": "1.16.x",
|
||||
"scriptcraft": "*"
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,9 @@ org.gradle.jvmargs = -Xmx1G
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/use
|
||||
minecraft_version = 1.15.2
|
||||
yarn_build = 15
|
||||
fabric_loader_version = 0.8.2+build.194
|
||||
minecraft_version = 1.16-pre3
|
||||
yarn_build = 1
|
||||
fabric_loader_version = 0.8.7+build.201
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.0.0
|
||||
|
@ -21,7 +21,7 @@
|
||||
},
|
||||
"depends": {
|
||||
"fabricloader": ">=0.7.4",
|
||||
"minecraft": "1.15.x",
|
||||
"minecraft": "1.16.x",
|
||||
"scriptcraft": "*"
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,9 @@ org.gradle.jvmargs = -Xmx1G
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/use
|
||||
minecraft_version = 1.15.2
|
||||
yarn_build = 15
|
||||
fabric_loader_version = 0.8.2+build.194
|
||||
minecraft_version = 1.16-pre2
|
||||
yarn_build = 1
|
||||
fabric_loader_version = 0.8.7+build.201
|
||||
|
||||
# Mod Properties
|
||||
maven_group = com.thebrokenrail
|
||||
@ -13,4 +13,4 @@ org.gradle.jvmargs = -Xmx1G
|
||||
|
||||
# Dependencies
|
||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||
fabric_api_version = 0.5.12+build.296-1.15
|
||||
fabric_api_version = 0.11.8+build.357-1.16
|
||||
|
@ -2,6 +2,8 @@ package com.thebrokenrail.scriptcraft.api.block;
|
||||
|
||||
import com.thebrokenrail.scriptcraft.core.ScriptCraftCore;
|
||||
import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
@ -25,14 +27,14 @@ public class CustomBlockEntity extends BlockEntity implements BlockEntityClientS
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(CompoundTag tag) {
|
||||
super.fromTag(tag);
|
||||
public void fromTag(BlockState state, CompoundTag tag) {
|
||||
super.fromTag(state, tag);
|
||||
ScriptCraftCore.useBridge("CustomBlockEntity.fromTag", objID, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromClientTag(CompoundTag compoundTag) {
|
||||
fromTag(compoundTag);
|
||||
fromTag(Blocks.AIR.getDefaultState(), compoundTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.thebrokenrail.scriptcraft.api.bridge;
|
||||
|
||||
import com.thebrokenrail.scriptcraft.core.ScriptCraftCore;
|
||||
import net.fabricmc.fabric.api.block.FabricBlockSettings;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
|
||||
@ -22,12 +22,11 @@ class BlockSettingsBridges {
|
||||
materialColor = material.getColor();
|
||||
}
|
||||
|
||||
FabricBlockSettings settings = FabricBlockSettings.of(material, materialColor);
|
||||
AbstractBlock.Settings settings = AbstractBlock.Settings.of(material, materialColor);
|
||||
|
||||
settings.hardness(((Double) args[2]).floatValue());
|
||||
settings.resistance(((Double) args[3]).floatValue());
|
||||
settings.strength(((Double) args[2]).floatValue(), ((Double) args[3]).floatValue());
|
||||
|
||||
return settings.build();
|
||||
return settings;
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -7,14 +7,14 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
class InventoryBridges {
|
||||
static void register() {
|
||||
ScriptCraftCore.addBridge("Inventory.get", args -> ((Inventory) args[0]).getInvStack((int) ValueUtil.toDouble(args[1], 0)));
|
||||
ScriptCraftCore.addBridge("Inventory.take", args -> ((Inventory) args[0]).takeInvStack((int) ValueUtil.toDouble(args[1], 0), (int) ValueUtil.toDouble(args[2], 0)));
|
||||
ScriptCraftCore.addBridge("Inventory.get", args -> ((Inventory) args[0]).getStack((int) ValueUtil.toDouble(args[1], 0)));
|
||||
ScriptCraftCore.addBridge("Inventory.take", args -> ((Inventory) args[0]).removeStack((int) ValueUtil.toDouble(args[1], 0), (int) ValueUtil.toDouble(args[2], 0)));
|
||||
ScriptCraftCore.addBridge("Inventory.set", args -> {
|
||||
((Inventory) args[0]).setInvStack((int) ValueUtil.toDouble(args[1], 0), (ItemStack) args[2]);
|
||||
((Inventory) args[0]).setStack((int) ValueUtil.toDouble(args[1], 0), (ItemStack) args[2]);
|
||||
return null;
|
||||
});
|
||||
ScriptCraftCore.addBridge("Inventory.size", args -> ((Inventory) args[0]).getInvSize());
|
||||
ScriptCraftCore.addBridge("Inventory.getMaxStackSize", args -> ((Inventory) args[0]).getInvMaxStackAmount());
|
||||
ScriptCraftCore.addBridge("Inventory.size", args -> ((Inventory) args[0]).size());
|
||||
ScriptCraftCore.addBridge("Inventory.getMaxStackSize", args -> ((Inventory) args[0]).getMaxCountPerStack());
|
||||
|
||||
ScriptCraftCore.addBridge("Inventory.isValid", args -> args[0] instanceof Inventory);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public class CustomItem extends Item {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) {
|
||||
return ValueUtil.toBoolean(ScriptCraftCore.useBridge("CustomItem.onUseOnEntity", id.toString(), user, entity, hand.name()), false);
|
||||
public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) {
|
||||
return ValueUtil.getEnumValue(ActionResult.class, (String) ScriptCraftCore.useBridge("CustomItem.onUseOnEntity", id.toString(), user, entity, hand.name()), ActionResult.PASS);
|
||||
}
|
||||
}
|
||||
|
@ -19,12 +19,4 @@ public class ValueUtil {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean toBoolean(Object value, boolean defaultValue) {
|
||||
try {
|
||||
return ((Boolean) value).booleanValue();
|
||||
} catch (NullPointerException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,6 @@
|
||||
"depends": {
|
||||
"fabricloader": ">=0.7.4",
|
||||
"fabric": "*",
|
||||
"minecraft": "1.15.x"
|
||||
"minecraft": "1.16.x"
|
||||
}
|
||||
}
|
||||
|
@ -353,6 +353,6 @@ addBridge('CustomItem.onUseOnBlock', (id: string, world: JavaObject, x: number,
|
||||
return ItemRegistry.INSTANCE.get(new Identifier(id)).onUseOnBlock(new World(world), new Pos(x, y, z), Direction[side], new PlayerEntity(player), Hand[hand]);
|
||||
});
|
||||
|
||||
addBridge('CustomItem.onUseOnEntity', (id: string, player: JavaObject, target: JavaObject, hand: keyof typeof Hand): boolean => {
|
||||
return ItemRegistry.INSTANCE.get(new Identifier(id)).onUseOnEntity(new PlayerEntity(player), new LivingEntity(target), Hand[hand]) === ActionResult.SUCCESS;
|
||||
addBridge('CustomItem.onUseOnEntity', (id: string, player: JavaObject, target: JavaObject, hand: keyof typeof Hand): string => {
|
||||
return ItemRegistry.INSTANCE.get(new Identifier(id)).onUseOnEntity(new PlayerEntity(player), new LivingEntity(target), Hand[hand]);
|
||||
});
|
||||
|
Reference in New Issue
Block a user