This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WireRenderer implements WorldRenderEvents.AfterEntities { | |
private static final SpriteIdentifier WIRE_TEX = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, vtId("block/generator")); | |
@Override | |
public void afterEntities(WorldRenderContext context) { | |
var wires = VivatechClient.getClientWireManager().getWires(); | |
if (wires.isEmpty()) { | |
return; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void render(DrawContext context, RenderTickCounter tickCounter) { | |
if (isVisible()) { | |
float opacity = Math.min(1, remainingDisplayTicks / 10f); | |
var yOffsetPerItem = ITEM_H + MARGIN; | |
var yOffset = (Math.min(focuses.size(), 3) - 1) * yOffsetPerItem; | |
var widgetW = SEL_TEX_W; | |
var widgetH = SEL_TEX_H + yOffset; | |
var x = 4; | |
var y = context.getScaledWindowHeight() / 2 - widgetH / 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class InventoryDescription { | |
protected final Int2ObjectMap<SlotDescription> slots = new Int2ObjectRBTreeMap<>(); | |
protected final Int2ObjectMap<BiPredicate<@Nullable Direction, ItemStack>> insertionRules = new Int2ObjectRBTreeMap<>(); | |
protected final Int2ObjectMap<BiPredicate<@Nullable Direction, ItemStack>> extractionRules = new Int2ObjectRBTreeMap<>(); | |
public SlotDescription describeSlot(int index, @Nullable Predicate<ItemStack> inputFilter, @Nullable Predicate<ItemStack> outputFilter) { | |
Preconditions.checkArgument(index >= 0, "Slot indices must be non-negative"); | |
Preconditions.checkArgument(!slots.containsKey(index), "Slot with index %d already exists", index); | |
final Predicate<ItemStack> normalizedInputFilter = inputFilter == null ? Predicates.alwaysTrue() : inputFilter; | |
final Predicate<ItemStack> normalizedOutputFilter = outputFilter == null ? Predicates.alwaysTrue() : outputFilter; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$divider_flags = [ | |
3 => "three", | |
5 => "five", | |
7 => "hello" | |
]; | |
# Order of this array is preserved | |
$flag_correspondences = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelectorAll(".image-vertical").forEach(canvas => canvas.toBlob(blob => console.log(URL.createObjectURL(blob)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function pointerAdd(state) | |
state.pointer = state.pointer + 1 | |
end | |
local function pointerSub(state) | |
state.pointer = state.pointer - 1 | |
end | |
local function dataAdd(state) | |
state.data[state.pointer] = (state.data[state.pointer] or 0) + 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final SimpleSingleVariantStorage<FluidVariant> fluidStorage = SimpleSingleVariantStorageBuilder.fluid() | |
.supportsExtraction(false) | |
.build(fluidVariant -> FluidConstants.BUCKET, () -> markDirty()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* <h2>USAGE EXAMPLE</h2> | |
* | |
* <p>In your ModInitializer: | |
* <pre>{@code | |
* AutoRegistry.create(MODID) | |
* .run(Registries.BLOCK, MyBlocks.class) | |
* .run(Registries.ITEM, MyItems.class); | |
* }</pre> | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AdvancementUtil { | |
protected String namespace = "all"; | |
protected String path = "all"; | |
protected final ServerPlayerEntity player; | |
protected final ServerAdvancementLoader advancementLoader; | |
protected final PlayerAdvancementTracker advancementTracker; | |
protected AdvancementUtil(ServerPlayerEntity player) { | |
this.player = player; | |
advancementLoader = player.getServer().getAdvancementLoader(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Commands { | |
public static void register(CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess registryAccess, CommandManager.RegistrationEnvironment environment) { | |
var revelationaryNode = CommandManager | |
.literal("revelationary") | |
.requires(source -> source.hasPermissionLevel(4)) | |
.build(); | |
dispatcher.getRoot().addChild(revelationaryNode); | |
var advancementNode = CommandManager.literal("advancement").build(); | |
revelationaryNode.addChild(advancementNode); |
NewerOlder