This commit is contained in:
p2vman 2025-05-26 19:02:40 +03:00
parent a364cbb128
commit a35dda60d3
35 changed files with 120 additions and 325 deletions

View File

@ -1 +1 @@
vmodaddon
vmodextras

View File

@ -9,7 +9,7 @@
<entry name="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.spongepowered/mixin/0.8.5/6d1c8bf4c28e697f472a83bd6add76ec4951734/mixin-0.8.5-processor.jar" />
<entry name="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.projectlombok/lombok/1.18.20/18bcea7d5df4d49227b4a0743a536208ce4825bb/lombok-1.18.20.jar" />
</processorPath>
<module name="vmodaddon.main" />
<module name="vmodextras.main" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel target="17" />

View File

@ -2,8 +2,8 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/modules/vmodaddon.main.iml" filepath="$PROJECT_DIR$/.idea/modules/vmodaddon.main.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/vmodaddon.test.iml" filepath="$PROJECT_DIR$/.idea/modules/vmodaddon.test.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/vmodextras.main.iml" filepath="$PROJECT_DIR$/.idea/modules/vmodextras.main.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/vmodextras.test.iml" filepath="$PROJECT_DIR$/.idea/modules/vmodextras.test.iml" />
</modules>
</component>
</project>

View File

@ -11,17 +11,12 @@
<autoDetectTypes>
<platformType>FORGE</platformType>
<platformType>MIXIN</platformType>
<platformType>MCP</platformType>
</autoDetectTypes>
<projectReimportVersion>1</projectReimportVersion>
</configuration>
</facet>
</component>
<component name="McpModuleSettings">
<option name="mappingFile" value="$MODULE_DIR$/../../build/createMcpToSrg/output.tsrg" />
<option name="mcpVersion" value="official_1.20.1" />
<option name="minecraftVersion" value="1.20.1" />
<option name="platformVersion" value="47.4.1" />
<option name="srgType" value="TSRG" />
<option name="srgType" value="SRG" />
</component>
</module>

View File

@ -6,17 +6,12 @@
<autoDetectTypes>
<platformType>FORGE</platformType>
<platformType>MIXIN</platformType>
<platformType>MCP</platformType>
</autoDetectTypes>
<projectReimportVersion>1</projectReimportVersion>
</configuration>
</facet>
</component>
<component name="McpModuleSettings">
<option name="mappingFile" value="$MODULE_DIR$/../../build/createMcpToSrg/output.tsrg" />
<option name="mcpVersion" value="official_1.20.1" />
<option name="minecraftVersion" value="1.20.1" />
<option name="platformVersion" value="47.4.1" />
<option name="srgType" value="TSRG" />
<option name="srgType" value="SRG" />
</component>
</module>

View File

@ -180,6 +180,8 @@ dependencies {
implementation(fg.deobf(files("./libs/trackwork-1.20.1-1.1.1b.jar")))
implementation(fg.deobf("org.valkyrienskies:valkyrienskies-120:2.3.0-beta.7"))
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.14.0'
implementation 'net.minecraftforge:modlauncher:10.1.1'
implementation 'net.minecraftforge:forgespi:7.1.0'

View File

@ -5,24 +5,10 @@ minecraft_version_range=[1.20.1,1.21)
forge_version=47.4.1
forge_version_range=[47,)
loader_version_range=[47,)
# The mapping channel to use for mappings.
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
#
# | Channel | Version | |
# |-----------|----------------------|--------------------------------------------------------------------------------|
# | official | MCVersion | Official field/method names from Mojang mapping files |
# | parchment | YYYY.MM.DD-MCVersion | Open community-sourced parameter names and javadocs layered on top of official |
#
# You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
# See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
#
# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge.
# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started
mapping_channel=official
mapping_version=1.20.1
mod_id=vmodaddon
mod_name=VModAddon
mod_id=vmodextras
mod_name=VModExtras
mod_license=MIT
mod_version=1.0-SNAPSHOT
mod_group_id=space.eptaproject

View File

@ -12,4 +12,4 @@ plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
}
rootProject.name = 'vmodaddon'
rootProject.name = 'vmodextras'

