Skip to content

Commit

Permalink
feat: ✨ Add copper backpack with more inventory slots but still only …
Browse files Browse the repository at this point in the history
…1 upgrade slot
  • Loading branch information
P3pp3rF1y committed Feb 5, 2024
1 parent b0786f7 commit a45a958
Show file tree
Hide file tree
Showing 30 changed files with 244 additions and 59 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.daemon=false

mod_id=sophisticatedbackpacks
mod_group_id=sophisticatedbackpacks
mod_version=3.19.8
mod_version=3.20.0
sonar_project_key=sophisticatedbackpacks:SophisticatedBackpacks
github_package_url=https://maven.pkg.github.com/P3pp3rF1y/SophisticatedBackpacks

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_backpack": {
"conditions": {
"items": [
{
"items": [
"sophisticatedbackpacks:backpack"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "sophisticatedbackpacks:copper_backpack"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_backpack",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"sophisticatedbackpacks:copper_backpack"
]
},
"sends_telemetry_event": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_copper_backpack": {
"conditions": {
"items": [
{
"items": [
"sophisticatedbackpacks:copper_backpack"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "sophisticatedbackpacks:iron_backpack_from_copper"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_copper_backpack",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"sophisticatedbackpacks:iron_backpack_from_copper"
]
},
"sends_telemetry_event": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "sophisticatedbackpacks:copper_backpack"
}
],
"functions": [
{
"function": "sophisticatedbackpacks:copy_backpack_data"
}
],
"name": "main",
"rolls": 1.0
}
],
"random_sequence": "sophisticatedbackpacks:blocks/copper_backpack"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
{
"type": "minecraft:item",
"name": "sophisticatedbackpacks:backpack",
"weight": 7
},
{
"type": "minecraft:item",
"name": "sophisticatedbackpacks:copper_backpack",
"weight": 5
},
{
Expand All @@ -25,7 +30,7 @@
},
{
"type": "minecraft:empty",
"weight": 89
"weight": 84
}
],
"name": "main",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"entries": [
{
"type": "minecraft:item",
"name": "sophisticatedbackpacks:backpack",
"name": "sophisticatedbackpacks:copper_backpack",
"weight": 5
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
{
"type": "minecraft:item",
"name": "sophisticatedbackpacks:backpack",
"weight": 4
"weight": 5
},
{
"type": "minecraft:item",
"name": "sophisticatedbackpacks:iron_backpack",
"weight": 2
"name": "sophisticatedbackpacks:copper_backpack",
"weight": 3
},
{
"type": "minecraft:item",
Expand All @@ -21,7 +21,7 @@
},
{
"type": "minecraft:empty",
"weight": 92
"weight": 90
}
],
"name": "main",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"type": "sophisticatedbackpacks:backpack_upgrade",
"conditions": [
{
"type": "sophisticatedcore:item_enabled",
"itemRegistryName": "sophisticatedbackpacks:copper_backpack"
}
],
"key": {
"B": {
"item": "sophisticatedbackpacks:backpack"
},
"C": {
"tag": "forge:ingots/copper"
}
},
"pattern": [
"CCC",
"CBC",
"CCC"
],
"result": {
"item": "sophisticatedbackpacks:copper_backpack"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"type": "sophisticatedbackpacks:backpack_upgrade",
"conditions": [
{
"type": "sophisticatedcore:item_enabled",
"itemRegistryName": "sophisticatedbackpacks:iron_backpack"
}
],
"key": {
"B": {
"item": "sophisticatedbackpacks:copper_backpack"
},
"I": {
"tag": "forge:ingots/iron"
}
},
"pattern": [
" I ",
"IBI",
" I "
],
"result": {
"item": "sophisticatedbackpacks:iron_backpack"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public static class Server {
public final NoInteractionBlocks noInteractionBlocks;
public final NoConnectionBlocks noConnectionBlocks;
public final BackpackConfig leatherBackpack;
public final BackpackConfig copperBackpack;
public final BackpackConfig ironBackpack;
public final BackpackConfig goldBackpack;
public final BackpackConfig diamondBackpack;
Expand Down Expand Up @@ -136,6 +137,7 @@ private void clearCache() {
noConnectionBlocks = new NoConnectionBlocks(builder);

leatherBackpack = new BackpackConfig(builder, "Leather", 27, 1);
copperBackpack = new BackpackConfig(builder, "Copper", 45, 1);
ironBackpack = new BackpackConfig(builder, "Iron", 54, 2);
goldBackpack = new BackpackConfig(builder, "Gold", 81, 3);
diamondBackpack = new BackpackConfig(builder, "Diamond", 108, 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@
import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks;
import net.p3pp3rf1y.sophisticatedbackpacks.client.init.ModBlockColors;
import net.p3pp3rf1y.sophisticatedbackpacks.client.init.ModItemColors;
import net.p3pp3rf1y.sophisticatedbackpacks.client.render.BackpackBlockEntityRenderer;
import net.p3pp3rf1y.sophisticatedbackpacks.client.render.BackpackDynamicModel;
import net.p3pp3rf1y.sophisticatedbackpacks.client.render.BackpackLayerRenderer;
import net.p3pp3rf1y.sophisticatedbackpacks.client.render.BackpackModel;
import net.p3pp3rf1y.sophisticatedbackpacks.client.render.ClientBackpackContentsTooltip;
import net.p3pp3rf1y.sophisticatedbackpacks.client.render.*;
import net.p3pp3rf1y.sophisticatedbackpacks.init.ModBlocks;
import net.p3pp3rf1y.sophisticatedbackpacks.network.BlockPickMessage;
import net.p3pp3rf1y.sophisticatedbackpacks.network.SBPPacketHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static void registerBlockColorHandlers(RegisterColorHandlersEvent.Block e
return WorldHelper.getBlockEntity(blockDisplayReader, pos, BackpackBlockEntity.class)
.map(te -> tintIndex == 0 ? te.getBackpackWrapper().getMainColor() : te.getBackpackWrapper().getAccentColor())
.orElse(getDefaultColor(tintIndex));
}, BACKPACK.get(), IRON_BACKPACK.get(), GOLD_BACKPACK.get(), DIAMOND_BACKPACK.get(), NETHERITE_BACKPACK.get());
}, BACKPACK.get(), COPPER_BACKPACK.get(), IRON_BACKPACK.get(), GOLD_BACKPACK.get(), DIAMOND_BACKPACK.get(), NETHERITE_BACKPACK.get());
}

private static int getDefaultColor(int tintIndex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public static void registerItemColorHandlers(RegisterColorHandlersEvent.Item eve
}
return -1;
}).orElse(BackpackWrapper.DEFAULT_CLOTH_COLOR);
}, BACKPACK.get(), IRON_BACKPACK.get(), GOLD_BACKPACK.get(), DIAMOND_BACKPACK.get(), NETHERITE_BACKPACK.get());
}, BACKPACK.get(), COPPER_BACKPACK.get(), IRON_BACKPACK.get(), GOLD_BACKPACK.get(), DIAMOND_BACKPACK.get(), NETHERITE_BACKPACK.get());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.texture.OverlayTexture;
Expand All @@ -38,13 +34,7 @@
import net.p3pp3rf1y.sophisticatedcore.upgrades.IRenderedTankUpgrade;

