Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for Minecraft release 1.21.42 #80

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions dye-brush/dye-brush.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import {
ActionTypes,
ColorPickerPropertyItemVariant,
CursorProperties,
CursorTargetMode,
IDropdownItem,
IModalTool,
Expand Down Expand Up @@ -139,7 +138,6 @@ interface DyeBrushStorage {
currentColor: EntityColor;
brushColor: IObservable<RGBA>;
brushSize: number;
backedUpCursorProps: CursorProperties | undefined;
}

type DyeBrushSession = IPlayerUISession<DyeBrushStorage>;
Expand All @@ -164,11 +162,12 @@ function addDyeBrushPane(uiSession: DyeBrushSession, tool: IModalTool) {

const pane = uiSession.createPropertyPane({
title: 'sample.dyeBrush.pane.title',
infoTooltip: { description: ['sample.dyebrush.tool.tooltip'] },
});

const entityBrush = makeObservable(EntityColor.White);

onColorUpdated(brushColor.value, uiSession);

pane.addDropdown(entityBrush, {
title: 'Brush',
entries: Object.values(EntityColor).reduce<IDropdownItem[]>((list, dye, index) => {
Expand Down Expand Up @@ -313,15 +312,7 @@ function addDyeBrushPane(uiSession: DyeBrushSession, tool: IModalTool) {

tool.onModalToolActivation.subscribe((evt: ModalToolLifecycleEventPayload) => {
if (evt.isActiveTool) {
if (uiSession.scratchStorage && !uiSession.scratchStorage.backedUpCursorProps) {
uiSession.scratchStorage.backedUpCursorProps = uiSession.extensionContext.cursor.getProperties();
}
onColorUpdated(brushColor.value, uiSession);
} else {
if (uiSession.scratchStorage && uiSession.scratchStorage.backedUpCursorProps) {
uiSession.extensionContext.cursor.setProperties(uiSession.scratchStorage.backedUpCursorProps);
uiSession.scratchStorage.backedUpCursorProps = undefined;
}
}
uiSession.scratchStorage?.previewSelection?.clear();
});
Expand Down Expand Up @@ -354,7 +345,6 @@ export function registerDyeBrushExtension() {
currentColor: EntityColor.White,
brushColor: makeObservable<RGBA>({ red: 1, green: 1, blue: 1, alpha: 0.5 }),
brushSize: 4,
backedUpCursorProps: undefined,
};
uiSession.scratchStorage = storage;

Expand Down
Binary file modified editor-samples.mceditoraddon
Binary file not shown.
42 changes: 18 additions & 24 deletions tree-generator/tree-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,49 +220,43 @@ export class SimpleTree implements ITree {
}
}

function createLeaf1Block(leafType: string): BlockPermutation {
return BlockPermutation.resolve(MinecraftBlockTypes.Leaves, {
old_leaf_type: leafType,
});
}

function createLeaf2Block(leafType: string): BlockPermutation {
return BlockPermutation.resolve(MinecraftBlockTypes.Leaves2, {
new_leaf_type: leafType,
});
}

const TreeTypes = [
{
name: 'Oak',
type: new SimpleTree(
BlockPermutation.resolve(MinecraftBlockTypes.OakLog),
BlockPermutation.resolve(MinecraftBlockTypes.OakLeaves)
),
type: new SimpleTree(BlockPermutation.resolve(MinecraftBlockTypes.OakLog), createLeaf1Block('oak')),
},
{
name: 'Spruce',
type: new SimpleTree(
BlockPermutation.resolve(MinecraftBlockTypes.SpruceLog),
BlockPermutation.resolve(MinecraftBlockTypes.SpruceLeaves)
),
type: new SimpleTree(BlockPermutation.resolve(MinecraftBlockTypes.SpruceLog), createLeaf1Block('spruce')),
},
{
name: 'Birch',
type: new SimpleTree(
BlockPermutation.resolve(MinecraftBlockTypes.BirchLog),
BlockPermutation.resolve(MinecraftBlockTypes.BirchLeaves)
),
type: new SimpleTree(BlockPermutation.resolve(MinecraftBlockTypes.BirchLog), createLeaf1Block('birch')),
},
{
name: 'Jungle',
type: new SimpleTree(
BlockPermutation.resolve(MinecraftBlockTypes.JungleLog),
BlockPermutation.resolve(MinecraftBlockTypes.JungleLeaves)
),
type: new SimpleTree(BlockPermutation.resolve(MinecraftBlockTypes.JungleLog), createLeaf1Block('jungle')),
},

{
name: 'Acacia',
type: new SimpleTree(
BlockPermutation.resolve(MinecraftBlockTypes.AcaciaLog),
BlockPermutation.resolve(MinecraftBlockTypes.AcaciaLeaves)
),
type: new SimpleTree(BlockPermutation.resolve(MinecraftBlockTypes.AcaciaLog), createLeaf2Block('acacia')),
},
{
name: 'Dark Oak',
type: new SimpleTree(
BlockPermutation.resolve(MinecraftBlockTypes.DarkOakLog),
BlockPermutation.resolve(MinecraftBlockTypes.DarkOakLeaves)
),
type: new SimpleTree(BlockPermutation.resolve(MinecraftBlockTypes.DarkOakLog), createLeaf2Block('dark_oak')),
},
];

Expand Down