RecipeTELib — различия между версиями

м
м
Строка 40: Строка 40:
 
=== Верстак ===
 
=== Верстак ===
  
 +
<div class="mw-parser-output">
 
<div class="mw-parser-output">
 
<div class="mw-parser-output">
 
<div class="mw-parser-output">
 
<div class="mw-parser-output">
Строка 102: Строка 103:
 
*'''''RecipeTE.registerGridCraftTable(description);'''''  
 
*'''''RecipeTE.registerGridCraftTable(description);'''''  
 
<pre><font style="font-family:Consolas, monospace; font-size:9,828pt; line-height:15px"><font class="fctbNone">RecipeTE</font><font class="fctbStyle5">.</font><font class="fctbNone">registerGridCraftTable</font><font class="fctbStyle5">({
 
<pre><font style="font-family:Consolas, monospace; font-size:9,828pt; line-height:15px"><font class="fctbNone">RecipeTE</font><font class="fctbStyle5">.</font><font class="fctbNone">registerGridCraftTable</font><font class="fctbStyle5">({
   </font> <font class="fctbStyle7">name</font><font class="fctbStyle5Style7">:</font><font class="fctbStyle2Style5">"</font><font class="fctbStyle2">Workbench_Grid</font><font class="fctbStyle2Style5">"</font><font class="fctbStyle5">,
+
   </font> <font class="fctbStyle7">name</font><font class="fctbStyle5Style7">:</font><font class="fctbStyle2Style5">"</font><font class="fctbStyle2">Workbench_Grid</font><font class="fctbStyle2Style5">"</font><font class="fctbStyle5"><syntaxhighlight lang="JavaScript">,
     </font><font class="fctbNone">rows</font><font class="fctbStyle5Style7">:</font><font class="fctbStyle3Style7">4</font><font class="fctbStyle5Style7">,
+
     </syntaxhighlight></font><font class="fctbNone">rows</font><font class="fctbStyle5Style7">:</font><font class="fctbStyle3Style7">4</font><font class="fctbStyle5Style7">,</font> <font class="fctbNone">cols</font><font class="fctbStyle5Style7">:</font><font class="fctbStyle3Style7">4</font><font class="fctbStyle5">
&nbsp;  </font> <font class="fctbNone">cols</font><font class="fctbStyle5Style7">:</font><font class="fctbStyle3Style7">4</font><font class="fctbStyle5"><syntaxhighlight lang="JavaScript">
+
});</font></font></pre>
});</syntaxhighlight></font></font></pre>
 
  
 
*​​'''''RecipeTE.registerGridCraftTable(name, columns, rows);'''''  
 
*​​'''''RecipeTE.registerGridCraftTable(name, columns, rows);'''''  
 +
<syntaxhighlight lang="JavaScript">RecipeTE.registerGridCraftTable("Workbench_Grid", 4, 4);</syntaxhighlight>
  
 
&nbsp;
 
&nbsp;
<syntaxhighlight lang="JavaScript">RecipeTE.registerGridCraftTable("Workbench_Grid", 4, 4);</syntaxhighlight>
 
 
&nbsp; </div>
 
 
</div>
 
</div>
  

Версия 22:40, 21 июня 2019

RecipeTELib - библиотека, упрощающая создание верстаков и печей.

Условия использования

  • Запрещено распространение на сторонних источниках без указания ссылки на официальное сообщество
  • Запрещено изменение кода библиотеки
  • Запрещено явное копирование кода в другие библиотеки или моды 

Используя данный продукт вы автоматически соглашаетесь с этими правилами

Документация

Инициализация

Импортируйте библиотеку.

IMPORT("RecipeTileEntityLib")

Верстак

Создание верстака

Для начала создаем блок

IDRegistry.genBlockID("Workbench_Grid");
Block.createBlock("Workbench_Grid", [{
    name: "Workbench Grid", 
    texture: [
        ["work_table_bottom", 0], // bottom
        ["work_table_top", 0], // top
        ["work_table_side", 0], // back
        ["work_table_side", 1], // front
        ["work_table_side", 0], // left
        ["work_table_side", 0]  // right
    ], 
    inCreative: true 
}]);

Затем создаем наш интерфейс.
!ВАЖНО!: Слоты, в которые нужно ложить предмет нужна ОБЯЗАТЕЛЬНО называть "inputSlot"+ порядковое число слота, начиная с нуля. Слот результата должен иметь название "outputSlot", так же стоит задавть isValid для outputSlot как RecipeTE.outputSlotValid

var Workbench_Grid = new UI.StandartWindow({
    standart: {
        header: {text: {text: "Workbench Grid 4x4"}},
        inventory: {standart:true},
        background: {standart: true}
    },
    drawing: [{
        type: "bitmap",
        bitmap: "arrow",
        x: 600,
        y: 170, scale: 4
    }],
    elements:{
        "inputSlot0":{x:350, y:80, type:"slot"},
        "inputSlot1":{x:410, y:80, type:"slot"},
        "inputSlot2":{x:470, y:80, type:"slot"},
        "inputSlot3":{x:530, y:80, type:"slot"},

        "inputSlot4":{x:350, y:140, type:"slot"},
        "inputSlot5":{x:410, y:140, type:"slot"},
        "inputSlot6":{x:470, y:140, type:"slot"},
        "inputSlot7":{x:530, y:140, type:"slot"},

        "inputSlot8":{x:350, y:200, type:"slot"},
        "inputSlot9":{x:410, y:200, type:"slot"},
        "inputSlot10":{x:470, y:200, type:"slot"},
        "inputSlot11":{x:530, y:200, type:"slot"},

        "inputSlot12":{x:350, y:260, type:"slot"},
        "inputSlot13":{x:410, y:260, type:"slot"},
        "inputSlot14":{x:470, y:260, type:"slot"},
        "inputSlot15":{x:530, y:260, type:"slot"},

        "outputSlot":{x:698, y:170, type:"slot", isValid:RecipeTE.outputSlotValid }
    }
});

Затем регистрируем наш верстак, есть два способа:

  • RecipeTE.registerGridCraftTable(description);
<font style="font-family:Consolas, monospace; font-size:9,828pt; line-height:15px"><font class="fctbNone">RecipeTE</font><font class="fctbStyle5">.</font><font class="fctbNone">registerGridCraftTable</font><font class="fctbStyle5">({
   </font> <font class="fctbStyle7">name</font><font class="fctbStyle5Style7">:</font><font class="fctbStyle2Style5">"</font><font class="fctbStyle2">Workbench_Grid</font><font class="fctbStyle2Style5">"</font><font class="fctbStyle5"><syntaxhighlight lang="JavaScript">,
    </syntaxhighlight></font><font class="fctbNone">rows</font><font class="fctbStyle5Style7">:</font><font class="fctbStyle3Style7">4</font><font class="fctbStyle5Style7">,</font> <font class="fctbNone">cols</font><font class="fctbStyle5Style7">:</font><font class="fctbStyle3Style7">4</font><font class="fctbStyle5">
});</font></font>
  • ​​RecipeTE.registerGridCraftTable(name, columns, rows);
RecipeTE.registerGridCraftTable("Workbench_Grid", 4, 4);

 

Создание рецептов для верстака

Электрическая(редстоун сигнал) печь

Создание печи

Создание рецептов для печи