Skip to content

Commit

Permalink
Merge pull request #73 from sakura-ryoko/multiversion
Browse files Browse the repository at this point in the history
1.20.6 & 1.21.0 branches update
  • Loading branch information
aria1th authored Jun 1, 2024
2 parents d26d9fb + 53b29f5 commit d3290e8
Show file tree
Hide file tree
Showing 27 changed files with 4,188 additions and 175 deletions.
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ preprocess {
def mc1201 = createNode('1.20.1', 1_20_01, 'yarn')
def mc1202 = createNode('1.20.2', 1_20_02, 'yarn')
def mc1204 = createNode('1.20.4', 1_20_04, 'yarn')
def mc1205 = createNode('1.20.5', 1_20_05, 'yarn')
def mc1206 = createNode('1.20.6', 1_20_06, 'yarn')
def mc1210 = createNode('1.21.0', 1_21_00, 'yarn')

// mapping difference map
// base 1194 -> 1193 -> 1192 ->1190-> 118 -> 117 -> 116
mc1202.link(mc1201, file('versions/mapping-1.20.2-1.20.1.txt'))
mc1201.link(mc1194, file('versions/mapping-1.20.1-1.19.4.txt'))
mc1204.link(mc1202, file('versions/mapping-1.20.4-1.20.2.txt'))
mc1205.link(mc1204, file('versions/mapping-1.20.5-1.20.4.txt'))
mc1206.link(mc1204, file('versions/mapping-1.20.6-1.20.4.txt'))
mc1210.link(mc1206, file('versions/mapping-1.21.0-1.20.6.txt'))
//mc1194.link(mc1193, file('versions/mapping-1.19.4-1.19.3.txt'))
//mc1193.link(mc1192, file('versions/mapping-1.19.3-1.19.2.txt'))
//mc1192.link(mc1190, file('versions/mapping-1.19.2-1.19.0.txt'))
Expand Down
4 changes: 2 additions & 2 deletions common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ preprocess {
tabIndentation = true
}

if (mcVersion > 12004) {
if (mcVersion >= 12005) {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
Expand Down Expand Up @@ -99,7 +99,7 @@ tasks.withType(JavaCompile).configureEach {
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"

if (mcVersion > 12004) {
if (mcVersion >= 12005) {
it.options.release = 21
}
else if (mcVersion >= 11800) {
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed external/modmenu-v10.0.0-alpha.3+1.20.5.c36bdf3.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ org.gradle.jvmargs=-Xmx6G
# This is base gradle.properties file for all projects in the workspace.
# This must not contain specific configuration for any project, such as minecraft version, etc.
# Fabric Properties
loader_version=0.15.9
loader_version=0.15.11

# Mod Properties
mod_version = 7.2.0-beta.1
mod_version = 7.2.0
maven_group = aria1th.extensions
archives_base_name = litematica-printer
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def versions = Arrays.asList(
"1.20.1",
"1.20.2",
"1.20.4",
"1.20.5"
"1.20.6",
"1.21.0"
)

for (String version : versions) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
],

"depends": {
"fabricloader": ">=0.15.9",
"fabricloader": ">=0.15.10",
"fabric": "*",
"minecraft": "${minecraft_dependency}",
"litematica": "*"
},
"custom": {
"modmenu": {
"parent": "malilib"
"parent": "litematica"
}
}
}
16 changes: 0 additions & 16 deletions versions/1.20.5/gradle.properties

This file was deleted.

15 changes: 15 additions & 0 deletions versions/1.20.6/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.20.6
yarn_mappings=1.20.6+build.3
fabricapi_version=0.97.8+1.20.6
minecraft_version_out = 1.20.6

# Mod Properties
#malilib_projectid=303119
#malilib_fileid=4946328
#litematica_fileid=4946471
#litematica_projectid=308892
essentialclient_filename=essential-client-1.20.1-1.3.6.jar
malilib_filename=malilib-fabric-1.20.6-0.18.999-sakura.4.jar
litematica_filename=litematica-fabric-1.20.6-0.17.999-sakura.8.jar
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.Item;
import net.minecraft.util.math.BlockPos;
import org.joml.Matrix4f;
Expand All @@ -19,7 +18,7 @@

import java.util.Set;

import static io.github.eatmyvenom.litematicin.LitematicaMixinMod.RENDER_ONLY_HOLDING_ITEMS;
import io.github.eatmyvenom.litematicin.LitematicaMixinMod;
import static io.github.eatmyvenom.litematicin.utils.InventoryUtils.ITEMS;

@Mixin(value = ChunkRendererSchematicVbo.class, priority = 1200)
Expand All @@ -31,7 +30,7 @@ public class ChunkRendererSchematicVboMixin

@Inject(method = "renderBlocksAndOverlay", at = @At("HEAD"), cancellable = true, remap = false)
private void onRenderBlocksAndOverlay(BlockPos pos, ChunkRenderDataSchematic data, Set<BlockEntity> tileEntities, Set<RenderLayer> usedLayers, Matrix4f matrix4f, BufferBuilderCache buffers, CallbackInfo ci) {
if (!RENDER_ONLY_HOLDING_ITEMS.getBooleanValue()) return;
if (!LitematicaMixinMod.RENDER_ONLY_HOLDING_ITEMS.getBooleanValue()) return;
BlockState stateSchematic = this.schematicWorldView.getBlockState(pos);
Item item = stateSchematic.getBlock().asItem();
if (!ITEMS.contains(item)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package io.github.eatmyvenom.litematicin.mixin.Litematica;

import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.DownloadingTerrainScreen;
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult;
import io.github.eatmyvenom.litematicin.utils.*;


@Mixin(MinecraftClient.class)
public abstract class MinecraftClientMixin
{
@Shadow
public HitResult crosshairTarget;

@Shadow
@Nullable
public ClientWorld world;

@Shadow
@Nullable
public abstract ClientPlayNetworkHandler getNetworkHandler();

@Shadow
@Nullable
public ClientPlayerEntity player;

// On join a new world/server
@Inject(at = @At("HEAD"), method = "joinWorld")
public void joinWorld(ClientWorld world, DownloadingTerrainScreen.WorldEntryReason worldEntryReason, CallbackInfo ci) {
Printer.worldBottomY = world.getBottomY();
Printer.worldTopY = world.getTopY();
}

@Inject(at = @At("HEAD"), method = "tick")
public void onPrinterTickCount(CallbackInfo info) {
BedrockBreaker.tick();
InventoryUtils.tick();
FakeAccurateBlockPlacement.tick(this.getNetworkHandler(), this.player);
}

@Inject(at = @At("HEAD"), method = "doItemUse")
public void getIfBlockEntity(CallbackInfo info) {
if (crosshairTarget != null && crosshairTarget.getType() == HitResult.Type.BLOCK && (this.world != null ? this.world.getBlockEntity(((BlockHitResult) crosshairTarget).getBlockPos()) : null) != null) {
ItemInputs.clickedPos = ((BlockHitResult) crosshairTarget).getBlockPos();
} else {
ItemInputs.clickedPos = null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import net.minecraft.block.entity.LootableContainerBlockEntity;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.component.ComponentMap;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.ContainerComponent;
import net.minecraft.entity.player.PlayerInventory;
Expand All @@ -28,9 +27,6 @@
import java.util.*;
import java.util.function.Predicate;

import static io.github.eatmyvenom.litematicin.LitematicaMixinMod.*;
import static io.github.eatmyvenom.litematicin.utils.Printer.*;

public class InventoryUtils {
private static int ptr = -1;

Expand All @@ -52,13 +48,13 @@ public class InventoryUtils {

public static void tick() {
tickCount++;
if (RENDER_ONLY_HOLDING_ITEMS.getBooleanValue() && tickCount % 20 == 0) {
if (LitematicaMixinMod.RENDER_ONLY_HOLDING_ITEMS.getBooleanValue() && tickCount % 20 == 0) {
calculateCache();
}
if (INVENTORY_CACHE_TICKS.getIntegerValue() != 0 && tickCount - lastWorkedTick > INVENTORY_CACHE_TICKS.getIntegerValue()){
if (LitematicaMixinMod.INVENTORY_CACHE_TICKS.getIntegerValue() != 0 && tickCount - lastWorkedTick > LitematicaMixinMod.INVENTORY_CACHE_TICKS.getIntegerValue()){
clearCache();
}
if (!isSleeping && Configs.Generic.EASY_PLACE_MODE.getBooleanValue() && Configs.Generic.EASY_PLACE_HOLD_ENABLED.getBooleanValue() && Hotkeys.EASY_PLACE_ACTIVATION.getKeybind().isKeybindHeld()) {
if (!Printer.isSleeping && Configs.Generic.EASY_PLACE_MODE.getBooleanValue() && Configs.Generic.EASY_PLACE_HOLD_ENABLED.getBooleanValue() && Hotkeys.EASY_PLACE_ACTIVATION.getKeybind().isKeybindHeld()) {
for (int i = 0; i < 9; i++) {
if (!usedSlots.containsKey(i)) {
continue;
Expand Down Expand Up @@ -104,28 +100,14 @@ private static void calculateCache() {
BlockItem blockItem = (BlockItem) item;
if (blockItem.getBlock() instanceof ShulkerBoxBlock) {
int invSize = 27;
//NbtCompound compound = stack.getSubNbt("BlockEntityTag");
//if (compound == null) {
//continue;
//}
DefaultedList<ItemStack> returnStacks = DefaultedList.ofSize(invSize, ItemStack.EMPTY);

ComponentMap data = stack.getComponents();
if (data != null && data.contains(DataComponentTypes.CONTAINER))
{
ContainerComponent container = data.get(DataComponentTypes.CONTAINER);
//if (compound.contains("Items")) {
//Inventories.readNbt(compound, returnStacks, client.player.getRegistryManager());
//}
if (container != null) {
container.copyTo(returnStacks);
for (ItemStack returnStack : returnStacks)
{
Item returnItem = returnStack.getItem();
if (returnItem != null)
{
ITEMS.add(returnItem);
}
ContainerComponent container = stack.getComponents().get(DataComponentTypes.CONTAINER);
if (container != null) {
container.copyTo(returnStacks);
for (ItemStack returnStack : returnStacks) {
Item returnItem = returnStack.getItem();
if (returnItem != null) {
ITEMS.add(returnItem);
}
}
}
Expand Down Expand Up @@ -247,7 +229,7 @@ private static boolean exceptToolItems(ItemStack a, ItemStack b) {
return a.getItem() == b.getItem();
}
boolean isItemEqual = ItemStack.areItemsEqual(a, b);
boolean nbtCondition = PRINTER_IGNORE_NBT.getBooleanValue() || ItemStack.areItemsAndComponentsEqual(a, b);
boolean nbtCondition = LitematicaMixinMod.PRINTER_IGNORE_NBT.getBooleanValue() || ItemStack.areItemsAndComponentsEqual(a, b);
return isItemEqual && nbtCondition;
}

Expand All @@ -258,20 +240,20 @@ public static boolean areItemsExactCount(ItemStack a, ItemStack b, boolean allow
if (allowNamed) {
return areItemsExactAllowNamed(a, b);
}
boolean nbtCondition = PRINTER_IGNORE_NBT.getBooleanValue() || ItemStack.areItemsAndComponentsEqual(a, b);
boolean nbtCondition = LitematicaMixinMod.PRINTER_IGNORE_NBT.getBooleanValue() || ItemStack.areItemsAndComponentsEqual(a, b);
return ItemStack.areItemsEqual(a, b) && nbtCondition;
}

public static ItemStack getStackForState(MinecraftClient client, BlockState state, World world, BlockPos pos) {
// if state is nether portal block, return FLINT_AND_STEEL
if (state.isOf(Blocks.NETHER_PORTAL)) {
if (!PRINTER_LIT_PORTAL_USE_FIRECHARGE.getBooleanValue()) return Items.FLINT_AND_STEEL.getDefaultStack();
if (!LitematicaMixinMod.PRINTER_LIT_PORTAL_USE_FIRECHARGE.getBooleanValue()) return Items.FLINT_AND_STEEL.getDefaultStack();
else {
return Items.FIRE_CHARGE.getDefaultStack();
}
}
ItemStack stack = isReplaceableWaterFluidSource(state) && PRINTER_PLACE_ICE.getBooleanValue() ? Items.ICE.getDefaultStack() : MaterialCache.getInstance().getRequiredBuildItemForState(state, world, pos);
if (PRINTER_PRINT_DIRT_VARIANTS.getBooleanValue() && !canPickItem(client, stack)) {
ItemStack stack = Printer.isReplaceableWaterFluidSource(state) && LitematicaMixinMod.PRINTER_PLACE_ICE.getBooleanValue() ? Items.ICE.getDefaultStack() : MaterialCache.getInstance().getRequiredBuildItemForState(state, world, pos);
if (LitematicaMixinMod.PRINTER_PRINT_DIRT_VARIANTS.getBooleanValue() && !Printer.canPickItem(client, stack)) {
if (state.isOf(Blocks.FARMLAND)) stack = Items.DIRT.getDefaultStack();
else if (state.isOf(Blocks.DIRT_PATH)) stack = Items.DIRT.getDefaultStack();
}
Expand Down Expand Up @@ -436,7 +418,7 @@ public static int getSlotWIthStackIgnoreNbt(PlayerInventory inv, ItemStack stack
if (defaultSlot != -1) {
return defaultSlot;
}
if (!PRINTER_IGNORE_NBT.getBooleanValue()) {
if (!LitematicaMixinMod.PRINTER_IGNORE_NBT.getBooleanValue()) {
return defaultSlot;
}
for (int i = 0; i < inv.main.size(); i++) {
Expand Down
Loading

0 comments on commit d3290e8

Please sign in to comment.