diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 840509d..3c14e87 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,5 +1,5 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion -import java.util.* +import java.util.Properties plugins { `kotlin-dsl` @@ -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()) } diff --git a/buildSrc/src/main/kotlin/util.kt b/buildSrc/src/main/kotlin/util.kt index dda4d9f..0ac7ae0 100644 --- a/buildSrc/src/main/kotlin/util.kt +++ b/buildSrc/src/main/kotlin/util.kt @@ -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 } } diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts index d435832..3b12697 100644 --- a/forge/build.gradle.kts +++ b/forge/build.gradle.kts @@ -6,6 +6,7 @@ unimined.minecraft { minecraftForge { loader("forge_version"()) mixinConfig("createunlimited.mixins.json") + accessTransformer(file("run/accesstransformer.cfg")) } mappings { diff --git a/forge/run/accesstransformer.cfg b/forge/run/accesstransformer.cfg new file mode 100644 index 0000000..8af8eb8 --- /dev/null +++ b/forge/run/accesstransformer.cfg @@ -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 (Lnet/minecraft/client/gui/components/CommandSuggestions;IIILjava/util/List;Z)V diff --git a/src/main/java/dev/rdh/createunlimited/asm/mixin/glue/ContraptionMixin.java b/src/main/java/dev/rdh/createunlimited/asm/mixin/glue/ContraptionMixin.java new file mode 100644 index 0000000..6bdcfc1 --- /dev/null +++ b/src/main/java/dev/rdh/createunlimited/asm/mixin/glue/ContraptionMixin.java @@ -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; + } +} diff --git a/src/main/java/dev/rdh/createunlimited/asm/mixin/glue/SuperGlueSelectionHelperMixin.java b/src/main/java/dev/rdh/createunlimited/asm/mixin/glue/SuperGlueSelectionHelperMixin.java new file mode 100644 index 0000000..1a0c0fb --- /dev/null +++ b/src/main/java/dev/rdh/createunlimited/asm/mixin/glue/SuperGlueSelectionHelperMixin.java @@ -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 searchGlueGroup(Level level, BlockPos startPos, BlockPos endPos, boolean includeOther) { + if(endPos == null || startPos == null) { + return null; + } + + AABB bb = new AABB(startPos, endPos); + Set 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; + } +} diff --git a/src/main/resources/createunlimited.mixins.json b/src/main/resources/createunlimited.mixins.json index e5efba4..a17795d 100755 --- a/src/main/resources/createunlimited.mixins.json +++ b/src/main/resources/createunlimited.mixins.json @@ -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",