Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e5a92aff7 | ||
|
|
a09e6058a9 | ||
|
|
e774dd5e10 |
No files matched your search
@@ -0,0 +1,17 @@
|
|||||||
|
name: Optimize images
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [ master, main, release/** ]
|
||||||
|
paths:
|
||||||
|
- "**/*.png"
|
||||||
|
|
||||||
|
push:
|
||||||
|
branches: [ master, main, release/** ]
|
||||||
|
paths:
|
||||||
|
- "**/*.png"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
optimize-images:
|
||||||
|
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
|
||||||
|
secrets: inherit
|
||||||
@@ -148,15 +148,32 @@ public class StructureDefinition<T> implements IStructureDefinition<T> {
|
|||||||
|
|
||||||
occupiedSpaces.put(name, occupiedSpace);
|
occupiedSpaces.put(name, occupiedSpace);
|
||||||
|
|
||||||
String built = builder.toString().replaceAll("[\\uA000\\uB000\\uC000]", "");
|
boolean hasPlus = false;
|
||||||
|
boolean hasMinus = false;
|
||||||
|
|
||||||
if (built.contains("+")) {
|
int write = 0;
|
||||||
|
for (int read = 0; read < builder.length(); read++) {
|
||||||
|
char ch = builder.charAt(read);
|
||||||
|
if (ch == A || ch == B || ch == C) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (ch == '+') {
|
||||||
|
hasPlus = true;
|
||||||
|
} else if (ch == '-') {
|
||||||
|
hasMinus = true;
|
||||||
|
}
|
||||||
|
if (read != write) builder.setCharAt(write, ch);
|
||||||
|
write++;
|
||||||
|
}
|
||||||
|
builder.setLength(write);
|
||||||
|
|
||||||
|
if (hasPlus) {
|
||||||
addElement('+', notAir());
|
addElement('+', notAir());
|
||||||
}
|
}
|
||||||
if (built.contains("-")) {
|
if (hasMinus) {
|
||||||
addElement('-', isAir());
|
addElement('-', isAir());
|
||||||
}
|
}
|
||||||
shapes.put(name, built);
|
shapes.put(name, builder.toString());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,10 @@ import net.minecraft.item.ItemBlock;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.ChatComponentText;
|
||||||
import net.minecraft.util.ChatComponentTranslation;
|
import net.minecraft.util.ChatComponentTranslation;
|
||||||
|
import net.minecraft.util.ChatStyle;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
import net.minecraft.util.IChatComponent;
|
import net.minecraft.util.IChatComponent;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@@ -338,9 +341,7 @@ public class StructureUtility {
|
|||||||
ItemStack stack = new ItemStack(itemBlock, 1, itemMeta);
|
ItemStack stack = new ItemStack(itemBlock, 1, itemMeta);
|
||||||
if (!s.takeOne(stack, true)) {
|
if (!s.takeOne(stack, true)) {
|
||||||
if (chatter != null) chatter.accept(
|
if (chatter != null) chatter.accept(
|
||||||
new ChatComponentTranslation(
|
new ChatComponentTranslation("structurelib.autoplace.missing_block", stack.func_151000_E()));
|
||||||
"structurelib.autoplace.error.no_simple_block",
|
|
||||||
stack.func_151000_E()));
|
|
||||||
return PlaceResult.REJECT;
|
return PlaceResult.REJECT;
|
||||||
}
|
}
|
||||||
if (block instanceof ICustomBlockSetting) {
|
if (block instanceof ICustomBlockSetting) {
|
||||||
@@ -447,7 +448,7 @@ public class StructureUtility {
|
|||||||
if (!StructureLibAPI.isBlockTriviallyReplaceable(world, x, y, z, actor)) return PlaceResult.REJECT;
|
if (!StructureLibAPI.isBlockTriviallyReplaceable(world, x, y, z, actor)) return PlaceResult.REJECT;
|
||||||
if (!assumeStackPresent && !s.takeOne(stack, true)) {
|
if (!assumeStackPresent && !s.takeOne(stack, true)) {
|
||||||
if (chatter != null) chatter.accept(
|
if (chatter != null) chatter.accept(
|
||||||
new ChatComponentTranslation("structurelib.autoplace.error.no_item_stack", stack.func_151000_E()));
|
new ChatComponentTranslation("structurelib.autoplace.missing_block", stack.func_151000_E()));
|
||||||
return PlaceResult.REJECT;
|
return PlaceResult.REJECT;
|
||||||
}
|
}
|
||||||
if (!stack.copy().tryPlaceItemIntoWorld(actor, world, x, y, z, ForgeDirection.UP.ordinal(), 0.5f, 0.5f, 0.5f))
|
if (!stack.copy().tryPlaceItemIntoWorld(actor, world, x, y, z, ForgeDirection.UP.ordinal(), 0.5f, 0.5f, 0.5f))
|
||||||
@@ -1411,6 +1412,53 @@ public class StructureUtility {
|
|||||||
} else {
|
} else {
|
||||||
return new IStructureElement<T>() {
|
return new IStructureElement<T>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger,
|
||||||
|
AutoPlaceEnvironment env) {
|
||||||
|
BlocksToPlace e = getBlocksToPlace(t, world, x, y, z, trigger, env);
|
||||||
|
IItemSource source = env.getSource();
|
||||||
|
EntityPlayer actor = env.getActor();
|
||||||
|
Consumer<IChatComponent> chatter = env.getChatter();
|
||||||
|
if (check(t, world, x, y, z)) return PlaceResult.SKIP;
|
||||||
|
if (e.getStacks() == null) {
|
||||||
|
ItemStack taken = source.takeOne(e.getPredicate(), true);
|
||||||
|
return StructureUtility.survivalPlaceBlock(
|
||||||
|
taken,
|
||||||
|
NBTMode.EXACT,
|
||||||
|
taken.stackTagCompound,
|
||||||
|
false,
|
||||||
|
world,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z,
|
||||||
|
source,
|
||||||
|
actor,
|
||||||
|
chatter);
|
||||||
|
}
|
||||||
|
for (ItemStack stack : e.getStacks()) {
|
||||||
|
if (!source.takeOne(stack, true)) {
|
||||||
|
IChatComponent name = new ChatComponentText(stack.getDisplayName());
|
||||||
|
name.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW));
|
||||||
|
env.getChatter()
|
||||||
|
.accept(new ChatComponentTranslation("structurelib.autoplace.missing_block", name));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return StructureUtility.survivalPlaceBlock(
|
||||||
|
stack,
|
||||||
|
NBTMode.EXACT,
|
||||||
|
stack.stackTagCompound,
|
||||||
|
false,
|
||||||
|
world,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z,
|
||||||
|
source,
|
||||||
|
actor,
|
||||||
|
chatter);
|
||||||
|
}
|
||||||
|
return PlaceResult.REJECT;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean check(T t, World world, int x, int y, int z) {
|
public boolean check(T t, World world, int x, int y, int z) {
|
||||||
Block worldBlock = world.getBlock(x, y, z);
|
Block worldBlock = world.getBlock(x, y, z);
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ structurelib.autoplace.error.not_enabled=§cThis multiblock does not support aut
|
|||||||
structurelib.autoplace.error.no_simple_block=§cSuggested to place §r%s§c but none was found
|
structurelib.autoplace.error.no_simple_block=§cSuggested to place §r%s§c but none was found
|
||||||
structurelib.autoplace.error.no_item_stack=§cSuggested to place block by using §r%s§c but none was found
|
structurelib.autoplace.error.no_item_stack=§cSuggested to place block by using §r%s§c but none was found
|
||||||
structurelib.autoplace.warning.no_explicit_channel=§6This structure depends on nonexistent sub channel §r%s§6. Using master channel instead.
|
structurelib.autoplace.warning.no_explicit_channel=§6This structure depends on nonexistent sub channel §r%s§6. Using master channel instead.
|
||||||
|
structurelib.autoplace.missing_block=§cMissing block: %s
|
||||||
|
|
||||||
structurelib.blockhint.desc.0=Helps while building
|
structurelib.blockhint.desc.0=Helps while building
|
||||||
structurelib.blockhint.0.name=Hint 1 dot
|
structurelib.blockhint.0.name=Hint 1 dot
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 126 B |
|
Before Width: | Height: | Size: 208 B After Width: | Height: | Size: 154 B |
|
Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 138 B |
|
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 160 B |
|
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 137 B |
|
Before Width: | Height: | Size: 186 B After Width: | Height: | Size: 138 B |
|
Before Width: | Height: | Size: 186 B After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 141 B |
|
Before Width: | Height: | Size: 184 B After Width: | Height: | Size: 132 B |
|
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 138 B |
|
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 139 B |
|
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 143 B |
|
Before Width: | Height: | Size: 133 B After Width: | Height: | Size: 99 B |
|
Before Width: | Height: | Size: 183 B After Width: | Height: | Size: 132 B |
|
Before Width: | Height: | Size: 197 B After Width: | Height: | Size: 146 B |
|
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 115 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 367 B After Width: | Height: | Size: 276 B |
|
Before Width: | Height: | Size: 667 B After Width: | Height: | Size: 606 B |
|
Before Width: | Height: | Size: 439 B After Width: | Height: | Size: 361 B |