Skip to content

Commit

Permalink
Start 1.20 update
Browse files Browse the repository at this point in the history
  • Loading branch information
StellarWind22 committed Nov 30, 2023
1 parent afac930 commit 0c7014a
Show file tree
Hide file tree
Showing 10 changed files with 741 additions and 756 deletions.
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ crowdintranslate.minecraftProjectName = "basicshields"
crowdintranslate.verbose = false

repositories {
maven { url = "https://jitpack.io" } //Jitpack
maven { url = "https://maven.shedaniel.me/" } //Cloth
maven { url = "https://maven.terraformersmc.com/" } //Modmenu
maven { url = "https://minecraft.guntram.de/maven/"} //Crowdlin
maven {url = "https://minecraft.guntram.de/maven/"}
maven { url = "https://jitpack.io" }
maven { url = "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/releases/"}
maven {url = "https://api.modrinth.com/maven"}
}

dependencies {
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ org.gradle.jvmargs=-Xmx2G

# Fabric Properties
# check these on https://fabricmc.net/develop/
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.28
loader_version=0.14.11
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.1
loader_version=0.14.22

# Mod Properties
mod_version = 1.4.0
maven_group = com.github.crimsondawn45
archives_base_name = BasicShields

# Dependencies
fabric_version=0.68.0+1.19.2
fabric_shield_lib_version=1.6.1-1.19
fabric_version=0.89.2+1.20.2
fabric_shield_lib_version=1.7.1-1.20.2
cloth_version=8.2.88
mod_menu_version=4.1.1
mod_menu_version=7.1.0
crowdlin_version=1.4+1.19
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.github.crimsondawn45.basicshields.initializers;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.github.crimsondawn45.basicshields.config.BasicShieldsConfig;
import com.github.crimsondawn45.basicshields.module.AdabraniumModule;
import com.github.crimsondawn45.basicshields.module.AlexandriteModule;
Expand All @@ -24,16 +27,14 @@
import com.github.crimsondawn45.basicshields.module.TopazModule;
import com.github.crimsondawn45.basicshields.module.TourmalineModule;
import com.github.crimsondawn45.basicshields.module.VanillaModule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import me.shedaniel.autoconfig.AutoConfig;
import me.shedaniel.autoconfig.serializer.GsonConfigSerializer;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import net.minecraft.text.Text;

public class BasicShields implements ModInitializer {

Expand Down Expand Up @@ -67,7 +68,12 @@ public class BasicShields implements ModInitializer {
public static TourmalineModule tourmaline;

//Item Group
public static ItemGroup SHIELDS = FabricItemGroupBuilder.build(new Identifier(MOD_ID, "shields"), () -> new ItemStack(vanilla.diamond_shield.getItem()));
public static final ItemGroup SHIELDS = FabricItemGroup.builder()
.icon(() -> new ItemStack(vanilla.diamond_shield.getItem()))
.displayName(Text.translatable("itemGroup.tutorial.test_group"))
.entries((context, entries) -> {
})
.build();

//Config
public static BasicShieldsConfig CONFIG = new BasicShieldsConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public void onInitializeClient() {

for(ModShieldItem shield : module.getShieldItems()) {
shield.clientShieldInit();
shield.RegisterModelLayer();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package com.github.crimsondawn45.basicshields.mixin;

import com.github.crimsondawn45.basicshields.util.ContentModule;
import com.github.crimsondawn45.basicshields.util.ModShieldItem;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import com.github.crimsondawn45.basicshields.util.ContentModule;
import com.github.crimsondawn45.basicshields.util.ModShieldItem;

import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.model.EntityModelLoader;
import net.minecraft.client.render.item.BuiltinModelItemRenderer;
import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;

Expand All @@ -39,7 +40,7 @@ private void setModels(CallbackInfo ci){
}

@Inject(method = "render", at = @At("HEAD"))
private void mainRender(ItemStack stack, ModelTransformation.Mode mode, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, CallbackInfo ci) {
private void mainRender(ItemStack stack, ModelTransformationMode mode, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, CallbackInfo ci) {

/**
* Handle rendering the shields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterial;
import net.minecraft.tag.TagKey;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.world.World;
Expand Down Expand Up @@ -37,12 +37,6 @@ public GobberShieldItem(Settings settings, int cooldownTicks, int enchantability
this.reflectPercentage = reflectPercentage;
}

public GobberShieldItem(Settings settings, int cooldownTicks, int enchantability, float reflectPercentage, boolean unbreakable, List<TagKey<Item>> repairItemTags) {
super(settings, cooldownTicks, enchantability, repairItemTags);
this.unbreakable = unbreakable;
this.reflectPercentage = reflectPercentage;
}

//Add reflection tooltip
@Override
public void appendShieldTooltip(ItemStack stack, List<Text> tooltip, TooltipContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import com.github.crimsondawn45.basicshields.initializers.BasicShields;

import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

public class ModItem {

Expand All @@ -19,7 +20,7 @@ public ModItem(ContentModule module, String name, Item item) {
this.identifier = new Identifier(BasicShields.MOD_ID, name);
this.item = item;

Registry.register(Registry.ITEM, this.identifier, this.item);
Registry.register(Registries.ITEM, this.identifier, this.item);
}

public Item getItem() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.google.gson.JsonObject;

import net.minecraft.item.Item;
import net.minecraft.tag.TagKey;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;

public class ModRecipe {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.model.EntityModelLayer;
import net.minecraft.client.render.entity.model.EntityModelLoader;
Expand Down Expand Up @@ -134,21 +132,6 @@ public EntityModelLayer getEntityModelLayer() {
return this.entityModelLayer;
}

/**
* Handles registering the model layer & setting up the client sprite registry callback
*/
@SuppressWarnings("deprecation")
@Environment(EnvType.CLIENT)
public void RegisterModelLayer(){

EntityModelLayerRegistry.registerModelLayer(this.getEntityModelLayer(), ShieldEntityModel::getTexturedModelData);

ClientSpriteRegistryCallback.event(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE).register((atlasTexture, registry) -> {
registry.register(new Identifier(BasicShields.MOD_ID, this.getBaseTexturePath()));
registry.register(new Identifier(BasicShields.MOD_ID, this.getNoPatternTexturePath()));
});
}

/**
* Handles setting the shieldEntity model
* @param modelLoader an instance of the entiyModelLoader.
Expand Down
Loading

0 comments on commit 0c7014a

Please sign in to comment.