Skip to content

Commit

Permalink
this could work, if access transformers would work
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysdh540 committed Jul 28, 2024
1 parent e7476cb commit bf27dd0
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 15 deletions.
12 changes: 3 additions & 9 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import java.util.*
import java.util.Properties

plugins {
`kotlin-dsl`
Expand All @@ -20,20 +20,14 @@ repositories {

idea.module.setDownloadSources(true)

fun DependencyHandler.plugin(id: String, version: String) {
this.implementation(group = id, name = "$id.gradle.plugin", version = version)
}
fun DependencyHandler.plugin(id: String, version: String) =
implementation(group = id, name = "$id.gradle.plugin", version = version)

tasks.compileKotlin {
compilerOptions.languageVersion.set(KotlinVersion.KOTLIN_2_0)
kotlinOptions.jvmTarget = "17"
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

val gradleProperties = Properties().apply {
load(rootDir.parentFile.resolve("gradle.properties").inputStream())
}
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/util.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ val JAVA_HOME = System.getProperty("java.home") ?: error("JAVA_HOME not set")
fun Jar.clearSourcePaths() {
AbstractCopyTask::class.java.getDeclaredField("mainSpec").let {
it.isAccessible = true
val thing = it.get(this) as DefaultCopySpec
thing.sourcePaths.clear()
val spec = it.get(this) as DefaultCopySpec
spec.sourcePaths.clear()
it.isAccessible = false
}
}
Expand Down
1 change: 1 addition & 0 deletions forge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ unimined.minecraft {
minecraftForge {
loader("forge_version"())
mixinConfig("createunlimited.mixins.json")
accessTransformer(file("run/accesstransformer.cfg"))
}

mappings {
Expand Down
44 changes: 44 additions & 0 deletions forge/run/accesstransformer.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
public net.minecraft.client.Minecraft pausePartialTick
public net.minecraft.client.gui.Font getFontSet(Lnet/minecraft/resources/ResourceLocation;)Lnet/minecraft/client/gui/font/FontSet;
public net.minecraft.client.gui.screens.TitleScreen panorama
public net.minecraft.client.multiplayer.ClientPacketListener serverChunkRadius
protected net.minecraft.client.particle.Particle stoppedByCollision
public net.minecraft.client.renderer.ItemInHandRenderer mainHandItem
public net.minecraft.client.renderer.ItemInHandRenderer offHandItem
public net.minecraft.client.renderer.entity.ItemRenderer textureManager

public-f net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket flyingSpeed

public net.minecraft.server.MinecraftServer storageSource
public net.minecraft.server.network.ServerGamePacketListenerImpl aboveGroundTickCount
public net.minecraft.server.network.ServerGamePacketListenerImpl aboveGroundVehicleTickCount

public net.minecraft.world.entity.Entity removalReason
protected net.minecraft.world.entity.Entity positionRider(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/entity/Entity$MoveFunction;)V
public net.minecraft.world.entity.LivingEntity jumping

public-f net.minecraft.world.item.HoneycombItem WAXABLES
public net.minecraft.world.item.alchemy.PotionBrewing POTION_MIXES
public net.minecraft.world.item.alchemy.PotionBrewing CONTAINER_MIXES
public net.minecraft.world.item.alchemy.PotionBrewing ALLOWED_CONTAINER
public net.minecraft.world.item.crafting.Ingredient values
public net.minecraft.world.item.crafting.RecipeManager recipes

public net.minecraft.world.level.BaseSpawner spawnPotentials
public net.minecraft.world.level.BaseSpawner nextSpawnData
public net.minecraft.world.level.biome.BiomeManager biomeZoomSeed
public net.minecraft.world.level.block.entity.BeaconBlockEntity beamSections
public net.minecraft.world.level.chunk.HashMapPalette values
public net.minecraft.world.level.chunk PaletteResize

public net.minecraft.client.model.geom.ModelPart cubes
public net.minecraft.client.model.geom.ModelPart children
public net.minecraft.client.model.AgeableListModel scaleHead
public net.minecraft.client.model.AgeableListModel babyYHeadOffset
public net.minecraft.client.model.AgeableListModel babyZHeadOffset
public net.minecraft.client.model.AgeableListModel babyHeadScale
public net.minecraft.client.model.AgeableListModel babyBodyScale
public net.minecraft.client.model.AgeableListModel bodyYOffset

public net.minecraft.client.gui.components.CommandSuggestions suggestions
public net.minecraft.client.gui.components.CommandSuggestions$SuggestionsList <init>(Lnet/minecraft/client/gui/components/CommandSuggestions;IIILjava/util/List;Z)V
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package dev.rdh.createunlimited.asm.mixin.glue;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

import com.simibubi.create.content.contraptions.Contraption;

@Mixin(Contraption.class)
public abstract class ContraptionMixin {
@ModifyExpressionValue(method = "moveBlock", at = @At(value = "INVOKE", target = "Lcom/simibubi/create/content/contraptions/glue/SuperGlueEntity;isGlued(Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Direction;Ljava/util/Set;)Z"))
private boolean a(boolean original) {
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package dev.rdh.createunlimited.asm.mixin.glue;


import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;

import com.simibubi.create.content.contraptions.glue.SuperGlueEntity;
import com.simibubi.create.content.contraptions.glue.SuperGlueSelectionHelper;

import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.phys.AABB;

import java.util.Set;

@Mixin(SuperGlueSelectionHelper.class)
public abstract class SuperGlueSelectionHelperMixin {
/**
* @author rdh
* @reason test
*/
@Overwrite
public static Set<BlockPos> searchGlueGroup(Level level, BlockPos startPos, BlockPos endPos, boolean includeOther) {
if(endPos == null || startPos == null) {
return null;
}

AABB bb = new AABB(startPos, endPos);
Set<BlockPos> blocks = new ObjectOpenHashSet<>();
for(double posx = bb.minX; posx <= bb.maxX; posx++) {
for(double posy = bb.minY; posy <= bb.maxY; posy++) {
for(double posz = bb.minZ; posz <= bb.maxZ; posz++) {
BlockPos pos = new BlockPos(posx, posy, posz);
Block block = level.getBlockState(pos).getBlock();

if(block != Blocks.AIR && block != Blocks.WATER) {
blocks.add(pos);
}
}
}
}

return blocks;
}
}
17 changes: 13 additions & 4 deletions src/main/resources/createunlimited.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@
"plugin": "dev.rdh.createunlimited.asm.CUMixinConfig",
"compatibilityLevel": "JAVA_17",
"mixins": [
"CopycatBlockMixin", "ExtendoGripItemMixin", "accessor.CValueAccessor", "glue.SuperGlueSelectionHelperMixin",
"glue.SuperGlueSelectionPacketMixin", "train.CarriageContraptionMixin", "train.CTrainsMixin",
"train.StationBlockEntityMixin", "train.TrackEdgeMixin", "train.TrackPlacementMixin",
"train.TrackTargetingBlockItemMixin", "train.TrainMixin"
"CopycatBlockMixin",
"ExtendoGripItemMixin",
"accessor.CValueAccessor",
"glue.SuperGlueSelectionHelperMixin",
"glue.SuperGlueSelectionPacketMixin",
"glue.ContraptionMixin",
"train.CarriageContraptionMixin",
"train.CTrainsMixin",
"train.StationBlockEntityMixin",
"train.TrackEdgeMixin",
"train.TrackPlacementMixin",
"train.TrackTargetingBlockItemMixin",
"train.TrainMixin"
],
"client": [
"glue.SuperGlueSectionHandlerMixin",
Expand Down

0 comments on commit bf27dd0

Please sign in to comment.