Skip to content

Commit

Permalink
Update for 1.18.1 (#157) - jhbuchanan45
Browse files Browse the repository at this point in the history
* Update to 1.18.1

* Optional config support for backpacks in trinkets mod back slot

* Make tent blocks resistance equal obsidian's

* Add new item textures and PT-BR translations by ppblitto

* Update workflows for jdk 17
  • Loading branch information
jhbuchanan45 authored Jan 12, 2022
1 parent 890e84f commit 8aca292
Show file tree
Hide file tree
Showing 67 changed files with 517 additions and 91 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
matrix:
# Use these Java versions
java: [
16, # Minimum
17, # Minimum
]
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
Expand All @@ -33,7 +33,7 @@ jobs:
- name: Build
run: ./gradlew build --stacktrace --parallel
- name: Capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '11' }} # Only upload artifacts built from LTS java on one OS
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from LTS java on one OS
uses: actions/upload-artifact@v2
with:
name: Artifacts
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
# Use these Java versions
java: [16]
java: [17]
# and run on both Linux and Windows
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
DISCORD_ANNOUNCEMENT_WEBHOOK: ${{ secrets.DISCORD_ANNOUNCEMENT_WEBHOOK }}
- name: Capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '11' }} # Only upload artifacts built from LTS java on one OS
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from LTS java on one OS
uses: actions/upload-artifact@v2
with:
name: Artifacts
Expand Down
9 changes: 7 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
plugins {
id 'fabric-loom' version '0.9.9'
id 'fabric-loom' version '0.10-SNAPSHOT'
}

apply from: 'https://raw.githubusercontent.com/TerraformersMC/GradleScripts/2.1/ferry.gradle'

repositories {
// mavenLocal()
// mavenLocal()
maven {
url "https://maven.jamieswhiteshirt.com/libs-release"
content {
includeGroup "com.jamieswhiteshirt"
}
}
maven {
name = "Ladysnake Libs"
url = "https://ladysnake.jfrog.io/artifactory/mods"
}
}

