Skip to content

Commit

Permalink
port 1.15.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeronimo97 committed Feb 11, 2024
1 parent f536440 commit 2197bcd
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 31 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up JDK 17
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '8'
distribution: 'adopt'
- name: Change wrapper permissions
run: chmod +x ./gradlew
Expand All @@ -37,10 +37,10 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up JDK 17
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '8'
distribution: 'adopt'
- name: Change wrapper permissions
run: chmod +x ./gradlew
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ modrinth {
projectId = 'rMlghquR'
versionNumber = ver
versionType = 'release'
versionName = 'TC-Redstone-1.16.5-Fabric'
versionName = 'TC-Redstone-1.15.2-Fabric'
uploadFile = remapJar
gameVersions = ['1.16.5']
loaders = ['fabric']
Expand All @@ -67,11 +67,11 @@ task publishToModSites {
}

dependencies {
minecraft "com.mojang:minecraft:1.16.5"
mappings "net.fabricmc:yarn:1.16.5+build.10:v2"
minecraft "com.mojang:minecraft:1.15.2"
mappings "net.fabricmc:yarn:1.15.2+build.17:v2"
modImplementation "net.fabricmc:fabric-loader:0.15.6"

modImplementation "net.fabricmc.fabric-api:fabric-api:0.42.0+1.16"
modImplementation "net.fabricmc.fabric-api:fabric-api:0.28.5+1.15"
}

processResources {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtHelper;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
Expand All @@ -25,7 +25,7 @@ public TypedActionResult<ItemStack> use(final World level, final PlayerEntity pl
final ItemStack itemstack = player.getStackInHand(hand);
if (!hand.equals(Hand.MAIN_HAND) || level.isClient())
return TypedActionResult.pass(itemstack);
final NbtCompound comp = itemstack.getTag();
final CompoundTag comp = itemstack.getTag();
final BlockPos linkpos = NbtHelper.toBlockPos(comp);
final boolean state = TileRedstoneEmitter.redstoneUpdate(linkpos, level);
message(player, "ra.state", String.valueOf(state));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

Expand All @@ -22,7 +22,7 @@ public TileRedstoneEmitter() {
private static final String ID_Y = "yLinkedPos";
private static final String ID_Z = "zLinkedPos";

public static NbtCompound writeBlockPosToNBT(final BlockPos pos, final NbtCompound compound) {
public static CompoundTag writeBlockPosToNBT(final BlockPos pos, final CompoundTag compound) {
if (pos != null && compound != null) {
compound.putInt(ID_X, pos.getX());
compound.putInt(ID_Y, pos.getY());
Expand All @@ -31,7 +31,7 @@ public static NbtCompound writeBlockPosToNBT(final BlockPos pos, final NbtCompou
return compound;
}

public static BlockPos readBlockPosFromNBT(final NbtCompound compound) {
public static BlockPos readBlockPosFromNBT(final CompoundTag compound) {
if (compound != null && compound.contains(ID_X) && compound.contains(ID_Y)
&& compound.contains(ID_Z)) {
return new BlockPos(compound.getInt(ID_X), compound.getInt(ID_Y),
Expand All @@ -41,14 +41,14 @@ public static BlockPos readBlockPosFromNBT(final NbtCompound compound) {
}

@Override
public void fromTag(BlockState state, NbtCompound tag) {
super.fromTag(state, tag);
public void fromTag(CompoundTag tag) {
super.fromTag(tag);
this.linkedpos = readBlockPosFromNBT(tag);
}

@Override
public NbtCompound writeNbt(final NbtCompound compound) {
super.writeNbt(compound);
public CompoundTag toTag(final CompoundTag compound) {
super.toTag(compound);
return writeBlockPosToNBT(linkedpos, compound);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtHelper;
import net.minecraft.nbt.NbtList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

Expand All @@ -25,12 +25,12 @@ public TileRedstoneMultiEmitter() {
super(TCInit.MULTI_EMITER_TILE);
}

public NbtCompound writeBlockPosToNBT(final List<BlockPos> pos, final NbtCompound compound) {
public CompoundTag writeBlockPosToNBT(final List<BlockPos> pos, final CompoundTag compound) {
if (pos != null && compound != null) {

final NbtList list = new NbtList();
final ListTag list = new ListTag();
listOfPositions.forEach(blockpos -> {
final NbtCompound item = NbtHelper.fromBlockPos(blockpos);
final CompoundTag item = NbtHelper.fromBlockPos(blockpos);
list.add(item);
});
compound.put(LINKED_POS_LIST, list);
Expand All @@ -40,12 +40,12 @@ public NbtCompound writeBlockPosToNBT(final List<BlockPos> pos, final NbtCompoun
return compound;
}

public List<BlockPos> readBlockPosFromNBT(final NbtCompound compound) {
final NbtList list = (NbtList) compound.get(LINKED_POS_LIST);
public List<BlockPos> readBlockPosFromNBT(final CompoundTag compound) {
final ListTag list = (ListTag) compound.get(LINKED_POS_LIST);
if (list != null) {
listOfPositions.clear();
list.forEach(pos -> {
final NbtCompound item = (NbtCompound) pos;
final CompoundTag item = (CompoundTag) pos;
listOfPositions.add(NbtHelper.toBlockPos(item));
});
return listOfPositions;
Expand Down Expand Up @@ -80,14 +80,14 @@ public List<BlockPos> getLinkedPos() {
}

@Override
public void fromTag(BlockState state, NbtCompound tag) {
super.fromTag(state, tag);
public void fromTag(CompoundTag tag) {
super.fromTag(tag);
this.listOfPositions = readBlockPosFromNBT(tag);
}

@Override
public NbtCompound writeNbt(final NbtCompound compound) {
super.writeNbt(compound);
public CompoundTag toTag(final CompoundTag compound) {
super.toTag(compound);
return writeBlockPosToNBT(listOfPositions, compound);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"depends": {
"fabricloader": ">=0.15.0",
"minecraft": "~1.16.5",
"minecraft": "~1.15.2",
"java": ">=8"
},
"suggests": {
Expand Down

0 comments on commit 2197bcd

Please sign in to comment.