Skip to content

Commit

Permalink
Port to 1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmeow committed Jun 15, 2022
1 parent cbddd35 commit f7764a0
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.Mth;
Expand Down Expand Up @@ -157,19 +156,19 @@ public void appendHoverText(ItemStack stack, BlockGetter worldIn, List<Component
String tooltipPrefix = "block.whisperwoods.hand_of_fate.tooltip.";
String recipePrefix = tooltipPrefix + "recipe.";
if(Screen.hasShiftDown()) {
tooltip.add(new TranslatableComponent(tooltipPrefix + "recipehint").setStyle(gIS));
tooltip.add(Component.translatable(tooltipPrefix + "recipehint").setStyle(gIS));
for (String recipeKey : HandOfFateBlockEntity.RECIPES.keySet()) {
HOFRecipe recipe = HandOfFateBlockEntity.RECIPES.get(recipeKey);
tooltip.add(
new TranslatableComponent("block.whisperwoods.hand_of_fate.tooltip.recipe_format" + (I18n.exists(recipePrefix + recipeKey + ".hint") ? "_hint" : ""),
new TranslatableComponent(recipePrefix + recipeKey).setStyle(Style.EMPTY.applyFormat(recipe.getColor()).withBold(recipe.isBold())),
new TranslatableComponent(recipe.getFirst().getDescriptionId()).withStyle(ChatFormatting.WHITE),
new TranslatableComponent(recipePrefix + recipeKey + ".hint").withStyle(ChatFormatting.GRAY)
Component.translatable("block.whisperwoods.hand_of_fate.tooltip.recipe_format" + (I18n.exists(recipePrefix + recipeKey + ".hint") ? "_hint" : ""),
Component.translatable(recipePrefix + recipeKey).setStyle(Style.EMPTY.applyFormat(recipe.getColor()).withBold(recipe.isBold())),
Component.translatable(recipe.getFirst().getDescriptionId()).withStyle(ChatFormatting.WHITE),
Component.translatable(recipePrefix + recipeKey + ".hint").withStyle(ChatFormatting.GRAY)
).withStyle(ChatFormatting.GRAY)
);
}
} else {
tooltip.add(new TranslatableComponent(tooltipPrefix + "shiftdown").setStyle(gIS));
tooltip.add(Component.translatable(tooltipPrefix + "shiftdown").setStyle(gIS));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;

import java.util.UUID;
Expand Down Expand Up @@ -46,7 +46,7 @@ public void render(EntityWisp entity, float entityYaw, float partialTicks, PoseS
head.setupAnim(0F, -entity.yHeadRot, 180F + entity.getXRot());
head.renderToBuffer(stack, vertex, packedLightIn, OverlayTexture.NO_OVERLAY, r / 255F, g / 255F, b / 255F, 0.6F);
stack.translate(0F, 0.4F, 0F);
this.renderNameTag(entity, new TextComponent(name + "'s soul"), stack, bufferIn, packedLightIn);
this.renderNameTag(entity, Component.literal(name + "'s soul"), stack, bufferIn, packedLightIn);
}
stack.popPose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,7 @@ public static void render(PoseStack stack, ModelPart.Cube cube, float scale) {
bufferBuilder.vertex(matrix, -1F, 1F, 0F).uv(u1, v0).endVertex();
bufferBuilder.vertex(matrix, 1F, 1F, 0F).uv(u0, v0).endVertex();
bufferBuilder.vertex(matrix, 1F, -1F, 0F).uv(u0, v1).endVertex();
bufferBuilder.end();
BufferUploader.end(bufferBuilder);
BufferUploader.drawWithShader(bufferBuilder.end());

matrix = Matrix4f.createTranslateMatrix(d.m03, d.m13, d.m23 + 0.01F);
matrix.multiply(Matrix4f.createScaleMatrix(0.1F * scale, 0.1F * scale, 0.1F * scale));
Expand All @@ -502,8 +501,7 @@ public static void render(PoseStack stack, ModelPart.Cube cube, float scale) {
bufferBuilder.vertex(matrix, -1F, 1F, 0F).uv(u1, v0).endVertex();
bufferBuilder.vertex(matrix, 1F, 1F, 0F).uv(u0, v0).endVertex();
bufferBuilder.vertex(matrix, 1F, -1F, 0F).uv(u0, v1).endVertex();
bufferBuilder.end();
BufferUploader.end(bufferBuilder);
BufferUploader.drawWithShader(bufferBuilder.end());
RenderSystem.disableDepthTest();
RenderSystem.enableCull();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
import dev.itsmeow.whisperwoods.util.IOverrideCollisions;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
Expand Down Expand Up @@ -222,7 +220,7 @@ public boolean hurt(DamageSource source, float amount) {
if(!this.level.isClientSide && source.getEntity() instanceof Player && !source.isCreativePlayer()) {
if (this.isDaytime()) {
Player player = (Player) source.getEntity();
player.sendMessage(new TranslatableComponent("entity.whisperwoods.hirschgeist.message.invulnerable"), Util.NIL_UUID);
player.sendSystemMessage(Component.translatable("entity.whisperwoods.hirschgeist.message.invulnerable"));
return false;
} else if (this.getRandom().nextInt(4) == 0) {
this.level.playSound(null, source.getEntity(), SoundEvents.BUCKET_FILL_LAVA, SoundSource.MASTER, 1F, 2F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
Expand All @@ -28,7 +27,6 @@
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.SupportType;
import net.minecraft.world.level.block.TorchBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
Expand Down Expand Up @@ -328,7 +326,7 @@ public static void bottleTooltip(EntityTypeContainer<? extends Mob> container, I
CompoundTag tag = stack.getTag();
if(tag != null) {
if(tag.contains("SizeTag")) {
tooltip.add(new TextComponent("Size: " + tag.getFloat("SizeTag")).setStyle(Style.EMPTY.applyFormats(ChatFormatting.ITALIC, ChatFormatting.GRAY)));
tooltip.add(Component.literal("Size: " + tag.getFloat("SizeTag")).setStyle(Style.EMPTY.applyFormats(ChatFormatting.ITALIC, ChatFormatting.GRAY)));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.Difficulty;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.effect.MobEffectInstance;
Expand All @@ -35,7 +36,6 @@
import net.minecraft.world.phys.Vec3;

import java.util.EnumSet;
import java.util.Random;

public class EntityZotzpyre extends EntityMonsterWithTypes implements FlyingAnimal {

Expand Down Expand Up @@ -104,7 +104,7 @@ protected SoundEvent getDeathSound() {
}

@SuppressWarnings("deprecation")
public static boolean canSpawn(EntityType<EntityZotzpyre> type, LevelAccessor world, MobSpawnType reason, BlockPos pos, Random rand) {
public static boolean canSpawn(EntityType<EntityZotzpyre> type, LevelAccessor world, MobSpawnType reason, BlockPos pos, RandomSource rand) {
if (pos.getY() >= world.getSeaLevel() && !BiomeTypes.getTypes(world.getBiome(pos).unwrapKey().get()).contains(BiomeTypes.JUNGLE)) {
return false;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public String getDescriptionId() {

@Override
public void fillItemCategory(CreativeModeTab group, NonNullList<ItemStack> items) {
if(this.allowdedIn(group)) {
if(this.allowedIn(group)) {
this.getBlock().fillItemCategory(group, items);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public ItemBlockHirschgeistSkull(Block blockIn) {
@Override
protected <A extends HumanoidModel<?>> A getBaseModelInstance() {
if(ModelHGSkullMask.INSTANCE == null) {
ModelHGSkullMask.INSTANCE = new ModelHGSkullMask<>(new EntityRendererProvider.Context(Minecraft.getInstance().getEntityRenderDispatcher(), Minecraft.getInstance().getItemRenderer(), Minecraft.getInstance().getResourceManager(), Minecraft.getInstance().getEntityModels(), Minecraft.getInstance().font).bakeLayer(new ModelLayerLocation(new ResourceLocation(WhisperwoodsMod.MODID, "hirschgeist_skull_mask"), "main")));
ModelHGSkullMask.INSTANCE = new ModelHGSkullMask<>(new EntityRendererProvider.Context(Minecraft.getInstance().getEntityRenderDispatcher(), Minecraft.getInstance().getItemRenderer(), Minecraft.getInstance().getBlockRenderer(), Minecraft.getInstance().getEntityRenderDispatcher().getItemInHandRenderer(), Minecraft.getInstance().getResourceManager(), Minecraft.getInstance().getEntityModels(), Minecraft.getInstance().font).bakeLayer(new ModelLayerLocation(new ResourceLocation(WhisperwoodsMod.MODID, "hirschgeist_skull_mask"), "main")));
}
return (A) ModelHGSkullMask.INSTANCE;
}
Expand Down
6 changes: 3 additions & 3 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ dependencies {
shadowModImplementation("dev.itsmeow.imdlib:imdlib-fabric:${rootProject.imdlib_version}") {
transitive = false
}
modRuntimeOnly("com.terraformersmc:modmenu:3.1.1") {
modRuntimeOnly("com.terraformersmc:modmenu:4.0.0") {
transitive = false
}
modRuntimeOnly ("curse.maven:cloth-config-319057:3641132") {
modRuntimeOnly ("curse.maven:cloth-config-348521:3827487") {
exclude(group: "net.fabricmc")
exclude(group: "net.fabricmc.fabric-api")
}
runtimeOnly("me.shedaniel.cloth:basic-math:0.6.0")
runtimeOnly("me.shedaniel.cloth:basic-math:0.6.1")
}

shadowJar {
Expand Down
4 changes: 2 additions & 2 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"modmenu": ["dev.itsmeow.imdlib.compat.modmenu.ModMenuCompat"]
},
"depends": {
"minecraft": "1.18.2",
"architectury": ">=4.0.0",
"minecraft": "1.19.x",
"architectury": ">=5.0.0",
"fabricloader": ">=0.12.0",
"fabric": ">=0.32.0"
},
Expand Down
6 changes: 3 additions & 3 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modLoader="javafml"
loaderVersion="[40,)"
loaderVersion="[41,)"
issueTrackerURL="https://github.com/itsmeow/whisperwoods/issues"
displayURL="https://www.curseforge.com/minecraft/mc-mods/whisperwoods"
logoFile="icon.png"
Expand All @@ -15,12 +15,12 @@ Spooky forest stuff for spooky jam'''
[[dependencies.whisperwoods]]
modId="forge"
mandatory=true
versionRange="[40.0.0,)"
versionRange="[41.0.0,)"
ordering="NONE"
side="BOTH"
[[dependencies.whisperwoods]]
modId="architectury"
mandatory=true
versionRange="[4.0.0,)"
versionRange="[5.0.0,)"
ordering="NONE"
side="BOTH"
2 changes: 1 addition & 1 deletion forge/src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"description": "whisperwoods resources",
"pack_format": 8
"pack_format": 9
}
}
22 changes: 11 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
maven_group = dev.itsmeow.whisperwoods

# Forge
mc_version = 1.18.2
forge_version = 40.0.46
architectury_version = 4.2.50
fabric_loader_version = 0.13.3
fabric_api_version = 0.50.0+1.18.2
imdlib_version = 1.18.2-0cefc723b2f1479aa04c92284c2e4b03fa164a50
mc_version = 1.19
forge_version = 41.0.33
architectury_version = 5.6.21
fabric_loader_version = 0.14.7
fabric_api_version = 0.55.3+1.19
imdlib_version = 1.19-194ae5c75cdc9a4be590991a3683d0e6f2fe3e74

# Publishing
github = itsmeow/whisperwoods
name = Whisperwoods
url = https://github.com/itsmeow/whisperwoods
curse_title = Whisperwoods
curse_project_id = 349597
curse_versions_fabric = Minecraft 1.18:1.18.2,Java 17,Fabric
curse_versions_forge = Minecraft 1.18:1.18.2,Java 17,Forge
curse_relations_fabric = fabric-api:requiredDependency,architectury-fabric:requiredDependency,cloth-config:optionalDependency,modmenu:optionalDependency,fiber2cloth:embeddedLibrary
curse_relations_forge = architectury-forge:requiredDependency
curse_versions_fabric = Minecraft 1.19:1.19,Java 17,Fabric
curse_versions_forge = Minecraft 1.19:1.19,Java 17,Forge
curse_relations_fabric = fabric-api:requiredDependency,architectury-api:requiredDependency,cloth-config:optionalDependency,modmenu:optionalDependency,fiber2cloth:embeddedLibrary
curse_relations_forge = architectury-api:requiredDependency

# Toolchain Versions
loom_version = 0.11.0-SNAPSHOT
loom_version = 0.12.0-SNAPSHOT
architectury_plugin_version = 3.4-SNAPSHOT

# Misc
Expand Down

0 comments on commit f7764a0

Please sign in to comment.