Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.20 port #813

Open
wants to merge 17 commits into
base: 1.20
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#Sun Apr 09 14:41:44 WEST 2023
mapping_channel=parchment
mod_id=psi
forge_version=47.1.3
forge_version=47.3.0
jei_version=15.2.0.27
build_number=101
build_number=103
patchy_version=1.20.1-83-FORGE
dir_output=../Build Output/Psi/
version=1.20
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "psi:blocks/psimetal_plate_black"
"all": "psi:block/psimetal_plate_black"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"parent": "minecraft:block/block",
"textures": {
"particle": "psi:blocks/empty"
"particle": "psi:block/empty"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "psi:blocks/ebony_psimetal_block"
"all": "psi:block/ebony_psimetal_block"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "psi:blocks/ivory_psimetal_block"
"all": "psi:block/ivory_psimetal_block"
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"parent": "minecraft:block/cube_bottom_top",
"textures": {
"bottom": "psi:blocks/psimetal_plate_black",
"side": "psi:blocks/psimetal_plate_black_light",
"top": "psi:blocks/psimetal_plate_black"
"bottom": "psi:block/psimetal_plate_black",
"side": "psi:block/psimetal_plate_black_light",
"top": "psi:block/psimetal_plate_black"
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"parent": "minecraft:block/cube_bottom_top",
"textures": {
"bottom": "psi:blocks/psimetal_plate_white",
"side": "psi:blocks/psimetal_plate_white_light",
"top": "psi:blocks/psimetal_plate_white"
"bottom": "psi:block/psimetal_plate_white",
"side": "psi:block/psimetal_plate_white_light",
"top": "psi:block/psimetal_plate_white"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "psi:blocks/psidust_block"
"all": "psi:block/psidust_block"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "psi:blocks/psigem_block"
"all": "psi:block/psigem_block"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "psi:blocks/psimetal_block"
"all": "psi:block/psimetal_block"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "psi:blocks/psimetal_plate_white"
"all": "psi:block/psimetal_plate_white"
}
}
5 changes: 3 additions & 2 deletions src/main/java/vazkii/psi/api/ClientPsiAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
package vazkii.psi.api;

import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.client.resources.model.Material;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
Expand All @@ -22,7 +23,7 @@
@OnlyIn(Dist.CLIENT)
public class ClientPsiAPI {

public static final ResourceLocation PSI_PIECE_TEXTURE_ATLAS = new ResourceLocation(MOD_ID, "spell_pieces");
//public static final ResourceLocation PSI_PIECE_TEXTURE_ATLAS = new ResourceLocation(MOD_ID, "spell_pieces");
private static final Map<ResourceLocation, Material> simpleSpellTextures = new ConcurrentHashMap<>();

/**
Expand All @@ -44,7 +45,7 @@ public class ClientPsiAPI {
*/
@OnlyIn(Dist.CLIENT)
public static void registerPieceTexture(ResourceLocation pieceId, ResourceLocation texture) {
ClientPsiAPI.simpleSpellTextures.put(pieceId, new Material(PSI_PIECE_TEXTURE_ATLAS, texture));
ClientPsiAPI.simpleSpellTextures.put(pieceId, new Material(TextureAtlas.LOCATION_BLOCKS, texture));
}

public static Material getSpellPieceMaterial(ResourceLocation key) {
Expand Down
16 changes: 13 additions & 3 deletions src/main/java/vazkii/psi/api/PsiAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Tier;
import net.minecraft.world.item.Tiers;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.ForgeTier;
import net.minecraftforge.common.TierSortingRegistry;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.common.capabilities.CapabilityToken;
Expand All @@ -36,14 +41,15 @@
import vazkii.psi.api.internal.DummyMethodHandler;
import vazkii.psi.api.internal.IInternalMethodHandler;
import vazkii.psi.api.material.PsimetalArmorMaterial;
import vazkii.psi.api.material.PsimetalToolMaterial;
import vazkii.psi.api.spell.ISpellAcceptor;
import vazkii.psi.api.spell.ISpellImmune;
import vazkii.psi.api.spell.SpellPiece;
import vazkii.psi.api.spell.detonator.IDetonationHandler;
import vazkii.psi.common.item.base.ModItems;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -83,7 +89,11 @@ public final class PsiAPI {

public static final PsimetalArmorMaterial PSIMETAL_ARMOR_MATERIAL = new PsimetalArmorMaterial("psimetal", 18, new int[] { 2, 5, 6, 2 },
12, SoundEvents.ARMOR_EQUIP_IRON, 0F, () -> Ingredient.of(ForgeRegistries.ITEMS.getValue(new ResourceLocation(MOD_ID, "psimetal"))), 0.0f);
public static final PsimetalToolMaterial PSIMETAL_TOOL_MATERIAL = new PsimetalToolMaterial();
public static final Tier PSIMETAL_TOOL_MATERIAL = TierSortingRegistry.registerTier(
new ForgeTier(3, 900, 7.8F, 2F, 12, BlockTags.NEEDS_DIAMOND_TOOL, () -> Ingredient.of(ModItems.psimetal)),
new ResourceLocation(MOD_ID, "psimetal_tier"),
List.of(Tiers.DIAMOND), List.of(Tiers.NETHERITE));


/**
* Registers a Spell Piece.
Expand All @@ -106,7 +116,7 @@ public static void registerSpellPiece(ResourceLocation resourceLocation, Class<?
*/
public static void registerSpellPieceAndTexture(ResourceLocation id, Class<? extends SpellPiece> clazz) {
registerSpellPiece(id, clazz);
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> () -> ClientPsiAPI.registerPieceTexture(id, new ResourceLocation(id.getNamespace(), "spell/" + id.getPath())));
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> ClientPsiAPI.registerPieceTexture(id, new ResourceLocation(id.getNamespace(), "spell/" + id.getPath())));
}

/**
Expand Down
52 changes: 0 additions & 52 deletions src/main/java/vazkii/psi/api/material/PsimetalToolMaterial.java

This file was deleted.

5 changes: 3 additions & 2 deletions src/main/java/vazkii/psi/api/spell/Spell.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
package vazkii.psi.api.spell;

import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.nbt.CompoundTag;
Expand Down Expand Up @@ -45,8 +46,8 @@ public Spell() {
}

@OnlyIn(Dist.CLIENT)
public void draw(GuiGraphics graphics, MultiBufferSource buffers, int light) {
grid.draw(graphics, buffers, light);
public void draw(PoseStack pPoseStack, MultiBufferSource buffers, int light) {
grid.draw(pPoseStack, buffers, light);
}

@Nullable
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/vazkii/psi/api/spell/SpellGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;

import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.nbt.CompoundTag;
Expand Down Expand Up @@ -45,15 +46,15 @@ public final class SpellGrid {
private int leftmost, rightmost, topmost, bottommost;

@OnlyIn(Dist.CLIENT)
public void draw(GuiGraphics graphics, MultiBufferSource buffers, int light) {
public void draw(PoseStack pPoseStack, MultiBufferSource buffers, int light) {
for(int i = 0; i < GRID_SIZE; i++) {
for(int j = 0; j < GRID_SIZE; j++) {
SpellPiece p = gridData[i][j];
if(p != null) {
graphics.pose().pushPose();
graphics.pose().translate(i * 18, j * 18, 0);
p.draw(graphics, buffers, light);
graphics.pose().popPose();
pPoseStack.pushPose();
pPoseStack.translate(i * 18, j * 18, 0);
p.draw(pPoseStack, buffers, light);
pPoseStack.popPose();
}
}
}
Expand Down
Loading