Skip to content

Commit

Permalink
Version 1.1.11
Browse files Browse the repository at this point in the history
Changed changed creative mode tab ordering (Also should help for when latest create releases)
Also removed some random comments
  • Loading branch information
cakeGit committed Aug 25, 2024
1 parent f55b5c1 commit 97d259b
Show file tree
Hide file tree
Showing 9 changed files with 1,223 additions and 14 deletions.
3 changes: 2 additions & 1 deletion changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
- This also should help to improve performance
1.20.1-1.1.10: |
- Fixed signal placement bug
1.20.1-1.1.11: |
- Changed changed creative mode tab ordering (Also should help for when latest create releases)
...
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,5 @@ public static boolean onMouseInput(int button, boolean pressed) {

return PatternSchematicsClient.PATTERN_SCHEMATIC_HANDLER.onMouseInput(button, pressed);
}

//Todo: For foge
// @Mod.EventBusSubscriber(value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
// public static class ModBusEvents {
//
// @SubscribeEvent
// public static void registerGuiOverlays(RegisterGuiOverlaysEvent event) {
// event.registerAbove(VanillaGuiOverlay.HOTBAR.id(), "pattern_schematic", PatternSchematicsClient.PATTERN_SCHEMATIC_HANDLER);
// }
//
// }

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.cak.pattern_schematics.mixin;

import com.cak.pattern_schematics.registry.PatternSchematicsTabInsertions;
import net.minecraft.world.item.Item;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import java.util.List;

@Mixin(remap = false, targets = "com.simibubi.create.AllCreativeModeTabs$RegistrateDisplayItemsGenerator")
public class CreateCreativeModeTabMixin {

@Redirect(method = "collectItems", at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z"))
private boolean addAdditionalItemInject(List<Item> instance, Object element) {
Item itemToAdd = (Item) element;
boolean result = instance.add(itemToAdd);

if (
PatternSchematicsTabInsertions.getAllInsertsAfter()
.containsKey(itemToAdd)
) {
instance.add(
PatternSchematicsTabInsertions.getAllInsertsAfter()
.get(itemToAdd)
);
}

return result;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.cak.pattern_schematics.registry;

import com.google.common.collect.ImmutableMap;
import com.simibubi.create.AllItems;
import com.tterrag.registrate.util.entry.ItemEntry;
import net.minecraft.world.item.Item;

import java.util.HashMap;
import java.util.Map;

public class PatternSchematicsTabInsertions {


private static Map<Item, Item> INSERTS_AFTER = null;

public static final Map<ItemEntry<Item>, ItemEntry<Item>> REGISTRY_INSERTS_AFTER = Map.of(
AllItems.EMPTY_SCHEMATIC, PatternSchematicsRegistry.EMPTY_PATTERN_SCHEMATIC
);

public static Map<Item, Item> getAllInsertsAfter() {
if (INSERTS_AFTER != null) {
return INSERTS_AFTER;
}

INSERTS_AFTER = new HashMap<>();
for (Map.Entry<ItemEntry<Item>, ItemEntry<Item>> entry : REGISTRY_INSERTS_AFTER.entrySet()) {
INSERTS_AFTER.put(entry.getKey().get(), entry.getValue().get());
}
return INSERTS_AFTER;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

public class PlatformRegistryTransforms {

@Deprecated //TODO : not needed, function replaced by tabInsertions
@ExpectPlatform
public static <T extends Item, P> NonNullUnaryOperator<ItemBuilder<T, P>> transformEmptyPatternSchematic() {
throw new AssertionError();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"AbstractContraptionEntityMixin",
"BlockHelperMixin",
"CreateClientMixin",
"CreateCreativeModeTabMixin",
"DeployBaseMixin",
"DeployerMovementBehaviorMixin",
"MovementContextMixin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
public class PlatformRegistryTransformsImpl {

public static <T extends Item, P> NonNullUnaryOperator<ItemBuilder<T, P>> transformEmptyPatternSchematic() {
Create.LOGGER.info("suknfidjbsfdgknjg");
return (i) -> i.tab(AllCreativeModeTabs.BASE_CREATIVE_TAB.getKey());
}

Expand Down
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": "Example Mod",
"description": "Create: Pattern Schematics",
"pack_format": 8
}
}
1,154 changes: 1,154 additions & 0 deletions icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 97d259b

Please sign in to comment.