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.70-preview.25 #103

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
Binary file modified editor-samples.mceditoraddon
Binary file not shown.
4 changes: 2 additions & 2 deletions portal-generator/portal-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,14 @@ class NetherPortal implements IPortalGenerator {
subPane.addNumber(this._sizeX, {
title: 'sample.portalgenerator.pane.nether.pane.width',
min: 4,
max: 33,
max: 23,
isInteger: true,
});

subPane.addNumber(this._sizeY, {
title: 'sample.portalgenerator.pane.nether.pane.height',
min: 5,
max: 33,
max: 23,
isInteger: true,
});

Expand Down
10 changes: 5 additions & 5 deletions simple-locate/SimpleLocateBiome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type LocateBiomeSourceType = {

type ResultsType = {
foundType: string;
foundPos: Vector3;
foundPos: IObservable<Vector3>;
};

// Implementation of a simple tool that allows the player to locate a biome
Expand All @@ -41,7 +41,7 @@ type ResultsType = {
export class SimpleLocate extends SimpleToolWrapper {
private _results: ResultsType = {
foundType: '',
foundPos: VECTOR3_ZERO,
foundPos: makeObservable<Vector3>(VECTOR3_ZERO),
};

// Activate the results pane with the found biome/structure and position in the
Expand All @@ -51,7 +51,7 @@ export class SimpleLocate extends SimpleToolWrapper {
this.simpleTool.logInfo(`Found ${biome} at ${Vector3Utils.toString(pos)}`);

this._results.foundType = biome;
this._results.foundPos = pos;
this._results.foundPos.set(pos);

// Hopefully, we'll be able to get rid of this function in the near future.
// reconstructing the pane is a last-resort hack to get the pane to update
Expand Down Expand Up @@ -185,7 +185,7 @@ export class SimpleLocate extends SimpleToolWrapper {
const actualPane = component.pane;
actualPane.addText(`Found ${this._results.foundType}`);

actualPane.addVector3_deprecated(this._results, 'foundPos', {
actualPane.addVector3(this._results.foundPos, {
title: 'sample.simplelocate.tool.results.foundat',
enable: false,
visible: true,
Expand All @@ -196,7 +196,7 @@ export class SimpleLocate extends SimpleToolWrapper {
actionType: ActionTypes.NoArgsAction,
onExecute: () => {
const pos = this._results.foundPos;
component.session.extensionContext.player.teleport(pos);
component.session.extensionContext.player.teleport(pos.value);
},
}),
{
Expand Down
2 changes: 1 addition & 1 deletion star-brush-shape/star-brush-shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export function registerStarBrushExtension() {

uiSession.extensionContext.brushShapeManager.registerBrushShape(
'Star-sample',
'star',
'pack://textures/editor/brushes/Star.png',
rebuildStar,
getStarUISettings
);
Expand Down
98 changes: 51 additions & 47 deletions tree-generator/tree-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,51 +220,53 @@ export class SimpleTree implements ITree {
}
}

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

{
name: 'Acacia',
type: new SimpleTree(
BlockPermutation.resolve(MinecraftBlockTypes.AcaciaLog),
BlockPermutation.resolve(MinecraftBlockTypes.AcaciaLeaves)
),
},
{
name: 'Dark Oak',
type: new SimpleTree(
BlockPermutation.resolve(MinecraftBlockTypes.DarkOakLog),
BlockPermutation.resolve(MinecraftBlockTypes.DarkOakLeaves)
),
},
];
function GetTreeTypes() {
return [
{
name: 'Oak',
type: new SimpleTree(
BlockPermutation.resolve(MinecraftBlockTypes.OakLog),
BlockPermutation.resolve(MinecraftBlockTypes.OakLeaves)
),
},
{
name: 'Spruce',
type: new SimpleTree(
BlockPermutation.resolve(MinecraftBlockTypes.SpruceLog),
BlockPermutation.resolve(MinecraftBlockTypes.SpruceLeaves)
),
},
{
name: 'Birch',
type: new SimpleTree(
BlockPermutation.resolve(MinecraftBlockTypes.BirchLog),
BlockPermutation.resolve(MinecraftBlockTypes.BirchLeaves)
),
},
{
name: 'Jungle',
type: new SimpleTree(
BlockPermutation.resolve(MinecraftBlockTypes.JungleLog),
BlockPermutation.resolve(MinecraftBlockTypes.JungleLeaves)
),
},

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

function addToolSettingsPane(uiSession: IPlayerUISession, tool: IModalTool) {
// Create a pane that will be shown when the tool is selected
Expand All @@ -285,6 +287,8 @@ function addToolSettingsPane(uiSession: IPlayerUISession, tool: IModalTool) {
treeType: makeObservable(0),
};

const treeTypes = GetTreeTypes();

const onExecuteTool = (ray?: Ray) => {
const player = uiSession.extensionContext.player;

Expand All @@ -310,7 +314,7 @@ function addToolSettingsPane(uiSession: IPlayerUISession, tool: IModalTool) {
// Begin transaction
uiSession.extensionContext.transactionManager.openTransaction('Tree Tool');

const selectedTreeType = TreeTypes[settings.treeType.value];
const selectedTreeType = treeTypes[settings.treeType.value];
const affectedBlocks = selectedTreeType.type.place(location, settings);

// Track changes
Expand Down Expand Up @@ -339,7 +343,7 @@ function addToolSettingsPane(uiSession: IPlayerUISession, tool: IModalTool) {
pane.addDropdown(settings.treeType, {
title: 'sample.treegenerator.pane.type',
enable: true,
entries: TreeTypes.map((tree, index): IDropdownPropertyItemEntry => {
entries: treeTypes.map((tree, index): IDropdownPropertyItemEntry => {
return {
label: tree.name,
value: index,
Expand Down