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
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/use
|
# check these on https://fabricmc.net/use
|
||||||
minecraft_version = 1.15.2
|
minecraft_version = 1.16-pre3
|
||||||
yarn_build = 15
|
yarn_build = 1
|
||||||
fabric_loader_version = 0.8.2+build.194
|
fabric_loader_version = 0.8.7+build.201
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.0.0
|
mod_version = 1.0.0
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
},
|
},
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.7.4",
|
"fabricloader": ">=0.7.4",
|
||||||
"minecraft": "1.15.x",
|
"minecraft": "1.16.x",
|
||||||
"scriptcraft": "*"
|
"scriptcraft": "*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,9 @@ org.gradle.jvmargs = -Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/use
|
# check these on https://fabricmc.net/use
|
||||||
minecraft_version = 1.15.2
|
minecraft_version = 1.16-pre3
|
||||||
yarn_build = 15
|
yarn_build = 1
|
||||||
fabric_loader_version = 0.8.2+build.194
|
fabric_loader_version = 0.8.7+build.201
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.0.0
|
mod_version = 1.0.0
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
},
|
},
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.7.4",
|
"fabricloader": ">=0.7.4",
|
||||||
"minecraft": "1.15.x",
|
"minecraft": "1.16.x",
|
||||||
"scriptcraft": "*"
|
"scriptcraft": "*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,9 @@ org.gradle.jvmargs = -Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/use
|
# check these on https://fabricmc.net/use
|
||||||
minecraft_version = 1.15.2
|
minecraft_version = 1.16-pre2
|
||||||
yarn_build = 15
|
yarn_build = 1
|
||||||
fabric_loader_version = 0.8.2+build.194
|
fabric_loader_version = 0.8.7+build.201
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
maven_group = com.thebrokenrail
|
maven_group = com.thebrokenrail
|
||||||
@ -13,4 +13,4 @@ org.gradle.jvmargs = -Xmx1G
|
|||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
# 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 com.thebrokenrail.scriptcraft.core.ScriptCraftCore;
|
||||||
import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
|
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.BlockEntity;
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
@ -25,14 +27,14 @@ public class CustomBlockEntity extends BlockEntity implements BlockEntityClientS
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromTag(CompoundTag tag) {
|
public void fromTag(BlockState state, CompoundTag tag) {
|
||||||
super.fromTag(tag);
|
super.fromTag(state, tag);
|
||||||
ScriptCraftCore.useBridge("CustomBlockEntity.fromTag", objID, tag);
|
ScriptCraftCore.useBridge("CustomBlockEntity.fromTag", objID, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromClientTag(CompoundTag compoundTag) {
|
public void fromClientTag(CompoundTag compoundTag) {
|
||||||
fromTag(compoundTag);
|
fromTag(Blocks.AIR.getDefaultState(), compoundTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.thebrokenrail.scriptcraft.api.bridge;
|
package com.thebrokenrail.scriptcraft.api.bridge;
|
||||||
|
|
||||||
import com.thebrokenrail.scriptcraft.core.ScriptCraftCore;
|
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.Material;
|
||||||
import net.minecraft.block.MaterialColor;
|
import net.minecraft.block.MaterialColor;
|
||||||
|
|
||||||
@ -22,12 +22,11 @@ class BlockSettingsBridges {
|
|||||||
materialColor = material.getColor();
|
materialColor = material.getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
FabricBlockSettings settings = FabricBlockSettings.of(material, materialColor);
|
AbstractBlock.Settings settings = AbstractBlock.Settings.of(material, materialColor);
|
||||||
|
|
||||||
settings.hardness(((Double) args[2]).floatValue());
|
settings.strength(((Double) args[2]).floatValue(), ((Double) args[3]).floatValue());
|
||||||
settings.resistance(((Double) args[3]).floatValue());
|
|
||||||
|
|
||||||
return settings.build();
|
return settings;
|
||||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,14 @@ import net.minecraft.item.ItemStack;
|
|||||||
|
|
||||||
class InventoryBridges {
|
class InventoryBridges {
|
||||||
static void register() {
|
static void register() {
|
||||||
ScriptCraftCore.addBridge("Inventory.get", args -> ((Inventory) args[0]).getInvStack((int) ValueUtil.toDouble(args[1], 0)));
|
ScriptCraftCore.addBridge("Inventory.get", args -> ((Inventory) args[0]).getStack((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.take", args -> ((Inventory) args[0]).removeStack((int) ValueUtil.toDouble(args[1], 0), (int) ValueUtil.toDouble(args[2], 0)));
|
||||||
ScriptCraftCore.addBridge("Inventory.set", args -> {
|
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;
|
return null;
|
||||||
});
|
});
|
||||||
ScriptCraftCore.addBridge("Inventory.size", args -> ((Inventory) args[0]).getInvSize());
|
ScriptCraftCore.addBridge("Inventory.size", args -> ((Inventory) args[0]).size());
|
||||||
ScriptCraftCore.addBridge("Inventory.getMaxStackSize", args -> ((Inventory) args[0]).getInvMaxStackAmount());
|
ScriptCraftCore.addBridge("Inventory.getMaxStackSize", args -> ((Inventory) args[0]).getMaxCountPerStack());
|
||||||
|
|
||||||
ScriptCraftCore.addBridge("Inventory.isValid", args -> args[0] instanceof Inventory);
|
ScriptCraftCore.addBridge("Inventory.isValid", args -> args[0] instanceof Inventory);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ public class CustomItem extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) {
|
public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) {
|
||||||
return ValueUtil.toBoolean(ScriptCraftCore.useBridge("CustomItem.onUseOnEntity", id.toString(), user, entity, hand.name()), false);
|
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;
|
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": {
|
"depends": {
|
||||||
"fabricloader": ">=0.7.4",
|
"fabricloader": ">=0.7.4",
|
||||||
"fabric": "*",
|
"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]);
|
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 => {
|
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]) === ActionResult.SUCCESS;
|
return ItemRegistry.INSTANCE.get(new Identifier(id)).onUseOnEntity(new PlayerEntity(player), new LivingEntity(target), Hand[hand]);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user