Skip to content

Commit

Permalink
Port to 1.19.3 [build] [publish]
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrbysco committed Apr 17, 2023
1 parent 6d58a5e commit 7e3ec28
Show file tree
Hide file tree
Showing 22 changed files with 120 additions and 61 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Initial update to 1.19.3
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

# Base info
mc_version=1.19.2
forge_version=43.2.8
mc_version=1.19.3
forge_version=44.1.23
mcp_channel=official
mcp_mappings=1.19.2
mcp_mappings=1.19.3

#Publishing
mod_name=Chowder Express
curseforge_id=783410
modrinth_id=CcY0wAVw

# Version
version=1.1.0
version=1.2.0

# Dependencies
jei_version=11.6.0.1013
jei_version=12.4.0.22
2 changes: 1 addition & 1 deletion gradle/curseforge.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if (System.getenv().CURSEFORGE_KEY) {
apiKey = System.getenv().CURSEFORGE_KEY
project {
id = project.curseforge_id
releaseType = "release"
releaseType = "beta"
addGameVersion "Forge"
addGameVersion "${mc_version}"
addGameVersion "Java 17"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.19.2 2023-01-04T02:59:55.3337736 Tags for minecraft:item
// 1.19.3 2023-04-18T01:11:03.260432 Tags for minecraft:item mod id chowderexpress
953a2d84283eb74fab164e4f15b3e025b4969366 data/chowderexpress/tags/items/soups.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.19.2 2023-01-03T01:40:56.5500115 Sound Definitions
// 1.19.3 2023-04-18T01:11:03.262435 Sound Definitions
45ca0a31bdc571cd49597904ef98727e71f3f745 assets/chowderexpress/sounds.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.19.2 2022-12-29T23:27:23.1716271 Item Models: chowderexpress
// 1.19.3 2023-04-18T01:11:03.258932 Item Models: chowderexpress
6890e612ff24d2d617b406b23b447c50fa99328b assets/chowderexpress/models/item/soup_cart.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// 1.19.2 2022-12-29T23:29:19.5698324 Recipes
// 1.19.3 2023-04-18T01:11:03.2599322 Recipes
87697b9ff626777c081797471122ff69ff48481b data/chowderexpress/advancements/recipes/transportation/soup_cart.json
c66bb42b33e84b32e7148cff2d6c8686b669d3a3 data/chowderexpress/recipes/soup_cart.json
0c7d883f64cfaac177d4bdb70b2048282692ba1f data/chowderexpress/recipes/soup_cart.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.19.2 2023-01-03T01:40:56.5485107 Languages: en_us
// 1.19.3 2023-04-18T01:11:03.2619605 Languages: en_us
63b8ca789489a584e633ade76911ec515a7315a7 assets/chowderexpress/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "minecraft:crafting_shapeless",
"category": "misc",
"ingredients": [
{
"item": "minecraft:minecart"
Expand Down
18 changes: 16 additions & 2 deletions src/main/java/com/mrbysco/chowderexpress/ChowderExpress.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
import com.mrbysco.chowderexpress.client.ClientHandler;
import com.mrbysco.chowderexpress.registry.CartDataSerializers;
import com.mrbysco.chowderexpress.registry.CartRegistry;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.event.CreativeModeTabEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.common.Mod;
Expand All @@ -19,7 +23,7 @@
public class ChowderExpress {
public static final String MOD_ID = "chowderexpress";
private static final Logger LOGGER = LogUtils.getLogger();
public static final TagKey<Item> SOUPS = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(ChowderExpress.MOD_ID, "soups"));
public static final TagKey<Item> SOUPS = TagKey.create(Registries.ITEM, new ResourceLocation(ChowderExpress.MOD_ID, "soups"));

public ChowderExpress() {
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
Expand All @@ -29,9 +33,19 @@ public ChowderExpress() {
CartRegistry.ENTITY_TYPES.register(eventBus);
CartDataSerializers.ENTITY_DATA_SERIALIZER.register(eventBus);

eventBus.addListener(this::buildCreativeContents);

DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
eventBus.addListener(ClientHandler::registerEntityRenders);
eventBus.addListener(ClientHandler::registerLayerDefinitions);
});
}

private void buildCreativeContents(CreativeModeTabEvent.BuildContents event) {
var entries = event.getEntries();
var visibility = CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS;
if (event.getTab() == CreativeModeTabs.TOOLS_AND_UTILITIES) {
entries.put(new ItemStack(CartRegistry.SOUP_CART_ITEM.get()), visibility);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import com.mrbysco.chowderexpress.client.ClientHandler;
import com.mrbysco.chowderexpress.client.SoupRenderTypes;
import com.mrbysco.chowderexpress.client.model.SoupModel;
Expand Down Expand Up @@ -71,16 +71,16 @@ public void render(T cart, float entityYaw, float partialTicks, PoseStack poseSt
}

poseStack.translate(0.0D, 0.375D, 0.0D);
poseStack.mulPose(Vector3f.YP.rotationDegrees(180.0F - entityYaw));
poseStack.mulPose(Vector3f.ZP.rotationDegrees(-f3));
poseStack.mulPose(Axis.YP.rotationDegrees(180.0F - entityYaw));
poseStack.mulPose(Axis.ZP.rotationDegrees(-f3));
float f5 = (float) cart.getHurtTime() - partialTicks;
float f6 = cart.getDamage() - partialTicks;
if (f6 < 0.0F) {
f6 = 0.0F;
}

if (f5 > 0.0F) {
poseStack.mulPose(Vector3f.XP.rotationDegrees(Mth.sin(f5) * f5 * f6 / 10.0F * (float) cart.getHurtDir()));
poseStack.mulPose(Axis.XP.rotationDegrees(Mth.sin(f5) * f5 * f6 / 10.0F * (float) cart.getHurtDir()));
}

int j = cart.getDisplayOffset();
Expand All @@ -90,7 +90,7 @@ public void render(T cart, float entityYaw, float partialTicks, PoseStack poseSt
float f4 = 0.75F;
poseStack.scale(f4, f4, f4);
poseStack.translate(-0.5D, (double) ((float) (j - 8) / 16.0F), 0.5D);
poseStack.mulPose(Vector3f.YP.rotationDegrees(90.0F));
poseStack.mulPose(Axis.YP.rotationDegrees(90.0F));
this.renderMinecartContents(cart, partialTicks, blockstate, poseStack, bufferSource, packedLightIn);
poseStack.popPose();
}
Expand Down
19 changes: 14 additions & 5 deletions src/main/java/com/mrbysco/chowderexpress/data/CartDatagen.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,38 @@
import com.mrbysco.chowderexpress.data.client.CartItemModelProvider;
import com.mrbysco.chowderexpress.data.client.CartLanguageProvider;
import com.mrbysco.chowderexpress.data.client.CartSoundProvider;
import com.mrbysco.chowderexpress.data.server.CartBlockTagProvider;
import com.mrbysco.chowderexpress.data.server.CartItemTagProvider;
import com.mrbysco.chowderexpress.data.server.CartRecipes;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.PackOutput;
import net.minecraftforge.common.data.BlockTagsProvider;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.data.event.GatherDataEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

import java.util.concurrent.CompletableFuture;

@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class CartDatagen {
@SubscribeEvent
public static void gatherData(GatherDataEvent event) {
DataGenerator generator = event.getGenerator();
PackOutput packOutput = generator.getPackOutput();
CompletableFuture<HolderLookup.Provider> lookupProvider = event.getLookupProvider();
ExistingFileHelper helper = event.getExistingFileHelper();

if (event.includeServer()) {
generator.addProvider(event.includeClient(), new CartRecipes(generator));
generator.addProvider(event.includeServer(), new CartItemTagProvider(generator, helper));
generator.addProvider(event.includeClient(), new CartRecipes(packOutput));
BlockTagsProvider blockTagsProvider = new CartBlockTagProvider(packOutput, lookupProvider, helper);
generator.addProvider(event.includeServer(), new CartItemTagProvider(packOutput, lookupProvider, blockTagsProvider, helper));
}
if (event.includeClient()) {
generator.addProvider(event.includeClient(), new CartLanguageProvider(generator));
generator.addProvider(event.includeClient(), new CartItemModelProvider(generator, helper));
generator.addProvider(event.includeClient(), new CartSoundProvider(generator, helper));
generator.addProvider(event.includeClient(), new CartLanguageProvider(packOutput));
generator.addProvider(event.includeClient(), new CartItemModelProvider(packOutput, helper));
generator.addProvider(event.includeClient(), new CartSoundProvider(packOutput, helper));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
import com.mrbysco.chowderexpress.ChowderExpress;
import com.mrbysco.chowderexpress.registry.CartRegistry;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.client.model.generators.ItemModelProvider;
import net.minecraftforge.common.data.ExistingFileHelper;

public class CartItemModelProvider extends ItemModelProvider {
public CartItemModelProvider(DataGenerator gen, ExistingFileHelper helper) {
super(gen, ChowderExpress.MOD_ID, helper);
public CartItemModelProvider(PackOutput packOutput, ExistingFileHelper helper) {
super(packOutput, ChowderExpress.MOD_ID, helper);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
import com.mrbysco.chowderexpress.ChowderExpress;
import com.mrbysco.chowderexpress.registry.CartRegistry;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.PackOutput;
import net.minecraft.sounds.SoundEvent;
import net.minecraftforge.common.data.LanguageProvider;
import net.minecraftforge.registries.RegistryObject;

public class CartLanguageProvider extends LanguageProvider {
public CartLanguageProvider(DataGenerator gen) {
super(gen, ChowderExpress.MOD_ID, "en_us");
public CartLanguageProvider(PackOutput packOutput) {
super(packOutput, ChowderExpress.MOD_ID, "en_us");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
import com.mrbysco.chowderexpress.ChowderExpress;
import com.mrbysco.chowderexpress.registry.CartRegistry;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.common.data.SoundDefinitionsProvider;

public class CartSoundProvider extends SoundDefinitionsProvider {

public CartSoundProvider(DataGenerator generator, ExistingFileHelper existingFileHelper) {
super(generator, ChowderExpress.MOD_ID, existingFileHelper);
public CartSoundProvider(PackOutput packOutput, ExistingFileHelper existingFileHelper) {
super(packOutput, ChowderExpress.MOD_ID, existingFileHelper);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.mrbysco.chowderexpress.data.server;

import com.mrbysco.chowderexpress.ChowderExpress;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraftforge.common.data.BlockTagsProvider;
import net.minecraftforge.common.data.ExistingFileHelper;
import org.jetbrains.annotations.Nullable;

import java.util.concurrent.CompletableFuture;

public class CartBlockTagProvider extends BlockTagsProvider {
public CartBlockTagProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider, @Nullable ExistingFileHelper existingFileHelper) {
super(output, lookupProvider, ChowderExpress.MOD_ID, existingFileHelper);
}

@Override
protected void addTags(HolderLookup.Provider provider) {

}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
package com.mrbysco.chowderexpress.data.server;

import com.mrbysco.chowderexpress.ChowderExpress;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.tags.BlockTagsProvider;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.data.tags.ItemTagsProvider;
import net.minecraft.data.tags.TagsProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.common.data.ExistingFileHelper;

import java.util.concurrent.CompletableFuture;

public class CartItemTagProvider extends ItemTagsProvider {
public CartItemTagProvider(DataGenerator dataGenerator, ExistingFileHelper existingFileHelper) {
super(dataGenerator, new BlockTagsProvider(dataGenerator), ChowderExpress.MOD_ID, existingFileHelper);

public CartItemTagProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider,
TagsProvider<Block> blockTagProvider, ExistingFileHelper existingFileHelper) {
super(output, lookupProvider, blockTagProvider, ChowderExpress.MOD_ID, existingFileHelper);
}

@Override
protected void addTags() {
protected void addTags(HolderLookup.Provider lookupProvider) {
this.tag(ChowderExpress.SOUPS).add(Items.BEETROOT_SOUP, Items.MUSHROOM_STEW, Items.RABBIT_STEW, Items.SUSPICIOUS_STEW);

//Enhanced Farming
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
package com.mrbysco.chowderexpress.data.server;

import com.mrbysco.chowderexpress.registry.CartRegistry;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.FinishedRecipe;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
import net.minecraft.world.item.Items;

import java.util.function.Consumer;

public class CartRecipes extends RecipeProvider {
public CartRecipes(DataGenerator generator) {
super(generator);
public CartRecipes(PackOutput packOutput) {
super(packOutput);
}

@Override
protected void buildCraftingRecipes(Consumer<FinishedRecipe> recipeConsumer) {
ShapelessRecipeBuilder.shapeless(CartRegistry.SOUP_CART_ITEM.get())
protected void buildRecipes(Consumer<FinishedRecipe> recipeConsumer) {
ShapelessRecipeBuilder.shapeless(RecipeCategory.TRANSPORTATION, CartRegistry.SOUP_CART_ITEM.get())
.requires(Items.MINECART).requires(Items.BOWL)
.unlockedBy("has_bowl", has(Items.BOWL))
.save(recipeConsumer);
Expand Down
17 changes: 11 additions & 6 deletions src/main/java/com/mrbysco/chowderexpress/entity/SoupCart.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.nbt.ListTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
Expand Down Expand Up @@ -92,17 +93,21 @@ public InteractionResult doSoupInteraction(Player player, InteractionHand hand,
effects.putAll(mobEffects);
}

stack.shrink(1);
player.addItem(new ItemStack(Items.BOWL));
if (!player.getAbilities().instabuild) {
stack.shrink(1);
player.addItem(new ItemStack(Items.BOWL));
}
level.playSound(null, blockPosition(), CartRegistry.EMPTY_BOWL.get(), SoundSource.PLAYERS, 1.0F, 1.0F);
return InteractionResult.SUCCESS;
}
} else if (getSoupData().get().getLocation().equals(soupLocation)) {
if (mobEffects.keySet().equals(effects.keySet())) {
if (setSoupAmount(getSoupAmount() + 1)) {
this.maybePlaySound(player);
stack.shrink(1);
player.addItem(new ItemStack(Items.BOWL));
if (!player.getAbilities().instabuild) {
stack.shrink(1);
player.addItem(new ItemStack(Items.BOWL));
}
level.playSound(null, blockPosition(), CartRegistry.EMPTY_BOWL.get(), SoundSource.PLAYERS, 1.0F, 1.0F);
return InteractionResult.SUCCESS;
}
Expand All @@ -129,7 +134,7 @@ public InteractionResult doSoupInteraction(Player player, InteractionHand hand,
}

public void maybePlaySound(Player player) {
if(random.nextDouble() <= 0.05) {
if (random.nextDouble() <= 0.05) {
player.displayClientMessage(Component.literal("Mm soup"), true);
level.playSound(null, blockPosition(), CartRegistry.MM_SOUP.get(), SoundSource.PLAYERS, 1.0F, 1.0F);
}
Expand Down Expand Up @@ -306,7 +311,7 @@ public Type getMinecartType() {
}

@Override
public Packet<?> getAddEntityPacket() {
public Packet<ClientGamePacketListener> getAddEntityPacket() {
return NetworkHooks.getEntitySpawningPacket(this);
}
}
Loading

0 comments on commit 7e3ec28

Please sign in to comment.