Browse Source

fix drama bottle crafting, add more documentation, fix GuideAPI compat bugs

pull/193/head
Adrian Siekierka 1 year ago
parent
commit
599c2c1f30

+ 5
- 1
src/main/java/pl/asie/charset/module/misc/drama/CharsetMiscDrama.java View File

@@ -23,6 +23,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.client.event.ColorHandlerEvent;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.common.brewing.BrewingRecipeRegistry;
@@ -74,6 +75,9 @@ public class CharsetMiscDrama {

@Mod.EventHandler
public void init(FMLInitializationEvent event) {
BrewingRecipeRegistry.addRecipe(new ItemStack(Items.POTIONITEM, 1, 16), "dyePink", new ItemStack(dramaInABottle));
ItemStack potion = new ItemStack(Items.POTIONITEM, 1);
potion.setTagCompound(new NBTTagCompound());
potion.getTagCompound().setString("Potion", "minecraft:awkward");
BrewingRecipeRegistry.addRecipe(potion, "dyePink", new ItemStack(dramaInABottle));
}
}

+ 2
- 3
src/main/java/pl/asie/charset/module/tablet/CharsetTablet.java View File

@@ -70,7 +70,6 @@ public class CharsetTablet {
@SideOnly(Side.CLIENT)
public void onPreInitClient(FMLPreInitializationEvent event) {
ICommand spaceCommand = ((typesetter, tokenizer) -> typesetter.write(new WordText(" ")));
ICommand newlineCommand = ((typesetter, tokenizer) -> typesetter.write(new WordNewline()));

TabletAPI.INSTANCE.registerRouter(new RouterIndex());
TabletAPI.INSTANCE.registerRouter(new RouterSearch());
@@ -85,8 +84,8 @@ public class CharsetTablet {

TabletAPI.INSTANCE.registerCommand("\\", spaceCommand);
TabletAPI.INSTANCE.registerCommand("\\ ", spaceCommand);
TabletAPI.INSTANCE.registerCommand("\\nl", newlineCommand);
TabletAPI.INSTANCE.registerCommand("\\p", newlineCommand);
TabletAPI.INSTANCE.registerCommand("\\nl", ((typesetter, tokenizer) -> typesetter.write(new WordNewline(1))));
TabletAPI.INSTANCE.registerCommand("\\p", ((typesetter, tokenizer) -> typesetter.write(new WordNewline(2))));
TabletAPI.INSTANCE.registerCommand("\\\\", (((typesetter, tokenizer) -> typesetter.write(new WordText("\\")))));
TabletAPI.INSTANCE.registerCommand("\\-", (((typesetter, tokenizer) -> {
String padS = tokenizer.getOptionalParameter();

+ 13
- 0
src/main/java/pl/asie/charset/module/tablet/format/words/WordNewline.java View File

@@ -25,4 +25,17 @@ import java.util.Arrays;
import java.util.EnumSet;

public class WordNewline extends Word {
private final int lines;

public WordNewline() {
this(1);
}

public WordNewline(int lines) {
this.lines = lines;
}

public int getLines() {
return lines;
}
}

+ 1
- 1
src/main/java/pl/asie/charset/module/tablet/format/words/minecraft/WordPrinterMCNewline.java View File

@@ -31,7 +31,7 @@ public class WordPrinterMCNewline extends WordPrinterMinecraft<WordNewline> {

@Override
public int getPaddingAbove(IPrintingContextMinecraft context, WordNewline word) {
return context.getFontRenderer().FONT_HEIGHT;
return (word.getLines() - 1) * context.getFontRenderer().FONT_HEIGHT;
}

@Override

+ 12
- 7
src/main/java/pl/asie/charset/module/tablet/modcompat/guideapi/RouterGuideAPI.java View File

@@ -22,15 +22,20 @@ import java.util.Map;
public class RouterGuideAPI implements IRouterSearchable {
private final ResourceLocation location;
private final Book book;
private final Map<String, CategoryAbstract> categoryAbstractMap;

public RouterGuideAPI(ResourceLocation location, Book book) {
this.location = location;
this.book = book;
this.categoryAbstractMap = new HashMap<>();
}

public CategoryAbstract getCategory(String name) {
name = name.toLowerCase(Locale.ROOT);
for (CategoryAbstract category : book.getCategoryList()) {
categoryAbstractMap.put(category.name.toLowerCase(Locale.ROOT), category);
if (category.name.toLowerCase(Locale.ROOT).equals(name)) {
return category;
}
}
return null;
}

private String getIndex() {
@@ -54,9 +59,9 @@ public class RouterGuideAPI implements IRouterSearchable {
StringBuilder builder = new StringBuilder("\\title{" + entry.getLocalizedName() + "}\n\n");
for (IPage page : entry.pageList) {
if (page instanceof PageTextImage) {
builder.append(((PageTextImage) page).draw).append("\n\n");
builder.append(((PageTextImage) page).draw.replaceAll("\\\\n", "\n")).append("\n\n");
} else if (page instanceof PageText) {
builder.append(((PageText) page).draw).append("\n\n");
builder.append(((PageText) page).draw.replaceAll("\\\\n", "\n")).append("\n\n");
}
}
builder.append("\\url{/" + location.getResourcePath() + "/" + TabletUtil.encode(category.name.toLowerCase(Locale.ROOT)) + "}{Back}");
@@ -76,9 +81,9 @@ public class RouterGuideAPI implements IRouterSearchable {

String[] splits = cutPath.split("/");
if (splits.length == 1) {
return getCategory(categoryAbstractMap.get(splits[0]));
return getCategory(getCategory(splits[0]));
} else if (splits.length == 2) {
CategoryAbstract category = categoryAbstractMap.get(splits[0]);
CategoryAbstract category = getCategory(splits[0]);
for (Map.Entry<ResourceLocation, EntryAbstract> entry : category.entries.entrySet()) {
if (splits[1].equals(entry.getValue().name.toLowerCase(Locale.ROOT))) {
return getEntry(category, entry.getValue());

+ 6
- 3
src/main/resources/assets/charset/doc/index.txt View File

@@ -10,11 +10,14 @@
\checkmods{all}{charset:storage.barrels}{\- \item{charset:barrel} \url{item://charset/barrel}{Barrel}}
\checkmods{all}{charset:storage.tanks}{\- \item{charset:fluidtank} \url{item://charset/fluidtank}{Fluid Tank}}}

\checkmods{any}{charset:transport.dyeableMinecarts charset:tweak.carry}{\b{New Mechanics}
\checkmods{any}{charset:transport.dyeableMinecarts charset:tweak.carry charset:tweak.zorro}{\b{New Mechanics}

\checkmods{all}{charset:tweak.carry}{\- \item{minecraft:chest} \url{mod://charset/info/block_carrying}{Block Carrying}}
\checkmods{all}{charset:transport.dyeableMinecarts}{\- \item{minecraft:minecart} \url{mod://charset/info/cart_dyeing}{Dyeable Minecarts}}}
\checkmods{all}{charset:transport.dyeableMinecarts}{\- \item{minecraft:minecart} \url{mod://charset/info/cart_dyeing}{Dyeable Minecarts}}
\checkmods{all}{charset:tweak.zorro}{\- \item{minecraft:iron_horse_armor} \url{mod://charset/info/zorro}{The Zorro Thing}}}

\b{Misc}

\- \item{charset:tablet} \url{item://charset/tablet}{Tablet}
\checkmods{all}{charset:misc.drama}{\- \item{charset:dramainabottle} \url{item://charset/dramainabottle}{Drama in a Bottle}}}
\- \item{charset:tablet} \url{item://charset/tablet}{Tablet}
\- \item{charset:icon} \url{mod://charset/info/tweaks}{Tweaks}

+ 7
- 0
src/main/resources/assets/charset/doc/info/tweaks.txt View File

@@ -0,0 +1,7 @@
\title{Tweaks}

The following tweaks are enabled:

\checkmods{all}{charset:tweak.doubledoors}{\- Double doors now open together, even if you right-click just one.}
\checkmods{all}{charset:tweak.anvilDyeItems}{\- Item names can now be dyed in the Anvil.}
\checkmods{all}{charset:tweak.pushableTnt}{\- Hands and projectiles can now push primed TNT around.}

+ 40
- 0
src/main/resources/assets/charset/doc/info/zorro.txt View File

@@ -0,0 +1,40 @@
\title{The Zorro Thing}

You.

You're the bigshot.
\nl The man of the house.
\nl You do what needs to be done, and wipe that smirk off your face, junior.

Who are you? The Hero. The Protagonist.


And it is you who, with manly agency,
\nl kills bad guys,
\nl and kicks butt,
\nl and carves his mark on the wall,
\nl and settles old scores,
\nl and shot first,
\nl and has the plan he doesn't share,
\nl and knows that dame will be yours by the end of Act IV,
\nl and ignores the stupid rules and the big explosions,
\nl and holsters his gun with a flourish


And then the Bad Guy, some nancy, sneers,
"You've been watching too many action movies, Mr. Jones",
but you coolly reply:
"No. You just haven't watched enough,"
and drop out the window, 5 stories up,
landing on your stead, for a clean getaway
towards the horizon and the closing credits.

\nl

Do you hear what I'm saying? When you jump off a building and land on a horse,
you'll be unhurt, and the lead will snap but you won't care, and if you fall exceptionally far, or with blade drawn, or while carying a baby,
you might find your ride gets an even better boost.

\nl

But you already knew that. You knew that all along.

+ 4
- 0
src/main/resources/assets/charset/doc/item/dramainabottle.txt View File

@@ -0,0 +1,4 @@
\scale{2}{\item{charset:dramainabottle}} \title{Drama in a Bottle}

Crafted by brewing an Awkward Potion with some Pink Dye, this Drama in a Bottle will permanently store one
unit of community drama just for you!

Loading…
Cancel
Save