Browse Source

Loot tables, update spinnery

master
Martmists 1 year ago
parent
commit
a668b2208b
9 changed files with 81 additions and 98 deletions
  1. +2
    -3
      src/main/java/com/martmists/ynet/screens/ControllerScreen.java
  2. +20
    -0
      src/main/java/spinnery/widget/WCustomTooltipItem.java
  3. +0
    -29
      src/main/java/spinnery/widget/WItem.java
  4. +0
    -64
      src/main/java/spinnery/widget/WTooltipItem.java
  5. +19
    -0
      src/main/resources/data/ynet/loot_tables/blocks/cable.json
  6. +19
    -0
      src/main/resources/data/ynet/loot_tables/blocks/connector.json
  7. +19
    -0
      src/main/resources/data/ynet/loot_tables/blocks/controller.json
  8. +1
    -1
      versions/1.15.2/gradle.properties
  9. +1
    -1
      versions/1.16/gradle.properties

+ 2
- 3
src/main/java/com/martmists/ynet/screens/ControllerScreen.java View File

@@ -12,7 +12,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.text.LiteralText;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.math.BlockPos;
import spinnery.client.TextRenderer;
import spinnery.common.BaseContainerScreen;
import spinnery.widget.*;
import spinnery.widget.api.Position;
@@ -198,8 +197,8 @@ public class ControllerScreen extends BaseContainerScreen<ControllerContainer> {
Size.of(154, 25)
);
i++;
WTooltipItem item = row.createChild(
WTooltipItem.class,
WCustomTooltipItem item = row.createChild(
WCustomTooltipItem.class,
Position.of(row, 4, 4),
Size.of(16, 16)
);


+ 20
- 0
src/main/java/spinnery/widget/WCustomTooltipItem.java View File

@@ -0,0 +1,20 @@
package spinnery.widget;

import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;

public class WCustomTooltipItem extends WTooltipItem {

@Override
public void updateText() {
// tooltipText.setText(stack.getName());
}

public void setText(String txt) {
setText(new LiteralText(txt));
}

public void setText(Text txt) {
this.tooltipText.setText(txt);
}
}

+ 0
- 29
src/main/java/spinnery/widget/WItem.java View File

@@ -1,29 +0,0 @@
package spinnery.widget;

import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.item.ItemStack;
import spinnery.client.BaseRenderer;
import spinnery.widget.api.Position;
import spinnery.widget.api.Size;
import spinnery.widget.api.listener.WFocusLossListener;

public class WItem extends WAbstractWidget {
ItemStack stack = ItemStack.EMPTY;

public ItemStack getStack() {
return stack;
}

public <W extends WItem> W setStack(ItemStack stack) {
this.stack = stack;
return (W) this;
}

@Override
public void draw() {
if (isHidden()) return;

RenderSystem.translatef(0, 0, getZ());
BaseRenderer.getItemRenderer().renderGuiItem(stack, getX(), getY());
}
}

+ 0
- 64
src/main/java/spinnery/widget/WTooltipItem.java View File

@@ -1,64 +0,0 @@
package spinnery.widget;

import spinnery.widget.api.Position;
import spinnery.widget.api.Size;

public class WTooltipItem extends WItem {
WTooltip tooltip;
public WStaticText tooltipText;

@Override
public void onFocusGained() {
super.onFocusGained();
updateHidden(false);
}

@Override
public void onFocusReleased() {
super.onFocusReleased();
updateHidden(true);
}

@Override
public void onMouseMoved(int mouseX, int mouseY) {
updateWidgets();
updateText();
updatePositions(mouseX, mouseY);
updateSizes();
}

public void updateWidgets() {
if (tooltip == null) tooltip = getInterface().createChild(WTooltip.class, Position.of(this), Size.of(this)).setHidden(true);
if (tooltipText == null) tooltipText = getInterface().createChild(WStaticText.class, Position.of(tooltip).add(0, 0, 1), Size.of(this)).setHidden(true);
}

public void updateText() {
// tooltipText.setText(stack.getName());
}

public void updatePositions(int mouseX, int mouseY) {
tooltip.setPosition(Position.of(mouseX + 12, mouseY - 4, 1));
}

public void updateSizes() {
tooltip.setSize(Size.of(tooltipText.getWidth() - 1, tooltipText.getHeight() - 1));
}

public void updateHidden(boolean hidden) {
tooltip.setHidden(hidden);
tooltipText.setHidden(hidden);
}

@Override
public void tick() {
updateWidgets();
updateText();
}

@Override
public void draw() {
super.draw();
tooltip.draw();
tooltipText.draw();
}
}

+ 19
- 0
src/main/resources/data/ynet/loot_tables/blocks/cable.json View File

@@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "ynet:cable"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

+ 19
- 0
src/main/resources/data/ynet/loot_tables/blocks/connector.json View File

@@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "ynet:connector"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

+ 19
- 0
src/main/resources/data/ynet/loot_tables/blocks/controller.json View File

@@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "ynet:controller"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

+ 1
- 1
versions/1.15.2/gradle.properties View File

@@ -3,4 +3,4 @@ yarn_mappings=1.15.2+build.14
loader_version=0.7.8+build.184
fabric_version=0.4.32+build.292-1.15
tr_slug=TechReborn-1.15:3.3.4+build.193
spinnery_version=2.0.18+fabric-1.15
spinnery_version=2.0.19+fabric-1.15.2

+ 1
- 1
versions/1.16/gradle.properties View File

@@ -3,4 +3,4 @@ yarn_mappings=20w11a+build.6
loader_version=0.7.8+build.187
fabric_version=0.5.3+build.308-1.16
tr_slug=TechReborn-1.16:3.3.3+build.3
spinnery_version=2.0.18+fabric-20w06a
spinnery_version=2.0.19+fabric-20w11a

Loading…
Cancel
Save