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 637433f commit 3303f31
Show file tree
Hide file tree
Showing 29 changed files with 244 additions and 68 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
minecraft_version=1.18.2
forge_version=40.1.30
mod_version=3.19.7
mod_version=3.20.0
jei_mc_version=1.18.2
jei_version=9.7.2.281
curios_version=1.18.2-5.0.9.1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"sophisticatedbackpacks:copper_backpack"
]
},
"criteria": {
"has_backpack": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": [
"sophisticatedbackpacks:backpack"
]
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "sophisticatedbackpacks:copper_backpack"
}
}
},
"requirements": [
[
"has_backpack",
"has_the_recipe"
]
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"sophisticatedbackpacks:iron_backpack_from_copper"
]
},
"criteria": {
"has_copper_backpack": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": [
"sophisticatedbackpacks:copper_backpack"
]
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "sophisticatedbackpacks:iron_backpack_from_copper"
}
}
},
"requirements": [
[
"has_copper_backpack",
"has_the_recipe"
]
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "sophisticatedbackpacks:copper_backpack"
}
],
"functions": [
{
"function": "sophisticatedbackpacks:copy_backpack_data"
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@
"entries": [
{
"type": "minecraft:item",
"weight": 5,
"weight": 7,
"name": "sophisticatedbackpacks:backpack"
},
{
"type": "minecraft:item",
"weight": 5,
"name": "sophisticatedbackpacks:copper_backpack"
},
{
"type": "minecraft:item",
"weight": 3,
Expand All @@ -27,7 +32,7 @@
},
{
"type": "minecraft:empty",
"weight": 89
"weight": 84
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
"type": "minecraft:item",
"weight": 5,
"name": "sophisticatedbackpacks:backpack"
"name": "sophisticatedbackpacks:copper_backpack"
},
{
"type": "minecraft:item",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"entries": [
{
"type": "minecraft:item",
"weight": 4,
"weight": 5,
"name": "sophisticatedbackpacks:backpack"
},
{
"type": "minecraft:item",
"weight": 2,
"name": "sophisticatedbackpacks:iron_backpack"
"weight": 3,
"name": "sophisticatedbackpacks:copper_backpack"
},
{
"type": "minecraft:item",
Expand All @@ -23,7 +23,7 @@
},
{
"type": "minecraft:empty",
"weight": 92
"weight": 90
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"type": "sophisticatedbackpacks:backpack_upgrade",
"conditions": [
{
"itemRegistryName": "sophisticatedbackpacks:copper_backpack",
"type": "sophisticatedcore:item_enabled"
}
],
"pattern": [
"CCC",
"CBC",
"CCC"
],
"key": {
"C": {
"tag": "forge:ingots/copper"
},
"B": {
"item": "sophisticatedbackpacks:backpack"
}
},
"result": {
"item": "sophisticatedbackpacks:copper_backpack"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"type": "sophisticatedbackpacks:backpack_upgrade",
"conditions": [
{
"itemRegistryName": "sophisticatedbackpacks:iron_backpack",
"type": "sophisticatedcore:item_enabled"
}
],
"pattern": [
" I ",
"IBI",
" I "
],
"key": {
"I": {
"tag": "forge:ingots/iron"
},
"B": {
"item": "sophisticatedbackpacks:copper_backpack"
}
},
"result": {
"item": "sophisticatedbackpacks:iron_backpack"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,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 @@ -137,6 +138,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 @@ -31,11 +31,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 Expand Up @@ -70,6 +66,7 @@ private static void onModelRegistry(ModelRegistryEvent event) {

private static void clientSetup(FMLClientSetupEvent event) {
ItemBlockRenderTypes.setRenderLayer(ModBlocks.BACKPACK.get(), RenderType.cutout());
ItemBlockRenderTypes.setRenderLayer(ModBlocks.COPPER_BACKPACK.get(), RenderType.cutout());
ItemBlockRenderTypes.setRenderLayer(ModBlocks.IRON_BACKPACK.get(), RenderType.cutout());
ItemBlockRenderTypes.setRenderLayer(ModBlocks.GOLD_BACKPACK.get(), RenderType.cutout());
ItemBlockRenderTypes.setRenderLayer(ModBlocks.DIAMOND_BACKPACK.get(), RenderType.cutout());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static void registerBlockColorHandlers(ColorHandlerEvent.Block event) {
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(ColorHandlerEvent.Item event) {
}
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 @@ -36,13 +32,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 @@ -238,25 +228,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 @@ -309,7 +299,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 @@ -326,10 +316,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 @@ -504,9 +495,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 3303f31

Please sign in to comment.