View File

@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@ToString
public class Validator implements IValidator {
public static final Logger LOGGER = LoggerFactory.getLogger("Validator");
public static ResourceLocation RB = ResourceLocation.fromNamespaceAndPath(Vmodaddon.MODID, "example_block");
public static ResourceLocation RB = ResourceLocation.fromNamespaceAndPath(VmodExtras.MODID, "example_block");
public Validator() {

View File

@ -1,6 +1,10 @@
package space.eptaproject.vmodextras;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.mojang.logging.LogUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.*;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntityType;
@ -16,7 +20,7 @@ import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.config.ModConfigEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.RegistryObject;
import net.minecraftforge.registries.*;
import org.slf4j.Logger;
import space.eptaproject.vmodextras.block.CompactBackupBlock;
import space.eptaproject.vmodextras.block.CompactBackupBlockEntity;
@ -24,10 +28,13 @@ import space.eptaproject.vmodextras.block.TrackBackupBlock;
import space.eptaproject.vmodextras.block.TrackBackupBlockEntity;
import space.eptaproject.vmodextras.util.ModRegistry;
@Mod(Vmodaddon.MODID)
public class Vmodaddon {
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Map;
public static final String MODID = "vmodaddon";
@Mod(VmodExtras.MODID)
public class VmodExtras {
public static final String MODID = "vmodextras";
private static final Logger LOGGER = LogUtils.getLogger();
@ -51,7 +58,7 @@ public class Vmodaddon {
static {
REGISTRY = new ModRegistry(MODID);
TRAK_BUK = REGISTRY.BLOCKS.register("track_b", () -> new TrackBackupBlock(BlockBehaviour.Properties.of().mapColor(MapColor.STONE)));
TRAK_BUK = REGISTRY.BLOCKS.register("track_backup", () -> new TrackBackupBlock(BlockBehaviour.Properties.of().mapColor(MapColor.STONE)));
SHIP_VOID_BLOCK = REGISTRY.BLOCKS.register("ship_void", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE)));
COMPACT_BACKUP = REGISTRY.BLOCKS.register("compact_backup", () -> new CompactBackupBlock(BlockBehaviour.Properties.of().mapColor(MapColor.STONE)));
@ -60,14 +67,14 @@ public class Vmodaddon {
EXAMPLE_TAB = REGISTRY.TabBuilder()
.push((registry) -> {
MY_BLOCK_ITEM = registry.register("track_b", () -> new BlockItem(TRAK_BUK.get(), new Item.Properties()));
MY_BLOCK_ITEM = registry.register("track_backup", () -> new BlockItem(TRAK_BUK.get(), new Item.Properties()));
SHIP_VOID_ITEM = registry.register("ship_void", () -> new BlockItem(SHIP_VOID_BLOCK.get(), new Item.Properties()));
COMPACT_BACKUP_ITEM = registry.register("compact_backup", () -> new BlockItem(COMPACT_BACKUP.get(), new Item.Properties()));
})
.build("vmodaddon", Items.BEDROCK.getDefaultInstance());
.build("vmodetras", Items.BEDROCK.getDefaultInstance());
}
public Vmodaddon() {
public VmodExtras() {
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
modEventBus.addListener(this::commonSetup);

View File

@ -3,7 +3,7 @@ package space.eptaproject.vmodextras.block;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntityType;
import space.eptaproject.vmodextras.Vmodaddon;
import space.eptaproject.vmodextras.VmodExtras;
public class CompactBackupBlock extends Block implements IBE<CompactBackupBlockEntity> {
@ -13,7 +13,7 @@ public class CompactBackupBlock extends Block implements IBE<CompactBackupBlockE
@Override
public BlockEntityType<? extends CompactBackupBlockEntity> getBlockEntityType() {
return Vmodaddon.COMPACT_BACKUP_BLOCK_ENTITY.get();
return VmodExtras.COMPACT_BACKUP_BLOCK_ENTITY.get();
}
@Override

View File

@ -15,14 +15,14 @@ import org.valkyrienskies.core.api.ships.ServerShip;
import org.valkyrienskies.mod.common.VSGameUtilsKt;
import space.eptaproject.vmodextras.trackwork.IPhysicsTrackController;
import space.eptaproject.vmodextras.trackwork.ISimpleWheelController;
import space.eptaproject.vmodextras.Vmodaddon;
import space.eptaproject.vmodextras.VmodExtras;
public class CompactBackupBlockEntity extends BlockEntity {
private CompoundTag pendingBackupData;
public CompactBackupBlockEntity(BlockPos p_155229_, BlockState p_155230_) {
super(Vmodaddon.COMPACT_BACKUP_BLOCK_ENTITY.get(), p_155229_, p_155230_);
super(VmodExtras.COMPACT_BACKUP_BLOCK_ENTITY.get(), p_155229_, p_155230_);
}
@Override

View File

@ -3,7 +3,7 @@ package space.eptaproject.vmodextras.block;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntityType;
import space.eptaproject.vmodextras.Vmodaddon;
import space.eptaproject.vmodextras.VmodExtras;
public class TrackBackupBlock extends Block implements IBE<TrackBackupBlockEntity> {
@ -13,7 +13,7 @@ public class TrackBackupBlock extends Block implements IBE<TrackBackupBlockEntit
@Override
public BlockEntityType<? extends TrackBackupBlockEntity> getBlockEntityType() {
return Vmodaddon.MY_BLOCK_ENTITY.get();
return VmodExtras.MY_BLOCK_ENTITY.get();
}
@Override

View File

@ -4,20 +4,19 @@ import edn.stratodonut.trackwork.tracks.forces.PhysicsTrackController;
import edn.stratodonut.trackwork.tracks.forces.SimpleWheelController;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import org.joml.Vector3d;
import org.joml.Vector3dc;
import org.valkyrienskies.core.api.ships.ServerShip;
import org.valkyrienskies.mod.common.VSGameUtilsKt;
import space.eptaproject.vmodextras.trackwork.IPhysicsTrackController;
import space.eptaproject.vmodextras.trackwork.ISimpleWheelController;
import space.eptaproject.vmodextras.Vmodaddon;
import space.eptaproject.vmodextras.VmodExtras;
import space.eptaproject.vmodextras.util.IBlockEntityClear;
public class TrackBackupBlockEntity extends BlockEntity implements IBlockEntityClear {
public TrackBackupBlockEntity(BlockPos p_155229_, BlockState p_155230_) {
super(Vmodaddon.MY_BLOCK_ENTITY.get(), p_155229_, p_155230_);
super(VmodExtras.MY_BLOCK_ENTITY.get(), p_155229_, p_155230_);
}
public CompoundTag tag = new CompoundTag();
@ -74,47 +73,25 @@ public class TrackBackupBlockEntity extends BlockEntity implements IBlockEntityC
if (ship != null) {
{
PhysicsTrackController physicsTrackController = ship.getAttachment(PhysicsTrackController.class);
IPhysicsTrackController controller = (IPhysicsTrackController) physicsTrackController;
if (physicsTrackController != null) {
CompoundTag PhysicsTrackControllerTag = new CompoundTag();
IPhysicsTrackController controller = (IPhysicsTrackController) physicsTrackController;
CompoundTag local = new CompoundTag();
PhysicsTrackControllerTag.putFloat("SuspensionStiffness", controller.getSuspensionStiffness());
{
CompoundTag suspensionAdjust = new CompoundTag();
controller.encode(local);
Vector3dc vec = controller.getSuspensionAdjust();
suspensionAdjust.putDouble("x", vec.x());
suspensionAdjust.putDouble("y", vec.y());
suspensionAdjust.putDouble("z", vec.z());
PhysicsTrackControllerTag.put("suspensionAdjust", suspensionAdjust);
}
tag.put("PhysicsTrackController", PhysicsTrackControllerTag);
tag.put("PhysicsTrackController", local);
}
}
{
SimpleWheelController simpleWheelController = ship.getAttachment(SimpleWheelController.class);
ISimpleWheelController controller = (ISimpleWheelController) simpleWheelController;
if (simpleWheelController != null) {
CompoundTag SimpleWheelControllerTag = new CompoundTag();
ISimpleWheelController controller = (ISimpleWheelController) simpleWheelController;
CompoundTag local = new CompoundTag();
SimpleWheelControllerTag.putFloat("SuspensionStiffness", controller.getSuspensionStiffness());
{
CompoundTag suspensionAdjust = new CompoundTag();
controller.encode(local);
Vector3dc vec = controller.getSuspensionAdjust();
suspensionAdjust.putDouble("x", vec.x());
suspensionAdjust.putDouble("y", vec.y());
suspensionAdjust.putDouble("z", vec.z());
SimpleWheelControllerTag.put("suspensionAdjust", suspensionAdjust);
}
tag.put("SimpleWheelController", SimpleWheelControllerTag);
tag.put("SimpleWheelController", local);
}
}
}
@ -124,34 +101,14 @@ public class TrackBackupBlockEntity extends BlockEntity implements IBlockEntityC
public void load(CompoundTag tag) {
this.tag = tag;
super.load(tag);
ServerShip ship = (ServerShip) VSGameUtilsKt.getShipObjectManagingPos(this.level, getBlockPos());
if (ship != null) {
if (tag.contains("SimpleWheelController")) {
CompoundTag L = tag.getCompound("SimpleWheelController");
SimpleWheelController controller2 = SimpleWheelController.getOrCreate(ship);
if (L.contains("SuspensionStiffness")) {
((ISimpleWheelController) controller2).setSuspensionStiffness(L.getFloat("SuspensionStiffness"));
}
if (L.contains("suspensionAdjust")) {
CompoundTag suspensionAdjust = L.getCompound("suspensionAdjust");
((ISimpleWheelController) controller2).setSuspensionAdjust(new Vector3d(new Vector3d(suspensionAdjust.getDouble("x"), suspensionAdjust.getDouble("y"), suspensionAdjust.getDouble("z"))));
}
if (tag.contains("SimpleWheelController", Tag.TAG_COMPOUND)) {
((ISimpleWheelController) SimpleWheelController.getOrCreate(ship)).decode(tag.getCompound("SimpleWheelController"));
}
if (tag.contains("PhysicsTrackController")) {
CompoundTag L = tag.getCompound("PhysicsTrackController");
PhysicsTrackController controller = PhysicsTrackController.getOrCreate(ship);
if (L.contains("SuspensionStiffness")) {
((IPhysicsTrackController) controller).setSuspensionStiffness(L.getFloat("SuspensionStiffness"));
}
if (L.contains("suspensionAdjust")) {
CompoundTag suspensionAdjust = L.getCompound("suspensionAdjust");
((IPhysicsTrackController) controller).setSuspensionAdjust(new Vector3d(suspensionAdjust.getDouble("x"), suspensionAdjust.getDouble("y"), suspensionAdjust.getDouble("z")));
}
if (tag.contains("PhysicsTrackController", Tag.TAG_COMPOUND)) {
((IPhysicsTrackController) PhysicsTrackController.getOrCreate(ship)).decode(tag.getCompound("PhysicsTrackController"));
}
}
}

View File

@ -1,12 +0,0 @@
package space.eptaproject.vmodextras.mixin;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface A {
String[] value();
}

View File

@ -1,8 +0,0 @@
package space.eptaproject.vmodextras.mixin;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
public interface ITransformer {
void transform(String targetClassName, ClassNode classNode, String mixinClassName, IMixinInfo mixinInfo);
}

View File

@ -1,35 +0,0 @@
package space.eptaproject.vmodextras.mixin;
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
import java.util.Map;
public class InstanceHolder<T> {
private final Map<Class<? extends T>, T> instances = new Object2ObjectArrayMap<>();
public InstanceHolder() {
}
public T get(String cls) {
try {
return get((Class<? extends T>) Class.forName(cls));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public T get(Class<? extends T> cls) {
if (instances.containsKey(cls)) {
return instances.get(cls);
}
try {
T instance = cls.getDeclaredConstructor().newInstance();
instances.put(cls, instance);
return instance;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

View File

@ -1,36 +0,0 @@
package space.eptaproject.vmodextras.mixin;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.*;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
import java.util.ListIterator;
public class KotlinOptimizationTransformer implements ITransformer {
@Override
public void transform(String targetClassName, ClassNode classNode, String mixinClassName, IMixinInfo mixinInfo) {
for (MethodNode method : classNode.methods) {
ListIterator<AbstractInsnNode> it = method.instructions.iterator();
while (it.hasNext()) {
AbstractInsnNode insn = it.next();
if (insn.getOpcode() == Opcodes.INVOKESTATIC &&
insn instanceof MethodInsnNode methodInsn &&
methodInsn.owner.equals("kotlin/jvm/internal/Intrinsics") &&
(methodInsn.name.equals("checkParameterIsNotNull") || methodInsn.name.equals("checkNotNullParameter") || methodInsn.name.equals("checkNotNullExpressionValue")) &&
methodInsn.desc.equals("(Ljava/lang/Object;Ljava/lang/String;)V")) {
AbstractInsnNode arg2Insn = methodInsn.getPrevious();
AbstractInsnNode arg1Insn = arg2Insn != null ? arg2Insn.getPrevious() : null;
method.instructions.remove(arg1Insn);
method.instructions.remove(arg2Insn);
method.instructions.remove(insn);
}
}
}
}
}

View File

@ -5,14 +5,10 @@ import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
import org.objectweb.asm.tree.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Set;
public class MixinPlugin implements IMixinConfigPlugin {
public InstanceHolder<ITransformer> transformerInstanceHolder = new InstanceHolder<>();
@Override
public void onLoad(String mixinPackage) {
@ -49,43 +45,6 @@ public class MixinPlugin implements IMixinConfigPlugin {
@Override
public void postApply(String targetClassName, ClassNode classNode, String mixinClassName, IMixinInfo mixinInfo) {
String annotationDesc = "Lspace/eptaproject/vmodaddon/mixin/A;";
if (classNode.visibleAnnotations == null) {
classNode.visibleAnnotations = new ArrayList<>();
}
AnnotationNode existing = null;
for (AnnotationNode ann : classNode.visibleAnnotations) {
if (Objects.equals(ann.desc, annotationDesc)) {
existing = ann;
break;
}
}
if (existing != null) {
List<Object> values = existing.values;
for (int i = 0; i < values.size(); i += 2) {
String key = (String) values.get(i);
if (key.equals("value")) {
List<String> list = (List<String>) values.get(i + 1);
if (!list.contains(mixinClassName)) {
list.add(mixinClassName);
}
return;
}
}
values.add("value");
values.add(new ArrayList<>(List.of(mixinClassName)));
} else {
AnnotationNode newAnnotation = new AnnotationNode(annotationDesc);
newAnnotation.values = new ArrayList<>();
newAnnotation.values.add("value");
newAnnotation.values.add(new ArrayList<>(List.of(mixinClassName)));
classNode.visibleAnnotations.add(newAnnotation);
}
//transformerInstanceHolder.get(KotlinOptimizationTransformer.class).transform(targetClassName, classNode, mixinClassName, mixinInfo);
}
}

View File

@ -1,12 +0,0 @@
package space.eptaproject.vmodextras.mixin;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Transformers {
Class<? extends ITransformer>[] transformers();
}

View File

@ -15,11 +15,8 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import space.eptaproject.vmodextras.IValidator;
import space.eptaproject.vmodextras.Validator;
import space.eptaproject.vmodextras.mixin.KotlinOptimizationTransformer;
import space.eptaproject.vmodextras.mixin.Transformers;
@Mixin(BlockPaletteHashMapV1.class)
@Transformers(transformers = {KotlinOptimizationTransformer.class})
public class BlockPaletteHashMapV1Mixin {
@Unique
public final IValidator validator = new Validator();

View File

@ -1,5 +1,6 @@
package space.eptaproject.vmodextras.mixins;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import edn.stratodonut.trackwork.tracks.forces.PhysicsTrackController;
import org.joml.Math;
import org.spongepowered.asm.mixin.Mixin;
@ -9,6 +10,7 @@ import space.eptaproject.vmodextras.Config;
import space.eptaproject.vmodextras.trackwork.IPhysicsTrackController;
@Mixin(PhysicsTrackController.class)
@JsonIgnoreProperties(ignoreUnknown = true)
public abstract class PhysicsTrackControllerMixin implements IPhysicsTrackController {
@Shadow private volatile float suspensionStiffness;

View File

@ -1,5 +1,6 @@
package space.eptaproject.vmodextras.mixins;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import edn.stratodonut.trackwork.tracks.forces.SimpleWheelController;
import org.joml.Math;
import org.spongepowered.asm.mixin.Mixin;
@ -9,9 +10,14 @@ import space.eptaproject.vmodextras.Config;
import space.eptaproject.vmodextras.trackwork.ISimpleWheelController;
@Mixin(SimpleWheelController.class)
@JsonIgnoreProperties(ignoreUnknown = true)
public abstract class SimpleWheelControllerMixin implements ISimpleWheelController {
@Shadow private volatile float suspensionStiffness;
/**
* @author
* @reason
*/
@Overwrite(remap = false)
public final float setDamperCoefficient(float delta) {
this.suspensionStiffness = Math.clamp(1, Config.Suspension_Stiffness_LIMIT.get(), this.suspensionStiffness + delta);

View File

@ -1,5 +1,8 @@
package space.eptaproject.vmodextras.trackwork;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import org.joml.Vector3d;
import org.joml.Vector3dc;
public interface IController {
@ -7,4 +10,30 @@ public interface IController {
void setSuspensionStiffness(float val);
Vector3dc getSuspensionAdjust();
void setSuspensionAdjust(Vector3dc vector3d);
default void encode(CompoundTag root) {
root.putFloat("SuspensionStiffness", this.getSuspensionStiffness());
{
CompoundTag suspensionAdjust = new CompoundTag();
Vector3dc vec = this.getSuspensionAdjust();
suspensionAdjust.putDouble("x", vec.x());
suspensionAdjust.putDouble("y", vec.y());
suspensionAdjust.putDouble("z", vec.z());
root.put("suspensionAdjust", suspensionAdjust);
}
}
default void decode(CompoundTag root) {
if (root.contains("SuspensionStiffness", Tag.TAG_FLOAT)) {
this.setSuspensionStiffness(root.getFloat("SuspensionStiffness"));
}
if (root.contains("suspensionAdjust", Tag.TAG_COMPOUND)) {
CompoundTag sus = root.getCompound("suspensionAdjust");
this.setSuspensionAdjust(new Vector3d(sus.getDouble("x"), sus.getDouble("y"), sus.getDouble("z")));
}
}
}

View File

@ -1,4 +1,4 @@
package space.eptaproject.vmodextras.item;
package space.eptaproject.vmodextras.trackwork.item;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
@ -22,7 +22,7 @@ public class ToolKit extends Item {
BlockPos pos = context.getClickedPos();
CompoundTag nbt = stack.getTag();
return InteractionResult.PASS;
} else {
return InteractionResult.PASS;
}

View File

@ -1,63 +1,21 @@
# This is an example mods.toml file. It contains the data relating to the loading mods.
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
# The overall format is standard TOML format, v0.5.0.
# Note that there are a couple of TOML lists in this file.
# Find more information on toml format here: https://github.com/toml-lang/toml
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader = "javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion = "${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
modLoader = "javafml"
loaderVersion = "${loader_version_range}"
license = "${mod_license}"
# A URL to refer people to when problems occur with this mod
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId = "${mod_id}" #mandatory
# The version number of the mod
version = "${mod_version}" #mandatory
# A display name for the mod
displayName = "${mod_name}" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
# A file name (in the root of the mod JAR) containing a logo for display
#logoFile="vmodaddon.png" #optional
# A text field displayed in the mod UI
#credits="Thanks for this example mod goes to Java" #optional
# A text field displayed in the mod UI
authors = "${mod_authors}" #optional
# Display Test controls the display for your mod in the server connection screen
# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod.
# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod.
# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component.
# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value.
# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself.
#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional)
# The description text for the mod (multi line!) (#mandatory)
[[mods]]
modId = "${mod_id}"
version = "${mod_version}"
displayName = "${mod_name}"
authors = "${mod_authors}"
description = '''${mod_description}'''
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies."${mod_id}"]] #optional
# the modid of the dependency
modId = "forge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified
mandatory = true #mandatory
# The version range of the dependency
versionRange = "${forge_version_range}" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory
# BEFORE - This mod is loaded BEFORE the dependency
# AFTER - This mod is loaded AFTER the dependency
[[dependencies."${mod_id}"]]
modId = "forge"
mandatory = true
versionRange = "${forge_version_range}"
ordering = "NONE"
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
side = "SERVER"# Here's another dependency
side = "SERVER"
[[dependencies."${mod_id}"]]
modId = "minecraft"
mandatory = true
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange = "${minecraft_version_range}"
ordering = "NONE"
side = "BOTH"

View File

@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "vmodextras:block/track_backup" }
}
}

View File

@ -0,0 +1,4 @@
{
"block.vmodextras.track_backup": "Track Backup",
"block.vmodextras.ship_void": "Ship Void"
}

View File

@ -2,8 +2,8 @@
"credit": "Made with Blockbench",
"texture_size": [64, 64],
"textures": {
"1": "vmodaddon:block/track_b",
"particle": "vmodaddon:block/track_b"
"1": "vmodextras:block/track_backup",
"particle": "vmodextras:block/track_backup"
},
"elements": [
{

View File

@ -2,8 +2,8 @@
"credit": "Made with Blockbench",
"texture_size": [64, 64],
"textures": {
"1": "vmodaddon:block/track_b",
"particle": "vmodaddon:block/track_b"
"1": "vmodextras:block/track_backup",
"particle": "vmodextras:block/track_backup"
},
"elements": [
{

View File

Before

Width:  |  Height:  |  Size: 434 B

After

Width:  |  Height:  |  Size: 434 B

View File

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "vmodaddon:block/track_b" }
}
}

View File

@ -1,4 +0,0 @@
{
"block.vmodaddon.track_b": "Track Backup",
"block.vmodaddon.ship_void": "Ship Void"
}

View File

@ -5,8 +5,13 @@
"friction": 0.0
},
{
"block": "vmodextras:track_b",
"mass": 40.0,
"block": "vmodextras:track_backup",
"mass": 120.0,
"friction": 0.0
},
{
"block": "vmodextras:compact_backup",
"mass": 120.0,
"friction": 0.0
}
]

View File

@ -3,7 +3,7 @@
"minVersion": "0.8",
"package": "space.eptaproject.vmodextras.mixins",
"compatibilityLevel": "JAVA_8",
"refmap": "vmodaddon.refmap.json",
"refmap": "vmodextras.refmap.json",
"mixins": [
],
"client": [