import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.*;

public class BackpackModel extends AgeableListModel<LivingEntity> implements IBackpackModel {
private static final Map<EntityType<?>, Vec3> entityTranslations;
Expand Down Expand Up @@ -240,25 +230,25 @@ public static LayerDefinition createBodyLayer() {
);

partDefinition.addOrReplaceChild(FABRIC_FRONT_PART, CubeListBuilder.create()
.texOffs(0, 55).addBox(-0.75F, 3.0F, 1.0F, 8.0F, 1.0F, 2.0F, true)
.texOffs(12, 58).addBox(-0.75F, 3.0F, 1.0F, 8.0F, 1.0F, 2.0F, true)
, PartPose.offset(-3.25F, 16.0F, -6.0F)
);
partDefinition.addOrReplaceChild(FABRIC_RIGHT_PART, CubeListBuilder.create()
.texOffs(32, 49).addBox(8.25F, -2.0F, 3.5F, 1.0F, 1.0F, 5.0F, true)
.texOffs(8, 45).addBox(8.25F, 3.0F, 3.5F, 2.0F, 1.0F, 5.0F, true)
.texOffs(8, 48).addBox(8.25F, 3.0F, 3.5F, 2.0F, 1.0F, 5.0F, true)
, PartPose.offset(-3.25F, 16.0F, -6.0F)
);
partDefinition.addOrReplaceChild(FABRIC_LEFT_PART, CubeListBuilder.create()
.texOffs(32, 49).addBox(-2.75F, -2.0F, 3.5F, 1.0F, 1.0F, 5.0F)
.texOffs(8, 45).addBox(-3.75F, 3.0F, 3.5F, 2.0F, 1.0F, 5.0F)
.texOffs(8, 48).addBox(-3.75F, 3.0F, 3.5F, 2.0F, 1.0F, 5.0F)
, PartPose.offset(-3.25F, 16.0F, -6.0F)
);
partDefinition.addOrReplaceChild(FABRIC_PART, CubeListBuilder.create()
.texOffs(54, 0).addBox(1.25F, -4.75F, 5.75F, 1.0F, 1.0F, 1.0F)
.texOffs(58, 0).addBox(4.25F, -4.75F, 5.75F, 1.0F, 1.0F, 1.0F)
.texOffs(44, 0).addBox(1.25F, -5.75F, 5.75F, 4.0F, 1.0F, 1.0F, true)
.texOffs(16, 44).addBox(0.0F, -5.5F, 2.5F, 1.0F, 4.0F, 7.0F)
.texOffs(0, 44).addBox(5.5F, -5.5F, 2.5F, 1.0F, 4.0F, 7.0F)
.texOffs(16, 47).addBox(0.0F, -5.5F, 2.5F, 1.0F, 4.0F, 7.0F)
.texOffs(0, 47).addBox(5.5F, -5.5F, 2.5F, 1.0F, 4.0F, 7.0F)
, PartPose.offset(-3.25F, 16.0F, -6.0F)
);

Expand Down Expand Up @@ -311,7 +301,7 @@ public static LayerDefinition createBodyLayer() {

for (int pixels = 1; pixels < 5; pixels++) {
partDefinition.addOrReplaceChild(BATTERY_CHARGE_PART + pixels, CubeListBuilder.create()
.texOffs(18, 55).addBox(-2.0F, 21F, -6.01F, pixels, 1.0F, 1.0F)
.texOffs(30, 58).addBox(-2.0F, 21F, -6.01F, pixels, 1.0F, 1.0F)
, PartPose.ZERO
);
}
Expand All @@ -328,10 +318,11 @@ public static LayerDefinition createBodyLayer() {
private static Map<Integer, Item> getBackpackItems() {
return new LinkedHashMap<>(Map.of(
0, ModItems.BACKPACK.get(),
1, ModItems.IRON_BACKPACK.get(),
2, ModItems.GOLD_BACKPACK.get(),
3, ModItems.DIAMOND_BACKPACK.get(),
4, ModItems.NETHERITE_BACKPACK.get()
1, ModItems.COPPER_BACKPACK.get(),
2, ModItems.IRON_BACKPACK.get(),
3, ModItems.GOLD_BACKPACK.get(),
4, ModItems.DIAMOND_BACKPACK.get(),
5, ModItems.NETHERITE_BACKPACK.get()
));
}

Expand Down Expand Up @@ -507,9 +498,13 @@ public int hashCode() {
}

private static void addBodyClips(PartDefinition partDefinition, Item backpackItem, int yTextureOffset) {
addBodyClips(partDefinition, backpackItem, 0, yTextureOffset);
}

private static void addBodyClips(PartDefinition partDefinition, Item backpackItem, int xTextureOffset, int yTextureOffset) {
partDefinition.addOrReplaceChild(getTierPartName(backpackItem, BODY_CLIPS_PART), CubeListBuilder.create()
.texOffs(22, yTextureOffset).addBox(-3.25F, -9.5F, -3.5F, 1.0F, 2.0F, 1.0F)
.texOffs(25, yTextureOffset).addBox(2.25F, -9.5F, -3.5F, 1.0F, 2.0F, 1.0F)
.texOffs(22 + xTextureOffset, yTextureOffset).addBox(-3.25F, -9.5F, -3.5F, 1.0F, 2.0F, 1.0F)
.texOffs(25 + xTextureOffset, yTextureOffset).addBox(2.25F, -9.5F, -3.5F, 1.0F, 2.0F, 1.0F)
, PartPose.offset(0.0F, 24.0F, 0.0F)
);
}
Expand Down
Loading

0 comments on commit a45a958

Please sign in to comment.