Skip to content

Commit

Permalink
Merge pull request #47 from sweetrpg/1.18
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
paulyhedral authored Dec 6, 2024
2 parents f90114c + f5dae4d commit c9d9c25
Show file tree
Hide file tree
Showing 54 changed files with 484 additions and 862 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,20 @@ jobs:
name: Get last version
run: |
echo "latest_version=$(cat .release-info/${{ github.ref_name }}/VERSION)" >> $GITHUB_ENV
- id: get_bump_level
name: Get bump level
run: |
echo "bump_level=$(cat .release-info/${{ github.ref_name }}/BUMP_LEVEL)" >> $GITHUB_ENV
- id: bump_version
name: Bump version
uses: cbrgm/semver-bump-action@main
with:
current-version: ${{ env.latest_version }}
bump-level: patch
bump-level: ${{ env.bump_level || 'patch' }}
- id: reset_bump_level
name: Reset bump level
run: |
echo "patch" > .release-info/${{ github.ref_name }}/BUMP_LEVEL
- name: Build with Gradle
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
with:
Expand All @@ -54,8 +62,8 @@ jobs:
git config --global user.email "[email protected]"
git config --global user.name "SweetRPG CI"
echo "${{ steps.bump_version.outputs.new_version }}" > .release-info/${{ github.ref_name }}/VERSION
git add .release-info/${{ github.ref_name }}/VERSION
git commit -m "Update ${{ github.ref_name }} VERSION file"
git add .release-info/${{ github.ref_name }}/*
git commit -m "Update ${{ github.ref_name }} .release-info files"
git push origin
- name: Release artifacts
uses: softprops/action-gh-release@v1
Expand Down
1 change: 1 addition & 0 deletions .release-info/1.18/BUMP_LEVEL
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
patch
2 changes: 1 addition & 1 deletion .release-info/1.18/RELEASE_HASH
Original file line number Diff line number Diff line change
@@ -1 +1 @@
256510bbbd810366ee9da94fc0ddd31d450e4576
f90114caa2b504cf129370ac131d1ebbc574c405
2 changes: 1 addition & 1 deletion .release-info/1.18/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.12
0.2.1
8 changes: 8 additions & 0 deletions CHANGELOG/1.18/0.1.12.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 0.1.12

- `[FIX]` Made cost calculation of non-vanilla recipes slightly more expensive
- `[FIX]` Made cost calculation of non-crafting table recipes slightly more expensive
- `[FIX]` Increased recipe calculation depth to 3
- `[FIX]` Added checks for recipe and ingredient namespaces in determining intermediate/raw status
- `[FIX]` Changed text for crafting queue sections
- `[NEW]` Intermediate and raw materials that are tags are marked with an asterisk
8 changes: 2 additions & 6 deletions CHANGELOG/1.18/current.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
- `[FIX]` Made cost calculation of non-vanilla recipes slightly more expensive
- `[FIX]` Made cost calculation of non-crafting table recipes slightly more expensive
- `[FIX]` Increased recipe calculation depth to 3
- `[FIX]` Added checks for recipe and ingredient namespaces in determining intermediate/raw status
- `[FIX]` Changed text for crafting queue sections
- `[NEW]` Intermediate and raw materials that are tags are marked with an asterisk
- `[DEV]` Code cleanup
- `[DEV]` Documentation
17 changes: 0 additions & 17 deletions src/main/java/com/sweetrpg/crafttracker/CraftTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public CraftTracker() {
ModBlocks.BLOCKS.register(modEventBus);
ModBlockEntityTypes.TILE_ENTITIES.register(modEventBus);
ModItems.ITEMS.register(modEventBus);
// ModEntityTypes.ENTITIES.register(modEventBus);
ModContainerTypes.CONTAINERS.register(modEventBus);
ModSerializers.SERIALIZERS.register(modEventBus);
ModRecipeSerializers.RECIPE_SERIALIZERS.register(modEventBus);
Expand All @@ -70,10 +69,6 @@ public CraftTracker() {
// Client Events
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
modEventBus.addListener(this::clientSetup);
// modEventBus.addListener(ModBlocks::registerBlockColours);
// modEventBus.addListener(ClientEventHandler::onModelBakeEvent);
// modEventBus.addListener(ClientSetup::setupTileEntityRenderers);
// modEventBus.addListener(ClientSetup::setupEntityRenderers);
modEventBus.addListener(ClientSetup::addClientReloadListeners);
modEventBus.addListener(ClientSetup::addKeyBindings);

Expand All @@ -85,9 +80,6 @@ public CraftTracker() {
AddonManager.init();
}

// public void commonSetup(final FMLCommonSetupEvent event) {
// }

public void serverStarting(final ServerStartingEvent event) {
LOGGER.debug("Server starting");
}
Expand Down Expand Up @@ -119,22 +111,13 @@ private void gatherData(final GatherDataEvent event) {
DataGenerator gen = event.getGenerator();

if(event.includeClient()) {
// BlockstateProvider blockstates = new BlockstateProvider(gen, event.getExistingFileHelper());
// gen.addProvider(blockstates);
// gen.addProvider(new ItemModelProvider(gen, blockstates.getExistingHelper()));
gen.addProvider(new CTLangProvider(gen, Constants.LOCALE_EN_US));
gen.addProvider(new CTLangProvider(gen, Constants.LOCALE_EN_GB));
gen.addProvider(new CTLangProvider(gen, Constants.LOCALE_DE_DE));
}

if(event.includeServer()) {
// gen.addProvider(new DTBlockTagsProvider(gen));
gen.addProvider(new CTAdvancementProvider(gen));
// BlockTagsProvider blockTagProvider = new CHBlockTagsProvider(gen, event.getExistingFileHelper());
// gen.addProvider(blockTagProvider);
// gen.addProvider(new ItemTagsProvider(gen, blockTagProvider, event.getExistingFileHelper()));
// gen.addProvider(new RecipeProvider(gen));
// gen.addProvider(new LootTableProvider(gen));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,13 @@
public class ClientSetup {

public static void setupScreenManagers(final FMLClientSetupEvent event) {
// MenuScreens.register(ModContainerTypes.CAT_BOWL.get(), CatBowlScreen::new);
}

// public static void setupEntityRenderers(final EntityRenderersEvent.RegisterLayerDefinitions event) {
// }

// public static void setupTileEntityRenderers(final EntityRenderersEvent.RegisterRenderers event) {
// }

public static void addClientReloadListeners(final RegisterClientReloadListenersEvent event) {
// event.registerReloadListener(CatTextureManager.INSTANCE);
}

public static void addKeyBindings(final FMLClientSetupEvent event) {

MinecraftForge.EVENT_BUS.addListener(ClientEventHandler::onClientTick);
MinecraftForge.EVENT_BUS.addListener(ClientEventHandler::onScreenInit);
MinecraftForge.EVENT_BUS.addListener(ClientEventHandler::onKeyInput);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,44 +21,10 @@
import net.minecraftforge.client.event.InputEvent;
import net.minecraftforge.client.event.MovementInputUpdateEvent;
import net.minecraftforge.client.event.ScreenEvent;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;

public class ClientEventHandler {

public static void onClientTick(TickEvent.ClientTickEvent event) {
CraftTracker.LOGGER.trace("#onClientTick: {}", event);

// if(event.phase != TickEvent.Phase.END) return;
//
// if(ModKeyBindings.ADD_TO_QUEUE_MAPPING.consumeClick()) {
// CraftTracker.LOGGER.debug("#onKeyInput: ADD_TO_QUEUE_MAPPING");
//
// handleAddToQueue();
// }
// else if(ModKeyBindings.TOGGLE_CRAFT_QUEUE_MAPPING.consumeClick()) {
// CraftTracker.LOGGER.debug("#onKeyInput: TOGGLE_CRAFT_LIST_MAPPING");
//
// handleToggleCraftList();
// }
// else if(ModKeyBindings.TOGGLE_SHOPPING_LIST_MAPPING.consumeClick()) {
// CraftTracker.LOGGER.debug("#onKeyInput: TOGGLE_SHOPPING_LIST_MAPPING");
//
// handleToggleShoppingList();
// }
// else if(ModKeyBindings.OPEN_QUEUE_MANAGER_MAPPING.consumeClick()) {
// CraftTracker.LOGGER.debug("#onKeyInput: OPEN_QUEUE_MANAGER_MAPPING");
//
// QueueManagementScreen.open();
// }
// else if(ModKeyBindings.POPULATE_SHOPPING_LIST_MAPPING.consumeClick()) {
// CraftTracker.LOGGER.debug("#onKeyInput: POPULATE_SHOPPING_LIST_MAPPING");
//
// handlePopulateShoppingList();
// }
}

// @SubscribeEvent
public static void onKeyInput(final InputEvent.KeyInputEvent event) {
CraftTracker.LOGGER.trace("#onKeyInput: {}", event);

Expand Down Expand Up @@ -213,7 +179,6 @@ private static void handleAddToQueue() {

var player = Minecraft.getInstance().player;
CraftingQueueManager.INSTANCE.addProduct(player, res, 1);
// PacketHandler.sendToServer(new AddToQueueData(res, 1));
}
});
}
Expand All @@ -224,41 +189,10 @@ public void onInputEvent(final MovementInputUpdateEvent event) {

}

// public static void onScreenRemove() {
// CraftTracker.LOGGER.trace("#onScreenRemove: {}", event);
//
// CTRuntime.INSTANCE.screenOpen = false;
// }

@SubscribeEvent
public static void onScreenInit(final ScreenEvent.InitScreenEvent.Post event) {
CraftTracker.LOGGER.trace("#onScreenInit: {}", event);

// CTRuntime.INSTANCE.screenOpen = true;

// Screen screen = event.getScreen();
// if(screen instanceof InventoryScreen || screen instanceof CreativeModeInventoryScreen) {
// boolean creative = screen instanceof CreativeModeInventoryScreen;
//// CraftTracker.LOGGER.debug("#onScreenInit: creative {}", creative);
//
// // boolean dtLoaded = ModList.get().isLoaded("doggytalents");
// Minecraft mc = Minecraft.getInstance();
// int width = mc.getWindow().getGuiScaledWidth();
// int height = mc.getWindow().getGuiScaledHeight();
// int sizeX = creative ? 195 : 176;
// int sizeY = creative ? 136 : 166;
// int guiLeft = (width - sizeX) / 2 - ((creative) ? 15 : 0);
// int guiTop = (height - sizeY) / 2 - ((!creative) ? 13 : 0);
//
// int x = guiLeft + (creative ? 36 : sizeX / 2 - 10);
// int y = guiTop + (creative ? 7 : 48);
//
// event.addListener(new SmallButton(x, y, new TranslatableComponent("X"), (btn) -> {
// CraftTracker.LOGGER.debug("#onScreenInit: SMALL BUTTON PRESSED {}", btn);
//// PacketHandler.send(PacketDistributor.SERVER.noArg(), new AddToQueueData("TODO"));
////// btn.active = false;
// }));
// }
}

@SubscribeEvent
Expand All @@ -267,71 +201,10 @@ public void onScreenDrawForeground(final ScreenEvent.DrawScreenEvent event) {

Screen screen = event.getScreen();
if(screen instanceof InventoryScreen || screen instanceof CreativeModeInventoryScreen) {
boolean creative = screen instanceof CreativeModeInventoryScreen;
// CraftTracker.LOGGER.debug("#onScreenInit: creative {}", creative);

// CatInventoryButton btn = null;
//
// //TODO just create a static variable in this class
// for (Widget widget : screen.renderables) {
// if (widget instanceof CatInventoryButton) {
// btn = (CatInventoryButton) widget;
// break;
// }
// }
//
// if (btn.visible && btn.isHoveredOrFocused()) {
// Minecraft mc = Minecraft.getInstance();
// int width = mc.getWindow().getGuiScaledWidth();
// int height = mc.getWindow().getGuiScaledHeight();
// int sizeX = creative ? 195 : 176;
// int sizeY = creative ? 136 : 166;
// int guiLeft = (width - sizeX) / 2;
// int guiTop = (height - sizeY) / 2;
// if (!creative) {
// RecipeBookComponent recipeBook = ((InventoryScreen) screen).getRecipeBookComponent();
// if (recipeBook.isVisible()) {
// guiLeft += 76;
// }
// }
//
// //event.getPoseStack().translate(-guiLeft, -guiTop, 0);
// btn.renderToolTip(event.getPoseStack(), event.getMouseX(), event.getMouseY());
// //event.getPoseStack().translate(guiLeft, guiTop, 0);
// }
// boolean creative = screen instanceof CreativeModeInventoryScreen;

// TODO
}
}

// public void drawSelectionBox(PoseStack matrixStackIn, Player player, float particleTicks, AABB boundingBox) {
// CraftTracker.LOGGER.debug("#drawSelectionBox: {}, player: {}", matrixStackIn, player);
//
// RenderSystem.setShader(GameRenderer::getPositionTexShader);
// RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
// // RenderSystem.disableAlphaTest();
// RenderSystem.depthMask(false);
// RenderSystem.enableBlend();
// RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
// RenderSystem.setShaderColor(0.0F, 0.0F, 0.0F, 0.7F);
// //TODO Used when drawing outline of bounding box
// RenderSystem.lineWidth(2.0F);
//
//
// RenderSystem.disableTexture();
// Vec3 vec3d = Minecraft.getInstance().gameRenderer.getMainCamera().getPosition();
// double d0 = vec3d.x();
// double d1 = vec3d.y();
// double d2 = vec3d.z();
//
// BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder();
// bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
// LevelRenderer.renderLineBox(matrixStackIn, bufferbuilder, boundingBox.move(-d0, -d1, -d2), 1F, 1F, 0F, 0.8F);
// Tesselator.getInstance().end();
// RenderSystem.setShaderColor(0.0F, 0.0F, 0.0F, 0.3F);
// RenderSystem.depthMask(true);
// RenderSystem.enableTexture();
// RenderSystem.disableBlend();
// //RenderSystem.enableAlphaTest();
// RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
// }

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,33 @@
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;

/**
* Handlers for various events.
*/
public class CraftingEvents {

/**
* Relays the request to remove a product to the @{link CraftingQueueManager}
*
* @param itemId the item to remove from the queue
* @param quantity the amount of the item to remove from the queue
*/
public static void removeProduct(ResourceLocation itemId, int quantity) {
var player = Minecraft.getInstance().player;

CraftingQueueManager.INSTANCE.removeProduct(player, itemId, quantity);
}

/**
* Removes an item from the crafting queue if it was picked up by the player.
*
* @param itemId the item to remove from the queue
* @param quantity the amount of the item to remove from the queue
*/
public static void pickupItem(ResourceLocation itemId, int quantity) {
var player = Minecraft.getInstance().player;

CraftingQueueManager.INSTANCE.removeProduct(player, itemId, quantity);
CraftingQueueManager.INSTANCE.computeAll();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ public class CraftQueueOverlay {
}

Player player = Minecraft.getInstance().player;
// var inventory = player.getInventory();

// SECTION: intermediates

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public class ShoppingListOverlay {

static int TITLE_COLOR = 0x99999999;
static int HELP_COLOR = 0x77777777;
static int SECTION_COLOR = 0xcccccccc;
static int TEXT_COLOR = 0xffffffff;
static int MESSAGE_COLOR = 0x66666666;
static int SECTION_X_OFFSET = 4;
Expand Down Expand Up @@ -139,7 +138,6 @@ public class ShoppingListOverlay {
yPos += LINE_HEIGHT + 2;
CraftTracker.LOGGER.trace("yPos (materials item {}): {}", i, yPos);
}

};

}
Loading

0 comments on commit c9d9c25

Please sign in to comment.