dependencies {
Expand All @@ -22,6 +26,7 @@ dependencies {
modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")
modImplementation("com.terraformersmc:dossier:${project.dossier_version}")
// modNotTransitive("gravestones", "net.guavy:Gravestones:${project.gravestones_version}")
modImplementation "dev.emi:trinkets:${trinkets_version}"

include modImplementation("com.jamieswhiteshirt:reach-entity-attributes:${project.reach_entity_attributes_version}")
}
Expand Down
17 changes: 9 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,34 @@ org.gradle.jvmargs=-Xmx1G
maven_group=com.terraformersmc
archive_name=campanion

minecraft_version=1.17.1
yarn_mappings=1.17.1+build.59
loader_version=0.11.6
fabric_version=0.37.0+1.17
dossier_version=0.4.0
minecraft_version=1.18.1
yarn_mappings=1.18.1+build.3
loader_version=0.12.11
fabric_version=0.44.0+1.18
dossier_version=0.5.0
reach_entity_attributes_version=2.1.1
#gravestones_version=v1.9
trinkets_version=3.1.0

# Project Metadata
project_name=Campanion
project_url=https://www.curseforge.com/minecraft/mc-mods/campanion
project_logo=https://i.imgur.com/Zm7PbHh.png
project_color=0xf5841f
# default_release_type can be stable, beta, or alpha
default_release_type=stable
default_release_type=alpha

# CurseForge Metadata
curseforge_slug=campanion
curseforge_id=373138
curseforge_game_versions=1.17.1, Fabric
curseforge_game_versions=1.18.1, Fabric
curseforge_required_dependencies=fabric-api
curseforge_optional_dependencies=

# Modrinth Metadata
modrinth_slug=campanion
modrinth_id=Y2Rds0HS
modrinth_game_versions=1.17.1
modrinth_game_versions=1.18.1
modrinth_mod_loaders=fabric

# Mod Loader Metadata
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity pl
tag.put("BlockState", NbtHelper.fromBlockState(world.getBlockState(off)));
BlockEntity entity = world.getBlockEntity(off);
if (entity != null) {
tag.put("BlockEntityData", entity.writeNbt(new NbtCompound()));
tag.put("BlockEntityData", entity.createNbt());
}
list.add(tag);
world.removeBlockEntity(off);//If we wan't block entities to drop items, remove this line
world.removeBlockEntity(off); // if we want block entities to drop items, remove this line
world.setBlockState(off, Blocks.AIR.getDefaultState(), 1 | 2 | 16);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public class CampanionBlocks {
public static final TentTopFlatBlock RED_FLAT_TENT_TOP = tentTopFlat(DyeColor.RED);
public static final TentTopFlatBlock BLACK_FLAT_TENT_TOP = tentTopFlat(DyeColor.BLACK);

public static final Block TENT_POLE = add("tent_pole", new TentPoleBlock(FabricBlockSettings.of(Material.WOOD).nonOpaque().hardness(-1F).sounds(BlockSoundGroup.WOOD)), (ItemGroup) null);
public static final Block TENT_POLE = add("tent_pole", new TentPoleBlock(FabricBlockSettings.of(Material.WOOD).nonOpaque().hardness(-1F).resistance(1200F).sounds(BlockSoundGroup.WOOD)), (ItemGroup) null);

public static final FlareBlock FLARE_BLOCK = add("flare_block", new FlareBlock(FabricBlockSettings.of(Material.TNT).lightLevel(14)), (ItemGroup) null);

Expand Down Expand Up @@ -157,19 +157,19 @@ public static void register() {
}

private static TentSideBlock tentSide(DyeColor color) {
return add(color.getName() + "_tent_side", new TentSideBlock(FabricBlockSettings.of(Material.WOOL).nonOpaque().hardness(1F).sounds(BlockSoundGroup.WOOL), color), (ItemGroup) null);
return add(color.getName() + "_tent_side", new TentSideBlock(FabricBlockSettings.of(Material.WOOL).nonOpaque().hardness(1F).resistance(1200F).sounds(BlockSoundGroup.WOOL), color), (ItemGroup) null);
}

private static TentTopBlock tentTop(DyeColor color) {
return add(color.getName() + "_tent_top", new TentTopBlock(FabricBlockSettings.of(Material.WOOL).nonOpaque().hardness(1F).sounds(BlockSoundGroup.WOOL), color), (ItemGroup) null);
return add(color.getName() + "_tent_top", new TentTopBlock(FabricBlockSettings.of(Material.WOOL).nonOpaque().hardness(1F).resistance(1200F).sounds(BlockSoundGroup.WOOL), color), (ItemGroup) null);
}

private static TentTopPoleBlock toppedTentPole(DyeColor color) {
return add(color.getName() + "_topped_tent_pole", new TentTopPoleBlock(FabricBlockSettings.of(Material.WOOL).nonOpaque().hardness(1F).sounds(BlockSoundGroup.WOOL), color), (ItemGroup) null);
return add(color.getName() + "_topped_tent_pole", new TentTopPoleBlock(FabricBlockSettings.of(Material.WOOL).nonOpaque().hardness(1F).resistance(1200F).sounds(BlockSoundGroup.WOOL), color), (ItemGroup) null);
}

private static TentTopFlatBlock tentTopFlat(DyeColor color) {
return add(color.getName() + "_flat_tent_top", new TentTopFlatBlock(FabricBlockSettings.of(Material.WOOL).nonOpaque().hardness(1F).sounds(BlockSoundGroup.WOOL), color), (ItemGroup) null);
return add(color.getName() + "_flat_tent_top", new TentTopFlatBlock(FabricBlockSettings.of(Material.WOOL).nonOpaque().hardness(1F).resistance(1200F).sounds(BlockSoundGroup.WOOL), color), (ItemGroup) null);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public FlareBlock(Settings settings) {

@Override
public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) {
world.getBlockTickScheduler().schedule(pos, this, new Random().nextInt(150) + 100);
world.createAndScheduleBlockTick(pos, this, new Random().nextInt(150) + 100);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private void scheduleRemoved(World world, BlockPos pos) {
}

for (BlockPos neighbour : neighbours) {
world.getBlockTickScheduler().schedule(neighbour, world.getBlockState(neighbour).getBlock(), 1);
world.createAndScheduleBlockTick(neighbour, world.getBlockState(neighbour).getBlock(), 1);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

import com.terraformersmc.campanion.entity.CampanionEntities;
import com.terraformersmc.campanion.entity.LawnChairEntity;
import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;

import java.util.List;
import java.util.UUID;

public class LawnChairBlockEntity extends BlockEntity implements BlockEntityClientSerializable {
public class LawnChairBlockEntity extends SerializableBlockEntity {

private UUID entityUUID = UUID.randomUUID();

Expand Down Expand Up @@ -40,25 +38,21 @@ public LawnChairEntity findOrCreateEntity() {
}

@Override
public NbtCompound writeNbt(NbtCompound tag) {
return super.writeNbt(this.toClientTag(tag));
public void fromTag(NbtCompound tag) {
this.entityUUID = tag.getUuid("EntityUUID");
this.cachedEntity = null;
}

@Override
public void readNbt(NbtCompound tag) {
this.fromClientTag(tag);
super.readNbt(tag);
public void toTag(NbtCompound tag) {
tag.putUuid("EntityUUID", this.entityUUID);
}

@Override
public void fromClientTag(NbtCompound tag) {
this.entityUUID = tag.getUuid("EntityUUID");
this.cachedEntity = null;
fromTag(tag);
}

@Override
public NbtCompound toClientTag(NbtCompound tag) {
tag.putUuid("EntityUUID", this.entityUUID);
return tag;
public void toClientTag(NbtCompound tag) {
toTag(tag);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

import com.terraformersmc.campanion.ropebridge.RopeBridge;
import com.terraformersmc.campanion.ropebridge.RopeBridgePlank;
import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
import net.fabricmc.fabric.api.renderer.v1.Renderer;
import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
import net.fabricmc.fabric.api.renderer.v1.mesh.MeshBuilder;
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.block.entity.FurnaceBlockEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
import net.minecraft.nbt.NbtList;
Expand All @@ -24,7 +22,7 @@
import java.util.Collections;
import java.util.List;

public class RopeBridgePlanksBlockEntity extends BlockEntity implements BlockEntityClientSerializable {
public class RopeBridgePlanksBlockEntity extends SerializableBlockEntity {

private final List<RopeBridgePlank> planks = new ArrayList<>();

Expand Down Expand Up @@ -150,32 +148,28 @@ public boolean forceRenderStopper() {
return false;
}

@Override
public void readNbt(NbtCompound tag) {
this.fromClientTag(tag);
super.readNbt(tag);

public void fromClientTag(NbtCompound tag) {
fromTag(tag);

assert this.world != null;
this.world.updateListeners(this.pos, this.getCachedState(), this.getCachedState(), 11);
}

@Override
public NbtCompound writeNbt(NbtCompound tag) {
return this.toClientTag(super.writeNbt(tag));
public void toClientTag(NbtCompound tag) {
toTag(tag);
}

@Override
public void fromClientTag(NbtCompound tag) {
this.planks.clear();
this.planks.addAll(this.getFrom(tag.getList("Planks", 10)));
this.clearPlankCache();

if (this.world != null && this.world.isClient) {
this.world.updateListeners(this.pos, this.getCachedState(), this.getCachedState(), 11);
}
public void toTag(NbtCompound tag) {
tag.put("Planks", writeTo(this.planks));
}

@Override
public NbtCompound toClientTag(NbtCompound tag) {
tag.put("Planks", writeTo(this.planks));
return tag;
public void fromTag(NbtCompound tag) {
this.planks.clear();
this.planks.addAll(this.getFrom(tag.getList("Planks", NbtElement.COMPOUND_TYPE)));
this.clearPlankCache();
}

protected List<RopeBridgePlank> getFrom(NbtList list) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public void fromClientTag(NbtCompound tag) {
}

@Override
public NbtCompound toClientTag(NbtCompound tag) {
tag = super.toClientTag(tag);
public void toClientTag(NbtCompound tag) {
super.toClientTag(tag);
NbtList list = new NbtList();
this.ghostPlanks.forEach((plankPos, pairs) -> {
NbtCompound nbt = new NbtCompound();
Expand All @@ -72,6 +72,5 @@ public NbtCompound toClientTag(NbtCompound tag) {
tag.put("GhostPlankMap", list);

tag.putLongArray("LinkedPositions", this.linkedPositions.stream().mapToLong(BlockPos::asLong).toArray());
return tag;
}
}
Loading

0 comments on commit 8aca292

Please sign in to comment.